forked from xjboss/KCauldronX
Initial commit (Forge 1291).
This commit is contained in:
52
patches/net/minecraft/block/Block.java.patch
Normal file
52
patches/net/minecraft/block/Block.java.patch
Normal file
@ -0,0 +1,52 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/Block.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/Block.java
|
||||
@@ -122,6 +122,7 @@
|
||||
private String unlocalizedName;
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon blockIcon;
|
||||
+ public boolean isForgeBlock; // Cauldron
|
||||
private static final String __OBFID = "CL_00000199";
|
||||
|
||||
public final cpw.mods.fml.common.registry.RegistryDelegate<Block> delegate =
|
||||
@@ -650,7 +651,7 @@
|
||||
|
||||
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
||||
{
|
||||
- if (!p_149690_1_.isRemote && !p_149690_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
|
||||
+ if (!p_149690_1_.isRemote && (!p_149690_1_.restoringBlockSnapshots || !p_149690_1_.restoringBlockStates)) // do not drop items while restoring blockstates, prevents item dupe
|
||||
{
|
||||
ArrayList<ItemStack> items = getDrops(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_);
|
||||
p_149690_6_ = ForgeEventFactory.fireBlockHarvesting(items, p_149690_1_, this, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_7_, p_149690_6_, false, harvesters.get());
|
||||
@@ -667,7 +668,7 @@
|
||||
|
||||
protected void dropBlockAsItem(World p_149642_1_, int p_149642_2_, int p_149642_3_, int p_149642_4_, ItemStack p_149642_5_)
|
||||
{
|
||||
- if (!p_149642_1_.isRemote && p_149642_1_.getGameRules().getGameRuleBooleanValue("doTileDrops") && !p_149642_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
|
||||
+ if (!p_149642_1_.isRemote && p_149642_1_.getGameRules().getGameRuleBooleanValue("doTileDrops") && (!p_149642_1_.restoringBlockSnapshots || !p_149642_1_.restoringBlockStates)) // do not drop items while restoring blockstates, prevents item dupe
|
||||
{
|
||||
if (captureDrops.get())
|
||||
{
|
||||
@@ -1131,6 +1132,23 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
+ // Spigot start
|
||||
+ public static float range(float min, float value, float max)
|
||||
+ {
|
||||
+ if (value < min)
|
||||
+ {
|
||||
+ return min;
|
||||
+ }
|
||||
+
|
||||
+ if (value > max)
|
||||
+ {
|
||||
+ return max;
|
||||
+ }
|
||||
+
|
||||
+ return value;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected String getTextureName()
|
||||
{
|
@ -0,0 +1,32 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockBasePressurePlate.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockBasePressurePlate.java
|
||||
@@ -11,6 +11,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockBasePressurePlate extends Block
|
||||
{
|
||||
private String field_150067_a;
|
||||
@@ -122,7 +124,20 @@
|
||||
int i1 = this.func_150065_e(p_150062_1_, p_150062_2_, p_150062_3_, p_150062_4_);
|
||||
boolean flag = p_150062_5_ > 0;
|
||||
boolean flag1 = i1 > 0;
|
||||
+ // CraftBukkit start - Interact Pressure Plate
|
||||
+ org.bukkit.World bworld = p_150062_1_.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = p_150062_1_.getServer().getPluginManager();
|
||||
|
||||
+ if (flag != flag1)
|
||||
+ {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(p_150062_2_, p_150062_3_, p_150062_4_), p_150062_5_, i1);
|
||||
+ manager.callEvent(eventRedstone);
|
||||
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ i1 = eventRedstone.getNewCurrent();
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (p_150062_5_ != i1)
|
||||
{
|
||||
p_150062_1_.setBlockMetadataWithNotify(p_150062_2_, p_150062_3_, p_150062_4_, this.func_150066_d(i1), 2);
|
89
patches/net/minecraft/block/BlockButton.java.patch
Normal file
89
patches/net/minecraft/block/BlockButton.java.patch
Normal file
@ -0,0 +1,89 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
+import org.bukkit.event.entity.EntityInteractEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public abstract class BlockButton extends Block
|
||||
{
|
||||
@@ -209,6 +213,19 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_149727_1_.getWorld().getBlockAt(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
+ int old = (k1 != 8) ? 15 : 0;
|
||||
+ int current = (k1 == 8) ? 15 : 0;
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
+ p_149727_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+
|
||||
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8))
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1 + k1, 3);
|
||||
p_149727_1_.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
p_149727_1_.playSoundEffect((double)p_149727_2_ + 0.5D, (double)p_149727_3_ + 0.5D, (double)p_149727_4_ + 0.5D, "random.click", 0.3F, 0.6F);
|
||||
@@ -262,6 +279,18 @@
|
||||
|
||||
if ((l & 8) != 0)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+
|
||||
+ if (eventRedstone.getNewCurrent() > 0)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.field_150047_a)
|
||||
{
|
||||
this.func_150046_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
@@ -309,6 +338,36 @@
|
||||
List list = p_150046_1_.getEntitiesWithinAABB(EntityArrow.class, AxisAlignedBB.getBoundingBox((double)p_150046_2_ + this.minX, (double)p_150046_3_ + this.minY, (double)p_150046_4_ + this.minZ, (double)p_150046_2_ + this.maxX, (double)p_150046_3_ + this.maxY, (double)p_150046_4_ + this.maxZ));
|
||||
boolean flag1 = !list.isEmpty();
|
||||
|
||||
+ // CraftBukkit start - Call interact event when arrows turn on wooden buttons
|
||||
+ if (flag != flag1 && flag1)
|
||||
+ {
|
||||
+ org.bukkit.block.Block block = p_150046_1_.getWorld().getBlockAt(p_150046_2_, p_150046_3_, p_150046_4_);
|
||||
+ boolean allowed = false;
|
||||
+
|
||||
+ // If all of the events are cancelled block the button press, else allow
|
||||
+ for (Object object : list)
|
||||
+ {
|
||||
+ if (object != null)
|
||||
+ {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
|
||||
+ p_150046_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ allowed = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!allowed)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 && !flag)
|
||||
{
|
||||
p_150046_1_.setBlockMetadataWithNotify(p_150046_2_, p_150046_3_, p_150046_4_, i1 | 8, 3);
|
31
patches/net/minecraft/block/BlockCactus.java.patch
Normal file
31
patches/net/minecraft/block/BlockCactus.java.patch
Normal file
@ -0,0 +1,31 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
|
||||
@@ -17,6 +17,8 @@
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockCactus extends Block implements IPlantable
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -47,9 +49,9 @@
|
||||
{
|
||||
int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
- if (i1 == 15)
|
||||
+ if (i1 >= (byte) range(3, (p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().cactusModifier * 15) + 0.5F, 15)) // Spigot // Cauldron
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, 0); // CraftBukkit
|
||||
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
|
||||
this.onNeighborBlockChange(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
|
||||
}
|
||||
@@ -135,6 +137,7 @@
|
||||
|
||||
public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity p_149670_5_)
|
||||
{
|
||||
+ // Cauldron - moved CraftBukkit hook to func_145775_I() - doBlockCollisions
|
||||
p_149670_5_.attackEntityFrom(DamageSource.cactus, 1.0F);
|
||||
}
|
||||
|
32
patches/net/minecraft/block/BlockCake.java.patch
Normal file
32
patches/net/minecraft/block/BlockCake.java.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCake.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCake.java
|
||||
@@ -12,6 +12,10 @@
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.entity.player.EntityPlayerMP;
|
||||
+import net.minecraft.network.play.server.S06PacketUpdateHealth;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class BlockCake extends Block
|
||||
{
|
||||
@@ -104,7 +108,17 @@
|
||||
{
|
||||
if (p_150036_5_.canEat(false))
|
||||
{
|
||||
- p_150036_5_.getFoodStats().addStats(2, 0.1F);
|
||||
+ // CraftBukkit start
|
||||
+ int oldFoodLevel = p_150036_5_.getFoodStats().foodLevel;
|
||||
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(p_150036_5_, 2 + oldFoodLevel);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ p_150036_5_.getFoodStats().addStats(event.getFoodLevel() - oldFoodLevel, 0.1F);
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayerMP) p_150036_5_).playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(((EntityPlayerMP) p_150036_5_).getBukkitEntity().getScaledHealth(), p_150036_5_.getFoodStats().foodLevel, p_150036_5_.getFoodStats().foodSaturationLevel));
|
||||
+ // CraftBukkit end
|
||||
int l = p_150036_1_.getBlockMetadata(p_150036_2_, p_150036_3_, p_150036_4_) + 1;
|
||||
|
||||
if (l >= 6)
|
12
patches/net/minecraft/block/BlockCocoa.java.patch
Normal file
12
patches/net/minecraft/block/BlockCocoa.java.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
|
||||
@@ -51,7 +51,8 @@
|
||||
if (i1 < 2)
|
||||
{
|
||||
++i1;
|
||||
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, i1 << 2 | getDirection(l), 2);
|
||||
+ // CraftBukkit
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, i1 << 2 | getDirection(l));
|
||||
}
|
||||
}
|
||||
}
|
34
patches/net/minecraft/block/BlockCommandBlock.java.patch
Normal file
34
patches/net/minecraft/block/BlockCommandBlock.java.patch
Normal file
@ -0,0 +1,34 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCommandBlock.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCommandBlock.java
|
||||
@@ -10,6 +10,8 @@
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockCommandBlock extends BlockContainer
|
||||
{
|
||||
private static final String __OBFID = "CL_00000219";
|
||||
@@ -31,13 +33,20 @@
|
||||
boolean flag = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
boolean flag1 = (l & 1) != 0;
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = p_149695_1_.getWorld().getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
+ int old = flag1 ? 15 : 0;
|
||||
+ int current = flag ? 15 : 0;
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
|
||||
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (flag && !flag1)
|
||||
+ if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) // CraftBukkit
|
||||
{
|
||||
p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l | 1, 4);
|
||||
p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, this.tickRate(p_149695_1_));
|
||||
}
|
||||
- else if (!flag && flag1)
|
||||
+ else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) // CraftBukkit
|
||||
{
|
||||
p_149695_1_.setBlockMetadataWithNotify(p_149695_2_, p_149695_3_, p_149695_4_, l & -2, 4);
|
||||
}
|
15
patches/net/minecraft/block/BlockCrops.java.patch
Normal file
15
patches/net/minecraft/block/BlockCrops.java.patch
Normal file
@ -0,0 +1,15 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
|
||||
@@ -49,10 +49,9 @@
|
||||
{
|
||||
float f = this.func_149864_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
- if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0)
|
||||
+ if (p_149674_5_.nextInt((int)(p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().wheatModifier * (25.0F / f)) + 1) == 0) // Spigot // Cauldron
|
||||
{
|
||||
- ++l;
|
||||
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, ++l); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
10
patches/net/minecraft/block/BlockDaylightDetector.java.patch
Normal file
10
patches/net/minecraft/block/BlockDaylightDetector.java.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDaylightDetector.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDaylightDetector.java
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
if (l != i1)
|
||||
{
|
||||
+ i1 = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(p_149957_1_, p_149957_2_, p_149957_3_, p_149957_4_, l, i1).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
|
||||
p_149957_1_.setBlockMetadataWithNotify(p_149957_2_, p_149957_3_, p_149957_4_, i1, 3);
|
||||
}
|
||||
}
|
28
patches/net/minecraft/block/BlockDispenser.java.patch
Normal file
28
patches/net/minecraft/block/BlockDispenser.java.patch
Normal file
@ -0,0 +1,28 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDispenser.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDispenser.java
|
||||
@@ -30,6 +30,7 @@
|
||||
{
|
||||
public static final IRegistry dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem());
|
||||
protected Random field_149942_b = new Random();
|
||||
+ public static boolean eventFired = false; // CraftBukkit
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon field_149944_M;
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -124,7 +125,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
|
||||
+ // CraftBukkit - protected -> public
|
||||
+ public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
|
||||
{
|
||||
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
|
||||
@@ -145,6 +147,7 @@
|
||||
if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
|
||||
{
|
||||
ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
|
||||
+ eventFired = false; // CraftBukkit - reset event status
|
||||
tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
|
||||
}
|
||||
}
|
48
patches/net/minecraft/block/BlockDoor.java.patch
Normal file
48
patches/net/minecraft/block/BlockDoor.java.patch
Normal file
@ -0,0 +1,48 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
|
||||
@@ -16,6 +16,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockDoor extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -329,15 +331,32 @@
|
||||
{
|
||||
this.dropBlockAsItem(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
}
|
||||
- else
|
||||
+ else if (p_149695_5_.canProvidePower())
|
||||
{
|
||||
- boolean flag1 = p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_) || p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
|
||||
+ org.bukkit.World bworld = p_149695_1_.getWorld();
|
||||
+ org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
+ org.bukkit.block.Block blockTop = bworld.getBlockAt(p_149695_2_, p_149695_3_ + 1, p_149695_4_);
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ int powerTop = blockTop.getBlockPower();
|
||||
|
||||
- if ((flag1 || p_149695_5_.canProvidePower()) && p_149695_5_ != this)
|
||||
+ if (powerTop > power)
|
||||
{
|
||||
- this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag1);
|
||||
+ power = powerTop;
|
||||
}
|
||||
+
|
||||
+ int oldPower = (p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 4) > 0 ? 15 : 0;
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0)
|
||||
+ {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power);
|
||||
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ this.func_150014_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, eventRedstone.getNewCurrent() > 0);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
else
|
44
patches/net/minecraft/block/BlockDragonEgg.java.patch
Normal file
44
patches/net/minecraft/block/BlockDragonEgg.java.patch
Normal file
@ -0,0 +1,44 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
|
||||
@@ -10,6 +10,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockDragonEgg extends Block
|
||||
{
|
||||
private static final String __OBFID = "CL_00000232";
|
||||
@@ -43,7 +45,8 @@
|
||||
|
||||
if (!BlockFalling.fallInstantly && p_150018_1_.checkChunksExist(p_150018_2_ - b0, p_150018_3_ - b0, p_150018_4_ - b0, p_150018_2_ + b0, p_150018_3_ + b0, p_150018_4_ + b0))
|
||||
{
|
||||
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(p_150018_1_, (double)((float)p_150018_2_ + 0.5F), (double)((float)p_150018_3_ + 0.5F), (double)((float)p_150018_4_ + 0.5F), this);
|
||||
+ // CraftBukkit - added data
|
||||
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(p_150018_1_, (double)((float) p_150018_2_ + 0.5F), (double)((float) p_150018_3_ + 0.5F), (double)((float) p_150018_4_ + 0.5F), this, p_150018_1_.getBlockMetadata(p_150018_2_, p_150018_3_, p_150018_4_));
|
||||
p_150018_1_.spawnEntityInWorld(entityfallingblock);
|
||||
}
|
||||
else
|
||||
@@ -86,6 +89,22 @@
|
||||
|
||||
if (p_150019_1_.getBlock(i1, j1, k1).blockMaterial == Material.air)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block from = p_150019_1_.getWorld().getBlockAt(p_150019_2_, p_150019_3_, p_150019_4_);
|
||||
+ org.bukkit.block.Block to = p_150019_1_.getWorld().getBlockAt(i1, j1, k1);
|
||||
+ BlockFromToEvent event = new BlockFromToEvent(from, to);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ i1 = event.getToBlock().getX();
|
||||
+ j1 = event.getToBlock().getY();
|
||||
+ k1 = event.getToBlock().getZ();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!p_150019_1_.isRemote)
|
||||
{
|
||||
p_150019_1_.setBlock(i1, j1, k1, this, p_150019_1_.getBlockMetadata(p_150019_2_, p_150019_3_, p_150019_4_), 2);
|
59
patches/net/minecraft/block/BlockDropper.java.patch
Normal file
59
patches/net/minecraft/block/BlockDropper.java.patch
Normal file
@ -0,0 +1,59 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
|
||||
@@ -13,6 +13,11 @@
|
||||
import net.minecraft.tileentity.TileEntityHopper;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.world.World;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
+import net.minecraft.inventory.InventoryLargeChest;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class BlockDropper extends BlockDispenser
|
||||
{
|
||||
@@ -38,7 +43,7 @@
|
||||
return new TileEntityDropper();
|
||||
}
|
||||
|
||||
- protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
|
||||
+ public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_) // CraftBukkit - protected -> public
|
||||
{
|
||||
BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
|
||||
@@ -60,10 +65,33 @@
|
||||
|
||||
if (iinventory != null)
|
||||
{
|
||||
- itemstack1 = TileEntityHopper.func_145889_a(iinventory, itemstack.copy().splitStack(1), Facing.oppositeSide[i1]);
|
||||
+ // CraftBukkit start - Fire event when pushing items into other inventories
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.copy().splitStack(1));
|
||||
+ org.bukkit.inventory.Inventory destinationInventory;
|
||||
|
||||
- if (itemstack1 == null)
|
||||
+ // Have to special case large chests as they work oddly
|
||||
+ if (iinventory instanceof InventoryLargeChest)
|
||||
{
|
||||
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ destinationInventory = iinventory.getOwner().getInventory();
|
||||
+ }
|
||||
+
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
|
||||
+ p_149941_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = TileEntityHopper.func_145889_a(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.oppositeSide[i1]);
|
||||
+
|
||||
+ if (event.getItem().equals(oitemstack) && itemstack1 == null)
|
||||
+ {
|
||||
+ // CraftBukkit end
|
||||
itemstack1 = itemstack.copy();
|
||||
|
||||
if (--itemstack1.stackSize == 0)
|
162
patches/net/minecraft/block/BlockDynamicLiquid.java.patch
Normal file
162
patches/net/minecraft/block/BlockDynamicLiquid.java.patch
Normal file
@ -0,0 +1,162 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockDynamicLiquid.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockDynamicLiquid.java
|
||||
@@ -5,6 +5,11 @@
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.event.block.BlockFromToEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockDynamicLiquid extends BlockLiquid
|
||||
{
|
||||
int field_149815_a;
|
||||
@@ -37,6 +42,12 @@
|
||||
int i1 = this.tickRate(p_149674_1_);
|
||||
int j1;
|
||||
|
||||
+ // Cauldron - move CB edit to after variable initialization for coremod compatibility
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ org.bukkit.Server server = p_149674_1_.getServer();
|
||||
+ org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ // CraftBukkit end
|
||||
if (l > 0)
|
||||
{
|
||||
byte b1 = -100;
|
||||
@@ -66,17 +77,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.field_149815_a >= 2 && this.blockMaterial == Material.water)
|
||||
+ // Cauldron start - allow disabling infinite water sources
|
||||
+ if(net.minecraft.server.MinecraftServer.getServer().cauldronConfig.infiniteWaterSource.getValue())
|
||||
{
|
||||
- if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial().isSolid())
|
||||
+ if (this.field_149815_a >= 2 && this.blockMaterial == Material.water)
|
||||
{
|
||||
- j1 = 0;
|
||||
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial().isSolid())
|
||||
+ {
|
||||
+ j1 = 0;
|
||||
+ }
|
||||
+ else if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == this.blockMaterial && p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == 0)
|
||||
+ {
|
||||
+ j1 = 0;
|
||||
+ }
|
||||
}
|
||||
- else if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == this.blockMaterial && p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == 0)
|
||||
- {
|
||||
- j1 = 0;
|
||||
- }
|
||||
}
|
||||
+ // Cauldron end
|
||||
|
||||
if (this.blockMaterial == Material.lava && l < 8 && j1 < 8 && j1 > l && p_149674_5_.nextInt(4) != 0)
|
||||
{
|
||||
@@ -89,6 +105,13 @@
|
||||
{
|
||||
this.func_149811_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
+ // Cauldron start - allow lava decaying at a 'natural' rate - see https://mojang.atlassian.net/browse/MC-4631 Lava decay fails to schedule block update
|
||||
+ else if (net.minecraft.server.MinecraftServer.getServer().cauldronConfig.flowingLavaDecay.getValue())
|
||||
+ {
|
||||
+ // Ensure that even if the flow decay was skipped, it will retry at the material's natural flow period.
|
||||
+ p_149674_1_.scheduleBlockUpdate(p_149674_2_, p_149674_3_, p_149674_4_, this, this.tickRate(p_149674_1_));
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,21 +136,34 @@
|
||||
|
||||
if (this.func_149809_q(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_))
|
||||
{
|
||||
- if (this.blockMaterial == Material.lava && p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == Material.water)
|
||||
+ // CraftBukkit start - Send "down" to the server
|
||||
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
|
||||
+
|
||||
+ if (server != null)
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, Blocks.stone);
|
||||
- this.func_149799_m(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_);
|
||||
- return;
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
}
|
||||
|
||||
- if (l >= 8)
|
||||
+ if (!event.isCancelled())
|
||||
{
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l);
|
||||
+ if (this.blockMaterial == Material.lava && p_149674_1_.getBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_).getMaterial() == Material.water)
|
||||
+ {
|
||||
+ p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, Blocks.stone);
|
||||
+ this.func_149799_m(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (l >= 8)
|
||||
+ {
|
||||
+ this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l + 8);
|
||||
+ }
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, l + 8);
|
||||
- }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else if (l >= 0 && (l == 0 || this.func_149807_p(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_)))
|
||||
{
|
||||
@@ -144,25 +180,31 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- if (aboolean[0])
|
||||
- {
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, j1);
|
||||
- }
|
||||
+ // CraftBukkit start - All four cardinal directions. Do not change the order!
|
||||
+ BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH };
|
||||
+ int index = 0;
|
||||
|
||||
- if (aboolean[1])
|
||||
+ for (BlockFace currentFace : faces)
|
||||
{
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, j1);
|
||||
- }
|
||||
+ if (aboolean[index])
|
||||
+ {
|
||||
+ BlockFromToEvent event = new BlockFromToEvent(source, currentFace);
|
||||
|
||||
- if (aboolean[2])
|
||||
- {
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, j1);
|
||||
- }
|
||||
+ if (server != null)
|
||||
+ {
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
||||
- if (aboolean[3])
|
||||
- {
|
||||
- this.func_149813_h(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, j1);
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.func_149813_h(p_149674_1_, p_149674_2_ + currentFace.getModX(), p_149674_3_, p_149674_4_ + currentFace.getModZ(), j1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ index++;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
22
patches/net/minecraft/block/BlockEndPortal.java.patch
Normal file
22
patches/net/minecraft/block/BlockEndPortal.java.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockEndPortal.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockEndPortal.java
|
||||
@@ -15,6 +15,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockEndPortal extends BlockContainer
|
||||
{
|
||||
public static boolean field_149948_a;
|
||||
@@ -64,6 +66,10 @@
|
||||
{
|
||||
if (p_149670_5_.ridingEntity == null && p_149670_5_.riddenByEntity == null && !p_149670_1_.isRemote)
|
||||
{
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(p_149670_5_.getBukkitEntity(), new org.bukkit.Location(p_149670_1_.getWorld(), p_149670_2_, p_149670_3_, p_149670_4_));
|
||||
+ p_149670_1_.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
p_149670_5_.travelToDimension(1);
|
||||
}
|
||||
}
|
57
patches/net/minecraft/block/BlockFarmland.java.patch
Normal file
57
patches/net/minecraft/block/BlockFarmland.java.patch
Normal file
@ -0,0 +1,57 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
|
||||
@@ -15,6 +15,11 @@
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityInteractEvent;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockFarmland extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -64,6 +69,15 @@
|
||||
}
|
||||
else if (!this.func_149822_e(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(block, Blocks.dirt).isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
|
||||
}
|
||||
}
|
||||
@@ -82,6 +96,26 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Interact soil
|
||||
+ // Cauldron start - validate data before sending event
|
||||
+ org.bukkit.event.Cancellable cancellable = null;
|
||||
+
|
||||
+ if (p_149746_5_ instanceof EntityPlayer)
|
||||
+ {
|
||||
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityPlayer) p_149746_5_, org.bukkit.event.block.Action.PHYSICAL, p_149746_2_, p_149746_3_, p_149746_4_, -1, null);
|
||||
+ }
|
||||
+ else if (p_149746_1_ != null && p_149746_1_.getWorld() != null && p_149746_5_ != null)
|
||||
+ {
|
||||
+ cancellable = new EntityInteractEvent(p_149746_5_.getBukkitEntity(), p_149746_1_.getWorld().getBlockAt(p_149746_2_, p_149746_3_, p_149746_4_));
|
||||
+ p_149746_1_.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ if (cancellable != null && cancellable.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
+ // CraftBukkit end
|
||||
p_149746_1_.setBlock(p_149746_2_, p_149746_3_, p_149746_4_, Blocks.dirt);
|
||||
}
|
||||
}
|
129
patches/net/minecraft/block/BlockFire.java.patch
Normal file
129
patches/net/minecraft/block/BlockFire.java.patch
Normal file
@ -0,0 +1,129 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
|
||||
@@ -17,6 +17,11 @@
|
||||
import net.minecraft.world.WorldProviderEnd;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.block.BlockBurnEvent;
|
||||
+import org.bukkit.event.block.BlockSpreadEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class BlockFire extends Block
|
||||
{
|
||||
@@ -105,12 +110,12 @@
|
||||
|
||||
if (!this.canPlaceBlockAt(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
|
||||
{
|
||||
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - invalid place location
|
||||
}
|
||||
|
||||
if (!flag && p_149674_1_.isRaining() && (p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ - 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ + 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ - 1) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ + 1)))
|
||||
{
|
||||
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - extinguished by rain
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -127,12 +132,12 @@
|
||||
{
|
||||
if (!World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || l > 3)
|
||||
{
|
||||
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out of inflammable block
|
||||
}
|
||||
}
|
||||
else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
|
||||
{
|
||||
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,7 +191,29 @@
|
||||
k2 = 15;
|
||||
}
|
||||
|
||||
- p_149674_1_.setBlock(i1, k1, j1, this, k2, 3);
|
||||
+ // CraftBukkit start - Call to stop spread of fire
|
||||
+ if (p_149674_1_.getBlock(i1, k1, j1) != Blocks.fire)
|
||||
+ {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, i1, k1, j1, p_149674_2_, p_149674_3_, p_149674_4_).isCancelled())
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.Server server = p_149674_1_.getServer();
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(this));
|
||||
+ blockState.setData(new org.bukkit.material.MaterialData(Block.getIdFromBlock(this), (byte) k2));
|
||||
+ BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
|
||||
+ server.getPluginManager().callEvent(spreadEvent);
|
||||
+
|
||||
+ if (!spreadEvent.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,7 +243,18 @@
|
||||
if (p_149841_6_.nextInt(p_149841_5_) < j1)
|
||||
{
|
||||
boolean flag = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt;
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block theBlock = p_149841_1_.getWorld().getBlockAt(p_149841_2_, p_149841_3_, p_149841_4_);
|
||||
+ BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
||||
+ p_149841_1_.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (p_149841_6_.nextInt(p_149841_7_ + 10) < 5 && !p_149841_1_.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_))
|
||||
{
|
||||
int k1 = p_149841_7_ + p_149841_6_.nextInt(5) / 4;
|
||||
@@ -297,7 +335,7 @@
|
||||
{
|
||||
if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && !this.canNeighborBurn(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_))
|
||||
{
|
||||
- p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
+ fireExtinguished(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); // CraftBukkit - fuel block gone
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,7 +345,7 @@
|
||||
{
|
||||
if (!World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) && !this.canNeighborBurn(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
|
||||
{
|
||||
- p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_);
|
||||
+ fireExtinguished(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); // CraftBukkit - fuel block broke
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -398,6 +436,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private void fireExtinguished(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.air).isCancelled())
|
||||
+ {
|
||||
+ world.setBlockToAir(x, y, z);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
||||
{
|
64
patches/net/minecraft/block/BlockGrass.java.patch
Normal file
64
patches/net/minecraft/block/BlockGrass.java.patch
Normal file
@ -0,0 +1,64 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
|
||||
@@ -15,6 +15,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.block.BlockSpreadEvent;
|
||||
+import org.bukkit.event.block.BlockFadeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockGrass extends Block implements IGrowable
|
||||
{
|
||||
private static final Logger logger = LogManager.getLogger();
|
||||
@@ -45,11 +51,25 @@
|
||||
{
|
||||
if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.dirt));
|
||||
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9)
|
||||
{
|
||||
- for (int l = 0; l < 4; ++l)
|
||||
+ int numGrowth = Math.min(4, Math.max(20, (int)(4 * 100F / p_149674_1_.growthOdds))); // Spigot
|
||||
+
|
||||
+ for (int l = 0; l < numGrowth; ++l) // Spigot
|
||||
{
|
||||
int i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
|
||||
int j1 = p_149674_3_ + p_149674_5_.nextInt(5) - 3;
|
||||
@@ -58,7 +78,19 @@
|
||||
|
||||
if (p_149674_1_.getBlock(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
{
|
||||
- p_149674_1_.setBlock(i1, j1, k1, Blocks.grass);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.grass));
|
||||
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
19
patches/net/minecraft/block/BlockHopper.java.patch
Normal file
19
patches/net/minecraft/block/BlockHopper.java.patch
Normal file
@ -0,0 +1,19 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockHopper.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockHopper.java
|
||||
@@ -22,6 +22,7 @@
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
+import net.minecraft.inventory.IInventory; // CraftBukkit
|
||||
|
||||
public class BlockHopper extends BlockContainer
|
||||
{
|
||||
@@ -210,7 +211,7 @@
|
||||
|
||||
public static int getDirectionFromMetadata(int p_149918_0_)
|
||||
{
|
||||
- return p_149918_0_ & 7;
|
||||
+ return Math.min(p_149918_0_ & 7, 5); // CraftBukkit - Fix AIOOBE in callers
|
||||
}
|
||||
|
||||
public static boolean func_149917_c(int p_149917_0_)
|
17
patches/net/minecraft/block/BlockIce.java.patch
Normal file
17
patches/net/minecraft/block/BlockIce.java.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
|
||||
@@ -86,6 +86,14 @@
|
||||
{
|
||||
if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11 - this.getLightOpacity())
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), Blocks.water).isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (p_149674_1_.provider.isHellWorld)
|
||||
{
|
||||
p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
26
patches/net/minecraft/block/BlockJukebox.java.patch
Normal file
26
patches/net/minecraft/block/BlockJukebox.java.patch
Normal file
@ -0,0 +1,26 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockJukebox.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockJukebox.java
|
||||
@@ -163,8 +163,23 @@
|
||||
|
||||
public void func_145857_a(ItemStack p_145857_1_)
|
||||
{
|
||||
+ // CraftBukkit start - There can only be one
|
||||
+ if (p_145857_1_ != null)
|
||||
+ {
|
||||
+ p_145857_1_.stackSize = 1;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.field_145858_a = p_145857_1_;
|
||||
this.markDirty();
|
||||
}
|
||||
+
|
||||
+ // Cauldron start
|
||||
+ @Override
|
||||
+ public boolean canUpdate()
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
}
|
||||
}
|
28
patches/net/minecraft/block/BlockLeaves.java.patch
Normal file
28
patches/net/minecraft/block/BlockLeaves.java.patch
Normal file
@ -0,0 +1,28 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
|
||||
@@ -18,6 +18,8 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
+import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
|
||||
{
|
||||
int[] field_150128_a;
|
||||
@@ -222,6 +224,16 @@
|
||||
|
||||
private void removeLeaves(World p_150126_1_, int p_150126_2_, int p_150126_3_, int p_150126_4_)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(p_150126_1_.getWorld().getBlockAt(p_150126_2_, p_150126_3_, p_150126_4_));
|
||||
+ p_150126_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.dropBlockAsItem(p_150126_1_, p_150126_2_, p_150126_3_, p_150126_4_, p_150126_1_.getBlockMetadata(p_150126_2_, p_150126_3_, p_150126_4_), 0);
|
||||
p_150126_1_.setBlockToAir(p_150126_2_, p_150126_3_, p_150126_4_);
|
||||
}
|
31
patches/net/minecraft/block/BlockLever.java.patch
Normal file
31
patches/net/minecraft/block/BlockLever.java.patch
Normal file
@ -0,0 +1,31 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockLever extends Block
|
||||
{
|
||||
private static final String __OBFID = "CL_00000264";
|
||||
@@ -270,6 +272,19 @@
|
||||
int i1 = p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
int j1 = i1 & 7;
|
||||
int k1 = 8 - (i1 & 8);
|
||||
+ // CraftBukkit start - Interact Lever
|
||||
+ org.bukkit.block.Block block = p_149727_1_.getWorld().getBlockAt(p_149727_2_, p_149727_3_, p_149727_4_);
|
||||
+ int old = (k1 != 8) ? 15 : 0;
|
||||
+ int current = (k1 == 8) ? 15 : 0;
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
||||
+ p_149727_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+
|
||||
+ if ((eventRedstone.getNewCurrent() > 0) != (k1 == 8))
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149727_1_.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1 + k1, 3);
|
||||
p_149727_1_.playSoundEffect((double)p_149727_2_ + 0.5D, (double)p_149727_3_ + 0.5D, (double)p_149727_4_ + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
|
||||
p_149727_1_.notifyBlocksOfNeighborChange(p_149727_2_, p_149727_3_, p_149727_4_, this);
|
60
patches/net/minecraft/block/BlockMushroom.java.patch
Normal file
60
patches/net/minecraft/block/BlockMushroom.java.patch
Normal file
@ -0,0 +1,60 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
|
||||
@@ -6,6 +6,12 @@
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.block.BlockSpreadEvent;
|
||||
+import org.bukkit.TreeType;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockMushroom extends BlockBush implements IGrowable
|
||||
{
|
||||
private static final String __OBFID = "CL_00000272";
|
||||
@@ -19,7 +25,9 @@
|
||||
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
|
||||
{
|
||||
- if (p_149674_5_.nextInt(25) == 0)
|
||||
+ final int sourceX = p_149674_2_, sourceY = p_149674_3_, sourceZ = p_149674_4_; // CraftBukkit
|
||||
+
|
||||
+ if (p_149674_5_.nextInt(Math.max(1, (int) p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().mushroomModifier * 25)) == 0) // Spigot // Cauldron
|
||||
{
|
||||
byte b0 = 4;
|
||||
int l = 5;
|
||||
@@ -66,7 +74,19 @@
|
||||
|
||||
if (p_149674_1_.isAirBlock(i1, j1, k1) && this.canBlockStay(p_149674_1_, i1, j1, k1))
|
||||
{
|
||||
- p_149674_1_.setBlock(i1, j1, k1, this, 0, 2);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(this)); // nms: this.id, 0, 2
|
||||
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,10 +122,12 @@
|
||||
|
||||
if (this == Blocks.brown_mushroom)
|
||||
{
|
||||
+ BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit
|
||||
worldgenbigmushroom = new WorldGenBigMushroom(0);
|
||||
}
|
||||
else if (this == Blocks.red_mushroom)
|
||||
{
|
||||
+ BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit
|
||||
worldgenbigmushroom = new WorldGenBigMushroom(1);
|
||||
}
|
||||
|
64
patches/net/minecraft/block/BlockMycelium.java.patch
Normal file
64
patches/net/minecraft/block/BlockMycelium.java.patch
Normal file
@ -0,0 +1,64 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
|
||||
@@ -12,6 +12,12 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.block.BlockFadeEvent;
|
||||
+import org.bukkit.event.block.BlockSpreadEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockMycelium extends Block
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -39,11 +45,25 @@
|
||||
{
|
||||
if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(Blocks.dirt));
|
||||
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9)
|
||||
{
|
||||
- for (int l = 0; l < 4; ++l)
|
||||
+ int numGrowth = Math.min(4, Math.max(20, (int)(4 * 100F / p_149674_1_.growthOdds))); // Spigot
|
||||
+
|
||||
+ for (int l = 0; l < numGrowth; ++l) // Spigot
|
||||
{
|
||||
int i1 = p_149674_2_ + p_149674_5_.nextInt(3) - 1;
|
||||
int j1 = p_149674_3_ + p_149674_5_.nextInt(5) - 3;
|
||||
@@ -52,7 +72,19 @@
|
||||
|
||||
if (p_149674_1_.getBlock(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
|
||||
{
|
||||
- p_149674_1_.setBlock(i1, j1, k1, this);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
||||
+ BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
|
||||
+ blockState.setTypeId(Block.getIdFromBlock(this));
|
||||
+ BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
|
||||
+ p_149674_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ blockState.update(true);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
11
patches/net/minecraft/block/BlockNetherWart.java.patch
Normal file
11
patches/net/minecraft/block/BlockNetherWart.java.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
|
||||
@@ -45,7 +45,7 @@
|
||||
if (l < 3 && p_149674_5_.nextInt(10) == 0)
|
||||
{
|
||||
++l;
|
||||
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, l); // CraftBukkit
|
||||
}
|
||||
|
||||
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
|
32
patches/net/minecraft/block/BlockNetherrack.java.patch
Normal file
32
patches/net/minecraft/block/BlockNetherrack.java.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockNetherrack.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherrack.java
|
||||
@@ -4,6 +4,11 @@
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
+import net.minecraft.world.World;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockNetherrack extends Block
|
||||
{
|
||||
private static final String __OBFID = "CL_00000275";
|
||||
@@ -18,4 +23,17 @@
|
||||
{
|
||||
return MapColor.netherrackColor;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void doPhysics(World world, int i, int j, int k, int l)
|
||||
+ {
|
||||
+ if (Block.getBlockById(l) != null && Block.getBlockById(l).canProvidePower())
|
||||
+ {
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
|
||||
+ int power = block.getBlockPower();
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, power, power);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
116
patches/net/minecraft/block/BlockPistonBase.java.patch
Normal file
116
patches/net/minecraft/block/BlockPistonBase.java.patch
Normal file
@ -0,0 +1,116 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
|
||||
@@ -21,6 +21,12 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.event.block.BlockPistonRetractEvent;
|
||||
+import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPistonBase extends Block
|
||||
{
|
||||
private final boolean isSticky;
|
||||
@@ -128,13 +134,37 @@
|
||||
|
||||
if (flag && !isExtended(l))
|
||||
{
|
||||
- if (canExtend(p_150078_1_, p_150078_2_, p_150078_3_, p_150078_4_, i1))
|
||||
+ // CraftBukkit start
|
||||
+ int length = canExtend_IntCB(p_150078_1_, p_150078_2_, p_150078_3_, p_150078_4_, i1);
|
||||
+
|
||||
+ if (length >= 0)
|
||||
{
|
||||
+ org.bukkit.block.Block block = p_150078_1_.getWorld().getBlockAt(p_150078_2_, p_150078_3_, p_150078_4_);
|
||||
+ BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
|
||||
+ p_150078_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_150078_1_.addBlockEvent(p_150078_2_, p_150078_3_, p_150078_4_, this, 0, i1);
|
||||
}
|
||||
}
|
||||
else if (!flag && isExtended(l))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_150078_1_.getWorld().getBlockAt(p_150078_2_, p_150078_3_, p_150078_4_);
|
||||
+ BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
|
||||
+ p_150078_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_150078_1_.setBlockMetadataWithNotify(p_150078_2_, p_150078_3_, p_150078_4_, i1, 2);
|
||||
p_150078_1_.addBlockEvent(p_150078_2_, p_150078_3_, p_150078_4_, this, 1, i1);
|
||||
}
|
||||
@@ -297,6 +327,11 @@
|
||||
|
||||
public static int getPistonOrientation(int p_150076_0_)
|
||||
{
|
||||
+ if ((p_150076_0_ & 7) >= Facing.oppositeSide.length)
|
||||
+ {
|
||||
+ return 7; // CraftBukkit - check for AIOOB on piston data
|
||||
+ }
|
||||
+
|
||||
return p_150076_0_ & 7;
|
||||
}
|
||||
|
||||
@@ -366,7 +401,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static boolean canExtend(World p_150077_0_, int p_150077_1_, int p_150077_2_, int p_150077_3_, int p_150077_4_)
|
||||
+ // Cauldron start - vanilla compatibility
|
||||
+ private static boolean canExtend(World world, int i, int j, int k, int l) {
|
||||
+ return canExtend_IntCB(world, i, j, k, l) >= 0;
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
+
|
||||
+ private static int canExtend_IntCB(World p_150077_0_, int p_150077_1_, int p_150077_2_, int p_150077_3_, int p_150077_4_) // CraftBukkit int -> boolean
|
||||
{
|
||||
int i1 = p_150077_1_ + Facing.offsetsXForSide[p_150077_4_];
|
||||
int j1 = p_150077_2_ + Facing.offsetsYForSide[p_150077_4_];
|
||||
@@ -379,7 +420,7 @@
|
||||
{
|
||||
if (j1 <= 0 || j1 >= p_150077_0_.getHeight())
|
||||
{
|
||||
- return false;
|
||||
+ return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
Block block = p_150077_0_.getBlock(i1, j1, k1);
|
||||
@@ -388,14 +429,14 @@
|
||||
{
|
||||
if (!canPushBlock(block, p_150077_0_, i1, j1, k1, true))
|
||||
{
|
||||
- return false;
|
||||
+ return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
if (block.getMobilityFlag() != 1)
|
||||
{
|
||||
if (l1 == 12)
|
||||
{
|
||||
- return false;
|
||||
+ return -1; // CraftBukkit
|
||||
}
|
||||
|
||||
i1 += Facing.offsetsXForSide[p_150077_4_];
|
||||
@@ -407,7 +448,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return true;
|
||||
+ return l1; // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
28
patches/net/minecraft/block/BlockPistonExtension.java.patch
Normal file
28
patches/net/minecraft/block/BlockPistonExtension.java.patch
Normal file
@ -0,0 +1,28 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPistonExtension.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonExtension.java
|
||||
@@ -55,6 +55,12 @@
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
+
|
||||
+ if ((p_149749_6_ & 7) >= Facing.oppositeSide.length)
|
||||
+ {
|
||||
+ return; // CraftBukkit - fix a piston AIOOBE issue
|
||||
+ }
|
||||
+
|
||||
int i1 = Facing.oppositeSide[getDirectionMeta(p_149749_6_)];
|
||||
p_149749_2_ += Facing.offsetsXForSide[i1];
|
||||
p_149749_3_ += Facing.offsetsYForSide[i1];
|
||||
@@ -200,6 +206,12 @@
|
||||
public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
|
||||
{
|
||||
int l = getDirectionMeta(p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_));
|
||||
+
|
||||
+ if ((l & 7) >= Facing.oppositeSide.length)
|
||||
+ {
|
||||
+ return; // CraftBukkit - fix a piston AIOOBE issue
|
||||
+ }
|
||||
+
|
||||
Block block1 = p_149695_1_.getBlock(p_149695_2_ - Facing.offsetsXForSide[l], p_149695_3_ - Facing.offsetsYForSide[l], p_149695_4_ - Facing.offsetsZForSide[l]);
|
||||
|
||||
if (block1 != Blocks.piston && block1 != Blocks.sticky_piston)
|
383
patches/net/minecraft/block/BlockPortal.java.patch
Normal file
383
patches/net/minecraft/block/BlockPortal.java.patch
Normal file
@ -0,0 +1,383 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPortal.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPortal.java
|
||||
@@ -14,6 +14,11 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.world.PortalCreateEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPortal extends BlockBreakable
|
||||
{
|
||||
public static final int[][] field_150001_a = new int[][] {new int[0], {3, 1}, {2, 0}};
|
||||
@@ -29,7 +34,7 @@
|
||||
{
|
||||
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
|
||||
|
||||
- if (p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId())
|
||||
+ if (p_149674_1_.getSpigotConfig().enableZombiePigmenPortalSpawns && p_149674_1_.provider.isSurfaceWorld() && p_149674_1_.getGameRules().getGameRuleBooleanValue("doMobSpawning") && p_149674_5_.nextInt(2000) < p_149674_1_.difficultySetting.getDifficultyId()) // Spigot // Cauldron
|
||||
{
|
||||
int l;
|
||||
|
||||
@@ -104,13 +109,15 @@
|
||||
|
||||
if (size.func_150860_b() && size.field_150864_e == 0)
|
||||
{
|
||||
- size.func_150859_c();
|
||||
- return true;
|
||||
+ // CraftBukkit start - return portalcreator
|
||||
+ return size.CB_func_150859_c(); // Cauldron
|
||||
+ //return true;
|
||||
}
|
||||
else if (size1.func_150860_b() && size1.field_150864_e == 0)
|
||||
{
|
||||
- size1.func_150859_c();
|
||||
- return true;
|
||||
+ return size1.CB_func_150859_c(); // Cauldron
|
||||
+ //return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -181,6 +188,10 @@
|
||||
{
|
||||
if (p_149670_5_.ridingEntity == null && p_149670_5_.riddenByEntity == null)
|
||||
{
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(p_149670_5_.getBukkitEntity(), new org.bukkit.Location(p_149670_1_.getWorld(), p_149670_2_, p_149670_3_, p_149670_4_));
|
||||
+ p_149670_1_.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
p_149670_5_.setInPortal();
|
||||
}
|
||||
}
|
||||
@@ -239,175 +250,223 @@
|
||||
}
|
||||
|
||||
public static class Size
|
||||
+ {
|
||||
+ private final World field_150867_a;
|
||||
+ private final int field_150865_b;
|
||||
+ private final int field_150866_c;
|
||||
+ private final int field_150863_d;
|
||||
+ private int field_150864_e = 0;
|
||||
+ private ChunkCoordinates field_150861_f;
|
||||
+ private int field_150862_g;
|
||||
+ private int field_150868_h;
|
||||
+ java.util.Collection<org.bukkit.block.Block> blocks; // CraftBukkit
|
||||
+ private static final String __OBFID = "CL_00000285";
|
||||
+
|
||||
+ public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_)
|
||||
{
|
||||
- private final World field_150867_a;
|
||||
- private final int field_150865_b;
|
||||
- private final int field_150866_c;
|
||||
- private final int field_150863_d;
|
||||
- private int field_150864_e = 0;
|
||||
- private ChunkCoordinates field_150861_f;
|
||||
- private int field_150862_g;
|
||||
- private int field_150868_h;
|
||||
- private static final String __OBFID = "CL_00000285";
|
||||
+ this.field_150867_a = p_i45415_1_;
|
||||
+ this.field_150865_b = p_i45415_5_;
|
||||
+ this.field_150863_d = BlockPortal.field_150001_a[p_i45415_5_][0];
|
||||
+ this.field_150866_c = BlockPortal.field_150001_a[p_i45415_5_][1];
|
||||
|
||||
- public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_)
|
||||
+ for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.func_150857_a(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)
|
||||
{
|
||||
- this.field_150867_a = p_i45415_1_;
|
||||
- this.field_150865_b = p_i45415_5_;
|
||||
- this.field_150863_d = BlockPortal.field_150001_a[p_i45415_5_][0];
|
||||
- this.field_150866_c = BlockPortal.field_150001_a[p_i45415_5_][1];
|
||||
+ ;
|
||||
+ }
|
||||
|
||||
- for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.func_150857_a(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)
|
||||
+ int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1;
|
||||
+
|
||||
+ if (j1 >= 0)
|
||||
+ {
|
||||
+ this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);
|
||||
+ this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c);
|
||||
+
|
||||
+ if (this.field_150868_h < 2 || this.field_150868_h > 21)
|
||||
{
|
||||
- ;
|
||||
+ this.field_150861_f = null;
|
||||
+ this.field_150868_h = 0;
|
||||
}
|
||||
+ }
|
||||
|
||||
- int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1;
|
||||
+ if (this.field_150861_f != null)
|
||||
+ {
|
||||
+ this.field_150862_g = this.func_150858_a();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (j1 >= 0)
|
||||
- {
|
||||
- this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);
|
||||
- this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c);
|
||||
+ protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_, int p_150853_4_)
|
||||
+ {
|
||||
+ int j1 = Direction.offsetX[p_150853_4_];
|
||||
+ int k1 = Direction.offsetZ[p_150853_4_];
|
||||
+ int i1;
|
||||
+ Block block;
|
||||
|
||||
- if (this.field_150868_h < 2 || this.field_150868_h > 21)
|
||||
- {
|
||||
- this.field_150861_f = null;
|
||||
- this.field_150868_h = 0;
|
||||
- }
|
||||
+ for (i1 = 0; i1 < 22; ++i1)
|
||||
+ {
|
||||
+ block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
|
||||
+
|
||||
+ if (!this.func_150857_a(block))
|
||||
+ {
|
||||
+ break;
|
||||
}
|
||||
|
||||
- if (this.field_150861_f != null)
|
||||
+ Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);
|
||||
+
|
||||
+ if (block1 != Blocks.obsidian)
|
||||
{
|
||||
- this.field_150862_g = this.func_150858_a();
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
- protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_, int p_150853_4_)
|
||||
+ block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
|
||||
+ return block == Blocks.obsidian ? i1 : 0;
|
||||
+ }
|
||||
+
|
||||
+ protected int func_150858_a()
|
||||
+ {
|
||||
+ this.blocks = new java.util.HashSet<org.bukkit.block.Block>(); // CraftBukkit
|
||||
+ org.bukkit.World bworld = this.field_150867_a.getWorld();
|
||||
+ int i;
|
||||
+ int j;
|
||||
+ int k;
|
||||
+ int l;
|
||||
+ label56:
|
||||
+
|
||||
+ for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
|
||||
{
|
||||
- int j1 = Direction.offsetX[p_150853_4_];
|
||||
- int k1 = Direction.offsetZ[p_150853_4_];
|
||||
- int i1;
|
||||
- Block block;
|
||||
+ i = this.field_150861_f.posY + this.field_150862_g;
|
||||
|
||||
- for (i1 = 0; i1 < 22; ++i1)
|
||||
+ for (j = 0; j < this.field_150868_h; ++j)
|
||||
{
|
||||
- block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
|
||||
+ k = this.field_150861_f.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
+ l = this.field_150861_f.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
+ Block block = this.field_150867_a.getBlock(k, i, l);
|
||||
|
||||
if (!this.func_150857_a(block))
|
||||
{
|
||||
- break;
|
||||
+ break label56;
|
||||
}
|
||||
|
||||
- Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);
|
||||
-
|
||||
- if (block1 != Blocks.obsidian)
|
||||
+ if (block == Blocks.portal)
|
||||
{
|
||||
- break;
|
||||
+ ++this.field_150864_e;
|
||||
}
|
||||
- }
|
||||
|
||||
- block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_, p_150853_3_ + k1 * i1);
|
||||
- return block == Blocks.obsidian ? i1 : 0;
|
||||
- }
|
||||
-
|
||||
- protected int func_150858_a()
|
||||
- {
|
||||
- int i;
|
||||
- int j;
|
||||
- int k;
|
||||
- int l;
|
||||
- label56:
|
||||
-
|
||||
- for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g)
|
||||
- {
|
||||
- i = this.field_150861_f.posY + this.field_150862_g;
|
||||
-
|
||||
- for (j = 0; j < this.field_150868_h; ++j)
|
||||
+ if (j == 0)
|
||||
{
|
||||
- k = this.field_150861_f.posX + j * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
- l = this.field_150861_f.posZ + j * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
- Block block = this.field_150867_a.getBlock(k, i, l);
|
||||
+ block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]);
|
||||
|
||||
- if (!this.func_150857_a(block))
|
||||
+ if (block != Blocks.obsidian)
|
||||
{
|
||||
break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
}
|
||||
-
|
||||
- if (block == Blocks.portal)
|
||||
+ else
|
||||
{
|
||||
- ++this.field_150864_e;
|
||||
+ blocks.add(bworld.getBlockAt(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ }
|
||||
+ else if (j == this.field_150868_h - 1)
|
||||
+ {
|
||||
+ block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]);
|
||||
|
||||
- if (j == 0)
|
||||
+ if (block != Blocks.obsidian)
|
||||
{
|
||||
- block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][0]]);
|
||||
-
|
||||
- if (block != Blocks.obsidian)
|
||||
- {
|
||||
- break label56;
|
||||
- }
|
||||
+ break label56;
|
||||
+ // CraftBukkit start - add the block to our list
|
||||
}
|
||||
- else if (j == this.field_150868_h - 1)
|
||||
+ else
|
||||
{
|
||||
- block = this.field_150867_a.getBlock(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]);
|
||||
-
|
||||
- if (block != Blocks.obsidian)
|
||||
- {
|
||||
- break label56;
|
||||
- }
|
||||
+ blocks.add(bworld.getBlockAt(k + Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]]));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
+ }
|
||||
|
||||
- for (i = 0; i < this.field_150868_h; ++i)
|
||||
- {
|
||||
- j = this.field_150861_f.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
- k = this.field_150861_f.posY + this.field_150862_g;
|
||||
- l = this.field_150861_f.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
+ for (i = 0; i < this.field_150868_h; ++i)
|
||||
+ {
|
||||
+ j = this.field_150861_f.posX + i * Direction.offsetX[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
+ k = this.field_150861_f.posY + this.field_150862_g;
|
||||
+ l = this.field_150861_f.posZ + i * Direction.offsetZ[BlockPortal.field_150001_a[this.field_150865_b][1]];
|
||||
|
||||
- if (this.field_150867_a.getBlock(j, k, l) != Blocks.obsidian)
|
||||
- {
|
||||
- this.field_150862_g = 0;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
|
||||
+ if (this.field_150867_a.getBlock(j, k, l) != Blocks.obsidian)
|
||||
{
|
||||
- return this.field_150862_g;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- this.field_150861_f = null;
|
||||
- this.field_150868_h = 0;
|
||||
this.field_150862_g = 0;
|
||||
- return 0;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
|
||||
- protected boolean func_150857_a(Block p_150857_1_)
|
||||
+ if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
|
||||
{
|
||||
- return p_150857_1_.blockMaterial == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
|
||||
+ return this.field_150862_g;
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
+ this.field_150861_f = null;
|
||||
+ this.field_150868_h = 0;
|
||||
+ this.field_150862_g = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- public boolean func_150860_b()
|
||||
+ protected boolean func_150857_a(Block p_150857_1_)
|
||||
+ {
|
||||
+ return p_150857_1_.blockMaterial == Material.air || p_150857_1_ == Blocks.fire || p_150857_1_ == Blocks.portal;
|
||||
+ }
|
||||
+
|
||||
+ public boolean func_150860_b()
|
||||
+ {
|
||||
+ return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;
|
||||
+ }
|
||||
+
|
||||
+ // Cauldron start - vanilla compatibility
|
||||
+ public void func_150859_c()
|
||||
+ {
|
||||
+ this.CB_func_150859_c();
|
||||
+ }
|
||||
+ // Cauldron end
|
||||
+
|
||||
+ public boolean CB_func_150859_c()
|
||||
+ {
|
||||
+ org.bukkit.World bworld = this.field_150867_a.getWorld();
|
||||
+
|
||||
+ // Copy below for loop
|
||||
+ for (int i = 0; i < this.field_150868_h; ++i)
|
||||
{
|
||||
- return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21;
|
||||
+ int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i;
|
||||
+ int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i;
|
||||
+
|
||||
+ for (int l = 0; l < this.field_150862_g; ++l)
|
||||
+ {
|
||||
+ int i1 = this.field_150861_f.posY + l;
|
||||
+ bworld.getBlockAt(j, i1, k);
|
||||
+ }
|
||||
}
|
||||
|
||||
- public void func_150859_c()
|
||||
+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE);
|
||||
+ this.field_150867_a.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled())
|
||||
{
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int i = 0; i < this.field_150868_h; ++i)
|
||||
{
|
||||
int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i;
|
||||
int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i;
|
||||
-
|
||||
+
|
||||
for (int l = 0; l < this.field_150862_g; ++l)
|
||||
{
|
||||
int i1 = this.field_150861_f.posY + l;
|
||||
this.field_150867_a.setBlock(j, i1, k, Blocks.portal, this.field_150865_b, 2);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
47
patches/net/minecraft/block/BlockPressurePlate.java.patch
Normal file
47
patches/net/minecraft/block/BlockPressurePlate.java.patch
Normal file
@ -0,0 +1,47 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPressurePlate.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPressurePlate.java
|
||||
@@ -8,6 +8,8 @@
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockPressurePlate extends BlockBasePressurePlate
|
||||
{
|
||||
private BlockPressurePlate.Sensitivity field_150069_a;
|
||||
@@ -54,8 +56,34 @@
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
- Entity entity = (Entity)iterator.next();
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ if (this.func_150060_c(p_150065_1_.getBlockMetadata(p_150065_2_, p_150065_3_, p_150065_4_)) == 0)
|
||||
+ {
|
||||
+ org.bukkit.World bworld = p_150065_1_.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = p_150065_1_.getServer().getPluginManager();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer)
|
||||
+ {
|
||||
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) entity, org.bukkit.event.block.Action.PHYSICAL, p_150065_2_, p_150065_3_, p_150065_4_, -1, null);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(p_150065_2_, p_150065_3_, p_150065_4_));
|
||||
+ manager.callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ // We only want to block turning the plate on if all events are cancelled
|
||||
+ if (cancellable.isCancelled())
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!entity.doesEntityNotTriggerPressurePlate())
|
||||
{
|
||||
return 15;
|
@ -0,0 +1,63 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPressurePlateWeighted.java
|
||||
@@ -5,6 +5,12 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import net.minecraft.entity.player.EntityPlayer;
|
||||
+import org.bukkit.event.entity.EntityInteractEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPressurePlateWeighted extends BlockBasePressurePlate
|
||||
{
|
||||
private final int field_150068_a;
|
||||
@@ -18,18 +24,43 @@
|
||||
|
||||
protected int func_150065_e(World p_150065_1_, int p_150065_2_, int p_150065_3_, int p_150065_4_)
|
||||
{
|
||||
- int l = Math.min(p_150065_1_.getEntitiesWithinAABB(Entity.class, this.func_150061_a(p_150065_2_, p_150065_3_, p_150065_4_)).size(), this.field_150068_a);
|
||||
+ // CraftBukkit start
|
||||
+ int l = 0;
|
||||
+ java.util.Iterator iterator = p_150065_1_.getEntitiesWithinAABB(Entity.class, this.func_150061_a(p_150065_2_, p_150065_3_, p_150065_4_)).iterator();
|
||||
|
||||
- if (l <= 0)
|
||||
+ while (iterator.hasNext())
|
||||
{
|
||||
- return 0;
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+
|
||||
+ if (entity instanceof EntityPlayer)
|
||||
+ {
|
||||
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) entity, org.bukkit.event.block.Action.PHYSICAL, p_150065_2_, p_150065_3_, p_150065_4_, -1, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), p_150065_1_.getWorld().getBlockAt(p_150065_2_, p_150065_3_, p_150065_4_));
|
||||
+ p_150065_1_.getServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ // We only want to block turning the plate on if all events are cancelled
|
||||
+ if (!cancellable.isCancelled())
|
||||
+ {
|
||||
+ l++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ l = Math.min(l, this.field_150068_a);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (l <= 0)
|
||||
+ {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
float f = (float)Math.min(this.field_150068_a, l) / (float)this.field_150068_a;
|
||||
return MathHelper.ceiling_float_int(f * 15.0F);
|
||||
}
|
||||
- }
|
||||
|
||||
protected int func_150060_c(int p_150060_1_)
|
||||
{
|
126
patches/net/minecraft/block/BlockPumpkin.java.patch
Normal file
126
patches/net/minecraft/block/BlockPumpkin.java.patch
Normal file
@ -0,0 +1,126 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
|
||||
@@ -14,6 +14,12 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPumpkin extends BlockDirectional
|
||||
{
|
||||
private boolean field_149985_a;
|
||||
@@ -45,15 +51,18 @@
|
||||
{
|
||||
if (!p_149726_1_.isRemote)
|
||||
{
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0), 0, 2);
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149726_1_.getWorld());
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_, p_149726_4_, 0);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_, 0);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 2, p_149726_4_, 0);
|
||||
EntitySnowman entitysnowman = new EntitySnowman(p_149726_1_);
|
||||
- entitysnowman.setLocationAndAngles((double)p_149726_2_ + 0.5D, (double)p_149726_3_ - 1.95D, (double)p_149726_4_ + 0.5D, 0.0F, 0.0F);
|
||||
- p_149726_1_.spawnEntityInWorld(entitysnowman);
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0));
|
||||
+ entitysnowman.setLocationAndAngles((double) p_149726_2_ + 0.5D, (double) p_149726_3_ - 1.95D, (double) p_149726_4_ + 0.5D, 0.0F, 0.0F);
|
||||
+
|
||||
+ if (p_149726_1_.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN))
|
||||
+ {
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 120; ++i1)
|
||||
@@ -68,45 +77,38 @@
|
||||
|
||||
if (flag || flag1)
|
||||
{
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0), 0, 2);
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149726_1_.getWorld());
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_, p_149726_4_, 0);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_, 0);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 2, p_149726_4_, 0);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
- p_149726_1_.setBlock(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeId(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, 0);
|
||||
+ blockList.setTypeId(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, getBlockById(0), 0, 2);
|
||||
- p_149726_1_.setBlock(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, 0);
|
||||
+ blockList.setTypeId(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, 0);
|
||||
}
|
||||
|
||||
EntityIronGolem entityirongolem = new EntityIronGolem(p_149726_1_);
|
||||
entityirongolem.setPlayerCreated(true);
|
||||
- entityirongolem.setLocationAndAngles((double)p_149726_2_ + 0.5D, (double)p_149726_3_ - 1.95D, (double)p_149726_4_ + 0.5D, 0.0F, 0.0F);
|
||||
- p_149726_1_.spawnEntityInWorld(entityirongolem);
|
||||
+ entityirongolem.setLocationAndAngles((double) p_149726_2_ + 0.5D, (double) p_149726_3_ - 1.95D, (double) p_149726_4_ + 0.5D, 0.0F, 0.0F);
|
||||
|
||||
- for (int l = 0; l < 120; ++l)
|
||||
+ if (p_149726_1_.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM))
|
||||
{
|
||||
- p_149726_1_.spawnParticle("snowballpoof", (double)p_149726_2_ + p_149726_1_.rand.nextDouble(), (double)(p_149726_3_ - 2) + p_149726_1_.rand.nextDouble() * 3.9D, (double)p_149726_4_ + p_149726_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
- }
|
||||
+ for (int i1 = 0; i1 < 120; ++i1)
|
||||
+ {
|
||||
+ p_149726_1_.spawnParticle("snowballpoof", (double) p_149726_2_ + p_149726_1_.rand.nextDouble(), (double)(p_149726_3_ - 2) + p_149726_1_.rand.nextDouble() * 3.9D, (double) p_149726_4_ + p_149726_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
+ }
|
||||
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_, p_149726_4_, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 2, p_149726_4_, getBlockById(0));
|
||||
-
|
||||
- if (flag)
|
||||
- {
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_ - 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_ + 1, p_149726_3_ - 1, p_149726_4_, getBlockById(0));
|
||||
+ blockList.updateList();
|
||||
}
|
||||
- else
|
||||
- {
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_ - 1, getBlockById(0));
|
||||
- p_149726_1_.notifyBlockChange(p_149726_2_, p_149726_3_ - 1, p_149726_4_ + 1, getBlockById(0));
|
||||
- }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,6 +124,19 @@
|
||||
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, l, 2);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void onNeighborBlockChange(World world, int i, int j, int k, Block block)
|
||||
+ {
|
||||
+ if (block != null && block.canProvidePower())
|
||||
+ {
|
||||
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(i, j, k);
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
|
||||
+ world.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister p_149651_1_)
|
||||
{
|
29
patches/net/minecraft/block/BlockRailDetector.java.patch
Normal file
29
patches/net/minecraft/block/BlockRailDetector.java.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRailDetector.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRailDetector.java
|
||||
@@ -16,6 +16,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockRailDetector extends BlockRailBase
|
||||
{
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -86,6 +88,17 @@
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (flag != flag1)
|
||||
+ {
|
||||
+ org.bukkit.block.Block block = p_150054_1_.getWorld().getBlockAt(p_150054_2_, p_150054_3_, p_150054_4_);
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
|
||||
+ p_150054_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 && !flag)
|
||||
{
|
||||
p_150054_1_.setBlockMetadataWithNotify(p_150054_2_, p_150054_3_, p_150054_4_, p_150054_5_ | 8, 3);
|
43
patches/net/minecraft/block/BlockRedstoneDiode.java.patch
Normal file
43
patches/net/minecraft/block/BlockRedstoneDiode.java.patch
Normal file
@ -0,0 +1,43 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public abstract class BlockRedstoneDiode extends BlockDirectional
|
||||
{
|
||||
protected final boolean isRepeaterPowered;
|
||||
@@ -44,16 +46,30 @@
|
||||
{
|
||||
int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
- if (!this.func_149910_g(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l))
|
||||
+ if (!this.func_149910_g((IBlockAccess) p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l)) // CraftBukkit - Cast world to IBlockAccess to call the right method.
|
||||
{
|
||||
boolean flag = this.isGettingInput(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, l);
|
||||
|
||||
if (this.isRepeaterPowered && !flag)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 15, 0).getNewCurrent() != 0)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, this.getBlockUnpowered(), l, 2);
|
||||
}
|
||||
else if (!this.isRepeaterPowered)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 0, 15).getNewCurrent() != 15)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, this.getBlockPowered(), l, 2);
|
||||
|
||||
if (!flag)
|
53
patches/net/minecraft/block/BlockRedstoneLight.java.patch
Normal file
53
patches/net/minecraft/block/BlockRedstoneLight.java.patch
Normal file
@ -0,0 +1,53 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneLight.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneLight.java
|
||||
@@ -9,6 +9,8 @@
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneLight extends Block
|
||||
{
|
||||
private final boolean field_150171_a;
|
||||
@@ -35,6 +37,13 @@
|
||||
}
|
||||
else if (!this.field_150171_a && p_149726_1_.isBlockIndirectlyGettingPowered(p_149726_2_, p_149726_3_, p_149726_4_))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_, 0, 15).getNewCurrent() != 15)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149726_1_.setBlock(p_149726_2_, p_149726_3_, p_149726_4_, Blocks.lit_redstone_lamp, 0, 2);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +59,13 @@
|
||||
}
|
||||
else if (!this.field_150171_a && p_149695_1_.isBlockIndirectlyGettingPowered(p_149695_2_, p_149695_3_, p_149695_4_))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, 0, 15).getNewCurrent() != 15)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149695_1_.setBlock(p_149695_2_, p_149695_3_, p_149695_4_, Blocks.lit_redstone_lamp, 0, 2);
|
||||
}
|
||||
}
|
||||
@@ -59,6 +75,13 @@
|
||||
{
|
||||
if (!p_149674_1_.isRemote && this.field_150171_a && !p_149674_1_.isBlockIndirectlyGettingPowered(p_149674_2_, p_149674_3_, p_149674_4_))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, 15, 0).getNewCurrent() != 0)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.redstone_lamp, 0, 2);
|
||||
}
|
||||
}
|
44
patches/net/minecraft/block/BlockRedstoneOre.java.patch
Normal file
44
patches/net/minecraft/block/BlockRedstoneOre.java.patch
Normal file
@ -0,0 +1,44 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneOre extends Block
|
||||
{
|
||||
private boolean field_150187_a;
|
||||
@@ -43,8 +45,30 @@
|
||||
|
||||
public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity p_149724_5_)
|
||||
{
|
||||
- this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
|
||||
- super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
|
||||
+ // CraftBukkit start
|
||||
+ if (p_149724_5_ instanceof EntityPlayer)
|
||||
+ {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) p_149724_5_, org.bukkit.event.block.Action.PHYSICAL, p_149724_2_, p_149724_3_, p_149724_4_, -1, null);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
|
||||
+ super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ EntityInteractEvent event = new EntityInteractEvent(p_149724_5_.getBukkitEntity(), p_149724_1_.getWorld().getBlockAt(p_149724_2_, p_149724_3_, p_149724_4_));
|
||||
+ p_149724_1_.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled())
|
||||
+ {
|
||||
+ this.func_150185_e(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_);
|
||||
+ super.onEntityWalking(p_149724_1_, p_149724_2_, p_149724_3_, p_149724_4_, p_149724_5_);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
|
62
patches/net/minecraft/block/BlockRedstoneTorch.java.patch
Normal file
62
patches/net/minecraft/block/BlockRedstoneTorch.java.patch
Normal file
@ -0,0 +1,62 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneTorch extends BlockTorch
|
||||
{
|
||||
private boolean field_150113_a;
|
||||
@@ -125,10 +127,30 @@
|
||||
list.remove(0);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.plugin.PluginManager manager = p_149674_1_.getServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ int oldCurrent = this.field_150113_a ? 15 : 0;
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.field_150113_a)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (oldCurrent != 0)
|
||||
+ {
|
||||
+ event.setNewCurrent(0);
|
||||
+ manager.callEvent(event);
|
||||
+
|
||||
+ if (event.getNewCurrent() != 0)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.unlit_redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);
|
||||
|
||||
if (this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, true))
|
||||
@@ -147,6 +169,19 @@
|
||||
}
|
||||
else if (!flag && !this.func_150111_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, false))
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (oldCurrent != 15)
|
||||
+ {
|
||||
+ event.setNewCurrent(15);
|
||||
+ manager.callEvent(event);
|
||||
+
|
||||
+ if (event.getNewCurrent() != 15)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.redstone_torch, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 3);
|
||||
}
|
||||
}
|
39
patches/net/minecraft/block/BlockRedstoneWire.java.patch
Normal file
39
patches/net/minecraft/block/BlockRedstoneWire.java.patch
Normal file
@ -0,0 +1,39 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
|
||||
@@ -18,6 +18,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockRedstoneWire extends Block
|
||||
{
|
||||
private boolean field_150181_a = true;
|
||||
@@ -159,8 +161,17 @@
|
||||
i3 = l1;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
if (k1 != i3)
|
||||
{
|
||||
+ BlockRedstoneEvent event = new BlockRedstoneEvent(p_150175_1_.getWorld().getBlockAt(p_150175_2_, p_150175_3_, p_150175_4_), k1, i3);
|
||||
+ p_150175_1_.getServer().getPluginManager().callEvent(event);
|
||||
+ i3 = event.getNewCurrent();
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+ if (k1 != i3)
|
||||
+ {
|
||||
p_150175_1_.setBlockMetadataWithNotify(p_150175_2_, p_150175_3_, p_150175_4_, i3, 2);
|
||||
this.field_150179_b.add(new ChunkPosition(p_150175_2_, p_150175_3_, p_150175_4_));
|
||||
this.field_150179_b.add(new ChunkPosition(p_150175_2_ - 1, p_150175_3_, p_150175_4_));
|
||||
@@ -294,7 +305,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private int func_150178_a(World p_150178_1_, int p_150178_2_, int p_150178_3_, int p_150178_4_, int p_150178_5_)
|
||||
+ // CraftBukkit - private -> public
|
||||
+ public int func_150178_a(World p_150178_1_, int p_150178_2_, int p_150178_3_, int p_150178_4_, int p_150178_5_)
|
||||
{
|
||||
if (p_150178_1_.getBlock(p_150178_2_, p_150178_3_, p_150178_4_) != this)
|
||||
{
|
14
patches/net/minecraft/block/BlockReed.java.patch
Normal file
14
patches/net/minecraft/block/BlockReed.java.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
|
||||
@@ -44,9 +44,9 @@
|
||||
{
|
||||
int i1 = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
- if (i1 == 15)
|
||||
+ if (i1 >= (byte) range(3, (p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().caneModifier * 15) + 0.5F, 15)) // Spigot // Cauldron
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, 0); // CraftBukkit
|
||||
p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, 0, 4);
|
||||
}
|
||||
else
|
122
patches/net/minecraft/block/BlockSapling.java.patch
Normal file
122
patches/net/minecraft/block/BlockSapling.java.patch
Normal file
@ -0,0 +1,122 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java
|
||||
@@ -22,10 +22,18 @@
|
||||
import net.minecraft.world.gen.feature.WorldGenTrees;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.block.BlockState;
|
||||
+import org.bukkit.event.world.StructureGrowEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockSapling extends BlockBush implements IGrowable
|
||||
{
|
||||
public static final String[] field_149882_a = new String[] {"oak", "spruce", "birch", "jungle", "acacia", "roofed_oak"};
|
||||
private static final IIcon[] field_149881_b = new IIcon[field_149882_a.length];
|
||||
+ public static TreeType treeType; // CraftBukkit
|
||||
private static final String __OBFID = "CL_00000305";
|
||||
|
||||
protected BlockSapling()
|
||||
@@ -41,9 +49,31 @@
|
||||
{
|
||||
super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
|
||||
|
||||
- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9 && p_149674_5_.nextInt(7) == 0)
|
||||
+ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9 && (p_149674_5_.nextInt(Math.max(2, (int)((p_149674_1_.growthOdds / p_149674_1_.getSpigotConfig().saplingModifier * 7) + 0.5F))) == 0)) // Spigot // Cauldron
|
||||
{
|
||||
+ // Cauldron start
|
||||
+ p_149674_1_.captureTreeGeneration = true;
|
||||
this.func_149879_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);
|
||||
+ p_149674_1_.captureTreeGeneration = false;
|
||||
+ if (p_149674_1_.capturedBlockStates.size() > 0)
|
||||
+ {
|
||||
+ TreeType treeType = BlockSapling.treeType;
|
||||
+ BlockSapling.treeType = null;
|
||||
+ Location location = new Location(p_149674_1_.getWorld(), p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ List<BlockState> blocks = (List<BlockState>) p_149674_1_.capturedBlockStates.clone();
|
||||
+ p_149674_1_.capturedBlockStates.clear();
|
||||
+ StructureGrowEvent event = null;
|
||||
+ if (treeType != null) {
|
||||
+ event = new StructureGrowEvent(location, treeType, false, null, blocks);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (event == null || !event.isCancelled()) {
|
||||
+ for (BlockState blockstate : blocks) {
|
||||
+ blockstate.update(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ //Cauldron end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +103,20 @@
|
||||
{
|
||||
if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return;
|
||||
int l = p_149878_1_.getBlockMetadata(p_149878_2_, p_149878_3_, p_149878_4_) & 7;
|
||||
- Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
|
||||
+ // CraftBukkit start
|
||||
+ Object object = null;
|
||||
+ if (p_149878_5_.nextInt(10) == 0)
|
||||
+ {
|
||||
+ treeType = TreeType.BIG_TREE; // CraftBukkit
|
||||
+ object = new WorldGenBigTree(true);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ treeType = TreeType.TREE; // CraftBukkit
|
||||
+ object = new WorldGenTrees(true);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
int i1 = 0;
|
||||
int j1 = 0;
|
||||
boolean flag = false;
|
||||
@@ -84,6 +127,7 @@
|
||||
default:
|
||||
break;
|
||||
case 1:
|
||||
+ treeType = TreeType.REDWOOD; // CraftBukkit
|
||||
label78:
|
||||
|
||||
for (i1 = 0; i1 >= -1; --i1)
|
||||
@@ -108,6 +152,7 @@
|
||||
|
||||
break;
|
||||
case 2:
|
||||
+ treeType = TreeType.BIRCH; // CraftBukkit
|
||||
object = new WorldGenForest(true, false);
|
||||
break;
|
||||
case 3:
|
||||
@@ -119,6 +164,7 @@
|
||||
{
|
||||
if (this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, 3) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, 3))
|
||||
{
|
||||
+ treeType = TreeType.JUNGLE; // CraftBukkit
|
||||
object = new WorldGenMegaJungle(true, 10, 20, 3, 3);
|
||||
flag = true;
|
||||
break label93;
|
||||
@@ -130,11 +176,13 @@
|
||||
{
|
||||
j1 = 0;
|
||||
i1 = 0;
|
||||
+ treeType = TreeType.SMALL_JUNGLE; // CraftBukkit
|
||||
object = new WorldGenTrees(true, 4 + p_149878_5_.nextInt(7), 3, 3, false);
|
||||
}
|
||||
|
||||
break;
|
||||
case 4:
|
||||
+ treeType = TreeType.ACACIA; // CraftBukkit
|
||||
object = new WorldGenSavannaTree(true);
|
||||
break;
|
||||
case 5:
|
||||
@@ -147,6 +195,7 @@
|
||||
if (this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, 5) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, 5))
|
||||
{
|
||||
object = new WorldGenCanopyTree(true);
|
||||
+ treeType = TreeType.DARK_OAK; // CraftBukkit
|
||||
flag = true;
|
||||
break label108;
|
||||
}
|
29
patches/net/minecraft/block/BlockSign.java.patch
Normal file
29
patches/net/minecraft/block/BlockSign.java.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockSign.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockSign.java
|
||||
@@ -14,6 +14,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockSign extends BlockContainer
|
||||
{
|
||||
private Class field_149968_a;
|
||||
@@ -163,6 +165,17 @@
|
||||
}
|
||||
|
||||
super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ if (p_149695_5_ != null && p_149695_5_.canProvidePower())
|
||||
+ {
|
||||
+ org.bukkit.block.Block bukkitBlock = p_149695_1_.getWorld().getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
+ int power = bukkitBlock.getBlockPower();
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power);
|
||||
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
156
patches/net/minecraft/block/BlockSkull.java.patch
Normal file
156
patches/net/minecraft/block/BlockSkull.java.patch
Normal file
@ -0,0 +1,156 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
|
||||
@@ -27,6 +27,11 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockSkull extends BlockContainer
|
||||
{
|
||||
private static final String __OBFID = "CL_00000307";
|
||||
@@ -172,16 +177,18 @@
|
||||
{
|
||||
if (p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2) == Blocks.soul_sand && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l, 1) && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, 1) && this.func_149966_a(p_149965_1_, p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, 1))
|
||||
{
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149965_1_.getWorld());
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l, 8, 2);
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, 8, 2);
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, 8, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0), 0, 2);
|
||||
|
||||
if (!p_149965_1_.isRemote)
|
||||
{
|
||||
@@ -190,18 +197,21 @@
|
||||
entitywither.renderYawOffset = 90.0F;
|
||||
entitywither.func_82206_m();
|
||||
|
||||
- if (!p_149965_1_.isRemote)
|
||||
+ if (p_149965_1_.addEntity(entitywither, SpawnReason.BUILD_WITHER))
|
||||
{
|
||||
- iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
|
||||
-
|
||||
- while (iterator.hasNext())
|
||||
+ if (!p_149965_1_.isRemote)
|
||||
{
|
||||
- entityplayer = (EntityPlayer)iterator.next();
|
||||
- entityplayer.triggerAchievement(AchievementList.field_150963_I);
|
||||
+ iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext())
|
||||
+ {
|
||||
+ entityplayer = (EntityPlayer) iterator.next();
|
||||
+ entityplayer.triggerAchievement(AchievementList.field_150963_I);
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- p_149965_1_.spawnEntityInWorld(entitywither);
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
}
|
||||
|
||||
for (i1 = 0; i1 < 120; ++i1)
|
||||
@@ -209,13 +219,7 @@
|
||||
p_149965_1_.spawnParticle("snowballpoof", (double)p_149965_2_ + p_149965_1_.rand.nextDouble(), (double)(p_149965_3_ - 2) + p_149965_1_.rand.nextDouble() * 3.9D, (double)(p_149965_4_ + l + 1) + p_149965_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l + 1, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_, p_149965_4_ + l + 2, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 1, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 1, p_149965_4_ + l + 2, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_, p_149965_3_ - 2, p_149965_4_ + l + 1, getBlockById(0));
|
||||
+ // CraftBukkit end
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -224,16 +228,18 @@
|
||||
{
|
||||
if (p_149965_1_.getBlock(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_) == Blocks.soul_sand && p_149965_1_.getBlock(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_) == Blocks.soul_sand && this.func_149966_a(p_149965_1_, p_149965_2_ + l, p_149965_3_, p_149965_4_, 1) && this.func_149966_a(p_149965_1_, p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, 1) && this.func_149966_a(p_149965_1_, p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, 1))
|
||||
{
|
||||
+ // CraftBukkit start - Use BlockStateListPopulator
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(p_149965_1_.getWorld());
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l, p_149965_3_, p_149965_4_, 8, 2);
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, 8, 2);
|
||||
p_149965_1_.setBlockMetadataWithNotify(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, 8, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
- p_149965_1_.setBlock(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0), 0, 2);
|
||||
+ blockList.setTypeAndData(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0), 0, 2);
|
||||
|
||||
if (!p_149965_1_.isRemote)
|
||||
{
|
||||
@@ -241,18 +247,21 @@
|
||||
entitywither.setLocationAndAngles((double)(p_149965_2_ + l) + 1.5D, (double)p_149965_3_ - 1.45D, (double)p_149965_4_ + 0.5D, 0.0F, 0.0F);
|
||||
entitywither.func_82206_m();
|
||||
|
||||
- if (!p_149965_1_.isRemote)
|
||||
+ if (p_149965_1_.addEntity(entitywither, SpawnReason.BUILD_WITHER))
|
||||
{
|
||||
- iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
|
||||
-
|
||||
- while (iterator.hasNext())
|
||||
+ if (!p_149965_1_.isRemote)
|
||||
{
|
||||
- entityplayer = (EntityPlayer)iterator.next();
|
||||
- entityplayer.triggerAchievement(AchievementList.field_150963_I);
|
||||
+ iterator = p_149965_1_.getEntitiesWithinAABB(EntityPlayer.class, entitywither.boundingBox.expand(50.0D, 50.0D, 50.0D)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext())
|
||||
+ {
|
||||
+ entityplayer = (EntityPlayer) iterator.next();
|
||||
+ entityplayer.triggerAchievement(AchievementList.field_150963_I);
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- p_149965_1_.spawnEntityInWorld(entitywither);
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
}
|
||||
|
||||
for (i1 = 0; i1 < 120; ++i1)
|
||||
@@ -260,13 +269,7 @@
|
||||
p_149965_1_.spawnParticle("snowballpoof", (double)(p_149965_2_ + l + 1) + p_149965_1_.rand.nextDouble(), (double)(p_149965_3_ - 2) + p_149965_1_.rand.nextDouble() * 3.9D, (double)p_149965_4_ + p_149965_1_.rand.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l, p_149965_3_, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 2, p_149965_3_, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 2, p_149965_3_ - 1, p_149965_4_, getBlockById(0));
|
||||
- p_149965_1_.notifyBlockChange(p_149965_2_ + l + 1, p_149965_3_ - 2, p_149965_4_, getBlockById(0));
|
||||
+ // CraftBukkit end
|
||||
return;
|
||||
}
|
||||
}
|
17
patches/net/minecraft/block/BlockSnow.java.patch
Normal file
17
patches/net/minecraft/block/BlockSnow.java.patch
Normal file
@ -0,0 +1,17 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
|
||||
@@ -114,6 +114,14 @@
|
||||
{
|
||||
if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11)
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), Blocks.air).isCancelled())
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+ this.dropBlockAsItem(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 0);
|
||||
p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
}
|
57
patches/net/minecraft/block/BlockStaticLiquid.java.patch
Normal file
57
patches/net/minecraft/block/BlockStaticLiquid.java.patch
Normal file
@ -0,0 +1,57 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java
|
||||
@@ -5,6 +5,8 @@
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockStaticLiquid extends BlockLiquid
|
||||
{
|
||||
private static final String __OBFID = "CL_00000315";
|
||||
@@ -43,6 +45,11 @@
|
||||
{
|
||||
int l = p_149674_5_.nextInt(3);
|
||||
int i1;
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords
|
||||
+ int x = p_149674_2_;
|
||||
+ int y = p_149674_3_;
|
||||
+ int z = p_149674_4_;
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (i1 = 0; i1 < l; ++i1)
|
||||
{
|
||||
@@ -55,6 +62,16 @@
|
||||
{
|
||||
if (this.isFlammable(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_))
|
||||
{
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire
|
||||
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_, p_149674_4_) != Blocks.fire)
|
||||
+ {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, x, y, z).isCancelled())
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.fire);
|
||||
return;
|
||||
}
|
||||
@@ -77,6 +94,16 @@
|
||||
|
||||
if (p_149674_1_.isAirBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_) && this.isFlammable(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
|
||||
{
|
||||
+ // CraftBukkit start - Prevent lava putting something on fire
|
||||
+ if (p_149674_1_.getBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_) != Blocks.fire)
|
||||
+ {
|
||||
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, x, y, z).isCancelled())
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, Blocks.fire);
|
||||
}
|
||||
}
|
37
patches/net/minecraft/block/BlockStem.java.patch
Normal file
37
patches/net/minecraft/block/BlockStem.java.patch
Normal file
@ -0,0 +1,37 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
|
||||
@@ -17,6 +17,8 @@
|
||||
import net.minecraft.world.World;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockStem extends BlockBush implements IGrowable
|
||||
{
|
||||
private final Block field_149877_a;
|
||||
@@ -46,14 +48,14 @@
|
||||
{
|
||||
float f = this.func_149875_n(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
- if (p_149674_5_.nextInt((int)(25.0F / f) + 1) == 0)
|
||||
+ if (p_149674_5_.nextInt((int)(p_149674_1_.growthOdds / (this == Blocks.pumpkin_stem ? p_149674_1_.getSpigotConfig().pumpkinModifier : p_149674_1_.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) // Spigot // Cauldron
|
||||
{
|
||||
int l = p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
|
||||
if (l < 7)
|
||||
{
|
||||
++l;
|
||||
- p_149674_1_.setBlockMetadataWithNotify(p_149674_2_, p_149674_3_, p_149674_4_, l, 2);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, this, l); // CraftBukkit
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,7 +107,7 @@
|
||||
|
||||
if (p_149674_1_.isAirBlock(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass))
|
||||
{
|
||||
- p_149674_1_.setBlock(j1, p_149674_3_, k1, this.field_149877_a);
|
||||
+ CraftEventFactory.handleBlockGrowEvent(p_149674_1_, j1, p_149674_3_, k1, this.field_149877_a, 0); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
32
patches/net/minecraft/block/BlockTrapDoor.java.patch
Normal file
32
patches/net/minecraft/block/BlockTrapDoor.java.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
|
||||
@@ -13,6 +13,8 @@
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockTrapDoor extends Block
|
||||
{
|
||||
/** Set this to allow trapdoors to remain free-floating */
|
||||
@@ -176,6 +178,20 @@
|
||||
|
||||
if (flag || p_149695_5_.canProvidePower())
|
||||
{
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = p_149695_1_.getWorld();
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(p_149695_2_, p_149695_3_, p_149695_4_);
|
||||
+ int power = bblock.getBlockPower();
|
||||
+ int oldPower = (p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 4) > 0 ? 15 : 0;
|
||||
+
|
||||
+ if (oldPower == 0 ^ power == 0 || p_149695_5_.canProvidePower())
|
||||
+ {
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bblock, oldPower, power);
|
||||
+ p_149695_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+ flag = eventRedstone.getNewCurrent() > 0;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.func_150120_a(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, flag);
|
||||
}
|
||||
}
|
63
patches/net/minecraft/block/BlockTripWire.java.patch
Normal file
63
patches/net/minecraft/block/BlockTripWire.java.patch
Normal file
@ -0,0 +1,63 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockTripWire.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWire.java
|
||||
@@ -16,6 +16,8 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockTripWire extends Block
|
||||
{
|
||||
private static final String __OBFID = "CL_00000328";
|
||||
@@ -208,6 +210,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Call interact even when triggering connected tripwire
|
||||
+ if (flag != flag1 && flag1 && (p_150140_1_.getBlockMetadata(p_150140_2_, p_150140_3_, p_150140_4_) & 4) == 4)
|
||||
+ {
|
||||
+ org.bukkit.World bworld = p_150140_1_.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = p_150140_1_.getServer().getPluginManager();
|
||||
+ org.bukkit.block.Block block = bworld.getBlockAt(p_150140_2_, p_150140_3_, p_150140_4_);
|
||||
+ boolean allowed = false;
|
||||
+
|
||||
+ // If all of the events are cancelled block the tripwire trigger, else allow
|
||||
+ for (Object object : list)
|
||||
+ {
|
||||
+ if (object != null)
|
||||
+ {
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+
|
||||
+ if (object instanceof EntityPlayer)
|
||||
+ {
|
||||
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityPlayer) object, org.bukkit.event.block.Action.PHYSICAL, p_150140_2_, p_150140_3_, p_150140_4_, -1, null);
|
||||
+ }
|
||||
+ else if (object instanceof Entity)
|
||||
+ {
|
||||
+ cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), block);
|
||||
+ manager.callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (!cancellable.isCancelled())
|
||||
+ {
|
||||
+ allowed = true;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!allowed)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 && !flag)
|
||||
{
|
||||
l |= 1;
|
29
patches/net/minecraft/block/BlockTripWireHook.java.patch
Normal file
29
patches/net/minecraft/block/BlockTripWireHook.java.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
|
||||
@@ -12,6 +12,8 @@
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import static net.minecraftforge.common.util.ForgeDirection.*;
|
||||
|
||||
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
||||
+
|
||||
public class BlockTripWireHook extends Block
|
||||
{
|
||||
private static final String __OBFID = "CL_00000329";
|
||||
@@ -210,6 +212,17 @@
|
||||
this.func_150135_a(p_150136_1_, l2, p_150136_3_, i3, flag4, flag5, flag2, flag3);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block block = p_150136_1_.getWorld().getBlockAt(p_150136_2_, p_150136_3_, p_150136_4_);
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
|
||||
+ p_150136_1_.getServer().getPluginManager().callEvent(eventRedstone);
|
||||
+
|
||||
+ if (eventRedstone.getNewCurrent() > 0)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.func_150135_a(p_150136_1_, p_150136_2_, p_150136_3_, p_150136_4_, flag4, flag5, flag2, flag3);
|
||||
|
||||
if (!p_150136_5_)
|
77
patches/net/minecraft/block/BlockVine.java.patch
Normal file
77
patches/net/minecraft/block/BlockVine.java.patch
Normal file
@ -0,0 +1,77 @@
|
||||
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
|
||||
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
|
||||
@@ -21,6 +21,8 @@
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
||||
+
|
||||
public class BlockVine extends Block implements IShearable
|
||||
{
|
||||
private static final String __OBFID = "CL_00000330";
|
||||
@@ -268,7 +270,11 @@
|
||||
|
||||
if (j2 > 0)
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ + 1, p_149674_4_, this, j2, 2);
|
||||
+ // CraftBukkit start - Call BlockSpreadEvent
|
||||
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ org.bukkit.block.Block block = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_ + 1, p_149674_4_);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, l1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,27 +296,34 @@
|
||||
{
|
||||
l1 = k1 + 1 & 3;
|
||||
i2 = k1 + 3 & 3;
|
||||
+ // CraftBukkit start - Call BlockSpreadEvent
|
||||
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ org.bukkit.block.Block bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1]);
|
||||
|
||||
if ((i1 & 1 << l1) != 0 && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1])))
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 1 << l1, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << l1);
|
||||
}
|
||||
else if ((i1 & 1 << i2) != 0 && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2])))
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 1 << i2, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << i2);
|
||||
}
|
||||
else if ((i1 & 1 << l1) != 0 && p_149674_1_.isAirBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1]) && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[l1])))
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1], this, 1 << (k1 + 2 & 3), 2);
|
||||
+ bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[l1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[l1]);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
|
||||
}
|
||||
else if ((i1 & 1 << i2) != 0 && p_149674_1_.isAirBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2]) && this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[i2])))
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2], this, 1 << (k1 + 2 & 3), 2);
|
||||
+ bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_ + Direction.offsetX[k1] + Direction.offsetX[i2], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1] + Direction.offsetZ[i2]);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 1 << (k1 + 2 & 3));
|
||||
}
|
||||
else if (this.func_150093_a(p_149674_1_.getBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_ + 1, p_149674_4_ + Direction.offsetZ[k1])))
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_ + Direction.offsetX[k1], p_149674_3_, p_149674_4_ + Direction.offsetZ[k1], this, 0, 2);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, 0);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
else if (block.blockMaterial.isOpaque() && block.renderAsNormalBlock())
|
||||
{
|
||||
@@ -327,7 +340,11 @@
|
||||
|
||||
if (l1 > 0)
|
||||
{
|
||||
- p_149674_1_.setBlock(p_149674_2_, p_149674_3_ - 1, p_149674_4_, this, l1, 2);
|
||||
+ // CraftBukkit start - Call BlockSpreadEvent
|
||||
+ org.bukkit.block.Block source = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
+ org.bukkit.block.Block bukkitBlock = p_149674_1_.getWorld().getBlockAt(p_149674_2_, p_149674_3_ - 1, p_149674_4_);
|
||||
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, l1);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
else if (block == this)
|
Reference in New Issue
Block a user