@@ -56,7 +56,7 @@
|
||||
resetTilt(iblockdata, worldserver, blockposition);
|
||||
}
|
||||
@@ -210,8 +228,10 @@
|
||||
return entity.isOnGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
|
||||
return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
|
||||
}
|
||||
|
||||
- private void setTiltAndScheduleTick(IBlockData iblockdata, World world, BlockPosition blockposition, Tilt tilt, @Nullable SoundEffect soundeffect) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -354,7 +354,13 @@
|
||||
@@ -342,7 +342,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +386,7 @@
|
||||
@@ -368,7 +374,7 @@
|
||||
|
||||
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
|
||||
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
|
||||
@@ -24,7 +24,7 @@
|
||||
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
|
||||
}
|
||||
|
||||
@@ -516,16 +522,24 @@
|
||||
@@ -504,16 +510,24 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBed.java
|
||||
@@ -85,7 +85,8 @@
|
||||
@@ -84,7 +84,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
world.removeBlock(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
||||
|
||||
@@ -104,7 +105,16 @@
|
||||
@@ -103,7 +104,16 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
@@ -27,7 +27,7 @@
|
||||
if (entityhuman_enumbedresult.getMessage() != null) {
|
||||
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
||||
}
|
||||
@@ -115,8 +125,29 @@
|
||||
@@ -114,8 +124,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
|
||||
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|
||||
@@ -320,6 +351,11 @@
|
||||
@@ -314,6 +345,11 @@
|
||||
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
|
||||
|
||||
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBell.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBell.java
|
||||
@@ -137,6 +137,11 @@
|
||||
@@ -136,6 +136,11 @@
|
||||
if (enumdirection == null) {
|
||||
enumdirection = (EnumDirection) world.getBlockState(blockposition).getValue(BlockBell.FACING);
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
((TileEntityBell) tileentity).onHit(enumdirection);
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BELL_BLOCK, SoundCategory.BLOCKS, 2.0F, 1.0F);
|
||||
@@ -268,4 +273,16 @@
|
||||
@@ -262,4 +267,16 @@
|
||||
public boolean isPathfindable(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
|
||||
|
||||
worldserver.setBlock(blockposition, iblockdata1, 4);
|
||||
@@ -114,7 +116,9 @@
|
||||
@@ -112,7 +114,9 @@
|
||||
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
public static final int READY = 8;
|
||||
@@ -246,7 +252,14 @@
|
||||
@@ -248,7 +254,14 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
itemstack.shrink(1);
|
||||
return iblockdata1;
|
||||
@@ -256,6 +269,14 @@
|
||||
@@ -258,6 +271,14 @@
|
||||
}
|
||||
|
||||
public static IBlockData extractProduce(Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -44,7 +44,7 @@
|
||||
if (!world.isClientSide) {
|
||||
Vec3D vec3d = Vec3D.atLowerCornerWithOffset(blockposition, 0.5D, 1.01D, 0.5D).offsetRandom(world.random, 0.7F);
|
||||
EntityItem entityitem = new EntityItem(world, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL));
|
||||
@@ -279,10 +300,16 @@
|
||||
@@ -281,10 +302,16 @@
|
||||
}
|
||||
|
||||
static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
@@ -62,7 +62,7 @@
|
||||
return iblockdata;
|
||||
} else {
|
||||
int j = i + 1;
|
||||
@@ -331,7 +358,8 @@
|
||||
@@ -333,7 +360,8 @@
|
||||
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -346,6 +374,7 @@
|
||||
@@ -348,6 +376,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -370,8 +399,15 @@
|
||||
@@ -372,8 +401,15 @@
|
||||
|
||||
@Override
|
||||
public void setChanged() {
|
||||
@@ -98,7 +98,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +420,7 @@
|
||||
@@ -386,6 +422,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
@@ -106,7 +106,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -426,8 +463,9 @@
|
||||
@@ -428,8 +465,9 @@
|
||||
|
||||
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDiodeAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDiodeAbstract.java
|
||||
@@ -19,6 +19,8 @@
|
||||
@@ -20,6 +20,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.ticks.TickListPriority;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
|
||||
|
||||
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
|
||||
@@ -45,8 +47,18 @@
|
||||
@@ -46,8 +48,18 @@
|
||||
boolean flag1 = this.shouldTurnOn(worldserver, blockposition, iblockdata);
|
||||
|
||||
if (flag && !flag1) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDispenser.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDispenser.java
|
||||
@@ -47,6 +47,7 @@
|
||||
@@ -46,6 +46,7 @@
|
||||
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
|
||||
});
|
||||
private static final int TRIGGER_DURATION = 4;
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
public static void registerBehavior(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
|
||||
BlockDispenser.DISPENSER_REGISTRY.put(imaterial.asItem(), idispensebehavior);
|
||||
@@ -90,6 +91,7 @@
|
||||
@@ -89,6 +90,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.NOOP) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDoor.java
|
||||
@@ -35,6 +35,8 @@
|
||||
@@ -33,6 +33,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockDoor extends Block {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -187,9 +189,24 @@
|
||||
@@ -189,9 +191,24 @@
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockIce.java
|
||||
+++ b/net/minecraft/world/level/block/BlockIce.java
|
||||
@@ -49,6 +49,11 @@
|
||||
@@ -51,6 +51,11 @@
|
||||
}
|
||||
|
||||
protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLeaves.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLeaves.java
|
||||
@@ -23,6 +23,8 @@
|
||||
@@ -24,6 +24,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockLeaves extends Block implements IBlockWaterlogged {
|
||||
|
||||
public static final int DECAY_DISTANCE = 7;
|
||||
@@ -49,6 +51,14 @@
|
||||
@@ -50,6 +52,14 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (this.decaying(iblockdata)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockMagma.java
|
||||
+++ b/net/minecraft/world/level/block/BlockMagma.java
|
||||
@@ -28,7 +28,9 @@
|
||||
@@ -23,7 +23,9 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNote.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNote.java
|
||||
@@ -79,6 +79,7 @@
|
||||
@@ -75,6 +75,7 @@
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
|
||||
if (flag1) {
|
||||
this.playNote((Entity) null, iblockdata, world, blockposition);
|
||||
@@ -8,10 +8,10 @@
|
||||
}
|
||||
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
|
||||
@@ -88,6 +89,12 @@
|
||||
@@ -84,6 +85,12 @@
|
||||
|
||||
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
if (!((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).requiresAirAbove() || world.getBlockState(blockposition.above()).isAir()) {
|
||||
if (((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).worksAboveNoteBlock() || world.getBlockState(blockposition.above()).isAir()) {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, iblockdata.getValue(BlockNote.INSTRUMENT), iblockdata.getValue(BlockNote.NOTE));
|
||||
+ if (event.isCancelled()) {
|
||||
|
||||
@@ -29,3 +29,20 @@
|
||||
if (i != j) {
|
||||
IBlockData iblockdata1 = this.setSignalForState(iblockdata, j);
|
||||
|
||||
@@ -140,9 +155,15 @@
|
||||
}
|
||||
|
||||
protected static int getEntityCount(World world, AxisAlignedBB axisalignedbb, Class<? extends Entity> oclass) {
|
||||
+ // CraftBukkit start
|
||||
+ return getEntities(world, axisalignedbb, oclass).size();
|
||||
+ }
|
||||
+
|
||||
+ protected static <T extends Entity> java.util.List<T> getEntities(World world, AxisAlignedBB axisalignedbb, Class<T> oclass) {
|
||||
+ // CraftBukkit end
|
||||
return world.getEntitiesOfClass(oclass, axisalignedbb, IEntitySelector.NO_SPECTATORS.and((entity) -> {
|
||||
return !entity.isIgnoringBlockTriggers();
|
||||
- })).size();
|
||||
+ })); // CraftBukkit
|
||||
}
|
||||
|
||||
protected abstract int getSignalStrength(World world, BlockPosition blockposition);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPressurePlateBinary.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPressurePlateBinary.java
|
||||
@@ -14,6 +14,11 @@
|
||||
@@ -11,6 +11,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockSetType;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.entity.player.EntityHuman;
|
||||
@@ -12,30 +12,45 @@
|
||||
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
||||
@@ -57,6 +62,26 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
@@ -34,7 +39,7 @@
|
||||
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ if (this.getSignalForState(world.getBlockState(blockposition)) == 0) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
@Override
|
||||
protected int getSignalStrength(World world, BlockPosition blockposition) {
|
||||
- Class oclass;
|
||||
+ Class<? extends Entity> oclass; // CraftBukkit
|
||||
|
||||
switch (this.sensitivity) {
|
||||
case EVERYTHING:
|
||||
@@ -49,7 +54,31 @@
|
||||
|
||||
Class oclass1 = oclass;
|
||||
|
||||
- return getEntityCount(world, BlockPressurePlateBinary.TOUCH_AABB.move(blockposition), oclass1) > 0 ? 15 : 0;
|
||||
+ // CraftBukkit start - Call interact event when turning on a pressure plate
|
||||
+ for (Entity entity : getEntities(world, BlockPressurePlateBinary.TOUCH_AABB.move(blockposition), oclass)) {
|
||||
+ if (this.getSignalForState(world.getBlockState(blockposition)) == 0) {
|
||||
+ org.bukkit.World bworld = world.getWorld();
|
||||
+ org.bukkit.plugin.PluginManager manager = world.getCraftServer().getPluginManager();
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ manager.callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+
|
||||
+ // We only want to block turning the plate on if all events are cancelled
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
|
||||
+ } else {
|
||||
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
+ manager.callEvent((EntityInteractEvent) cancellable);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!entity.isIgnoringBlockTriggers()) {
|
||||
return 15;
|
||||
}
|
||||
+ // We only want to block turning the plate on if all events are cancelled
|
||||
+ if (cancellable.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 15;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,19 +12,15 @@
|
||||
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
|
||||
|
||||
public static final BlockStateInteger POWER = BlockProperties.POWER;
|
||||
@@ -24,7 +29,31 @@
|
||||
@@ -24,7 +29,27 @@
|
||||
|
||||
@Override
|
||||
protected int getSignalStrength(World world, BlockPosition blockposition) {
|
||||
- int i = Math.min(world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).size(), this.maxWeight);
|
||||
- int i = Math.min(getEntityCount(world, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition), Entity.class), this.maxWeight);
|
||||
+ // CraftBukkit start
|
||||
+ // int i = Math.min(world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).size(), this.maxWeight);
|
||||
+ // int i = Math.min(getEntityCount(world, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition), Entity.class), this.maxWeight);
|
||||
+ int i = 0;
|
||||
+ java.util.Iterator iterator = world.getEntitiesOfClass(Entity.class, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition)).iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ Entity entity = (Entity) iterator.next();
|
||||
+
|
||||
+ for (Entity entity : getEntities(world, BlockPressurePlateWeighted.TOUCH_AABB.move(blockposition), Entity.class)) {
|
||||
+ org.bukkit.event.Cancellable cancellable;
|
||||
+
|
||||
+ if (entity instanceof EntityHuman) {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPumpkinCarved.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPumpkinCarved.java
|
||||
@@ -27,6 +27,10 @@
|
||||
@@ -23,6 +23,10 @@
|
||||
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateDirection;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BlockPumpkinCarved extends BlockFacingHorizontal implements Equipable {
|
||||
public class BlockPumpkinCarved extends BlockFacingHorizontal {
|
||||
|
||||
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
|
||||
@@ -83,9 +87,14 @@
|
||||
@@ -79,9 +83,14 @@
|
||||
}
|
||||
|
||||
private static void spawnGolemInWorld(World world, ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection, Entity entity, BlockPosition blockposition) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSoil.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSoil.java
|
||||
@@ -27,6 +27,11 @@
|
||||
@@ -28,6 +28,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
public class BlockSoil extends Block {
|
||||
|
||||
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
|
||||
@@ -83,26 +88,49 @@
|
||||
@@ -84,26 +89,49 @@
|
||||
|
||||
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
|
||||
if (i > 0) {
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
|
||||
} else if (!isUnderCrops(worldserver, blockposition)) {
|
||||
} else if (!shouldMaintainFarmland(worldserver, blockposition)) {
|
||||
turnToDirt((Entity) null, iblockdata, worldserver, blockposition);
|
||||
}
|
||||
} else if (i < 7) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSponge.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSponge.java
|
||||
@@ -13,6 +13,13 @@
|
||||
@@ -9,6 +9,13 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
@@ -14,57 +14,63 @@
|
||||
public class BlockSponge extends Block {
|
||||
|
||||
public static final int MAX_DEPTH = 6;
|
||||
@@ -48,6 +55,7 @@
|
||||
@@ -41,7 +48,8 @@
|
||||
}
|
||||
|
||||
queue.add(new Tuple<>(blockposition, 0));
|
||||
int i = 0;
|
||||
private boolean removeWaterBreadthFirstSearch(World world, BlockPosition blockposition) {
|
||||
- return BlockPosition.breadthFirstTraversal(blockposition, 6, 65, (blockposition1, consumer) -> {
|
||||
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
|
||||
+ BlockPosition.breadthFirstTraversal(blockposition, 6, 65, (blockposition1, consumer) -> {
|
||||
EnumDirection[] aenumdirection = BlockSponge.ALL_DIRECTIONS;
|
||||
int i = aenumdirection.length;
|
||||
|
||||
while (!queue.isEmpty()) {
|
||||
Tuple<BlockPosition, Integer> tuple = (Tuple) queue.poll();
|
||||
@@ -59,27 +67,31 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
EnumDirection enumdirection = aenumdirection[l];
|
||||
BlockPosition blockposition2 = blockposition1.relative(enumdirection);
|
||||
- IBlockData iblockdata = world.getBlockState(blockposition2);
|
||||
- Fluid fluid = world.getFluidState(blockposition2);
|
||||
@@ -55,8 +63,10 @@
|
||||
if (blockposition1.equals(blockposition)) {
|
||||
return true;
|
||||
} else {
|
||||
- IBlockData iblockdata = world.getBlockState(blockposition1);
|
||||
- Fluid fluid = world.getFluidState(blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ IBlockData iblockdata = blockList.getBlockState(blockposition2);
|
||||
+ Fluid fluid = blockList.getFluidState(blockposition2);
|
||||
+ IBlockData iblockdata = blockList.getBlockState(blockposition1);
|
||||
+ Fluid fluid = blockList.getFluidState(blockposition1);
|
||||
+ // CraftBukkit end
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
if (fluid.is(TagsFluid.WATER)) {
|
||||
- if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(world, blockposition2, iblockdata).isEmpty()) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(blockList, blockposition2, iblockdata).isEmpty()) { // CraftBukkit
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
if (!fluid.is(TagsFluid.WATER)) {
|
||||
return false;
|
||||
@@ -66,27 +76,64 @@
|
||||
if (block instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) block;
|
||||
|
||||
- if (!ifluidsource.pickupBlock(world, blockposition1, iblockdata).isEmpty()) {
|
||||
+ if (!ifluidsource.pickupBlock(blockList, blockposition1, iblockdata).isEmpty()) { // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
} else if (iblockdata.getBlock() instanceof BlockFluids) {
|
||||
- world.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ blockList.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
}
|
||||
|
||||
if (iblockdata.getBlock() instanceof BlockFluids) {
|
||||
- world.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
|
||||
} else {
|
||||
if (!iblockdata.is(Blocks.KELP) && !iblockdata.is(Blocks.KELP_PLANT) && !iblockdata.is(Blocks.SEAGRASS) && !iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
||||
return false;
|
||||
}
|
||||
} else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
- TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
|
||||
- TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
||||
+ // CraftBukkit start
|
||||
+ // TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
+ // TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
||||
|
||||
- dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
- world.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ // dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
+ blockList.setBlock(blockposition2, Blocks.AIR.defaultBlockState(), 3);
|
||||
- dropResources(iblockdata, world, blockposition1, tileentity);
|
||||
- world.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ // dropResources(iblockdata, world, blockposition1, tileentity);
|
||||
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
|
||||
+ // CraftBukkit end
|
||||
++i;
|
||||
if (j < 6) {
|
||||
queue.add(new Tuple<>(blockposition2, j + 1));
|
||||
@@ -92,6 +104,39 @@
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
- }) > 1;
|
||||
+ });
|
||||
+ // CraftBukkit start
|
||||
+ List<CraftBlockState> blocks = blockList.getList(); // Is a clone
|
||||
+ if (!blocks.isEmpty()) {
|
||||
@@ -78,26 +84,27 @@
|
||||
+ }
|
||||
+
|
||||
+ for (CraftBlockState block : blocks) {
|
||||
+ BlockPosition blockposition2 = block.getPosition();
|
||||
+ IBlockData iblockdata = world.getBlockState(blockposition2);
|
||||
+ Fluid fluid = world.getFluidState(blockposition2);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+ BlockPosition blockposition1 = block.getPosition();
|
||||
+ IBlockData iblockdata = world.getBlockState(blockposition1);
|
||||
+ Fluid fluid = world.getFluidState(blockposition1);
|
||||
+
|
||||
+ if (fluid.is(TagsFluid.WATER)) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(blockList, blockposition2, iblockdata).isEmpty()) {
|
||||
+ if (iblockdata.getBlock() instanceof IFluidSource && !((IFluidSource) iblockdata.getBlock()).pickupBlock(blockList, blockposition1, iblockdata).isEmpty()) {
|
||||
+ // NOP
|
||||
+ } else if (iblockdata.getBlock() instanceof BlockFluids) {
|
||||
+ // NOP
|
||||
+ } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) {
|
||||
+ TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition2) : null;
|
||||
+ } else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
||||
+ TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
||||
+
|
||||
+ dropResources(iblockdata, world, blockposition2, tileentity);
|
||||
+ dropResources(iblockdata, world, blockposition1, tileentity);
|
||||
+ }
|
||||
+ }
|
||||
+ world.setBlock(blockposition2, block.getHandle(), block.getFlag());
|
||||
+ world.setBlock(blockposition1, block.getHandle(), block.getFlag());
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ // CraftBukkit end
|
||||
|
||||
return i > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
|
||||
@@ -30,6 +30,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
|
||||
@@ -111,6 +113,19 @@
|
||||
@@ -110,6 +112,19 @@
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockWaterLily.java
|
||||
+++ b/net/minecraft/world/level/block/BlockWaterLily.java
|
||||
@@ -25,7 +25,7 @@
|
||||
@@ -24,7 +24,7 @@
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/BlockWitherSkull.java
|
||||
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
|
||||
@@ -26,6 +26,10 @@
|
||||
import net.minecraft.world.level.block.state.predicate.MaterialPredicate;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
@@ -24,6 +24,10 @@
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBuilder;
|
||||
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
@@ -11,7 +11,7 @@
|
||||
public class BlockWitherSkull extends BlockSkull {
|
||||
|
||||
@Nullable
|
||||
@@ -49,6 +53,7 @@
|
||||
@@ -47,6 +51,7 @@
|
||||
}
|
||||
|
||||
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
|
||||
@@ -19,7 +19,7 @@
|
||||
if (!world.isClientSide) {
|
||||
IBlockData iblockdata = tileentityskull.getBlockState();
|
||||
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
|
||||
@@ -60,12 +65,18 @@
|
||||
@@ -58,12 +63,18 @@
|
||||
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world);
|
||||
|
||||
if (entitywither != null) {
|
||||
@@ -39,7 +39,7 @@
|
||||
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -74,7 +85,7 @@
|
||||
@@ -72,7 +83,7 @@
|
||||
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
@@ -44,7 +44,7 @@
|
||||
@@ -38,7 +38,7 @@
|
||||
if (block != null) {
|
||||
IBlockData iblockdata2 = (IBlockData) ((IBlockData) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == FluidTypes.WATER);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -44,6 +44,11 @@
|
||||
@@ -42,6 +42,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class PointedDripstoneBlock extends Block implements Fallable, IBlockWaterlogged {
|
||||
|
||||
public static final BlockStateDirection TIP_DIRECTION = BlockProperties.VERTICAL_DIRECTION;
|
||||
@@ -126,6 +131,11 @@
|
||||
@@ -124,6 +129,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
|
||||
@@ -24,7 +24,7 @@
|
||||
world.destroyBlock(blockposition, true);
|
||||
}
|
||||
|
||||
@@ -134,7 +144,9 @@
|
||||
@@ -132,7 +142,9 @@
|
||||
@Override
|
||||
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
|
||||
if (iblockdata.getValue(PointedDripstoneBlock.TIP_DIRECTION) == EnumDirection.UP && iblockdata.getValue(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) {
|
||||
@@ -34,7 +34,7 @@
|
||||
} else {
|
||||
super.fallOn(world, iblockdata, blockposition, entity, f);
|
||||
}
|
||||
@@ -389,15 +401,15 @@
|
||||
@@ -377,15 +389,15 @@
|
||||
if (isUnmergedTipWithDirection(iblockdata, enumdirection.getOpposite())) {
|
||||
createMergedTips(iblockdata, worldserver, blockposition1);
|
||||
} else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) {
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
private static void createMergedTips(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
@@ -412,8 +424,8 @@
|
||||
@@ -400,8 +412,8 @@
|
||||
blockposition1 = blockposition.below();
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
}
|
||||
|
||||
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -446,7 +458,7 @@
|
||||
@@ -434,7 +446,7 @@
|
||||
|
||||
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
|
||||
return isTip(iblockdata1, flag);
|
||||
@@ -73,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,7 +574,7 @@
|
||||
@@ -550,7 +562,7 @@
|
||||
return canDripThrough(world, blockposition1, iblockdata);
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -571,7 +583,7 @@
|
||||
@@ -559,7 +571,7 @@
|
||||
return canDripThrough(world, blockposition1, iblockdata);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkCatalystBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
|
||||
@@ -86,9 +86,16 @@
|
||||
@@ -61,9 +61,16 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
@@ -38,6 +38,11 @@
|
||||
@@ -41,6 +41,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
+
|
||||
public class SculkSensorBlock extends BlockTileEntity implements IBlockWaterlogged {
|
||||
|
||||
public static final int ACTIVE_TICKS = 40;
|
||||
@@ -87,6 +92,18 @@
|
||||
public static final int ACTIVE_TICKS = 30;
|
||||
@@ -95,6 +100,18 @@
|
||||
@Override
|
||||
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
|
||||
if (!world.isClientSide() && canActivate(iblockdata) && entity.getType() != EntityTypes.WARDEN) {
|
||||
@@ -31,7 +31,7 @@
|
||||
TileEntity tileentity = world.getBlockEntity(blockposition);
|
||||
|
||||
if (tileentity instanceof SculkSensorBlockEntity) {
|
||||
@@ -188,6 +205,15 @@
|
||||
@@ -198,6 +215,15 @@
|
||||
}
|
||||
|
||||
public static void deactivate(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -45,12 +45,12 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.COOLDOWN)).setValue(SculkSensorBlock.POWER, 0), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), 1);
|
||||
if (!(Boolean) iblockdata.getValue(SculkSensorBlock.WATERLOGGED)) {
|
||||
@@ -198,6 +224,15 @@
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), 10);
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -209,6 +235,15 @@
|
||||
}
|
||||
|
||||
public static void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
|
||||
public void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
+ // CraftBukkit start
|
||||
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), iblockdata.getValue(SculkSensorBlock.POWER), i);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
||||
@@ -61,9 +61,9 @@
|
||||
+ i = eventRedstone.getNewCurrent();
|
||||
+ // CraftBukkit end
|
||||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.ACTIVE)).setValue(SculkSensorBlock.POWER, i), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), 40);
|
||||
updateNeighbours(world, blockposition);
|
||||
@@ -260,9 +295,16 @@
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), this.getActiveTicks());
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -291,9 +326,16 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkVeinBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
|
||||
@@ -103,10 +103,11 @@
|
||||
@@ -101,10 +101,11 @@
|
||||
|
||||
@Override
|
||||
public int attemptUseCharge(SculkSpreader.a sculkspreader_a, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, SculkSpreader sculkspreader, boolean flag) {
|
||||
@@ -14,7 +14,7 @@
|
||||
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
|
||||
TagKey<Block> tagkey = sculkspreader.replaceableBlocks();
|
||||
Iterator iterator = EnumDirection.allShuffled(randomsource).iterator();
|
||||
@@ -121,7 +122,11 @@
|
||||
@@ -119,7 +120,11 @@
|
||||
if (iblockdata1.is(tagkey)) {
|
||||
IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState();
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
public ChiseledBookShelfBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.CHISELED_BOOKSHELF, blockposition, iblockdata);
|
||||
@@ -113,7 +155,7 @@
|
||||
@@ -120,7 +162,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -86,7 +86,9 @@
|
||||
@@ -35,7 +35,9 @@
|
||||
}
|
||||
|
||||
public static void serverTick(World world, BlockPosition blockposition, IBlockData iblockdata, SculkCatalystBlockEntity sculkcatalystblockentity) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = sculkcatalystblockentity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
|
||||
sculkcatalystblockentity.sculkSpreader.updateCursors(world, blockposition, world.getRandom(), true);
|
||||
sculkcatalystblockentity.catalystListener.getSculkSpreader().updateCursors(world, blockposition, world.getRandom(), true);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = null; // CraftBukkit
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBell.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBell.java
|
||||
@@ -35,8 +35,8 @@
|
||||
public boolean shaking;
|
||||
public EnumDirection clickDirection;
|
||||
private List<EntityLiving> nearbyEntities;
|
||||
- private boolean resonating;
|
||||
- private int resonationTicks;
|
||||
+ public boolean resonating;
|
||||
+ public int resonationTicks;
|
||||
|
||||
public TileEntityBell(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.BELL, blockposition, iblockdata);
|
||||
@@ -120,7 +120,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) iterator.next();
|
||||
|
||||
|
||||
@@ -183,17 +183,18 @@
|
||||
}
|
||||
|
||||
public static boolean isFuel(ItemStack itemstack) {
|
||||
@@ -493,14 +591,20 @@
|
||||
@@ -493,8 +591,8 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman) {}
|
||||
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
|
||||
|
||||
- public void awardUsedRecipesAndPopExperience(EntityPlayer entityplayer) {
|
||||
- List<IRecipe<?>> list = this.getRecipesToAwardAndPopExperience(entityplayer.getLevel(), entityplayer.position());
|
||||
- List<IRecipe<?>> list = this.getRecipesToAwardAndPopExperience(entityplayer.serverLevel(), entityplayer.position());
|
||||
+ public void awardUsedRecipesAndPopExperience(EntityPlayer entityplayer, ItemStack itemstack, int amount) { // CraftBukkit
|
||||
+ List<IRecipe<?>> list = this.getRecipesToAwardAndPopExperience(entityplayer.getLevel(), entityplayer.position(), this.worldPosition, entityplayer, itemstack, amount); // CraftBukkit
|
||||
+ List<IRecipe<?>> list = this.getRecipesToAwardAndPopExperience(entityplayer.serverLevel(), entityplayer.position(), this.worldPosition, entityplayer, itemstack, amount); // CraftBukkit
|
||||
|
||||
entityplayer.awardRecipes(list);
|
||||
this.recipesUsed.clear();
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -511,6 +609,12 @@
|
||||
}
|
||||
|
||||
public List<IRecipe<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
|
||||
@@ -206,7 +207,7 @@
|
||||
List<IRecipe<?>> list = Lists.newArrayList();
|
||||
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -509,14 +613,14 @@
|
||||
@@ -519,14 +623,14 @@
|
||||
|
||||
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
|
||||
list.add(irecipe);
|
||||
@@ -223,7 +224,7 @@
|
||||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -524,6 +628,17 @@
|
||||
@@ -534,6 +638,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
boolean flag = false;
|
||||
+ // CraftBukkit start
|
||||
+ InventoryPickupItemEvent event = new InventoryPickupItemEvent(iinventory.getOwner().getInventory(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ entityitem.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
@@ -24,14 +24,57 @@
|
||||
@@ -24,6 +24,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
@@ -14,14 +14,10 @@
|
||||
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem {
|
||||
|
||||
private static final int SONG_END_PADDING = 20;
|
||||
private final NonNullList<ItemStack> items;
|
||||
private int ticksSinceLastEvent;
|
||||
- private long tickCount;
|
||||
- private long recordStartedTick;
|
||||
- private boolean isPlaying;
|
||||
+ public long tickCount;
|
||||
+ public long recordStartedTick;
|
||||
+ public boolean isPlaying;
|
||||
@@ -32,6 +39,42 @@
|
||||
public long tickCount;
|
||||
public long recordStartedTick;
|
||||
public boolean isPlaying;
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
+ private int maxStack = MAX_STACK;
|
||||
|
||||
@@ -1,67 +1,81 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
@@ -25,7 +25,7 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
@@ -31,7 +31,17 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
-public class TileEntitySign extends TileEntity {
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.EnumChatFormat;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.block.SignChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
+public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements
|
||||
|
||||
public static final int LINES = 4;
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TEXT_LINE_WIDTH = 90;
|
||||
@@ -83,6 +83,12 @@
|
||||
}
|
||||
}
|
||||
@@ -100,7 +110,7 @@
|
||||
@Override
|
||||
protected void saveAdditional(NBTTagCompound nbttagcompound) {
|
||||
super.saveAdditional(nbttagcompound);
|
||||
- DataResult dataresult = SignText.DIRECT_CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.frontText);
|
||||
+ DataResult<NBTBase> dataresult = SignText.DIRECT_CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.frontText); // CraftBukkit - decompile error
|
||||
Logger logger = TileEntitySign.LOGGER;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (Boolean.getBoolean("convertLegacySigns")) {
|
||||
+ nbttagcompound.putBoolean("Bukkit.isConverted", true);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
nbttagcompound.putString("Color", this.color.getName());
|
||||
nbttagcompound.putBoolean("GlowingText", this.hasGlowingText);
|
||||
}
|
||||
@@ -93,8 +99,24 @@
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -119,7 +129,7 @@
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
super.load(nbttagcompound);
|
||||
this.color = EnumColor.byName(nbttagcompound.getString("Color"), EnumColor.BLACK);
|
||||
- DataResult dataresult;
|
||||
+ DataResult<SignText> dataresult; // CraftBukkit - decompile error
|
||||
Logger logger;
|
||||
|
||||
+ // CraftBukkit start - Add an option to convert signs correctly
|
||||
+ // This is done with a flag instead of all the time because
|
||||
+ // we have no way to tell whether a sign is from 1.7.10 or 1.8
|
||||
+ boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbttagcompound.getBoolean("Bukkit.isConverted");
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
String s = nbttagcompound.getString(TileEntitySign.RAW_TEXT_FIELD_NAMES[i]);
|
||||
+ // CraftBukkit start
|
||||
+ if (s != null && s.length() > 2048) {
|
||||
+ s = "\"\"";
|
||||
+ }
|
||||
+
|
||||
+ if (oldSign) {
|
||||
+ messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChatBaseComponent ichatbasecomponent = this.loadLine(s);
|
||||
|
||||
this.messages[i] = ichatbasecomponent;
|
||||
@@ -132,6 +154,10 @@
|
||||
if (ichatmutablecomponent != null) {
|
||||
return ichatmutablecomponent;
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
|
||||
+ return IChatBaseComponent.empty();
|
||||
+ // CraftBukkit end
|
||||
} catch (Exception exception) {
|
||||
;
|
||||
if (nbttagcompound.contains("front_text")) {
|
||||
@@ -179,6 +189,7 @@
|
||||
this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
|
||||
} else {
|
||||
TileEntitySign.LOGGER.warn("Player {} just tried to change non-editable sign", entityhuman.getName().getString());
|
||||
+ ((EntityPlayer) entityhuman).connection.send(this.getUpdatePacket()); // CraftBukkit
|
||||
}
|
||||
@@ -240,11 +266,37 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -198,6 +209,25 @@
|
||||
} else {
|
||||
signtext = signtext.setMessage(i, IChatBaseComponent.literal(filteredtext.raw()).setStyle(chatmodifier), IChatBaseComponent.literal(filteredtext.filteredOrEmpty()).setStyle(chatmodifier));
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ Player player = ((EntityPlayer) entityhuman).getBukkitEntity();
|
||||
+ String[] lines = new String[4];
|
||||
+
|
||||
+ for (int j = 0; j < list.size(); ++j) {
|
||||
+ lines[j] = CraftChatMessage.fromComponent(signtext.getMessage(j, entityhuman.isTextFilteringEnabled()));
|
||||
+ }
|
||||
+
|
||||
+ SignChangeEvent event = new SignChangeEvent(CraftBlock.at(this.level, this.worldPosition), player, lines);
|
||||
+ entityhuman.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ IChatBaseComponent[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
|
||||
+ for (int j = 0; j < components.length; j++) {
|
||||
+ signtext = signtext.setMessage(j, components[j]);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return signtext;
|
||||
@@ -250,11 +280,37 @@
|
||||
return flag1;
|
||||
}
|
||||
|
||||
- private static CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {}
|
||||
@@ -85,23 +99,24 @@
|
||||
+ public boolean shouldInformAdmins() {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CommandListenerWrapper createCommandSourceStack(@Nullable EntityPlayer entityplayer) {
|
||||
String s = entityplayer == null ? "Sign" : entityplayer.getName().getString();
|
||||
Object object = entityplayer == null ? IChatBaseComponent.literal("Sign") : entityplayer.getDisplayName();
|
||||
+ private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition) {
|
||||
+ // CraftBukkit end
|
||||
String s = entityhuman == null ? "Sign" : entityhuman.getName().getString();
|
||||
Object object = entityhuman == null ? IChatBaseComponent.literal("Sign") : entityhuman.getDisplayName();
|
||||
|
||||
- return new CommandListenerWrapper(ICommandListener.NULL, Vec3D.atCenterOf(this.worldPosition), Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityplayer);
|
||||
- return new CommandListenerWrapper(ICommandListener.NULL, Vec3D.atCenterOf(blockposition), Vec2F.ZERO, (WorldServer) world, 2, s, (IChatBaseComponent) object, world.getServer(), entityhuman);
|
||||
+ // CraftBukkit - this
|
||||
+ return new CommandListenerWrapper(this, Vec3D.atCenterOf(this.worldPosition), Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityplayer);
|
||||
+ return new CommandListenerWrapper(this, Vec3D.atCenterOf(blockposition), Vec2F.ZERO, (WorldServer) world, 2, s, (IChatBaseComponent) object, world.getServer(), entityhuman);
|
||||
}
|
||||
|
||||
public EnumColor getColor() {
|
||||
@@ -277,6 +329,6 @@
|
||||
@Override
|
||||
@@ -283,7 +339,7 @@
|
||||
|
||||
private void markUpdated() {
|
||||
this.setChanged();
|
||||
- this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3);
|
||||
+ if (this.level != null) this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); // CraftBukkit - skip notify if world is null (SPIGOT-5122)
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isWaxed() {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
world.blockEvent(blockposition, this, b0, enumdirection.get3DDataValue());
|
||||
}
|
||||
|
||||
@@ -316,6 +336,48 @@
|
||||
@@ -317,6 +337,48 @@
|
||||
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.getOpposite();
|
||||
int j = 0;
|
||||
|
||||
Reference in New Issue
Block a user