@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
|
||||
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
|
||||
@@ -45,6 +45,11 @@
|
||||
@@ -46,6 +46,11 @@
|
||||
@Override
|
||||
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
protected void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, movingobjectpositionblock.getBlockPos(), iprojectile).isCancelled()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
+++ b/net/minecraft/world/level/block/BigDripleafBlock.java
|
||||
@@ -42,6 +42,11 @@
|
||||
@@ -43,6 +43,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
|
||||
|
||||
public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new);
|
||||
@@ -116,7 +121,7 @@
|
||||
@@ -117,7 +122,7 @@
|
||||
|
||||
@Override
|
||||
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
protected void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
|
||||
- this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN);
|
||||
+ this.setTiltAndScheduleTick(iblockdata, world, movingobjectpositionblock.getBlockPos(), Tilt.FULL, SoundEffects.BIG_DRIPLEAF_TILT_DOWN, iprojectile); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,7 +180,20 @@
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
@@ -176,7 +181,20 @@
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide) {
|
||||
if (iblockdata.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockposition, entity) && !world.hasNeighborSignal(blockposition)) {
|
||||
- this.setTiltAndScheduleTick(iblockdata, world, blockposition, Tilt.UNSTABLE, (SoundEffect) null);
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -189,9 +207,9 @@
|
||||
@@ -190,9 +208,9 @@
|
||||
Tilt tilt = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
|
||||
|
||||
if (tilt == Tilt.UNSTABLE) {
|
||||
@@ -55,7 +55,7 @@
|
||||
} else if (tilt == Tilt.FULL) {
|
||||
resetTilt(iblockdata, worldserver, blockposition);
|
||||
}
|
||||
@@ -217,8 +235,10 @@
|
||||
@@ -218,8 +236,10 @@
|
||||
return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
if (soundeffect != null) {
|
||||
playTiltSound(world, blockposition, soundeffect);
|
||||
}
|
||||
@@ -232,14 +252,21 @@
|
||||
@@ -233,14 +253,21 @@
|
||||
}
|
||||
|
||||
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -92,8 +92,8 @@
|
||||
Tilt tilt1 = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
|
||||
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
|
||||
@@ -247,6 +274,7 @@
|
||||
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockposition);
|
||||
@@ -248,6 +275,7 @@
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_CHANGE, blockposition);
|
||||
}
|
||||
|
||||
+ return true; // CraftBukkit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/Block.java
|
||||
+++ b/net/minecraft/world/level/block/Block.java
|
||||
@@ -349,7 +349,13 @@
|
||||
@@ -341,7 +341,13 @@
|
||||
EntityItem entityitem = (EntityItem) supplier.get();
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
@@ -15,7 +15,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,7 +381,7 @@
|
||||
@@ -367,7 +373,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);
|
||||
}
|
||||
|
||||
@@ -512,17 +518,25 @@
|
||||
@@ -500,17 +506,25 @@
|
||||
return this.builtInRegistryHolder;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockBed.java
|
||||
+++ b/net/minecraft/world/level/block/BlockBed.java
|
||||
@@ -94,7 +94,8 @@
|
||||
@@ -93,7 +93,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
world.removeBlock(blockposition, false);
|
||||
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
||||
|
||||
@@ -113,7 +114,16 @@
|
||||
@@ -112,7 +113,16 @@
|
||||
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
@@ -27,7 +27,7 @@
|
||||
if (entityhuman_enumbedresult.getMessage() != null) {
|
||||
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
||||
}
|
||||
@@ -124,8 +134,29 @@
|
||||
@@ -123,8 +133,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
|
||||
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|
||||
@@ -324,6 +355,11 @@
|
||||
@@ -323,6 +354,11 @@
|
||||
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
|
||||
|
||||
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);
|
||||
|
||||
@@ -9,3 +9,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@
|
||||
ItemStack itemstack = new ItemStack(this);
|
||||
|
||||
itemstack.applyComponents(tileentitybeehive.collectComponents());
|
||||
- itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, (Comparable) i));
|
||||
+ itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, i)); // CraftBukkit - decompile error
|
||||
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
+ // CraftBukkit end
|
||||
this.press(iblockdata, world, blockposition);
|
||||
this.playSound(entityhuman, world, blockposition, true);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.BLOCK_ACTIVATE, blockposition);
|
||||
@@ -195,11 +213,36 @@
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@@ -119,7 +121,7 @@
|
||||
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
- entity.hurt(world.damageSources().cactus(), 1.0F);
|
||||
+ entity.hurt(world.damageSources().cactus().directBlock(world, blockposition), 1.0F); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCake.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCake.java
|
||||
@@ -92,7 +92,18 @@
|
||||
@@ -100,7 +100,18 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);
|
||||
@@ -19,4 +19,4 @@
|
||||
+ // CraftBukkit end
|
||||
int i = (Integer) iblockdata.getValue(BlockCake.BITES);
|
||||
|
||||
generatoraccess.gameEvent((Entity) entityhuman, GameEvent.EAT, blockposition);
|
||||
generatoraccess.gameEvent((Entity) entityhuman, (Holder) GameEvent.EAT, blockposition);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCampfire.java
|
||||
@@ -106,7 +106,7 @@
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
|
||||
- entity.hurt(world.damageSources().inFire(), (float) this.fireDamage);
|
||||
+ entity.hurt(world.damageSources().inFire().directBlock(world, blockposition), (float) this.fireDamage); // CraftBukkit
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCauldron.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCauldron.java
|
||||
@@ -12,6 +12,10 @@
|
||||
@@ -13,6 +13,10 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
|
||||
@@ -11,18 +11,18 @@
|
||||
public class BlockCauldron extends AbstractCauldronBlock {
|
||||
|
||||
public static final MapCodec<BlockCauldron> CODEC = simpleCodec(BlockCauldron::new);
|
||||
@@ -61,13 +65,11 @@
|
||||
@@ -62,13 +66,11 @@
|
||||
|
||||
if (fluidtype == FluidTypes.WATER) {
|
||||
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.levelEvent(1047, blockposition, 0);
|
||||
} else if (fluidtype == FluidTypes.LAVA) {
|
||||
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
+ LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
world.levelEvent(1046, blockposition, 0);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/world/level/block/BlockChest.java
|
||||
+++ b/net/minecraft/world/level/block/BlockChest.java
|
||||
@@ -93,24 +93,7 @@
|
||||
@@ -90,24 +90,7 @@
|
||||
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
|
||||
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
|
||||
|
||||
- return Optional.of(new ITileInventory() {
|
||||
- return Optional.of(new ITileInventory(this) {
|
||||
- @Nullable
|
||||
- @Override
|
||||
- public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
@@ -22,11 +22,11 @@
|
||||
- return (IChatBaseComponent) (tileentitychest.hasCustomName() ? tileentitychest.getDisplayName() : (tileentitychest1.hasCustomName() ? tileentitychest1.getDisplayName() : IChatBaseComponent.translatable("container.chestDouble")));
|
||||
- }
|
||||
- });
|
||||
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit
|
||||
+ return Optional.of(new DoubleInventory(tileentitychest, tileentitychest1, inventorylargechest)); // CraftBukkit // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
|
||||
@@ -123,6 +106,38 @@
|
||||
@@ -120,6 +103,38 @@
|
||||
}
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
@Override
|
||||
public MapCodec<? extends BlockChest> codec() {
|
||||
return BlockChest.CODEC;
|
||||
@@ -278,7 +293,7 @@
|
||||
@@ -263,7 +278,7 @@
|
||||
|
||||
@Override
|
||||
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
|
||||
@@ -74,10 +74,10 @@
|
||||
|
||||
if (flag) {
|
||||
bipredicate = (generatoraccess, blockposition1) -> {
|
||||
@@ -294,7 +309,14 @@
|
||||
@@ -279,7 +294,14 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- return (ITileInventory) ((Optional) this.combine(iblockdata, world, blockposition, false).apply(BlockChest.MENU_PROVIDER_COMBINER)).orElse((Object) null);
|
||||
+ // CraftBukkit start
|
||||
+ return getMenuProvider(iblockdata, world, blockposition, false);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockCommand.java
|
||||
+++ b/net/minecraft/world/level/block/BlockCommand.java
|
||||
@@ -30,6 +30,8 @@
|
||||
@@ -29,6 +29,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
|
||||
|
||||
public static final MapCodec<BlockCommand> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -70,6 +72,15 @@
|
||||
@@ -69,6 +71,15 @@
|
||||
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
boolean flag2 = tileentitycommand.isPowered();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockComposter.java
|
||||
+++ b/net/minecraft/world/level/block/BlockComposter.java
|
||||
@@ -41,6 +41,11 @@
|
||||
@@ -43,6 +43,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockComposter extends Block implements IInventoryHolder {
|
||||
|
||||
public static final MapCodec<BlockComposter> CODEC = simpleCodec(BlockComposter::new);
|
||||
@@ -255,7 +260,14 @@
|
||||
@@ -263,7 +268,14 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
itemstack.shrink(1);
|
||||
return iblockdata1;
|
||||
@@ -265,6 +277,14 @@
|
||||
@@ -273,6 +285,14 @@
|
||||
}
|
||||
|
||||
public static IBlockData extractProduce(Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -43,7 +43,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));
|
||||
@@ -288,10 +308,16 @@
|
||||
@@ -296,10 +316,16 @@
|
||||
}
|
||||
|
||||
static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
|
||||
@@ -61,7 +61,7 @@
|
||||
return iblockdata;
|
||||
} else {
|
||||
int j = i + 1;
|
||||
@@ -340,7 +366,8 @@
|
||||
@@ -348,7 +374,8 @@
|
||||
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
|
||||
@@ -355,6 +382,7 @@
|
||||
@@ -363,6 +390,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -379,8 +407,15 @@
|
||||
@@ -387,8 +415,15 @@
|
||||
|
||||
@Override
|
||||
public void setChanged() {
|
||||
@@ -95,7 +95,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,6 +428,7 @@
|
||||
@@ -401,6 +436,7 @@
|
||||
|
||||
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
super(1);
|
||||
@@ -103,7 +103,7 @@
|
||||
this.state = iblockdata;
|
||||
this.level = generatoraccess;
|
||||
this.pos = blockposition;
|
||||
@@ -435,8 +471,9 @@
|
||||
@@ -443,8 +479,9 @@
|
||||
|
||||
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
@@ -83,7 +106,25 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
protected IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return touchesLiquid(generatoraccess, blockposition) ? this.concrete.defaultBlockState() : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ if (touchesLiquid(generatoraccess, blockposition)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoral.java
|
||||
@@ -39,6 +39,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!this.scanForWater(worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState()).isCancelled()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFan.java
|
||||
@@ -40,6 +40,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFan.WATERLOGGED, false)).isCancelled()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralFanWall.java
|
||||
@@ -40,6 +40,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralFanWall.WATERLOGGED, false).setValue(BlockCoralFanWall.FACING, iblockdata.getValue(BlockCoralFanWall.FACING))).isCancelled()) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockCoralPlant.java
|
||||
@@ -45,6 +45,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!scanForWater(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, this.deadBlock.defaultBlockState().setValue(BlockCoralPlant.WATERLOGGED, false)).isCancelled()) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
@@ -160,7 +162,7 @@
|
||||
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
- if (entity instanceof EntityRavager && world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
+ if (entity instanceof EntityRavager && CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
|
||||
world.destroyBlock(blockposition, true, entity);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
|
||||
@@ -44,6 +44,11 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDispenser.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDispenser.java
|
||||
@@ -49,6 +49,7 @@
|
||||
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
|
||||
@@ -51,6 +51,7 @@
|
||||
object2objectopenhashmap.defaultReturnValue(BlockDispenser.DEFAULT_BEHAVIOR);
|
||||
});
|
||||
private static final int TRIGGER_DURATION = 4;
|
||||
+ public static boolean eventFired = false; // CraftBukkit
|
||||
|
||||
@Override
|
||||
public MapCodec<? extends BlockDispenser> codec() {
|
||||
@@ -85,7 +86,7 @@
|
||||
@@ -91,7 +92,7 @@
|
||||
}
|
||||
|
||||
public void dispenseFrom(WorldServer worldserver, IBlockData iblockdata, BlockPosition blockposition) {
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
if (tileentitydispenser == null) {
|
||||
BlockDispenser.LOGGER.warn("Ignoring dispensing attempt for Dispenser without matching block entity at {}", blockposition);
|
||||
@@ -101,6 +102,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.getDispenseMethod(itemstack);
|
||||
@@ -107,6 +108,7 @@
|
||||
IDispenseBehavior idispensebehavior = this.getDispenseMethod(worldserver, itemstack);
|
||||
|
||||
if (idispensebehavior != IDispenseBehavior.NOOP) {
|
||||
+ eventFired = false; // CraftBukkit - reset event status
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
@@ -220,9 +222,24 @@
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
- boolean flag1 = world.hasNeighborSignal(blockposition) || world.hasNeighborSignal(blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN));
|
||||
+ // CraftBukkit start
|
||||
+ BlockPosition otherHalf = blockposition.relative(iblockdata.getValue(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? EnumDirection.UP : EnumDirection.DOWN);
|
||||
@@ -35,4 +35,4 @@
|
||||
+ // CraftBukkit end
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockDoor.OPEN)) {
|
||||
this.playSound((Entity) null, world, blockposition, flag1);
|
||||
world.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockposition);
|
||||
world.gameEvent((Entity) null, (Holder) (flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE), blockposition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDragonEgg.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDragonEgg.java
|
||||
@@ -17,6 +17,8 @@
|
||||
@@ -16,6 +16,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockDragonEgg extends BlockFalling {
|
||||
|
||||
public static final MapCodec<BlockDragonEgg> CODEC = simpleCodec(BlockDragonEgg::new);
|
||||
@@ -54,6 +56,18 @@
|
||||
@@ -53,6 +55,18 @@
|
||||
BlockPosition blockposition1 = blockposition.offset(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
|
||||
|
||||
if (world.getBlockState(blockposition1).isAir() && worldborder.isWithinBounds(blockposition1)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockDropper.java
|
||||
+++ b/net/minecraft/world/level/block/BlockDropper.java
|
||||
@@ -19,11 +19,17 @@
|
||||
@@ -20,11 +20,17 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
@Override
|
||||
public MapCodec<BlockDropper> codec() {
|
||||
@@ -46,7 +52,7 @@
|
||||
@@ -47,7 +53,7 @@
|
||||
|
||||
@Override
|
||||
public void dispenseFrom(WorldServer worldserver, IBlockData iblockdata, BlockPosition blockposition) {
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
if (tileentitydispenser == null) {
|
||||
BlockDropper.LOGGER.warn("Ignoring dispensing attempt for Dropper without matching block entity at {}", blockposition);
|
||||
@@ -67,8 +73,25 @@
|
||||
@@ -68,8 +74,25 @@
|
||||
if (iinventory == null) {
|
||||
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
|
||||
} else {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public static final MapCodec<BlockEnderPortal> CODEC = simpleCodec(BlockEnderPortal::new);
|
||||
@@ -48,13 +55,22 @@
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
|
||||
@@ -168,6 +168,17 @@
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
if (!world.isClientSide) {
|
||||
boolean flag1 = world.hasNeighborSignal(blockposition);
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
@@ -100,7 +108,24 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
protected IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return this.canSurvive(iblockdata, generatoraccess, blockposition) ? this.getStateWithAge(generatoraccess, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE)) : Blocks.AIR.defaultBlockState();
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.canSurvive(iblockdata, generatoraccess, blockposition)) {
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
if (!entity.fireImmune()) {
|
||||
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
|
||||
if (entity.getRemainingFireTicks() == 0) {
|
||||
- entity.setSecondsOnFire(8);
|
||||
- entity.igniteForSeconds(8);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition), entity.getBukkitEntity(), 8);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ entity.setSecondsOnFire(event.getDuration(), false);
|
||||
+ entity.igniteForSeconds(event.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
- DataResult dataresult;
|
||||
+ DataResult<FluidTypeFlowing> dataresult; // CraftBukkit - decompile error
|
||||
|
||||
if (fluidtype instanceof FluidTypeFlowing) {
|
||||
FluidTypeFlowing fluidtypeflowing = (FluidTypeFlowing) fluidtype;
|
||||
@@ -174,14 +174,20 @@
|
||||
if (fluidtype instanceof FluidTypeFlowing fluidtypeflowing) {
|
||||
dataresult = DataResult.success(fluidtypeflowing);
|
||||
@@ -172,14 +172,20 @@
|
||||
if (world.getFluidState(blockposition1).is(TagsFluid.WATER)) {
|
||||
Block block = world.getFluidState(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -51,6 +51,11 @@
|
||||
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
+ // CraftBukkit start - do not fade if the block is valid here
|
||||
+ if (iblockdata.canSurvive(worldserver, blockposition)) {
|
||||
+ return;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public static final MapCodec<BlockLeaves> CODEC = simpleCodec(BlockLeaves::new);
|
||||
@@ -57,6 +59,14 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (this.decaying(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
+ LeavesDecayEvent event = new LeavesDecayEvent(worldserver.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
--- a/net/minecraft/world/level/block/BlockLectern.java
|
||||
+++ b/net/minecraft/world/level/block/BlockLectern.java
|
||||
@@ -207,12 +207,13 @@
|
||||
@@ -207,11 +207,12 @@
|
||||
}
|
||||
|
||||
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
- TileEntity tileentity = world.getBlockEntity(blockposition);
|
||||
+ TileEntity tileentity = world.getBlockEntity(blockposition, false); // CraftBukkit - don't validate, type may be changed already
|
||||
|
||||
if (tileentity instanceof TileEntityLectern) {
|
||||
TileEntityLectern tileentitylectern = (TileEntityLectern) tileentity;
|
||||
if (tileentity instanceof TileEntityLectern tileentitylectern) {
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockLectern.FACING);
|
||||
ItemStack itemstack = tileentitylectern.getBook().copy();
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5500
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
|
||||
@@ -45,12 +45,20 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockNote.java
|
||||
+++ b/net/minecraft/world/level/block/BlockNote.java
|
||||
@@ -82,6 +82,7 @@
|
||||
@@ -83,6 +83,7 @@
|
||||
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
|
||||
if (flag1) {
|
||||
this.playNote((Entity) null, iblockdata, world, blockposition);
|
||||
@@ -8,7 +8,7 @@
|
||||
}
|
||||
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
|
||||
@@ -91,6 +92,12 @@
|
||||
@@ -92,6 +93,12 @@
|
||||
|
||||
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
if (((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).worksAboveNoteBlock() || world.getBlockState(blockposition.above()).isAir()) {
|
||||
@@ -19,5 +19,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.blockEvent(blockposition, this, 0, 0);
|
||||
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
|
||||
world.gameEvent(entity, (Holder) GameEvent.NOTE_BLOCK_PLAY, blockposition);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockNylium.java
|
||||
@@ -41,6 +41,11 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (!canBeNylium(iblockdata, worldserver, blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.NETHERRACK.defaultBlockState()).isCancelled()) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public static final MapCodec<BlockObserver> CODEC = simpleCodec(BlockObserver::new);
|
||||
@@ -48,8 +50,18 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@@ -26,7 +26,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
protected IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
||||
- return !iblockdata.canSurvive(generatoraccess, blockposition) ? Blocks.AIR.defaultBlockState() : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
|
||||
+ // CraftBukkit start
|
||||
+ if (!iblockdata.canSurvive(generatoraccess, blockposition)) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
entity.setPortalCooldown();
|
||||
@@ -85,6 +90,10 @@
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (entity.canChangeDimensions()) {
|
||||
+ // CraftBukkit start - Entity in portal
|
||||
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
||||
+++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
|
||||
@@ -22,6 +22,8 @@
|
||||
@@ -23,6 +23,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public abstract class BlockPressurePlateAbstract extends Block {
|
||||
|
||||
protected static final VoxelShape PRESSED_AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
|
||||
@@ -90,6 +92,19 @@
|
||||
@@ -91,6 +93,19 @@
|
||||
boolean flag = i > 0;
|
||||
boolean flag1 = j > 0;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
if (i != j) {
|
||||
IBlockData iblockdata1 = this.setSignalForState(iblockdata, j);
|
||||
|
||||
@@ -144,9 +159,15 @@
|
||||
@@ -145,9 +160,15 @@
|
||||
}
|
||||
|
||||
protected static int getEntityCount(World world, AxisAlignedBB axisalignedbb, Class<? extends Entity> oclass) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneComparator.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneComparator.java
|
||||
@@ -28,6 +28,8 @@
|
||||
@@ -27,6 +27,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.ticks.TickListPriority;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
|
||||
|
||||
public static final MapCodec<BlockRedstoneComparator> CODEC = simpleCodec(BlockRedstoneComparator::new);
|
||||
@@ -110,7 +112,8 @@
|
||||
@@ -109,7 +111,8 @@
|
||||
|
||||
@Nullable
|
||||
private EntityItemFrame getItemFrame(World world, EnumDirection enumdirection, BlockPosition blockposition) {
|
||||
@@ -19,7 +19,7 @@
|
||||
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
|
||||
});
|
||||
|
||||
@@ -165,8 +168,18 @@
|
||||
@@ -162,8 +165,18 @@
|
||||
boolean flag1 = (Boolean) iblockdata.getValue(BlockRedstoneComparator.POWERED);
|
||||
|
||||
if (flag1 && !flag) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
}
|
||||
@@ -52,6 +59,11 @@
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneLamp.LIT) && !worldserver.hasNeighborSignal(blockposition)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callRedstoneChange(worldserver, blockposition, 15, 0).getNewCurrent() != 0) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@@ -39,14 +44,27 @@
|
||||
|
||||
@Override
|
||||
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
protected void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
|
||||
- interact(iblockdata, world, blockposition);
|
||||
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
super.attack(iblockdata, world, blockposition, entityhuman);
|
||||
@@ -42,7 +42,7 @@
|
||||
}
|
||||
|
||||
super.stepOn(world, blockposition, iblockdata, entity);
|
||||
@@ -57,7 +75,7 @@
|
||||
@@ -57,15 +75,20 @@
|
||||
if (world.isClientSide) {
|
||||
spawnParticles(world, blockposition);
|
||||
} else {
|
||||
@@ -50,9 +50,7 @@
|
||||
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
|
||||
}
|
||||
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -65,9 +83,14 @@
|
||||
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
|
||||
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION : ItemInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
- private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -67,9 +65,9 @@
|
||||
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, true), 3);
|
||||
}
|
||||
|
||||
@@ -81,6 +104,11 @@
|
||||
@@ -79,6 +102,11 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, iblockdata.setValue(BlockRedstoneOre.LIT, false)).isCancelled()) {
|
||||
@@ -79,9 +77,9 @@
|
||||
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
|
||||
}
|
||||
|
||||
@@ -89,12 +117,20 @@
|
||||
@@ -87,12 +115,20 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegated to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
|
||||
@@ -37,6 +37,8 @@
|
||||
@@ -36,6 +36,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockRedstoneWire extends Block {
|
||||
|
||||
public static final MapCodec<BlockRedstoneWire> CODEC = simpleCodec(BlockRedstoneWire::new);
|
||||
@@ -261,7 +263,16 @@
|
||||
@@ -260,7 +262,16 @@
|
||||
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = this.calculateTargetStrength(world, blockposition);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockRespawnAnchor.java
|
||||
+++ b/net/minecraft/world/level/block/BlockRespawnAnchor.java
|
||||
@@ -87,7 +87,7 @@
|
||||
@@ -89,7 +89,7 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
||||
|
||||
if (entityplayer.getRespawnDimension() != world.dimension() || !blockposition.equals(entityplayer.getRespawnPosition())) {
|
||||
@@ -9,7 +9,7 @@
|
||||
world.playSound((EntityHuman) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, SoundEffects.RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -127,7 +127,7 @@
|
||||
@@ -129,14 +129,14 @@
|
||||
|
||||
private void explode(IBlockData iblockdata, World world, final BlockPosition blockposition) {
|
||||
world.removeBlock(blockposition, false);
|
||||
@@ -18,3 +18,11 @@
|
||||
|
||||
Objects.requireNonNull(blockposition);
|
||||
boolean flag = stream.map(blockposition::relative).anyMatch((blockposition1) -> {
|
||||
return isWaterThatWouldFlow(blockposition1, world);
|
||||
});
|
||||
final boolean flag1 = flag || world.getFluidState(blockposition.above()).is(TagsFluid.WATER);
|
||||
- ExplosionDamageCalculator explosiondamagecalculator = new ExplosionDamageCalculator(this) {
|
||||
+ ExplosionDamageCalculator explosiondamagecalculator = new ExplosionDamageCalculator() { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public Optional<Float> getBlockExplosionResistance(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition1, IBlockData iblockdata1, Fluid fluid) {
|
||||
return blockposition1.equals(blockposition) && flag1 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, iblockaccess, blockposition1, iblockdata1, fluid);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSign.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSign.java
|
||||
@@ -118,7 +118,7 @@
|
||||
} else if (flag2) {
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag1)) {
|
||||
- this.openTextEdit(entityhuman, tileentitysign, flag1);
|
||||
+ this.openTextEdit(entityhuman, tileentitysign, flag1, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit
|
||||
return this.getInteractionResult(flag);
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
@@ -171,6 +171,15 @@
|
||||
@@ -142,7 +142,7 @@
|
||||
} else if (flag1) {
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag)) {
|
||||
- this.openTextEdit(entityhuman, tileentitysign, flag);
|
||||
+ this.openTextEdit(entityhuman, tileentitysign, flag, org.bukkit.event.player.PlayerSignOpenEvent.Cause.INTERACT); // CraftBukkit
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
return EnumInteractionResult.PASS;
|
||||
@@ -188,6 +188,15 @@
|
||||
}
|
||||
|
||||
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {
|
||||
@@ -25,7 +25,7 @@
|
||||
tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID());
|
||||
entityhuman.openTextEdit(tileentitysign, flag);
|
||||
}
|
||||
@@ -184,6 +193,6 @@
|
||||
@@ -201,6 +210,6 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/BlockSnow.java
|
||||
@@ -99,6 +99,11 @@
|
||||
@Override
|
||||
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
|
||||
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSoil.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSoil.java
|
||||
@@ -29,6 +29,11 @@
|
||||
@@ -30,6 +30,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockSoil extends Block {
|
||||
|
||||
public static final MapCodec<BlockSoil> CODEC = simpleCodec(BlockSoil::new);
|
||||
@@ -91,26 +96,49 @@
|
||||
@@ -92,26 +97,49 @@
|
||||
|
||||
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
|
||||
if (i > 0) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
||||
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
|
||||
@@ -28,6 +28,13 @@
|
||||
@@ -30,6 +30,13 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
|
||||
|
||||
public static final MapCodec<BlockSweetBerryBush> CODEC = simpleCodec(BlockSweetBerryBush::new);
|
||||
@@ -69,7 +76,7 @@
|
||||
@@ -71,7 +78,7 @@
|
||||
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
|
||||
|
||||
- worldserver.setBlock(blockposition, iblockdata1, 2);
|
||||
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, iblockdata1, 2)) return; // CraftBukkit
|
||||
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
worldserver.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
}
|
||||
|
||||
@@ -84,7 +91,7 @@
|
||||
@@ -86,7 +93,7 @@
|
||||
double d1 = Math.abs(entity.getZ() - entity.zOld);
|
||||
|
||||
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
|
||||
@@ -32,13 +32,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,7 +108,15 @@
|
||||
} else if (i > 1) {
|
||||
@@ -109,7 +116,15 @@
|
||||
if (i > 1) {
|
||||
int j = 1 + world.random.nextInt(2);
|
||||
|
||||
- popResource(world, blockposition, new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0)));
|
||||
+ // CraftBukkit start
|
||||
+ PlayerHarvestBlockEvent event = CraftEventFactory.callPlayerHarvestBlockEvent(world, blockposition, entityhuman, enumhand, Collections.singletonList(new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0))));
|
||||
+ // CraftBukkit start - useWithoutItem is always MAIN_HAND
|
||||
+ PlayerHarvestBlockEvent event = CraftEventFactory.callPlayerHarvestBlockEvent(world, blockposition, entityhuman, EnumHand.MAIN_HAND, Collections.singletonList(new ItemStack(Items.SWEET_BERRIES, j + (flag ? 1 : 0))));
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.SUCCESS; // We need to return a success either way, because making it PASS or FAIL will result in a bug where cancelling while harvesting w/ block in hand places block
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTNT.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTNT.java
|
||||
@@ -26,6 +26,11 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
|
||||
@@ -12,25 +12,25 @@
|
||||
public class BlockTNT extends Block {
|
||||
|
||||
public static final MapCodec<BlockTNT> CODEC = simpleCodec(BlockTNT::new);
|
||||
@@ -44,7 +49,7 @@
|
||||
@@ -45,7 +50,7 @@
|
||||
@Override
|
||||
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
|
||||
if (!iblockdata1.is(iblockdata.getBlock())) {
|
||||
- if (world.hasNeighborSignal(blockposition)) {
|
||||
+ if (world.hasNeighborSignal(blockposition) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.REDSTONE, null, null)) { // CraftBukkit - TNTPrimeEvent
|
||||
explode(world, blockposition);
|
||||
world.removeBlock(blockposition, false);
|
||||
}
|
||||
@@ -54,7 +59,7 @@
|
||||
@@ -55,7 +60,7 @@
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
- if (world.hasNeighborSignal(blockposition)) {
|
||||
+ if (world.hasNeighborSignal(blockposition) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.REDSTONE, null, blockposition1)) { // CraftBukkit - TNTPrimeEvent
|
||||
explode(world, blockposition);
|
||||
world.removeBlock(blockposition, false);
|
||||
}
|
||||
@@ -63,7 +68,7 @@
|
||||
@@ -64,7 +69,7 @@
|
||||
|
||||
@Override
|
||||
public IBlockData playerWillDestroy(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
||||
@@ -39,19 +39,19 @@
|
||||
explode(world, blockposition);
|
||||
}
|
||||
|
||||
@@ -102,6 +107,11 @@
|
||||
@@ -101,6 +106,11 @@
|
||||
if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) {
|
||||
return super.use(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock);
|
||||
return super.useItemOn(itemstack, iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock);
|
||||
} else {
|
||||
+ // CraftBukkit start - TNTPrimeEvent
|
||||
+ if (!CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.PLAYER, entityhuman, null)) {
|
||||
+ return EnumInteractionResult.CONSUME;
|
||||
+ return ItemInteractionResult.CONSUME;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
explode(world, blockposition, entityhuman);
|
||||
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 11);
|
||||
Item item = itemstack.getItem();
|
||||
@@ -128,6 +138,11 @@
|
||||
@@ -125,6 +135,11 @@
|
||||
Entity entity = iprojectile.getOwner();
|
||||
|
||||
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTripwire.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTripwire.java
|
||||
@@ -27,6 +27,8 @@
|
||||
@@ -28,6 +28,8 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class BlockTripwire extends Block {
|
||||
|
||||
public static final MapCodec<BlockTripwire> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -166,6 +168,40 @@
|
||||
@@ -167,6 +169,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTripwireHook.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTripwireHook.java
|
||||
@@ -29,6 +29,11 @@
|
||||
@@ -30,6 +30,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class BlockTripwireHook extends Block {
|
||||
|
||||
public static final MapCodec<BlockTripwireHook> CODEC = simpleCodec(BlockTripwireHook::new);
|
||||
@@ -173,6 +178,15 @@
|
||||
@@ -174,6 +179,15 @@
|
||||
emitState(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockTurtleEgg.java
|
||||
+++ b/net/minecraft/world/level/block/BlockTurtleEgg.java
|
||||
@@ -30,6 +30,12 @@
|
||||
@@ -31,6 +31,12 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class BlockTurtleEgg extends Block {
|
||||
|
||||
public static final MapCodec<BlockTurtleEgg> CODEC = simpleCodec(BlockTurtleEgg::new);
|
||||
@@ -72,6 +78,19 @@
|
||||
@@ -73,6 +79,19 @@
|
||||
private void destroyEgg(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
|
||||
if (this.canDestroyEgg(world, entity)) {
|
||||
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.is(Blocks.TURTLE_EGG)) {
|
||||
@@ -33,7 +33,7 @@
|
||||
this.decreaseEggs(world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -98,10 +117,20 @@
|
||||
@@ -99,10 +118,20 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockTurtleEgg.HATCH);
|
||||
|
||||
if (i < 2) {
|
||||
@@ -45,7 +45,7 @@
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + randomsource.nextFloat() * 0.2F);
|
||||
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2);
|
||||
+ // worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockTurtleEgg.HATCH, i + 1), 2); // CraftBukkit - handled above
|
||||
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata));
|
||||
worldserver.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata));
|
||||
} else {
|
||||
+ // CraftBukkit start - Call BlockFadeEvent
|
||||
+ if (CraftEventFactory.callBlockFadeEvent(worldserver, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
||||
@@ -54,8 +54,8 @@
|
||||
+ // CraftBukkit end
|
||||
worldserver.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + randomsource.nextFloat() * 0.2F);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
worldserver.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(iblockdata));
|
||||
@@ -114,7 +143,7 @@
|
||||
worldserver.gameEvent((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(iblockdata));
|
||||
@@ -115,7 +144,7 @@
|
||||
entityturtle.setAge(-24000);
|
||||
entityturtle.setHomePos(blockposition);
|
||||
entityturtle.moveTo((double) blockposition.getX() + 0.3D + (double) j * 0.2D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.3D, 0.0F, 0.0F);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
public static final MapCodec<BlockWaterLily> CODEC = simpleCodec(BlockWaterLily::new);
|
||||
@@ -32,6 +36,11 @@
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
super.entityInside(iblockdata, world, blockposition, entity);
|
||||
if (world instanceof WorldServer && entity instanceof EntityBoat) {
|
||||
+ // CraftBukkit start
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/BlockWitherRose.java
|
||||
+++ b/net/minecraft/world/level/block/BlockWitherRose.java
|
||||
@@ -66,7 +66,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
if (!entityliving.isInvulnerableTo(world.damageSources().wither())) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
public class BlockWitherSkull extends BlockSkull {
|
||||
|
||||
public static final MapCodec<BlockWitherSkull> CODEC = simpleCodec(BlockWitherSkull::new);
|
||||
@@ -54,6 +58,7 @@
|
||||
@@ -57,6 +61,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);
|
||||
@@ -65,12 +70,18 @@
|
||||
@@ -68,12 +73,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()) {
|
||||
@@ -79,7 +90,7 @@
|
||||
@@ -82,7 +93,7 @@
|
||||
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/CaveVines.java
|
||||
+++ b/net/minecraft/world/level/block/CaveVines.java
|
||||
@@ -18,6 +18,13 @@
|
||||
@@ -19,6 +19,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
public interface CaveVines {
|
||||
|
||||
VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
|
||||
@@ -25,7 +32,24 @@
|
||||
@@ -26,7 +33,24 @@
|
||||
|
||||
static EnumInteractionResult use(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
if ((Boolean) iblockdata.getValue(CaveVines.BERRIES)) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
+++ b/net/minecraft/world/level/block/CeilingHangingSignBlock.java
|
||||
@@ -161,6 +161,6 @@
|
||||
@@ -158,6 +158,6 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
+++ b/net/minecraft/world/level/block/DecoratedPotBlock.java
|
||||
@@ -230,6 +230,11 @@
|
||||
@@ -238,6 +238,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/DropExperienceBlock.java
|
||||
@@ -31,9 +31,16 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
||||
@@ -16,6 +16,12 @@
|
||||
@@ -17,6 +17,12 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.material.FluidTypes;
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
||||
|
||||
public static final MapCodec<LayeredCauldronBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -61,10 +67,14 @@
|
||||
@@ -62,10 +68,14 @@
|
||||
@Override
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(iblockdata, blockposition, entity)) {
|
||||
- entity.clearFire();
|
||||
+ // CraftBukkit start
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -79,20 +89,42 @@
|
||||
@@ -80,20 +90,42 @@
|
||||
}
|
||||
|
||||
public static void lowerFillLevel(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
@@ -43,7 +43,7 @@
|
||||
IBlockData iblockdata1 = i == 0 ? Blocks.CAULDRON.defaultBlockState() : (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, i);
|
||||
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
+ return changeLevel(iblockdata, world, blockposition, iblockdata1, entity, reason);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+ newState.update(true);
|
||||
+ world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(newBlock));
|
||||
+ world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(newBlock));
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -72,17 +72,17 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL);
|
||||
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
+ changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,8 +143,11 @@
|
||||
@@ -112,8 +144,11 @@
|
||||
if (!this.isFull(iblockdata)) {
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1);
|
||||
|
||||
- world.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
- world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
|
||||
+ // CraftBukkit start
|
||||
+ if (!changeLevel(iblockdata, world, blockposition, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) {
|
||||
+ return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
|
||||
@@ -132,6 +132,11 @@
|
||||
@@ -133,6 +133,11 @@
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
|
||||
if (iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
|
||||
@@ -12,7 +12,7 @@
|
||||
world.destroyBlock(blockposition, true);
|
||||
}
|
||||
|
||||
@@ -141,7 +146,7 @@
|
||||
@@ -142,7 +147,7 @@
|
||||
@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) {
|
||||
@@ -21,7 +21,7 @@
|
||||
} else {
|
||||
super.fallOn(world, iblockdata, blockposition, entity, f);
|
||||
}
|
||||
@@ -386,15 +391,15 @@
|
||||
@@ -387,15 +392,15 @@
|
||||
if (isUnmergedTipWithDirection(iblockdata, enumdirection.getOpposite())) {
|
||||
createMergedTips(iblockdata, worldserver, blockposition1);
|
||||
} else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) {
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
private static void createMergedTips(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
|
||||
@@ -409,8 +414,8 @@
|
||||
@@ -410,8 +415,8 @@
|
||||
blockposition1 = blockposition.below();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
}
|
||||
|
||||
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -443,7 +448,7 @@
|
||||
@@ -444,7 +449,7 @@
|
||||
|
||||
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
|
||||
return isTip(iblockdata1, flag);
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,7 +564,7 @@
|
||||
@@ -560,7 +565,7 @@
|
||||
return canDripThrough(world, blockposition1, iblockdata);
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -568,7 +573,7 @@
|
||||
@@ -569,7 +574,7 @@
|
||||
return canDripThrough(world, blockposition1, iblockdata);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/level/block/RootedDirtBlock.java
|
||||
+++ b/net/minecraft/world/level/block/RootedDirtBlock.java
|
||||
@@ -34,6 +34,6 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
@Override
|
||||
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
- worldserver.setBlockAndUpdate(blockposition.below(), Blocks.HANGING_ROOTS.defaultBlockState());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition.below(), Blocks.HANGING_ROOTS.defaultBlockState()); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
|
||||
@@ -68,9 +68,16 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
|
||||
@@ -42,6 +42,11 @@
|
||||
@@ -43,6 +43,11 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class SculkSensorBlock extends BlockTileEntity implements IBlockWaterlogged {
|
||||
|
||||
public static final MapCodec<SculkSensorBlock> CODEC = simpleCodec(SculkSensorBlock::new);
|
||||
@@ -102,6 +107,18 @@
|
||||
@@ -103,6 +108,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) {
|
||||
@@ -205,6 +222,15 @@
|
||||
@@ -206,6 +223,15 @@
|
||||
}
|
||||
|
||||
public static void deactivate(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -47,7 +47,7 @@
|
||||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.COOLDOWN)).setValue(SculkSensorBlock.POWER, 0), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), 10);
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -216,6 +242,15 @@
|
||||
@@ -217,6 +243,15 @@
|
||||
}
|
||||
|
||||
public void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
@@ -63,9 +63,9 @@
|
||||
world.setBlock(blockposition, (IBlockData) ((IBlockData) iblockdata.setValue(SculkSensorBlock.PHASE, SculkSensorPhase.ACTIVE)).setValue(SculkSensorBlock.POWER, i), 3);
|
||||
world.scheduleTick(blockposition, iblockdata.getBlock(), this.getActiveTicks());
|
||||
updateNeighbours(world, blockposition, iblockdata);
|
||||
@@ -298,9 +333,16 @@
|
||||
@@ -297,9 +332,16 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
|
||||
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
|
||||
@@ -63,6 +63,7 @@
|
||||
@@ -62,6 +62,7 @@
|
||||
EntityPlayer entityplayer = SculkShriekerBlockEntity.tryGetPlayer(entity);
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -8,9 +8,9 @@
|
||||
worldserver.getBlockEntity(blockposition, TileEntityTypes.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> {
|
||||
sculkshriekerblockentity.tryShriek(worldserver, entityplayer);
|
||||
});
|
||||
@@ -147,10 +148,17 @@
|
||||
@@ -144,10 +145,17 @@
|
||||
@Override
|
||||
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
|
||||
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);
|
||||
+ // CraftBukkit start - Delegate to getExpDrop
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
+++ b/net/minecraft/world/level/block/WallHangingSignBlock.java
|
||||
@@ -186,6 +186,6 @@
|
||||
@@ -183,6 +183,6 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
|
||||
@@ -28,6 +28,12 @@
|
||||
@@ -31,6 +31,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class BrushableBlockEntity extends TileEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -153,7 +159,10 @@
|
||||
@@ -156,7 +162,10 @@
|
||||
EntityItem entityitem = new EntityItem(this.level, d3, d4, d5, this.item.split(this.level.random.nextInt(21) + 10));
|
||||
|
||||
entityitem.setDeltaMovement(Vec3D.ZERO);
|
||||
@@ -25,11 +25,3 @@
|
||||
this.item = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@@ -230,6 +239,7 @@
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
+ super.load(nbttagcompound); // CraftBukkit - SPIGOT-7393: Load super Bukkit data
|
||||
if (!this.tryLoadLootTable(nbttagcompound) && nbttagcompound.contains("item")) {
|
||||
this.item = ItemStack.of(nbttagcompound.getCompound("item"));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
|
||||
@@ -18,12 +18,54 @@
|
||||
@@ -23,12 +23,54 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -55,15 +55,7 @@
|
||||
|
||||
public ChiseledBookShelfBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.CHISELED_BOOKSHELF, blockposition, iblockdata);
|
||||
@@ -52,6 +94,7 @@
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
+ super.load(nbttagcompound); // CraftBukkit - SPIGOT-7393: Load super Bukkit data
|
||||
this.items.clear();
|
||||
ContainerUtil.loadAllItems(nbttagcompound, this.items);
|
||||
this.lastInteractedSlot = nbttagcompound.getInt("last_interacted_slot");
|
||||
@@ -93,7 +136,7 @@
|
||||
@@ -100,7 +142,7 @@
|
||||
|
||||
this.items.set(i, ItemStack.EMPTY);
|
||||
if (!itemstack.isEmpty()) {
|
||||
@@ -72,7 +64,7 @@
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -108,7 +151,7 @@
|
||||
@@ -115,7 +157,7 @@
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
if (itemstack.is(TagsItem.BOOKSHELF_BOOKS)) {
|
||||
this.items.set(i, itemstack);
|
||||
@@ -81,7 +73,7 @@
|
||||
} else if (itemstack.isEmpty()) {
|
||||
this.removeItem(i, 1);
|
||||
}
|
||||
@@ -124,7 +167,7 @@
|
||||
@@ -131,7 +173,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
|
||||
+++ b/net/minecraft/world/level/block/entity/ContainerOpenersCounter.java
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
private static final int CHECK_TICK_DELAY = 5;
|
||||
private int openCount;
|
||||
private double maxInteractionRange;
|
||||
+ public boolean opened; // CraftBukkit
|
||||
|
||||
public ContainerOpenersCounter() {}
|
||||
|
||||
@@ -22,11 +23,36 @@
|
||||
@@ -26,11 +27,36 @@
|
||||
|
||||
protected abstract void openerCountChanged(World world, BlockPosition blockposition, IBlockData iblockdata, int i, int j);
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
+
|
||||
if (i == 0) {
|
||||
this.onOpen(world, blockposition, iblockdata);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, blockposition);
|
||||
@@ -37,8 +63,19 @@
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_OPEN, blockposition);
|
||||
@@ -42,8 +68,19 @@
|
||||
}
|
||||
|
||||
public void decrementOpeners(EntityHuman entityhuman, World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -64,11 +64,11 @@
|
||||
+
|
||||
if (this.openCount == 0) {
|
||||
this.onClose(world, blockposition, iblockdata);
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_CLOSE, blockposition);
|
||||
@@ -59,6 +96,7 @@
|
||||
world.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_CLOSE, blockposition);
|
||||
@@ -72,6 +109,7 @@
|
||||
}
|
||||
|
||||
public void recheckOpeners(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
int i = this.getOpenCount(world, blockposition);
|
||||
int i = list.size();
|
||||
+ if (opened) i++; // CraftBukkit - add dummy count from API
|
||||
int j = this.openCount;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
|
||||
@@ -21,6 +21,12 @@
|
||||
@@ -23,6 +23,12 @@
|
||||
import net.minecraft.world.level.block.CrafterBlock;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class CrafterBlockEntity extends TileEntityLootable implements InventoryCrafting {
|
||||
|
||||
public static final int CONTAINER_WIDTH = 3;
|
||||
@@ -33,6 +39,46 @@
|
||||
@@ -35,12 +41,52 @@
|
||||
private NonNullList<ItemStack> items;
|
||||
public int craftingTicksRemaining;
|
||||
protected final IContainerProperties containerData;
|
||||
@@ -60,3 +60,10 @@
|
||||
|
||||
public CrafterBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.CRAFTER, blockposition, iblockdata);
|
||||
this.items = NonNullList.withSize(9, ItemStack.EMPTY);
|
||||
this.craftingTicksRemaining = 0;
|
||||
- this.containerData = new IContainerProperties(this) {
|
||||
+ this.containerData = new IContainerProperties() { // CraftBukkit - decompile error
|
||||
private final int[] slotStates = new int[9];
|
||||
private int triggered = 0;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java
|
||||
@@ -21,8 +21,59 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockProperties;
|
||||
@@ -20,8 +20,59 @@
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
+// CraftBukkit start
|
||||
@@ -14,7 +14,7 @@
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class DecoratedPotBlockEntity extends TileEntity implements RandomizableContainer, ContainerSingleItem {
|
||||
public class DecoratedPotBlockEntity extends TileEntity implements RandomizableContainer, ContainerSingleItem.a {
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new ArrayList<>();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
|
||||
@@ -32,14 +32,18 @@
|
||||
@@ -34,10 +34,13 @@
|
||||
public SculkCatalystBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.SCULK_CATALYST, blockposition, iblockdata);
|
||||
this.catalystListener = new SculkCatalystBlockEntity.CatalystListener(iblockdata, new BlockPositionSource(blockposition));
|
||||
@@ -14,12 +14,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
+ super.load(nbttagcompound); // CraftBukkit - SPIGOT-7393: Load super Bukkit data
|
||||
this.catalystListener.sculkSpreader.load(nbttagcompound);
|
||||
}
|
||||
|
||||
@@ -60,11 +64,13 @@
|
||||
@@ -63,11 +66,13 @@
|
||||
final SculkSpreader sculkSpreader;
|
||||
private final IBlockData blockState;
|
||||
private final PositionSource positionSource;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntity.java
|
||||
@@ -15,8 +15,18 @@
|
||||
@@ -26,8 +26,18 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final TileEntityTypes<?> type;
|
||||
@Nullable
|
||||
@@ -48,7 +58,16 @@
|
||||
@@ -61,7 +71,16 @@
|
||||
return this.level != null;
|
||||
}
|
||||
|
||||
- public void load(NBTTagCompound nbttagcompound) {}
|
||||
- protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {}
|
||||
+ // CraftBukkit start - read container
|
||||
+ public void load(NBTTagCompound nbttagcompound) {
|
||||
+ protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
+ this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
+
|
||||
+ net.minecraft.nbt.NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues");
|
||||
@@ -35,12 +35,12 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
protected void saveAdditional(NBTTagCompound nbttagcompound) {}
|
||||
|
||||
@@ -70,6 +89,11 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
this.saveAdditional(nbttagcompound);
|
||||
public final void loadWithComponents(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
this.loadAdditional(nbttagcompound, holderlookup_a);
|
||||
@@ -101,6 +120,11 @@
|
||||
}).ifPresent((nbtbase) -> {
|
||||
nbttagcompound.merge((NBTTagCompound) nbtbase);
|
||||
});
|
||||
+ // CraftBukkit start - store container
|
||||
+ if (this.persistentDataContainer != null && !this.persistentDataContainer.isEmpty()) {
|
||||
+ nbttagcompound.put("PublicBukkitValues", this.persistentDataContainer.toTagCompound());
|
||||
@@ -49,11 +49,19 @@
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -202,4 +226,13 @@
|
||||
public void setBlockState(IBlockData iblockdata) {
|
||||
this.blockState = iblockdata;
|
||||
@@ -264,7 +288,7 @@
|
||||
set.add(DataComponents.BLOCK_ENTITY_DATA);
|
||||
final PatchedDataComponentMap patcheddatacomponentmap = PatchedDataComponentMap.fromPatch(datacomponentmap, datacomponentpatch);
|
||||
|
||||
- this.applyImplicitComponents(new TileEntity.b(this) {
|
||||
+ this.applyImplicitComponents(new TileEntity.b() { // CraftBukkit - decompile error
|
||||
@Nullable
|
||||
@Override
|
||||
public <T> T get(DataComponentType<T> datacomponenttype) {
|
||||
@@ -306,6 +330,15 @@
|
||||
this.components = datacomponentmap;
|
||||
}
|
||||
+
|
||||
|
||||
+ // CraftBukkit start - add method
|
||||
+ public InventoryHolder getOwner() {
|
||||
+ if (level == null) return null;
|
||||
@@ -62,4 +70,7 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+
|
||||
private static class a {
|
||||
|
||||
public static final Codec<DataComponentMap> COMPONENTS_CODEC = DataComponentMap.CODEC.optionalFieldOf("components", DataComponentMap.EMPTY).codec();
|
||||
|
||||
@@ -1,14 +1,45 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBanner.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBanner.java
|
||||
@@ -102,6 +102,11 @@
|
||||
@@ -19,6 +19,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class TileEntityBanner extends TileEntity implements INamableTileEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -80,7 +84,7 @@
|
||||
BannerPatternLayers.CODEC.parse(holderlookup_a.createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("patterns")).resultOrPartial((s) -> {
|
||||
TileEntityBanner.LOGGER.error("Failed to parse banner patterns: '{}'", s);
|
||||
}).ifPresent((bannerpatternlayers) -> {
|
||||
- this.patterns = bannerpatternlayers;
|
||||
+ this.setPatterns(bannerpatternlayers); // CraftBukkit - apply limits
|
||||
});
|
||||
}
|
||||
|
||||
this.itemPatterns = nbttagcompound.getList("Patterns", 10);
|
||||
+ // CraftBukkit start
|
||||
+ while (this.itemPatterns.size() > 20) {
|
||||
+ this.itemPatterns.remove(20);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.patterns = null;
|
||||
@@ -114,7 +118,7 @@
|
||||
@Override
|
||||
protected void applyImplicitComponents(TileEntity.b tileentity_b) {
|
||||
super.applyImplicitComponents(tileentity_b);
|
||||
- this.patterns = (BannerPatternLayers) tileentity_b.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY);
|
||||
+ this.setPatterns((BannerPatternLayers) tileentity_b.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY)); // CraftBukkit - apply limits
|
||||
this.name = (IChatBaseComponent) tileentity_b.get(DataComponents.CUSTOM_NAME);
|
||||
}
|
||||
|
||||
@@ -130,4 +134,13 @@
|
||||
nbttagcompound.remove("patterns");
|
||||
nbttagcompound.remove("CustomName");
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void setPatterns(BannerPatternLayers bannerpatternlayers) {
|
||||
+ if (bannerpatternlayers.layers().size() > 20) {
|
||||
+ bannerpatternlayers = new BannerPatternLayers(List.copyOf(bannerpatternlayers.layers().subList(0, 20)));
|
||||
+ }
|
||||
+ this.patterns = bannerpatternlayers;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBarrel.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBarrel.java
|
||||
@@ -20,8 +20,49 @@
|
||||
@@ -21,8 +21,49 @@
|
||||
import net.minecraft.world.level.block.BlockBarrel;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBeacon.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBeacon.java
|
||||
@@ -40,6 +40,11 @@
|
||||
@@ -46,6 +46,11 @@
|
||||
import net.minecraft.world.level.levelgen.HeightMap;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class TileEntityBeacon extends TileEntity implements ITileInventory, INamableTileEntity {
|
||||
|
||||
private static final int MAX_LEVELS = 4;
|
||||
@@ -65,6 +70,15 @@
|
||||
@@ -71,6 +76,15 @@
|
||||
public IChatBaseComponent name;
|
||||
public ChestLock lockKey;
|
||||
private final IContainerProperties dataAccess;
|
||||
@@ -27,20 +27,20 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Nullable
|
||||
static MobEffectList filterEffect(@Nullable MobEffectList mobeffectlist) {
|
||||
@@ -245,38 +259,77 @@
|
||||
static Holder<MobEffectList> filterEffect(@Nullable Holder<MobEffectList> holder) {
|
||||
@@ -251,38 +265,77 @@
|
||||
super.setRemoved();
|
||||
}
|
||||
|
||||
- private static void applyEffects(World world, BlockPosition blockposition, int i, @Nullable MobEffectList mobeffectlist, @Nullable MobEffectList mobeffectlist1) {
|
||||
- if (!world.isClientSide && mobeffectlist != null) {
|
||||
- private static void applyEffects(World world, BlockPosition blockposition, int i, @Nullable Holder<MobEffectList> holder, @Nullable Holder<MobEffectList> holder1) {
|
||||
- if (!world.isClientSide && holder != null) {
|
||||
- double d0 = (double) (i * 10 + 10);
|
||||
+ // CraftBukkit start - split into components
|
||||
+ private static byte getAmplification(int i, @Nullable MobEffectList mobeffectlist, @Nullable MobEffectList mobeffectlist1) {
|
||||
+ private static byte getAmplification(int i, @Nullable Holder<MobEffectList> holder, @Nullable Holder<MobEffectList> holder1) {
|
||||
+ {
|
||||
byte b0 = 0;
|
||||
|
||||
if (i >= 4 && mobeffectlist == mobeffectlist1) {
|
||||
if (i >= 4 && Objects.equals(holder, holder1)) {
|
||||
b0 = 1;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void applyEffect(List list, MobEffectList mobeffectlist, int j, int b0) {
|
||||
+ private static void applyEffect(List list, @Nullable Holder<MobEffectList> holder, int j, int b0) {
|
||||
+ {
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -74,20 +74,20 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
entityhuman = (EntityHuman) iterator.next();
|
||||
- entityhuman.addEffect(new MobEffect(mobeffectlist, j, b0, true, true));
|
||||
+ entityhuman.addEffect(new MobEffect(mobeffectlist, j, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
- entityhuman.addEffect(new MobEffect(holder, j, b0, true, true));
|
||||
+ entityhuman.addEffect(new MobEffect(holder, j, b0, true, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||
}
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+ private static boolean hasSecondaryEffect(int i, @Nullable MobEffectList mobeffectlist, @Nullable MobEffectList mobeffectlist1) {
|
||||
+ private static boolean hasSecondaryEffect(int i, @Nullable Holder<MobEffectList> holder, @Nullable Holder<MobEffectList> holder1) {
|
||||
+ {
|
||||
if (i >= 4 && mobeffectlist != mobeffectlist1 && mobeffectlist1 != null) {
|
||||
if (i >= 4 && !Objects.equals(holder, holder1) && holder1 != null) {
|
||||
- iterator = list.iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
- entityhuman = (EntityHuman) iterator.next();
|
||||
- entityhuman.addEffect(new MobEffect(mobeffectlist1, j, 0, true, true));
|
||||
- entityhuman.addEffect(new MobEffect(holder1, j, 0, true, true));
|
||||
- }
|
||||
+ return true;
|
||||
}
|
||||
@@ -96,18 +96,18 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void applyEffects(World world, BlockPosition blockposition, int i, @Nullable MobEffectList mobeffectlist, @Nullable MobEffectList mobeffectlist1) {
|
||||
+ if (!world.isClientSide && mobeffectlist != null) {
|
||||
+ private static void applyEffects(World world, BlockPosition blockposition, int i, @Nullable Holder<MobEffectList> holder, @Nullable Holder<MobEffectList> holder1) {
|
||||
+ if (!world.isClientSide && holder != null) {
|
||||
+ double d0 = (double) (i * 10 + 10);
|
||||
+ byte b0 = getAmplification(i, mobeffectlist, mobeffectlist1);
|
||||
+ byte b0 = getAmplification(i, holder, holder1);
|
||||
+
|
||||
+ int j = getLevel(i);
|
||||
+ List list = getHumansInRange(world, blockposition, i);
|
||||
+
|
||||
+ applyEffect(list, mobeffectlist, j, b0);
|
||||
+ applyEffect(list, holder, j, b0);
|
||||
+
|
||||
+ if (hasSecondaryEffect(i, mobeffectlist, mobeffectlist1)) {
|
||||
+ applyEffect(list, mobeffectlist1, j, 0);
|
||||
+ if (hasSecondaryEffect(i, holder, holder1)) {
|
||||
+ applyEffect(list, holder1, j, 0);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
@@ -116,20 +116,20 @@
|
||||
|
||||
public static void playSound(World world, BlockPosition blockposition, SoundEffect soundeffect) {
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
@@ -312,7 +365,7 @@
|
||||
@@ -316,7 +369,7 @@
|
||||
if (nbttagcompound.contains(s, 8)) {
|
||||
MinecraftKey minecraftkey = MinecraftKey.tryParse(nbttagcompound.getString(s));
|
||||
|
||||
- return filterEffect((MobEffectList) BuiltInRegistries.MOB_EFFECT.get(minecraftkey));
|
||||
+ return (MobEffectList) BuiltInRegistries.MOB_EFFECT.get(minecraftkey); // CraftBukkit - persist manually set non-default beacon effects (SPIGOT-3598)
|
||||
- return minecraftkey == null ? null : (Holder) BuiltInRegistries.MOB_EFFECT.getHolder(minecraftkey).map(TileEntityBeacon::filterEffect).orElse((Object) null);
|
||||
+ return minecraftkey == null ? null : (Holder) BuiltInRegistries.MOB_EFFECT.getHolder(minecraftkey).orElse(null); // CraftBukkit - persist manually set non-default beacon effects (SPIGOT-3598)
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -323,6 +376,7 @@
|
||||
super.load(nbttagcompound);
|
||||
@@ -327,6 +380,7 @@
|
||||
super.loadAdditional(nbttagcompound, holderlookup_a);
|
||||
this.primaryPower = loadEffect(nbttagcompound, "primary_effect");
|
||||
this.secondaryPower = loadEffect(nbttagcompound, "secondary_effect");
|
||||
+ this.levels = nbttagcompound.getInt("Levels"); // CraftBukkit - SPIGOT-5053, use where available
|
||||
if (nbttagcompound.contains("CustomName", 8)) {
|
||||
this.name = IChatBaseComponent.ChatSerializer.fromJson(nbttagcompound.getString("CustomName"));
|
||||
this.name = IChatBaseComponent.ChatSerializer.fromJson(nbttagcompound.getString("CustomName"), holderlookup_a);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBeehive.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBeehive.java
|
||||
@@ -27,6 +27,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -42,6 +42,10 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
@@ -10,8 +10,8 @@
|
||||
+
|
||||
public class TileEntityBeehive extends TileEntity {
|
||||
|
||||
public static final String TAG_FLOWER_POS = "FlowerPos";
|
||||
@@ -43,6 +47,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -55,6 +59,7 @@
|
||||
private final List<TileEntityBeehive.HiveBee> stored = Lists.newArrayList();
|
||||
@Nullable
|
||||
public BlockPosition savedFlowerPos;
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
public TileEntityBeehive(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.BEEHIVE, blockposition, iblockdata);
|
||||
@@ -82,7 +87,7 @@
|
||||
@@ -94,7 +99,7 @@
|
||||
}
|
||||
|
||||
public boolean isFull() {
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
public void emptyAllLivingFromHive(@Nullable EntityHuman entityhuman, IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
|
||||
@@ -99,7 +104,7 @@
|
||||
@@ -111,7 +116,7 @@
|
||||
|
||||
if (entityhuman.position().distanceToSqr(entity.position()) <= 16.0D) {
|
||||
if (!this.isSedated()) {
|
||||
@@ -37,7 +37,7 @@
|
||||
} else {
|
||||
entitybee.setStayOutOfHiveCountdown(400);
|
||||
}
|
||||
@@ -111,10 +116,16 @@
|
||||
@@ -123,10 +128,16 @@
|
||||
}
|
||||
|
||||
private List<Entity> releaseAllOccupants(IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
|
||||
@@ -49,16 +49,16 @@
|
||||
List<Entity> list = Lists.newArrayList();
|
||||
|
||||
this.stored.removeIf((tileentitybeehive_hivebee) -> {
|
||||
- return releaseOccupant(this.level, this.worldPosition, iblockdata, tileentitybeehive_hivebee, list, tileentitybeehive_releasestatus, this.savedFlowerPos);
|
||||
+ return releaseBee(this.level, this.worldPosition, iblockdata, tileentitybeehive_hivebee, list, tileentitybeehive_releasestatus, this.savedFlowerPos, force);
|
||||
- return releaseOccupant(this.level, this.worldPosition, iblockdata, tileentitybeehive_hivebee.toOccupant(), list, tileentitybeehive_releasestatus, this.savedFlowerPos);
|
||||
+ return releaseOccupant(this.level, this.worldPosition, iblockdata, tileentitybeehive_hivebee.toOccupant(), list, tileentitybeehive_releasestatus, this.savedFlowerPos, force);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
if (!list.isEmpty()) {
|
||||
super.setChanged();
|
||||
@@ -142,7 +153,19 @@
|
||||
@@ -150,7 +161,19 @@
|
||||
}
|
||||
|
||||
public void addOccupantWithPresetTicks(Entity entity, boolean flag, int i) {
|
||||
public void addOccupant(Entity entity) {
|
||||
- if (this.stored.size() < 3) {
|
||||
+ if (this.stored.size() < this.maxBees) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
@@ -75,9 +75,9 @@
|
||||
+ // CraftBukkit end
|
||||
entity.stopRiding();
|
||||
entity.ejectPassengers();
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -164,7 +187,7 @@
|
||||
this.level.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, this.getBlockState()));
|
||||
this.storeBee(TileEntityBeehive.c.of(entity));
|
||||
@@ -169,7 +192,7 @@
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, this.getBlockState()));
|
||||
}
|
||||
|
||||
- entity.discard();
|
||||
@@ -85,77 +85,79 @@
|
||||
super.setChanged();
|
||||
}
|
||||
}
|
||||
@@ -174,7 +197,13 @@
|
||||
@@ -179,7 +202,13 @@
|
||||
}
|
||||
|
||||
private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.HiveBee tileentitybeehive_hivebee, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) {
|
||||
private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.c tileentitybeehive_c, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) {
|
||||
- if ((world.isNight() || world.isRaining()) && tileentitybeehive_releasestatus != TileEntityBeehive.ReleaseStatus.EMERGENCY) {
|
||||
+ // CraftBukkit start - This allows us to bypass the night/rain/emergency check
|
||||
+ return releaseBee(world, blockposition, iblockdata, tileentitybeehive_hivebee, list, tileentitybeehive_releasestatus, blockposition1, false);
|
||||
+ return releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_c, list, tileentitybeehive_releasestatus, blockposition1, false);
|
||||
+ }
|
||||
+
|
||||
+ private static boolean releaseBee(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.HiveBee tileentitybeehive_hivebee, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1, boolean force) {
|
||||
+ private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.c tileentitybeehive_c, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1, boolean force) {
|
||||
+ if (!force && (world.isNight() || world.isRaining()) && tileentitybeehive_releasestatus != TileEntityBeehive.ReleaseStatus.EMERGENCY) {
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
} else {
|
||||
NBTTagCompound nbttagcompound = tileentitybeehive_hivebee.entityData.copy();
|
||||
@@ -197,6 +226,18 @@
|
||||
if (!entity.getType().is(TagsEntity.BEEHIVE_INHABITORS)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (entity instanceof EntityBee) {
|
||||
+ float f = entity.getBbWidth();
|
||||
+ double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
|
||||
+ double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
|
||||
+ double d2 = (double) blockposition.getY() + 0.5D - (double) (entity.getBbHeight() / 2.0F);
|
||||
+ double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockBeehive.FACING);
|
||||
@@ -192,6 +221,18 @@
|
||||
Entity entity = tileentitybeehive_c.createEntity(world, blockposition);
|
||||
|
||||
if (entity != null) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entity instanceof EntityBee) {
|
||||
+ float f = entity.getBbWidth();
|
||||
+ double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
|
||||
+ double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
|
||||
+ double d2 = (double) blockposition.getY() + 0.5D - (double) (entity.getBbHeight() / 2.0F);
|
||||
+ double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
|
||||
+
|
||||
+ entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
|
||||
+ }
|
||||
+ if (!world.addFreshEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BEEHIVE)) return false; // CraftBukkit - SpawnReason, moved from below
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityBee) {
|
||||
EntityBee entitybee = (EntityBee) entity;
|
||||
+ entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
|
||||
+ }
|
||||
+ if (!world.addFreshEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BEEHIVE)) return false; // CraftBukkit - SpawnReason, moved from below
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityBee) {
|
||||
EntityBee entitybee = (EntityBee) entity;
|
||||
|
||||
@@ -228,6 +269,7 @@
|
||||
list.add(entitybee);
|
||||
}
|
||||
|
||||
+ /* // CraftBukkit start
|
||||
float f = entity.getBbWidth();
|
||||
double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
|
||||
double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
|
||||
@@ -235,11 +277,12 @@
|
||||
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
|
||||
|
||||
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
|
||||
+ */ // CraftBukkit end
|
||||
@@ -222,6 +263,7 @@
|
||||
list.add(entitybee);
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, world.getBlockState(blockposition)));
|
||||
- return world.addFreshEntity(entity);
|
||||
+ return true; // return this.world.addFreshEntity(entity); // CraftBukkit - moved up
|
||||
+ /* // CraftBukkit start
|
||||
float f = entity.getBbWidth();
|
||||
double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
|
||||
double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
|
||||
@@ -229,11 +271,12 @@
|
||||
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
|
||||
|
||||
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
|
||||
+ */ // CraftBukkit end
|
||||
}
|
||||
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BEEHIVE_EXIT, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, world.getBlockState(blockposition)));
|
||||
- return world.addFreshEntity(entity);
|
||||
+ return true; // return this.world.addFreshEntity(entity); // CraftBukkit - moved up
|
||||
} else {
|
||||
return false;
|
||||
@@ -288,6 +331,10 @@
|
||||
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee, (List) null, tileentitybeehive_releasestatus, blockposition1)) {
|
||||
}
|
||||
@@ -258,6 +301,10 @@
|
||||
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee.toOccupant(), (List) null, tileentitybeehive_releasestatus, blockposition1)) {
|
||||
flag = true;
|
||||
iterator.remove();
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.minOccupationTicks / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable
|
||||
+ tileentitybeehive_hivebee.ticksInHive = tileentitybeehive_hivebee.occupant.minTicksInHive / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,6 +376,11 @@
|
||||
this.savedFlowerPos = GameProfileSerializer.readBlockPos(nbttagcompound.getCompound("FlowerPos"));
|
||||
@@ -293,7 +340,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
- this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse((Object) null);
|
||||
+ this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse(null); // CraftBukkit - decompile error
|
||||
+ // CraftBukkit start
|
||||
+ if (nbttagcompound.contains("Bukkit.MaxEntities")) {
|
||||
+ this.maxBees = nbttagcompound.getInt("Bukkit.MaxEntities");
|
||||
@@ -164,11 +166,29 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -338,6 +390,7 @@
|
||||
@@ -303,6 +355,7 @@
|
||||
if (this.hasSavedFlowerPos()) {
|
||||
nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
|
||||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
|
||||
}
|
||||
+ nbttagcompound.putInt("Bukkit.MaxEntities", this.maxBees); // CraftBukkit
|
||||
|
||||
}
|
||||
|
||||
@@ -350,7 +403,7 @@
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
|
||||
entity.save(nbttagcompound);
|
||||
- List list = TileEntityBeehive.IGNORED_BEE_TAGS;
|
||||
+ List<String> list = TileEntityBeehive.IGNORED_BEE_TAGS; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(nbttagcompound);
|
||||
list.forEach(nbttagcompound::remove);
|
||||
@@ -369,7 +422,7 @@
|
||||
@Nullable
|
||||
public Entity createEntity(World world, BlockPosition blockposition) {
|
||||
NBTTagCompound nbttagcompound = this.entityData.copyTag();
|
||||
- List list = TileEntityBeehive.IGNORED_BEE_TAGS;
|
||||
+ List<String> list = TileEntityBeehive.IGNORED_BEE_TAGS; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(nbttagcompound);
|
||||
list.forEach(nbttagcompound::remove);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
|
||||
@@ -25,6 +25,20 @@
|
||||
@@ -23,6 +23,20 @@
|
||||
import net.minecraft.world.level.block.BlockBrewingStand;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
public class TileEntityBrewingStand extends TileEntityContainer implements IWorldInventory {
|
||||
|
||||
private static final int INGREDIENT_SLOT = 3;
|
||||
@@ -42,6 +56,36 @@
|
||||
@@ -40,6 +54,36 @@
|
||||
private Item ingredient;
|
||||
public int fuel;
|
||||
protected final IContainerProperties dataAccess;
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
public TileEntityBrewingStand(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.BREWING_STAND, blockposition, iblockdata);
|
||||
@@ -109,8 +153,19 @@
|
||||
@@ -106,8 +150,19 @@
|
||||
ItemStack itemstack = (ItemStack) tileentitybrewingstand.items.get(4);
|
||||
|
||||
if (tileentitybrewingstand.fuel <= 0 && itemstack.is(Items.BLAZE_POWDER)) {
|
||||
@@ -80,7 +80,7 @@
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
}
|
||||
|
||||
@@ -118,12 +173,17 @@
|
||||
@@ -115,12 +170,17 @@
|
||||
boolean flag1 = tileentitybrewingstand.brewTime > 0;
|
||||
ItemStack itemstack1 = (ItemStack) tileentitybrewingstand.items.get(3);
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
|
||||
tileentitybrewingstand.brewTime = 0;
|
||||
@@ -131,7 +191,11 @@
|
||||
@@ -128,7 +188,11 @@
|
||||
}
|
||||
} else if (flag && tileentitybrewingstand.fuel > 0) {
|
||||
--tileentitybrewingstand.fuel;
|
||||
@@ -114,20 +114,21 @@
|
||||
tileentitybrewingstand.ingredient = itemstack1.getItem();
|
||||
setChanged(world, blockposition, iblockdata);
|
||||
}
|
||||
@@ -187,11 +251,33 @@
|
||||
@@ -184,12 +248,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private static void doBrew(World world, BlockPosition blockposition, NonNullList<ItemStack> nonnulllist) {
|
||||
+ // CraftBukkit start
|
||||
+ private static void doBrew(World world, BlockPosition blockposition, NonNullList<ItemStack> nonnulllist, TileEntityBrewingStand tileentitybrewingstand) {
|
||||
+ private static void doBrew(World world, BlockPosition blockposition, NonNullList<ItemStack> nonnulllist, TileEntityBrewingStand tileentitybrewingstand) { // CraftBukkit
|
||||
ItemStack itemstack = (ItemStack) nonnulllist.get(3);
|
||||
PotionBrewer potionbrewer = world.potionBrewing();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ InventoryHolder owner = tileentitybrewingstand.getOwner();
|
||||
+ List<org.bukkit.inventory.ItemStack> brewResults = new ArrayList<>(3);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
- nonnulllist.set(i, PotionBrewer.mix(itemstack, (ItemStack) nonnulllist.get(i)));
|
||||
+ brewResults.add(i, CraftItemStack.asCraftMirror(PotionBrewer.mix(itemstack, (ItemStack) nonnulllist.get(i))));
|
||||
- nonnulllist.set(i, potionbrewer.mix(itemstack, (ItemStack) nonnulllist.get(i)));
|
||||
+ brewResults.add(i, CraftItemStack.asCraftMirror(potionbrewer.mix(itemstack, (ItemStack) nonnulllist.get(i))));
|
||||
+ }
|
||||
+
|
||||
+ if (owner != null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityCampfire.java
|
||||
@@ -26,6 +26,14 @@
|
||||
@@ -31,6 +31,14 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class TileEntityCampfire extends TileEntity implements Clearable {
|
||||
|
||||
private static final int BURN_COOL_SPEED = 2;
|
||||
@@ -60,6 +68,20 @@
|
||||
@@ -65,6 +73,20 @@
|
||||
}).orElse(itemstack);
|
||||
|
||||
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
|
||||
@@ -36,7 +36,7 @@
|
||||
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
|
||||
tileentitycampfire.items.set(i, ItemStack.EMPTY);
|
||||
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -172,7 +194,11 @@
|
||||
@@ -177,7 +199,11 @@
|
||||
ItemStack itemstack1 = (ItemStack) this.items.get(j);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
@@ -48,4 +48,4 @@
|
||||
+ // CraftBukkit end
|
||||
this.cookingProgress[j] = 0;
|
||||
this.items.set(j, itemstack.split(1));
|
||||
this.level.gameEvent(GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entity, this.getBlockState()));
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entity, this.getBlockState()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityChest.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityChest.java
|
||||
@@ -23,6 +23,12 @@
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.block.state.properties.BlockPropertyChestType;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public class TileEntityChest extends TileEntityLootable implements LidBlockEntity {
|
||||
|
||||
private static final int EVENT_SET_OPEN_COUNT = 1;
|
||||
@@ -30,6 +36,36 @@
|
||||
@@ -31,6 +37,36 @@
|
||||
public final ContainerOpenersCounter openersCounter;
|
||||
private final ChestLidController chestLidController;
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(tileentitytypes, blockposition, iblockdata);
|
||||
this.items = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
@@ -198,4 +234,11 @@
|
||||
@@ -199,4 +235,11 @@
|
||||
|
||||
world.blockEvent(blockposition, block, 1, j);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityCommand.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityCommand.java
|
||||
@@ -20,6 +20,13 @@
|
||||
@@ -24,6 +24,13 @@
|
||||
private boolean auto;
|
||||
private boolean conditionMet;
|
||||
private final CommandBlockListenerAbstract commandBlock = new CommandBlockListenerAbstract() {
|
||||
|
||||
@@ -1,21 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityConduit.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityConduit.java
|
||||
@@ -40,11 +40,11 @@
|
||||
private float activeRotation;
|
||||
private boolean isActive;
|
||||
private boolean isHunting;
|
||||
- private final List<BlockPosition> effectBlocks = Lists.newArrayList();
|
||||
+ public final List<BlockPosition> effectBlocks = Lists.newArrayList();
|
||||
@Nullable
|
||||
- private EntityLiving destroyTarget;
|
||||
+ public EntityLiving destroyTarget;
|
||||
@Nullable
|
||||
- private UUID destroyTargetUUID;
|
||||
+ public UUID destroyTargetUUID;
|
||||
private long nextAmbientSoundActivation;
|
||||
|
||||
public TileEntityConduit(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
@@ -186,8 +186,20 @@
|
||||
@@ -187,8 +187,20 @@
|
||||
}
|
||||
|
||||
private static void applyEffects(World world, BlockPosition blockposition, List<BlockPosition> list) {
|
||||
@@ -36,7 +21,7 @@
|
||||
int k = blockposition.getX();
|
||||
int l = blockposition.getY();
|
||||
int i1 = blockposition.getZ();
|
||||
@@ -201,7 +213,7 @@
|
||||
@@ -202,7 +214,7 @@
|
||||
EntityHuman entityhuman = (EntityHuman) iterator.next();
|
||||
|
||||
if (blockposition.closerThan(entityhuman.blockPosition(), (double) j) && entityhuman.isInWaterOrRain()) {
|
||||
@@ -45,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,6 +221,12 @@
|
||||
@@ -210,6 +222,12 @@
|
||||
}
|
||||
|
||||
private static void updateDestroyTarget(World world, BlockPosition blockposition, IBlockData iblockdata, List<BlockPosition> list, TileEntityConduit tileentityconduit) {
|
||||
@@ -58,7 +43,7 @@
|
||||
EntityLiving entityliving = tileentityconduit.destroyTarget;
|
||||
int i = list.size();
|
||||
|
||||
@@ -229,9 +247,12 @@
|
||||
@@ -230,9 +248,12 @@
|
||||
tileentityconduit.destroyTarget = null;
|
||||
}
|
||||
|
||||
@@ -74,12 +59,3 @@
|
||||
}
|
||||
|
||||
if (entityliving != tileentityconduit.destroyTarget) {
|
||||
@@ -252,7 +273,7 @@
|
||||
|
||||
}
|
||||
|
||||
- private static AxisAlignedBB getDestroyRangeAABB(BlockPosition blockposition) {
|
||||
+ public static AxisAlignedBB getDestroyRangeAABB(BlockPosition blockposition) {
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityContainer.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityContainer.java
|
||||
@@ -89,4 +89,12 @@
|
||||
@@ -178,4 +178,12 @@
|
||||
nbttagcompound.remove("Lock");
|
||||
nbttagcompound.remove("Items");
|
||||
}
|
||||
|
||||
protected abstract Container createMenu(int i, PlayerInventory playerinventory);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityDispenser.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityDispenser.java
|
||||
@@ -13,11 +13,47 @@
|
||||
@@ -14,11 +14,47 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
|
||||
@@ -33,6 +33,15 @@
|
||||
@@ -34,6 +34,15 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
public class TileEntityEndGateway extends TileEntityEnderPortal {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -169,7 +178,7 @@
|
||||
@@ -163,7 +172,7 @@
|
||||
tileentityendgateway.teleportCooldown = 100;
|
||||
BlockPosition blockposition1;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
@@ -190,7 +199,7 @@
|
||||
@@ -184,7 +193,7 @@
|
||||
|
||||
if (entity2 != null) {
|
||||
entity1 = entity2;
|
||||
@@ -34,7 +34,7 @@
|
||||
} else {
|
||||
entity1 = entity;
|
||||
}
|
||||
@@ -198,8 +207,34 @@
|
||||
@@ -192,8 +201,34 @@
|
||||
entity1 = entity.getRootVehicle();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityFurnace.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityFurnace.java
|
||||
@@ -47,6 +47,21 @@
|
||||
@@ -48,6 +48,21 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeCraftingHolder, AutoRecipeOutput {
|
||||
|
||||
protected static final int SLOT_INPUT = 0;
|
||||
@@ -115,7 +130,7 @@
|
||||
@@ -118,7 +133,7 @@
|
||||
}
|
||||
};
|
||||
this.recipesUsed = new Object2IntOpenHashMap();
|
||||
@@ -30,9 +30,9 @@
|
||||
+ this.quickCheck = CraftingManager.createCheck((Recipes<RecipeCooking>) recipes); // CraftBukkit - decompile error // Eclipse fail
|
||||
}
|
||||
|
||||
public static Map<Item, Integer> getFuel() {
|
||||
@@ -183,6 +198,40 @@
|
||||
return map;
|
||||
public static void invalidateCache() {
|
||||
@@ -197,6 +212,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
@@ -72,7 +72,7 @@
|
||||
private static boolean isNeverAFurnaceFuel(Item item) {
|
||||
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
|
||||
}
|
||||
@@ -271,7 +320,7 @@
|
||||
@@ -285,7 +334,7 @@
|
||||
RecipeHolder recipeholder;
|
||||
|
||||
if (flag2) {
|
||||
@@ -81,7 +81,7 @@
|
||||
} else {
|
||||
recipeholder = null;
|
||||
}
|
||||
@@ -279,9 +328,20 @@
|
||||
@@ -293,9 +342,20 @@
|
||||
int i = tileentityfurnace.getMaxStackSize();
|
||||
|
||||
if (!tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -104,7 +104,7 @@
|
||||
flag1 = true;
|
||||
if (flag3) {
|
||||
Item item = itemstack.getItem();
|
||||
@@ -297,11 +357,23 @@
|
||||
@@ -311,11 +371,23 @@
|
||||
}
|
||||
|
||||
if (tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
|
||||
@@ -129,7 +129,7 @@
|
||||
tileentityfurnace.setRecipeUsed(recipeholder);
|
||||
}
|
||||
|
||||
@@ -340,17 +412,44 @@
|
||||
@@ -354,17 +426,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
+ /*
|
||||
if (itemstack2.isEmpty()) {
|
||||
nonnulllist.set(2, itemstack1.copy());
|
||||
} else if (itemstack2.is(itemstack1.getItem())) {
|
||||
} else if (ItemStack.isSameItemSameComponents(itemstack2, itemstack1)) {
|
||||
itemstack2.grow(1);
|
||||
}
|
||||
+ */
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
|
||||
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
|
||||
@@ -374,6 +473,7 @@
|
||||
@@ -388,6 +487,7 @@
|
||||
}
|
||||
|
||||
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
|
||||
@@ -183,7 +183,7 @@
|
||||
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(tileentityfurnace, world).map((recipeholder) -> {
|
||||
return ((RecipeCooking) recipeholder.value()).getCookingTime();
|
||||
}).orElse(200);
|
||||
@@ -495,8 +595,8 @@
|
||||
@@ -474,8 +574,8 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
|
||||
entityplayer.awardRecipes(list);
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -513,6 +613,12 @@
|
||||
@@ -492,6 +592,12 @@
|
||||
}
|
||||
|
||||
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
|
||||
@@ -207,7 +207,7 @@
|
||||
List<RecipeHolder<?>> list = Lists.newArrayList();
|
||||
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -521,14 +627,14 @@
|
||||
@@ -500,14 +606,14 @@
|
||||
|
||||
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((recipeholder) -> {
|
||||
list.add(recipeholder);
|
||||
@@ -224,7 +224,7 @@
|
||||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -536,6 +642,17 @@
|
||||
@@ -515,6 +621,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityHopper.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityHopper.java
|
||||
@@ -32,6 +32,22 @@
|
||||
import net.minecraft.world.phys.shapes.OperatorBoolean;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
@@ -30,6 +30,22 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.InventoryLargeChest;
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
public static final int MOVE_ITEM_SPEED = 8;
|
||||
@@ -40,6 +56,36 @@
|
||||
private int cooldownTime;
|
||||
private long tickedGameTime;
|
||||
private EnumDirection facing;
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
@@ -60,62 +60,41 @@
|
||||
public TileEntityHopper(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.HOPPER, blockposition, iblockdata);
|
||||
this.items = NonNullList.withSize(5, ItemStack.EMPTY);
|
||||
@@ -113,7 +159,7 @@
|
||||
boolean flag = false;
|
||||
@@ -167,7 +213,28 @@
|
||||
|
||||
if (!tileentityhopper.isEmpty()) {
|
||||
- flag = ejectItems(world, blockposition, iblockdata, tileentityhopper);
|
||||
+ flag = ejectItems(world, blockposition, iblockdata, (IInventory) tileentityhopper, tileentityhopper); // CraftBukkit
|
||||
}
|
||||
|
||||
if (!tileentityhopper.inventoryFull()) {
|
||||
@@ -147,7 +193,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- private static boolean ejectItems(World world, BlockPosition blockposition, IBlockData iblockdata, IInventory iinventory) {
|
||||
+ private static boolean ejectItems(World world, BlockPosition blockposition, IBlockData iblockdata, IInventory iinventory, TileEntityHopper hopper) { // CraftBukkit
|
||||
IInventory iinventory1 = getAttachedContainer(world, blockposition, iblockdata);
|
||||
|
||||
if (iinventory1 == null) {
|
||||
@@ -161,7 +207,30 @@
|
||||
for (int i = 0; i < iinventory.getContainerSize(); ++i) {
|
||||
if (!iinventory.getItem(i).isEmpty()) {
|
||||
ItemStack itemstack = iinventory.getItem(i).copy();
|
||||
- ItemStack itemstack1 = addItem(iinventory, iinventory1, iinventory.removeItem(i, 1), enumdirection);
|
||||
+ // ItemStack itemstack1 = addItem(iinventory, iinventory1, iinventory.removeItem(i, 1), enumdirection);
|
||||
+
|
||||
if (!itemstack.isEmpty()) {
|
||||
int j = itemstack.getCount();
|
||||
- ItemStack itemstack1 = addItem(tileentityhopper, iinventory, tileentityhopper.removeItem(i, 1), enumdirection);
|
||||
+ // CraftBukkit start - Call event when pushing items into other inventories
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, 1));
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(tileentityhopper.removeItem(i, 1));
|
||||
+
|
||||
+ Inventory destinationInventory;
|
||||
+ // Have to special case large chests as they work oddly
|
||||
+ if (iinventory1 instanceof InventoryLargeChest) {
|
||||
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory1);
|
||||
+ } else if (iinventory1.getOwner() != null) {
|
||||
+ destinationInventory = iinventory1.getOwner().getInventory();
|
||||
+ if (iinventory instanceof InventoryLargeChest) {
|
||||
+ destinationInventory = new org.bukkit.craftbukkit.inventory.CraftInventoryDoubleChest((InventoryLargeChest) iinventory);
|
||||
+ } else if (iinventory.getOwner() != null) {
|
||||
+ destinationInventory = iinventory.getOwner().getInventory();
|
||||
+ } else {
|
||||
+ destinationInventory = new CraftInventory(iinventory);
|
||||
+ }
|
||||
+
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(iinventory.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true);
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(iinventory.getOwner().getInventory(), oitemstack, destinationInventory, true);
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ hopper.setItem(i, itemstack);
|
||||
+ hopper.setCooldown(8); // Delay hopper checks
|
||||
+ tileentityhopper.setItem(i, itemstack);
|
||||
+ tileentityhopper.setCooldown(8); // Delay hopper checks
|
||||
+ return false;
|
||||
+ }
|
||||
+ ItemStack itemstack1 = addItem(iinventory, iinventory1, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||
+ ItemStack itemstack1 = addItem(tileentityhopper, iinventory, CraftItemStack.asNMSCopy(event.getItem()), enumdirection);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
iinventory1.setChanged();
|
||||
@@ -226,7 +295,34 @@
|
||||
iinventory.setChanged();
|
||||
@@ -279,7 +346,33 @@
|
||||
|
||||
if (!itemstack.isEmpty() && canTakeItemFromContainer(ihopper, iinventory, itemstack, i, enumdirection)) {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
- ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
|
||||
+ // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
|
||||
int j = itemstack.getCount();
|
||||
- ItemStack itemstack1 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
|
||||
+ // CraftBukkit start - Call event on collection of items from inventories into the hopper
|
||||
+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.removeItem(i, 1));
|
||||
+
|
||||
@@ -129,11 +108,11 @@
|
||||
+ sourceInventory = new CraftInventory(iinventory);
|
||||
+ }
|
||||
+
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory, oitemstack.clone(), ihopper.getOwner().getInventory(), false);
|
||||
+ InventoryMoveItemEvent event = new InventoryMoveItemEvent(sourceInventory, oitemstack, ihopper.getOwner().getInventory(), false);
|
||||
+
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ iinventory.setItem(i, itemstack1);
|
||||
+ iinventory.setItem(i, itemstack);
|
||||
+
|
||||
+ if (ihopper instanceof TileEntityHopper) {
|
||||
+ ((TileEntityHopper) ihopper).setCooldown(8); // Delay hopper checks
|
||||
@@ -141,12 +120,12 @@
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+ ItemStack itemstack2 = addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||
+ ItemStack itemstack1 = addItem(iinventory, ihopper, CraftItemStack.asNMSCopy(event.getItem()), null);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack2.isEmpty()) {
|
||||
if (itemstack1.isEmpty()) {
|
||||
iinventory.setChanged();
|
||||
@@ -241,13 +337,20 @@
|
||||
@@ -297,13 +390,20 @@
|
||||
|
||||
public static boolean addItem(IInventory iinventory, EntityItem entityitem) {
|
||||
boolean flag = false;
|
||||
@@ -168,7 +147,7 @@
|
||||
} else {
|
||||
entityitem.setItem(itemstack1);
|
||||
}
|
||||
@@ -367,16 +470,40 @@
|
||||
@@ -421,14 +521,38 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -183,13 +162,11 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Nullable
|
||||
private static IInventory getAttachedContainer(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockHopper.FACING);
|
||||
|
||||
- return getContainerAt(world, blockposition.relative(enumdirection));
|
||||
private static IInventory getAttachedContainer(World world, BlockPosition blockposition, TileEntityHopper tileentityhopper) {
|
||||
- return getContainerAt(world, blockposition.relative(tileentityhopper.facing));
|
||||
+ // CraftBukkit start
|
||||
+ BlockPosition searchPosition = blockposition.relative(enumdirection);
|
||||
+ IInventory inventory = getContainerAt(world, blockposition.relative(enumdirection));
|
||||
+ BlockPosition searchPosition = blockposition.relative(tileentityhopper.facing);
|
||||
+ IInventory inventory = getContainerAt(world, searchPosition);
|
||||
+
|
||||
+ CraftBlock hopper = CraftBlock.at(world, blockposition);
|
||||
+ CraftBlock searchBlock = CraftBlock.at(world, searchPosition);
|
||||
@@ -198,10 +175,10 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static IInventory getSourceContainer(World world, IHopper ihopper) {
|
||||
- return getContainerAt(world, ihopper.getLevelX(), ihopper.getLevelY() + 1.0D, ihopper.getLevelZ());
|
||||
private static IInventory getSourceContainer(World world, IHopper ihopper, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
- return getContainerAt(world, blockposition, iblockdata, ihopper.getLevelX(), ihopper.getLevelY() + 1.0D, ihopper.getLevelZ());
|
||||
+ // CraftBukkit start
|
||||
+ IInventory inventory = getContainerAt(world, ihopper.getLevelX(), ihopper.getLevelY() + 1.0D, ihopper.getLevelZ());
|
||||
+ IInventory inventory = getContainerAt(world, blockposition, iblockdata, ihopper.getLevelX(), ihopper.getLevelY() + 1.0D, ihopper.getLevelZ());
|
||||
+
|
||||
+ BlockPosition blockPosition = BlockPosition.containing(ihopper.getLevelX(), ihopper.getLevelY(), ihopper.getLevelZ());
|
||||
+ CraftBlock hopper = CraftBlock.at(world, blockPosition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
|
||||
@@ -22,6 +22,14 @@
|
||||
@@ -24,6 +24,14 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem {
|
||||
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem.a {
|
||||
|
||||
private static final int SONG_END_PADDING = 20;
|
||||
@@ -30,6 +38,42 @@
|
||||
@@ -32,6 +40,42 @@
|
||||
public long tickCount;
|
||||
public long recordStartedTick;
|
||||
public boolean isPlaying;
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
|
||||
@@ -150,7 +194,7 @@
|
||||
@@ -154,7 +198,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -203,7 +247,11 @@
|
||||
@@ -206,7 +250,11 @@
|
||||
@VisibleForTesting
|
||||
public void setRecordWithoutPlaying(ItemStack itemstack) {
|
||||
this.item = itemstack;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityLectern.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityLectern.java
|
||||
@@ -25,13 +25,72 @@
|
||||
@@ -29,13 +29,72 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
return 1;
|
||||
@@ -76,11 +135,20 @@
|
||||
@@ -80,11 +139,20 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +98,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,7 +228,7 @@
|
||||
@@ -164,7 +232,7 @@
|
||||
if (j != this.page) {
|
||||
this.page = j;
|
||||
this.setChanged();
|
||||
@@ -107,7 +107,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -183,6 +251,32 @@
|
||||
@@ -187,6 +255,32 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman) {
|
||||
String s;
|
||||
Object object;
|
||||
@@ -197,7 +291,8 @@
|
||||
@@ -201,7 +295,8 @@
|
||||
|
||||
Vec3D vec3d = Vec3D.atCenterOf(this.worldPosition);
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -235,7 +330,7 @@
|
||||
@@ -239,7 +334,7 @@
|
||||
|
||||
@Override
|
||||
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntityShulkerBox.java
|
||||
@@ -32,6 +32,11 @@
|
||||
@@ -34,6 +34,11 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class TileEntityShulkerBox extends TileEntityLootable implements IWorldInventory {
|
||||
|
||||
public static final int COLUMNS = 9;
|
||||
@@ -51,6 +56,37 @@
|
||||
@@ -52,6 +57,37 @@
|
||||
@Nullable
|
||||
private final EnumColor color;
|
||||
|
||||
@@ -50,19 +50,19 @@
|
||||
public TileEntityShulkerBox(@Nullable EnumColor enumcolor, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
super(TileEntityTypes.SHULKER_BOX, blockposition, iblockdata);
|
||||
this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
@@ -172,6 +208,7 @@
|
||||
@@ -173,6 +209,7 @@
|
||||
}
|
||||
|
||||
++this.openCount;
|
||||
+ if (opened) return; // CraftBukkit - only animate if the ShulkerBox hasn't been forced open already by an API call.
|
||||
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);
|
||||
if (this.openCount == 1) {
|
||||
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, this.worldPosition);
|
||||
@@ -185,6 +222,7 @@
|
||||
this.level.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_OPEN, this.worldPosition);
|
||||
@@ -186,6 +223,7 @@
|
||||
public void stopOpen(EntityHuman entityhuman) {
|
||||
if (!this.remove && !entityhuman.isSpectator()) {
|
||||
--this.openCount;
|
||||
+ if (opened) return; // CraftBukkit - only animate if the ShulkerBox hasn't been forced open already by an API call.
|
||||
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);
|
||||
if (this.openCount <= 0) {
|
||||
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_CLOSE, this.worldPosition);
|
||||
this.level.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_CLOSE, this.worldPosition);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
|
||||
@@ -33,7 +33,17 @@
|
||||
@@ -36,7 +36,17 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -19,25 +19,25 @@
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TEXT_LINE_WIDTH = 90;
|
||||
@@ -98,7 +108,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
|
||||
@@ -101,7 +111,7 @@
|
||||
protected void saveAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
super.saveAdditional(nbttagcompound, holderlookup_a);
|
||||
DynamicOps<NBTBase> dynamicops = holderlookup_a.createSerializationContext(DynamicOpsNBT.INSTANCE);
|
||||
- DataResult dataresult = SignText.DIRECT_CODEC.encodeStart(dynamicops, this.frontText);
|
||||
+ DataResult<NBTBase> dataresult = SignText.DIRECT_CODEC.encodeStart(dynamicops, this.frontText); // CraftBukkit - decompile error
|
||||
Logger logger = TileEntitySign.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -117,7 +127,7 @@
|
||||
@Override
|
||||
public void load(NBTTagCompound nbttagcompound) {
|
||||
super.load(nbttagcompound);
|
||||
@@ -121,7 +131,7 @@
|
||||
protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
|
||||
super.loadAdditional(nbttagcompound, holderlookup_a);
|
||||
DynamicOps<NBTBase> dynamicops = holderlookup_a.createSerializationContext(DynamicOpsNBT.INSTANCE);
|
||||
- DataResult dataresult;
|
||||
+ DataResult<SignText> dataresult; // CraftBukkit - decompile error
|
||||
Logger logger;
|
||||
|
||||
if (nbttagcompound.contains("front_text")) {
|
||||
@@ -171,12 +181,13 @@
|
||||
@@ -173,12 +183,13 @@
|
||||
public void updateSignText(EntityHuman entityhuman, boolean flag, List<FilteredText> list) {
|
||||
if (!this.isWaxed() && entityhuman.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) {
|
||||
this.updateText((signtext) -> {
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +197,8 @@
|
||||
@@ -188,7 +199,8 @@
|
||||
return this.setText((SignText) unaryoperator.apply(signtext), flag);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
FilteredText filteredtext = (FilteredText) list.get(i);
|
||||
ChatModifier chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
|
||||
@@ -198,6 +210,29 @@
|
||||
@@ -200,6 +212,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
return signtext;
|
||||
}
|
||||
|
||||
@@ -248,11 +283,37 @@
|
||||
@@ -250,11 +285,37 @@
|
||||
return flag1;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -276,12 +337,17 @@
|
||||
@@ -278,12 +339,17 @@
|
||||
|
||||
@Nullable
|
||||
public UUID getPlayerWhoMayEdit() {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/world/level/block/entity/TileEntitySkull.java
|
||||
+++ b/net/minecraft/world/level/block/entity/TileEntitySkull.java
|
||||
@@ -194,6 +194,16 @@
|
||||
|
||||
if (!SystemUtils.isBlank(s)) {
|
||||
resolveGameProfile(nbttagcompound, s);
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ net.minecraft.nbt.NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts
|
||||
+ for (int i = 0; i < textures.size(); i++) {
|
||||
+ if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).contains("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) {
|
||||
+ nbttagcompound.remove("SkullOwner");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
@@ -179,13 +179,13 @@
|
||||
}
|
||||
|
||||
public void resetAfterBecomingOminous(TrialSpawner trialspawner, WorldServer worldserver) {
|
||||
- Stream stream = this.currentMobs.stream();
|
||||
+ Stream<UUID> stream = this.currentMobs.stream(); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(worldserver);
|
||||
stream.map(worldserver::getEntity).forEach((entity) -> {
|
||||
if (entity != null) {
|
||||
worldserver.levelEvent(3012, entity.blockPosition(), TrialSpawner.a.NORMAL.encode());
|
||||
- entity.remove(Entity.RemovalReason.DISCARDED);
|
||||
+ entity.remove(Entity.RemovalReason.DISCARDED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - Add bukkit remove cause;
|
||||
}
|
||||
});
|
||||
if (!trialspawner.getOminousConfig().spawnPotentialsDefinition().isEmpty()) {
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
|
||||
+++ b/net/minecraft/world/level/block/grower/WorldGenTreeProvider.java
|
||||
@@ -25,6 +25,12 @@
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.WorldGenFeatureConfigured;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
public final class WorldGenTreeProvider {
|
||||
|
||||
private static final Map<String, WorldGenTreeProvider> GROWERS = new Object2ObjectArrayMap();
|
||||
@@ -75,21 +81,22 @@
|
||||
@@ -74,21 +80,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
for (int i = 0; i >= -1; --i) {
|
||||
for (int j = 0; j >= -1; --j) {
|
||||
if (isTwoByTwoSapling(iblockdata, worldserver, blockposition, i, j)) {
|
||||
@@ -120,11 +127,12 @@
|
||||
@@ -119,11 +126,12 @@
|
||||
if (resourcekey1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -53,7 +53,7 @@
|
||||
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured1 = (WorldGenFeatureConfigured) holder1.value();
|
||||
IBlockData iblockdata2 = worldserver.getFluidState(blockposition).createLegacyBlock();
|
||||
|
||||
@@ -165,11 +173,62 @@
|
||||
@@ -164,11 +172,62 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,4 +117,4 @@
|
||||
+ Map<String, WorldGenTreeProvider> map = WorldGenTreeProvider.GROWERS; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(map);
|
||||
CODEC = ExtraCodecs.stringResolverCodec(function, map::get);
|
||||
CODEC = Codec.stringResolver(function, map::get);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/piston/BlockPiston.java
|
||||
+++ b/net/minecraft/world/level/block/piston/BlockPiston.java
|
||||
@@ -41,6 +41,14 @@
|
||||
@@ -42,6 +42,14 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class BlockPiston extends BlockDirectional {
|
||||
|
||||
public static final MapCodec<BlockPiston> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
|
||||
@@ -151,6 +159,18 @@
|
||||
@@ -152,6 +160,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
world.blockEvent(blockposition, this, b0, enumdirection.get3DDataValue());
|
||||
}
|
||||
|
||||
@@ -331,6 +351,48 @@
|
||||
@@ -332,6 +352,48 @@
|
||||
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
|
||||
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.getOpposite();
|
||||
int i = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/block/state/BlockBase.java
|
||||
+++ b/net/minecraft/world/level/block/state/BlockBase.java
|
||||
@@ -188,8 +188,10 @@
|
||||
@@ -174,8 +174,10 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition) : null;
|
||||
LootParams.a lootparams_a = (new LootParams.a(worldserver)).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, explosion.getDirectSourceEntity());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user