Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
@@ -46,6 +46,11 @@
@@ -47,6 +47,11 @@
@Override
protected void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -43,6 +43,11 @@
@@ -45,6 +45,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -12,7 +12,7 @@
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new);
@@ -117,7 +122,7 @@
@@ -119,7 +124,7 @@
@Override
protected void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
@@ -21,7 +21,7 @@
}
@Override
@@ -176,7 +181,20 @@
@@ -178,7 +183,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)) {
@@ -43,7 +43,7 @@
}
}
@@ -190,9 +208,9 @@
@@ -192,9 +210,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);
}
@@ -218,8 +236,10 @@
@@ -220,8 +238,10 @@
return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
}
@@ -68,7 +68,7 @@
if (soundeffect != null) {
playTiltSound(world, blockposition, soundeffect);
}
@@ -233,14 +253,21 @@
@@ -235,14 +255,21 @@
}
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -92,7 +92,7 @@
Tilt tilt1 = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
@@ -248,6 +275,7 @@
@@ -250,6 +277,7 @@
world.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_CHANGE, blockposition);
}

View File

@@ -1,21 +1,21 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -340,7 +340,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
- world.addFreshEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addFreshEntity(entityitem);
+ }
+ // CraftBukkit end
entityitem.setDefaultPickUpDelay();
- world.addFreshEntity(entityitem);
+ // CraftBukkit start
+ if (world.captureDrops != null) {
+ world.captureDrops.add(entityitem);
+ } else {
+ world.addFreshEntity(entityitem);
+ }
+ // CraftBukkit end
return;
}
}
}
@@ -366,7 +372,7 @@
@@ -369,7 +375,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);
}
@@ -499,15 +505,23 @@
@@ -494,15 +500,23 @@
return this.builtInRegistryHolder;
}
@@ -47,6 +47,6 @@
+ }
+ // CraftBukkit end
+
public static final class a {
private static record a(VoxelShape first, VoxelShape second) {
private final IBlockData first;
public boolean equals(Object object) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBamboo.java
+++ b/net/minecraft/world/level/block/BlockBamboo.java
@@ -187,7 +187,7 @@
@@ -183,7 +183,7 @@
BlockPosition blockposition1 = blockposition.above(i);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
@@ -9,7 +9,7 @@
return;
}
@@ -208,14 +208,18 @@
@@ -204,14 +204,18 @@
BlockPosition blockposition1 = blockposition.below(2);
IBlockData iblockdata2 = world.getBlockState(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@@ -30,7 +30,7 @@
}
}
} else {
@@ -226,7 +230,14 @@
@@ -222,7 +226,14 @@
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
int k = (i < 11 || randomsource.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBambooSapling.java
+++ b/net/minecraft/world/level/block/BlockBambooSapling.java
@@ -95,6 +95,6 @@
@@ -87,6 +87,6 @@
}
protected void growBamboo(World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBed.java
+++ b/net/minecraft/world/level/block/BlockBed.java
@@ -93,7 +93,8 @@
@@ -95,7 +95,8 @@
}
}
@@ -10,9 +10,9 @@
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -112,7 +113,16 @@
@@ -114,7 +115,16 @@
return EnumInteractionResult.SUCCESS;
return EnumInteractionResult.SUCCESS_SERVER;
} else {
+ // CraftBukkit start
+ IBlockData finaliblockdata = iblockdata;
@@ -27,7 +27,7 @@
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -123,8 +133,30 @@
@@ -125,8 +135,30 @@
}
}
@@ -59,7 +59,7 @@
}
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
@@ -323,6 +355,11 @@
@@ -325,6 +357,11 @@
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBeehive.java
+++ b/net/minecraft/world/level/block/BlockBeehive.java
@@ -119,7 +119,7 @@
@@ -133,7 +133,7 @@
if (entitybee.getTarget() == null) {
EntityHuman entityhuman = (EntityHuman) SystemUtils.getRandom(list1, world.random);
@@ -9,12 +9,12 @@
}
}
}
@@ -287,7 +287,7 @@
ItemStack itemstack = new ItemStack(this);
@@ -302,7 +302,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);
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();
entityitem.setDefaultPickUpDelay();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBell.java
+++ b/net/minecraft/world/level/block/BlockBell.java
@@ -146,6 +146,11 @@
@@ -148,6 +148,11 @@
if (enumdirection == null) {
enumdirection = (EnumDirection) world.getBlockState(blockposition).getValue(BlockBell.FACING);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
@@ -33,6 +33,11 @@
@@ -35,6 +35,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,7 +12,7 @@
public class BlockButtonAbstract extends BlockAttachable {
public static final MapCodec<BlockButtonAbstract> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -124,6 +129,19 @@
@@ -126,6 +131,19 @@
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
return EnumInteractionResult.CONSUME;
} else {
@@ -30,9 +30,9 @@
+ }
+ // CraftBukkit end
this.press(iblockdata, world, blockposition, entityhuman);
return EnumInteractionResult.sidedSuccess(world.isClientSide);
return EnumInteractionResult.SUCCESS;
}
@@ -195,11 +213,36 @@
@@ -197,11 +215,36 @@
}
protected void checkPressed(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCactus.java
+++ b/net/minecraft/world/level/block/BlockCactus.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 class BlockCactus extends Block {
public static final MapCodec<BlockCactus> CODEC = simpleCodec(BlockCactus::new);
@@ -64,7 +66,7 @@
@@ -65,7 +67,7 @@
int j = (Integer) iblockdata.getValue(BlockCactus.AGE);
if (j == 15) {
@@ -18,7 +18,7 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
worldserver.setBlock(blockposition, iblockdata1, 4);
@@ -119,7 +121,7 @@
@@ -120,7 +122,7 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCake.java
+++ b/net/minecraft/world/level/block/BlockCake.java
@@ -97,7 +97,18 @@
@@ -98,7 +98,18 @@
return EnumInteractionResult.PASS;
} else {
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCampfire.java
+++ b/net/minecraft/world/level/block/BlockCampfire.java
@@ -105,7 +105,7 @@
@@ -113,7 +113,7 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving) {
@@ -9,15 +9,15 @@
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -215,6 +215,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
@@ -224,6 +224,11 @@
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, iprojectile).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
if (world instanceof WorldServer worldserver) {
if (iprojectile.isOnFire() && iprojectile.mayInteract(worldserver, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, iprojectile).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockProperties.LIT, true), 11);
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChest.java
+++ b/net/minecraft/world/level/block/BlockChest.java
@@ -90,24 +90,7 @@
@@ -91,24 +91,7 @@
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
@@ -26,7 +26,7 @@
}
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
@@ -120,6 +103,38 @@
@@ -121,6 +104,38 @@
}
};
@@ -65,7 +65,7 @@
@Override
public MapCodec<? extends BlockChest> codec() {
return BlockChest.CODEC;
@@ -263,7 +278,7 @@
@@ -262,7 +277,7 @@
@Override
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
@@ -74,7 +74,7 @@
if (flag) {
bipredicate = (generatoraccess, blockposition1) -> {
@@ -279,7 +294,14 @@
@@ -278,7 +293,14 @@
@Nullable
@Override
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChorusFlower.java
+++ b/net/minecraft/world/level/block/BlockChorusFlower.java
@@ -22,6 +22,8 @@
@@ -23,6 +23,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -9,7 +9,7 @@
public class BlockChorusFlower extends Block {
public static final MapCodec<BlockChorusFlower> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -102,8 +104,12 @@
@@ -103,8 +105,12 @@
}
if (flag && allNeighborsEmpty(worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmptyBlock(blockposition.above(2))) {
@@ -24,7 +24,7 @@
} else if (i < 4) {
j = randomsource.nextInt(4);
if (flag1) {
@@ -117,18 +123,30 @@
@@ -118,18 +124,30 @@
BlockPosition blockposition2 = blockposition.relative(enumdirection);
if (worldserver.isEmptyBlock(blockposition2) && worldserver.isEmptyBlock(blockposition2.below()) && allNeighborsEmpty(worldserver, blockposition2, enumdirection.getOpposite())) {
@@ -59,15 +59,15 @@
}
}
@@ -265,6 +283,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
@@ -267,6 +285,11 @@
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true, iprojectile);
if (world instanceof WorldServer worldserver) {
if (iprojectile.mayInteract(worldserver, blockposition) && iprojectile.mayBreak(worldserver)) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true, iprojectile);
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
@@ -29,6 +29,8 @@
@@ -31,6 +31,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
@@ -9,19 +9,19 @@
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
public static final MapCodec<BlockCommand> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -69,6 +71,15 @@
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
boolean flag1 = world.hasNeighborSignal(blockposition);
boolean flag2 = tileentitycommand.isPowered();
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag2 ? 15 : 0;
+ int current = flag1 ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
@@ -78,6 +80,15 @@
tileentitycommand.setPowered(flag1);
if (!flag2 && !tileentitycommand.isAutomatic() && tileentitycommand.getMode() != TileEntityCommand.Type.SEQUENCE) {
private void setPoweredAndUpdate(World world, BlockPosition blockposition, TileEntityCommand tileentitycommand, boolean flag) {
boolean flag1 = tileentitycommand.isPowered();
+ // CraftBukkit start
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ flag = eventRedstone.getNewCurrent() > 0;
+ // CraftBukkit end
if (flag != flag1) {
tileentitycommand.setPowered(flag);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockComposter.java
+++ b/net/minecraft/world/level/block/BlockComposter.java
@@ -43,6 +43,11 @@
@@ -42,6 +42,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -12,7 +12,7 @@
public class BlockComposter extends Block implements IInventoryHolder {
public static final MapCodec<BlockComposter> CODEC = simpleCodec(BlockComposter::new);
@@ -263,7 +268,14 @@
@@ -267,7 +272,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;
@@ -273,6 +285,14 @@
@@ -277,6 +289,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));
@@ -296,10 +316,16 @@
@@ -300,10 +320,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;
@@ -348,7 +374,8 @@
@@ -352,7 +378,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 {
@@ -363,6 +390,7 @@
@@ -367,6 +394,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -79,7 +79,7 @@
}
@Override
@@ -387,8 +415,15 @@
@@ -391,8 +419,15 @@
@Override
public void setChanged() {
@@ -95,7 +95,7 @@
}
}
@@ -401,6 +436,7 @@
@@ -405,6 +440,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@@ -103,7 +103,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -443,8 +479,9 @@
@@ -447,8 +483,9 @@
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockConcretePowder.java
+++ b/net/minecraft/world/level/block/BlockConcretePowder.java
@@ -14,6 +14,12 @@
@@ -16,6 +16,12 @@
import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
@@ -13,7 +13,7 @@
public class BlockConcretePowder extends BlockFalling {
public static final MapCodec<BlockConcretePowder> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -36,7 +42,7 @@
@@ -38,7 +44,7 @@
@Override
public void onLand(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
if (shouldSolidify(world, blockposition, iblockdata1)) {
@@ -22,7 +22,7 @@
}
}
@@ -47,7 +53,24 @@
@@ -49,7 +55,24 @@
BlockPosition blockposition = blockactioncontext.getClickedPos();
IBlockData iblockdata = world.getBlockState(blockposition);
@@ -48,29 +48,29 @@
}
private static boolean shouldSolidify(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
@@ -83,7 +106,25 @@
@@ -85,7 +108,25 @@
@Override
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);
protected IBlockData updateShape(IBlockData iblockdata, IWorldReader iworldreader, ScheduledTickAccess scheduledtickaccess, BlockPosition blockposition, EnumDirection enumdirection, BlockPosition blockposition1, IBlockData iblockdata1, RandomSource randomsource) {
- return touchesLiquid(iworldreader, blockposition) ? this.concrete.defaultBlockState() : super.updateShape(iblockdata, iworldreader, scheduledtickaccess, blockposition, enumdirection, blockposition1, iblockdata1, randomsource);
+ // CraftBukkit start
+ if (touchesLiquid(generatoraccess, blockposition)) {
+ if (touchesLiquid(iworldreader, blockposition)) {
+ // Suppress during worldgen
+ if (!(generatoraccess instanceof World)) {
+ if (!(iworldreader instanceof World world)) {
+ return this.concrete.defaultBlockState();
+ }
+ CraftBlockState blockState = CraftBlockStates.getBlockState(generatoraccess, blockposition);
+ CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockposition);
+ blockState.setData(this.concrete.defaultBlockState());
+
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ }
+ }
+
+ return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
+ return super.updateShape(iblockdata, iworldreader, scheduledtickaccess, blockposition, enumdirection, blockposition1, iblockdata1, randomsource);
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoral.java
+++ b/net/minecraft/world/level/block/BlockCoral.java
@@ -39,6 +39,11 @@
@@ -40,6 +40,11 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!this.scanForWater(worldserver, blockposition)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoralFan.java
+++ b/net/minecraft/world/level/block/BlockCoralFan.java
@@ -40,6 +40,11 @@
@@ -41,6 +41,11 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoralFanWall.java
+++ b/net/minecraft/world/level/block/BlockCoralFanWall.java
@@ -40,6 +40,11 @@
@@ -41,6 +41,11 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoralPlant.java
+++ b/net/minecraft/world/level/block/BlockCoralPlant.java
@@ -45,6 +45,11 @@
@@ -46,6 +46,11 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!scanForWater(iblockdata, worldserver, blockposition)) {

View File

@@ -27,12 +27,12 @@
}
protected int getBonemealAgeIncrease(World world) {
@@ -160,7 +162,7 @@
@@ -161,7 +163,7 @@
@Override
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);
if (world instanceof WorldServer worldserver) {
- if (entity instanceof EntityRavager && worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ if (entity instanceof EntityRavager && CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) { // CraftBukkit
worldserver.destroyBlock(blockposition, true, entity);
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDiodeAbstract.java
+++ b/net/minecraft/world/level/block/BlockDiodeAbstract.java
@@ -21,6 +21,8 @@
@@ -24,6 +24,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.ticks.TickListPriority;
@@ -9,7 +9,7 @@
public abstract class BlockDiodeAbstract extends BlockFacingHorizontal {
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
@@ -56,8 +58,18 @@
@@ -59,8 +61,18 @@
boolean flag1 = this.shouldTurnOn(worldserver, blockposition, iblockdata);
if (flag && !flag1) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/block/BlockDispenser.java
+++ b/net/minecraft/world/level/block/BlockDispenser.java
@@ -51,6 +51,7 @@
object2objectopenhashmap.defaultReturnValue(BlockDispenser.DEFAULT_BEHAVIOR);
});
@@ -52,6 +52,7 @@
private static final DispenseBehaviorItem DEFAULT_BEHAVIOR = new DispenseBehaviorItem();
public static final Map<Item, IDispenseBehavior> DISPENSER_REGISTRY = new IdentityHashMap();
private static final int TRIGGER_DURATION = 4;
+ public static boolean eventFired = false; // CraftBukkit
@Override
public MapCodec<? extends BlockDispenser> codec() {
@@ -91,7 +92,7 @@
@@ -88,7 +89,7 @@
}
public void dispenseFrom(WorldServer worldserver, IBlockData iblockdata, BlockPosition blockposition) {
@@ -17,7 +17,7 @@
if (tileentitydispenser == null) {
BlockDispenser.LOGGER.warn("Ignoring dispensing attempt for Dispenser without matching block entity at {}", blockposition);
@@ -107,6 +108,7 @@
@@ -104,6 +105,7 @@
IDispenseBehavior idispensebehavior = this.getDispenseMethod(worldserver, itemstack);
if (idispensebehavior != IDispenseBehavior.NOOP) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDoor.java
+++ b/net/minecraft/world/level/block/BlockDoor.java
@@ -37,6 +37,8 @@
@@ -39,6 +39,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,10 +9,10 @@
public class BlockDoor extends Block {
public static final MapCodec<BlockDoor> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -220,9 +222,24 @@
@@ -222,9 +224,24 @@
@Override
protected 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, @Nullable Orientation orientation, 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);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockEndGateway.java
+++ b/net/minecraft/world/level/block/BlockEndGateway.java
@@ -21,6 +21,10 @@
import net.minecraft.world.level.portal.DimensionTransition;
@@ -23,6 +23,10 @@
import net.minecraft.world.level.portal.TeleportTransition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
@@ -11,12 +11,12 @@
public class BlockEndGateway extends BlockTileEntity implements Portal {
public static final MapCodec<BlockEndGateway> CODEC = simpleCodec(BlockEndGateway::new);
@@ -110,7 +114,7 @@
@@ -112,7 +116,7 @@
if (tileentity instanceof TileEntityEndGateway tileentityendgateway) {
Vec3D vec3d = tileentityendgateway.getPortalPosition(worldserver, blockposition);
- return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET) : null;
+ return vec3d != null ? new DimensionTransition(worldserver, vec3d, calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY) : null; // CraftBukkit
- return vec3d == null ? null : (entity instanceof EntityEnderPearl ? new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET) : new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET));
+ return vec3d == null ? null : (entity instanceof EntityEnderPearl ? new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Set.of(), TeleportTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY) : new TeleportTransition(worldserver, vec3d, Vec3D.ZERO, 0.0F, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), TeleportTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY)); // CraftBukkit
} else {
return null;
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BlockEnderPortal.java
+++ b/net/minecraft/world/level/block/BlockEnderPortal.java
@@ -26,6 +26,19 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
+// CraftBukkit start
+import java.util.List;
@@ -20,10 +20,10 @@
public class BlockEnderPortal extends BlockTileEntity implements Portal {
public static final MapCodec<BlockEnderPortal> CODEC = simpleCodec(BlockEnderPortal::new);
@@ -53,6 +66,10 @@
@@ -58,6 +71,10 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (entity.canUsePortal(false) && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
if (entity.canUsePortal(false)) {
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);
@@ -31,41 +31,41 @@
if (!world.isClientSide && world.dimension() == World.END && entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
@@ -69,11 +86,11 @@
@@ -74,11 +91,11 @@
@Override
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
public TeleportTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
- ResourceKey<World> resourcekey = worldserver.dimension() == World.END ? World.OVERWORLD : World.END;
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
WorldServer worldserver1 = worldserver.getServer().getLevel(resourcekey);
if (worldserver1 == null) {
- return null;
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit- always fire event in case plugins wish to change it
+ return new TeleportTransition(PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit- always fire event in case plugins wish to change it
} else {
boolean flag = resourcekey == World.END;
BlockPosition blockposition1 = flag ? WorldServer.END_SPAWN_POINT : worldserver1.getSharedSpawnPos();
@@ -81,7 +98,7 @@
float f = entity.getYRot();
@@ -87,7 +104,7 @@
Set set;
if (flag) {
- EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true);
+ EndPlatformFeature.createEndPlatform(worldserver1, BlockPosition.containing(vec3d).below(), true, entity); // CraftBukkit
f = EnumDirection.WEST.toYRot();
set = Relative.union(Relative.DELTA, Set.of(Relative.X_ROT));
if (entity instanceof EntityPlayer) {
vec3d = vec3d.subtract(0.0D, 1.0D, 0.0D);
@@ -90,13 +107,21 @@
@@ -99,13 +116,21 @@
if (entity instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) entity;
- return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING);
+ return entityplayer.findRespawnPositionAndUseSpawnBlock(false, DimensionTransition.DO_NOTHING, PlayerRespawnEvent.RespawnReason.END_PORTAL); // CraftBukkit
- return entityplayer.findRespawnPositionAndUseSpawnBlock(false, TeleportTransition.DO_NOTHING);
+ return entityplayer.findRespawnPositionAndUseSpawnBlock(false, TeleportTransition.DO_NOTHING, PlayerRespawnEvent.RespawnReason.END_PORTAL); // CraftBukkit
}
vec3d = entity.adjustSpawnLocation(worldserver1, blockposition1).getBottomCenter();
}
- return new DimensionTransition(worldserver1, vec3d, entity.getDeltaMovement(), f, entity.getXRot(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET));
- return new TeleportTransition(worldserver1, vec3d, Vec3D.ZERO, f, 0.0F, set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET));
+ // CraftBukkit start
+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f, entity.getXRot()), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
+ if (event == null) {
@@ -73,7 +73,7 @@
+ }
+ Location to = event.getTo();
+
+ return new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), entity.getDeltaMovement(), to.getYaw(), to.getPitch(), DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET), PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ return new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), entity.getDeltaMovement(), to.getYaw(), to.getPitch(), set, TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET), PlayerTeleportEvent.TeleportCause.END_PORTAL);
+ // CraftBukkit end
}
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockFenceGate.java
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
@@ -168,6 +168,17 @@
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
@@ -173,6 +173,17 @@
protected void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, @Nullable Orientation orientation, boolean flag) {
if (!world.isClientSide) {
boolean flag1 = world.hasNeighborSignal(blockposition);
+ // CraftBukkit start

View File

@@ -19,25 +19,25 @@
@@ -100,7 +109,24 @@
@Override
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();
protected IBlockData updateShape(IBlockData iblockdata, IWorldReader iworldreader, ScheduledTickAccess scheduledtickaccess, BlockPosition blockposition, EnumDirection enumdirection, BlockPosition blockposition1, IBlockData iblockdata1, RandomSource randomsource) {
- return this.canSurvive(iblockdata, iworldreader, blockposition) ? this.getStateWithAge(iworldreader, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE)) : Blocks.AIR.defaultBlockState();
+ // CraftBukkit start
+ if (!this.canSurvive(iblockdata, generatoraccess, blockposition)) {
+ if (!this.canSurvive(iblockdata, iworldreader, blockposition)) {
+ // Suppress during worldgen
+ if (!(generatoraccess instanceof World)) {
+ if (!(iworldreader instanceof World world)) {
+ return Blocks.AIR.defaultBlockState();
+ }
+ CraftBlockState blockState = CraftBlockStates.getBlockState(generatoraccess, blockposition);
+ CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockposition);
+ blockState.setData(Blocks.AIR.defaultBlockState());
+
+ BlockFadeEvent event = new BlockFadeEvent(blockState.getBlock(), blockState);
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ return blockState.getHandle();
+ }
+ }
+ return this.getStateWithAge(generatoraccess, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE));
+ return this.getStateWithAge(iworldreader, blockposition, (Integer) iblockdata.getValue(BlockFire.AGE));
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFireAbstract.java
+++ b/net/minecraft/world/level/block/BlockFireAbstract.java
@@ -19,6 +19,10 @@
@@ -20,6 +20,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,10 +11,10 @@
public abstract class BlockFireAbstract extends Block {
private static final int SECONDS_ON_FIRE = 8;
@@ -127,7 +131,14 @@
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
@@ -137,7 +141,14 @@
}
if (entity.getRemainingFireTicks() >= 0) {
- entity.igniteForSeconds(8.0F);
+ // 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.0F);
@@ -27,7 +27,7 @@
}
}
@@ -136,26 +147,26 @@
@@ -146,26 +157,26 @@
}
@Override
@@ -38,8 +38,8 @@
Optional<BlockPortalShape> optional = BlockPortalShape.findEmptyPortalShape(world, blockposition, EnumDirection.EnumAxis.X);
if (optional.isPresent()) {
- ((BlockPortalShape) optional.get()).createPortalBlocks();
+ ((BlockPortalShape) optional.get()).createPortalBlocks((context == null) ? null : context.getPlayer()); // CraftBukkit - player
- ((BlockPortalShape) optional.get()).createPortalBlocks(world);
+ ((BlockPortalShape) optional.get()).createPortalBlocks(world, (context == null) ? null : context.getPlayer()); // CraftBukkit - player
return;
}
}
@@ -58,7 +58,7 @@
}
@Override
@@ -203,4 +214,12 @@
@@ -213,4 +224,12 @@
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFluids.java
+++ b/net/minecraft/world/level/block/BlockFluids.java
@@ -39,7 +39,7 @@
@@ -42,7 +42,7 @@
public class BlockFluids extends Block implements IFluidSource {
private static final Codec<FluidTypeFlowing> FLOWING_FLUID = BuiltInRegistries.FLUID.byNameCodec().comapFlatMap((fluidtype) -> {
@@ -9,7 +9,7 @@
if (fluidtype instanceof FluidTypeFlowing fluidtypeflowing) {
dataresult = DataResult.success(fluidtypeflowing);
@@ -172,14 +172,20 @@
@@ -175,14 +175,20 @@
if (world.getFluidState(blockposition1).is(TagsFluid.WATER)) {
Block block = world.getFluidState(blockposition).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockIce.java
+++ b/net/minecraft/world/level/block/BlockIce.java
@@ -59,6 +59,11 @@
@@ -60,6 +60,11 @@
}
protected void melt(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLeaves.java
+++ b/net/minecraft/world/level/block/BlockLeaves.java
@@ -25,6 +25,8 @@
@@ -27,6 +27,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -9,7 +9,7 @@
public class BlockLeaves extends Block implements IBlockWaterlogged {
public static final MapCodec<BlockLeaves> CODEC = simpleCodec(BlockLeaves::new);
@@ -57,6 +59,14 @@
@@ -59,6 +61,14 @@
@Override
protected void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (this.decaying(iblockdata)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLectern.java
+++ b/net/minecraft/world/level/block/BlockLectern.java
@@ -208,11 +208,12 @@
@@ -211,11 +211,12 @@
}
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLever.java
+++ b/net/minecraft/world/level/block/BlockLever.java
@@ -29,6 +29,8 @@
@@ -32,6 +32,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,9 +9,9 @@
public class BlockLever extends BlockAttachable {
public static final MapCodec<BlockLever> CODEC = simpleCodec(BlockLever::new);
@@ -101,6 +103,20 @@
return EnumInteractionResult.SUCCESS;
@@ -102,6 +104,20 @@
makeParticle(iblockdata1, world, blockposition, 1.0F);
}
} else {
+ // CraftBukkit start - Interact Lever
+ boolean powered = iblockdata.getValue(BlockLever.POWERED); // Old powered state
@@ -28,5 +28,5 @@
+ // CraftBukkit end
+
this.pull(iblockdata, world, blockposition, (EntityHuman) null);
return EnumInteractionResult.CONSUME;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMagma.java
+++ b/net/minecraft/world/level/block/BlockMagma.java
@@ -29,7 +29,7 @@
@@ -30,7 +30,7 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving) {

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockMinecartDetector.java
+++ b/net/minecraft/world/level/block/BlockMinecartDetector.java
@@ -26,6 +26,8 @@
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -27,6 +27,8 @@
import net.minecraft.world.level.redstone.Orientation;
import net.minecraft.world.phys.AxisAlignedBB;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
@@ -9,7 +9,7 @@
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final MapCodec<BlockMinecartDetector> CODEC = simpleCodec(BlockMinecartDetector::new);
@@ -87,6 +89,16 @@
@@ -88,6 +90,16 @@
}
IBlockData iblockdata1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMonsterEggs.java
+++ b/net/minecraft/world/level/block/BlockMonsterEggs.java
@@ -19,6 +19,8 @@
@@ -20,6 +20,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -9,7 +9,7 @@
public class BlockMonsterEggs extends Block {
public static final MapCodec<BlockMonsterEggs> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -53,7 +55,7 @@
@@ -54,7 +56,7 @@
if (entitysilverfish != null) {
entitysilverfish.moveTo((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, 0.0F, 0.0F);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -83,6 +83,7 @@
@@ -85,6 +85,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);
@@ -92,6 +93,12 @@
@@ -94,6 +95,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()) {

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/block/BlockObserver.java
+++ b/net/minecraft/world/level/block/BlockObserver.java
@@ -15,6 +15,8 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
@@ -18,6 +18,8 @@
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
import net.minecraft.world.level.redstone.Orientation;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockObserver extends BlockDirectional {
public static final MapCodec<BlockObserver> CODEC = simpleCodec(BlockObserver::new);
@@ -48,8 +50,18 @@
@@ -51,8 +53,18 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockObserver.POWERED)) {

View File

@@ -1,17 +1,29 @@
--- a/net/minecraft/world/level/block/BlockPlant.java
+++ b/net/minecraft/world/level/block/BlockPlant.java
@@ -26,7 +26,14 @@
@@ -12,6 +12,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.pathfinder.PathMode;
+// CraftBukkit start
+import net.minecraft.world.level.World;
+// CraftBukkit end
+
public abstract class BlockPlant extends Block {
protected BlockPlant(BlockBase.Info blockbase_info) {
@@ -27,7 +31,15 @@
@Override
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);
protected IBlockData updateShape(IBlockData iblockdata, IWorldReader iworldreader, ScheduledTickAccess scheduledtickaccess, BlockPosition blockposition, EnumDirection enumdirection, BlockPosition blockposition1, IBlockData iblockdata1, RandomSource randomsource) {
- return !iblockdata.canSurvive(iworldreader, blockposition) ? Blocks.AIR.defaultBlockState() : super.updateShape(iblockdata, iworldreader, scheduledtickaccess, blockposition, enumdirection, blockposition1, iblockdata1, randomsource);
+ // CraftBukkit start
+ if (!iblockdata.canSurvive(generatoraccess, blockposition)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) {
+ if (!iblockdata.canSurvive(iworldreader, blockposition)) {
+ // Suppress during worldgen
+ if (!(iworldreader instanceof World world) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
+ return Blocks.AIR.defaultBlockState();
+ }
+ }
+ return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
+ return super.updateShape(iblockdata, iworldreader, scheduledtickaccess, blockposition, enumdirection, blockposition1, iblockdata1, randomsource);
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPortal.java
+++ b/net/minecraft/world/level/block/BlockPortal.java
@@ -38,6 +38,15 @@
@@ -39,6 +39,15 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import org.slf4j.Logger;
@@ -16,17 +16,17 @@
public class BlockPortal extends Block implements Portal {
public static final MapCodec<BlockPortal> CODEC = simpleCodec(BlockPortal::new);
@@ -76,7 +85,8 @@
@@ -77,7 +86,8 @@
}
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE);
- Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EntitySpawnReason.STRUCTURE);
+ // CraftBukkit - set spawn reason to NETHER_PORTAL
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EnumMobSpawn.STRUCTURE, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
+ Entity entity = EntityTypes.ZOMBIFIED_PIGLIN.spawn(worldserver, blockposition.above(), EntitySpawnReason.STRUCTURE, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL);
if (entity != null) {
entity.setPortalCooldown();
@@ -98,6 +108,10 @@
@@ -104,6 +114,10 @@
@Override
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (entity.canUsePortal(false)) {
@@ -37,10 +37,10 @@
entity.setAsInsidePortal(this, blockposition);
}
@@ -115,24 +129,34 @@
@@ -121,24 +135,34 @@
@Nullable
@Override
public DimensionTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
public TeleportTransition getPortalDestination(WorldServer worldserver, Entity entity, BlockPosition blockposition) {
- ResourceKey<World> resourcekey = worldserver.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
+ // CraftBukkit start
+ ResourceKey<World> resourcekey = worldserver.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER;
@@ -48,7 +48,7 @@
if (worldserver1 == null) {
- return null;
+ return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it
+ return new TeleportTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it
} else {
- boolean flag = worldserver1.dimension() == World.NETHER;
+ boolean flag = worldserver1.getTypeKey() == WorldDimension.NETHER;
@@ -71,15 +71,15 @@
}
@Nullable
- private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder) {
- private TeleportTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder) {
- Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, flag, worldborder);
+ private DimensionTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
+ private TeleportTransition getExitPortal(WorldServer worldserver, Entity entity, BlockPosition blockposition, BlockPosition blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
+ Optional<BlockPosition> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, worldborder, searchRadius);
BlockUtil.Rectangle blockutil_rectangle;
DimensionTransition.a dimensiontransition_a;
TeleportTransition.a teleporttransition_a;
@@ -146,17 +170,22 @@
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then((entity1) -> {
@@ -152,17 +176,22 @@
teleporttransition_a = TeleportTransition.PLAY_PORTAL_SOUND.then((entity1) -> {
entity1.placePortalTicket(blockposition2);
});
- } else {
@@ -96,20 +96,20 @@
}
blockutil_rectangle = (BlockUtil.Rectangle) optional1.get();
dimensiontransition_a = DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET);
teleporttransition_a = TeleportTransition.PLAY_PORTAL_SOUND.then(TeleportTransition.PLACE_PORTAL_TICKET);
+ // CraftBukkit start
+ } else {
+ return null;
+ // CraftBukkit end
}
return getDimensionTransitionFromExit(entity, blockposition, blockutil_rectangle, worldserver, dimensiontransition_a);
@@ -198,7 +227,7 @@
Vec3D vec3d3 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
Vec3D vec3d4 = BlockPortalShape.findCollisionFreePosition(vec3d3, worldserver, entity, entitysize);
return getDimensionTransitionFromExit(entity, blockposition, blockutil_rectangle, worldserver, teleporttransition_a);
@@ -203,7 +232,7 @@
Vec3D vec3d1 = new Vec3D((double) blockposition.getX() + (flag ? d2 : d4), (double) blockposition.getY() + d3, (double) blockposition.getZ() + (flag ? d4 : d2));
Vec3D vec3d2 = BlockPortalShape.findCollisionFreePosition(vec3d1, worldserver, entity, entitysize);
- return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a);
+ return new DimensionTransition(worldserver, vec3d4, vec3d2, f + (float) i, f1, dimensiontransition_a, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit
- return new TeleportTransition(worldserver, vec3d2, Vec3D.ZERO, (float) i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), teleporttransition_a);
+ return new TeleportTransition(worldserver, vec3d2, Vec3D.ZERO, (float) i, 0.0F, Relative.union(Relative.DELTA, Relative.ROTATION), teleporttransition_a, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // CraftBukkit
}
@Override

View File

@@ -22,4 +22,4 @@
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockPoweredRail.POWERED, flag1), 3);
world.updateNeighborsAt(blockposition.below(), this);
if (((BlockPropertyTrackPosition) iblockdata.getValue(BlockPoweredRail.SHAPE)).isAscending()) {
if (((BlockPropertyTrackPosition) iblockdata.getValue(BlockPoweredRail.SHAPE)).isSlope()) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BlockPumpkinCarved.java
+++ b/net/minecraft/world/level/block/BlockPumpkinCarved.java
@@ -24,6 +24,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
import net.minecraft.world.level.block.state.properties.BlockStateDirection;
import net.minecraft.world.level.block.state.properties.BlockStateEnum;
+// CraftBukkit start
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@@ -11,7 +11,7 @@
public class BlockPumpkinCarved extends BlockFacingHorizontal {
public static final MapCodec<BlockPumpkinCarved> CODEC = simpleCodec(BlockPumpkinCarved::new);
@@ -86,9 +90,14 @@
@@ -87,9 +91,14 @@
}
private static void spawnGolemInWorld(World world, ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection, Entity entity, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockRedstoneComparator.java
+++ b/net/minecraft/world/level/block/BlockRedstoneComparator.java
@@ -27,6 +27,8 @@
@@ -28,6 +28,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);
@@ -109,7 +111,8 @@
@@ -110,7 +112,8 @@
@Nullable
private EntityItemFrame getItemFrame(World world, EnumDirection enumdirection, BlockPosition blockposition) {
@@ -19,7 +19,7 @@
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
});
@@ -162,8 +165,18 @@
@@ -163,8 +166,18 @@
boolean flag1 = (Boolean) iblockdata.getValue(BlockRedstoneComparator.POWERED);
if (flag1 && !flag) {

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/block/BlockRedstoneLamp.java
+++ b/net/minecraft/world/level/block/BlockRedstoneLamp.java
@@ -12,6 +12,8 @@
import net.minecraft.world.level.block.state.IBlockData;
@@ -13,6 +13,8 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import net.minecraft.world.level.redstone.Orientation;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockRedstoneLamp extends Block {
public static final MapCodec<BlockRedstoneLamp> CODEC = simpleCodec(BlockRedstoneLamp::new);
@@ -42,6 +44,11 @@
@@ -43,6 +45,11 @@
if (flag1) {
world.scheduleTick(blockposition, (Block) this, 4);
} else {
@@ -21,7 +21,7 @@
world.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockRedstoneLamp.LIT), 2);
}
}
@@ -52,6 +59,11 @@
@@ -53,6 +60,11 @@
@Override
protected void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockRedstoneLamp.LIT) && !worldserver.hasNeighborSignal(blockposition)) {

View File

@@ -50,7 +50,7 @@
+ interact(iblockdata, world, blockposition, entityhuman); // CraftBukkit - add entityhuman
}
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION : ItemInteractionResult.SUCCESS;
return (EnumInteractionResult) (itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS);
}
- private static void interact(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BlockRedstoneTorch.java
+++ b/net/minecraft/world/level/block/BlockRedstoneTorch.java
@@ -19,6 +19,8 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
@@ -22,6 +22,8 @@
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
import net.minecraft.world.level.redstone.Orientation;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+

View File

@@ -1,29 +0,0 @@
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
@@ -36,6 +36,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block {
public static final MapCodec<BlockRedstoneWire> CODEC = simpleCodec(BlockRedstoneWire::new);
@@ -260,7 +262,16 @@
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = this.calculateTargetStrength(world, blockposition);
- if ((Integer) iblockdata.getValue(BlockRedstoneWire.POWER) != i) {
+ // CraftBukkit start
+ int oldPower = (Integer) iblockdata.getValue(BlockRedstoneWire.POWER);
+ if (oldPower != i) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), oldPower, i);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ i = event.getNewCurrent();
+ }
+ if (oldPower != i) {
+ // CraftBukkit end
if (world.getBlockState(blockposition) == iblockdata) {
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneWire.POWER, i), 2);
}

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/block/BlockRespawnAnchor.java
+++ b/net/minecraft/world/level/block/BlockRespawnAnchor.java
@@ -89,7 +89,7 @@
@@ -88,7 +88,7 @@
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
if (entityplayer.getRespawnDimension() != world.dimension() || !blockposition.equals(entityplayer.getRespawnPosition())) {
- entityplayer.setRespawnPosition(world.dimension(), blockposition, 0.0F, false, true);
+ entityplayer.setRespawnPosition(world.dimension(), blockposition, 0.0F, false, true, org.bukkit.event.player.PlayerSpawnChangeEvent.Cause.RESPAWN_ANCHOR); // CraftBukkit
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;
return EnumInteractionResult.SUCCESS_SERVER;
}
@@ -128,15 +128,16 @@
@@ -127,15 +127,16 @@
}
private void explode(IBlockData iblockdata, World world, final BlockPosition blockposition) {
@@ -28,7 +28,7 @@
@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);
@@ -144,7 +145,7 @@
@@ -143,7 +144,7 @@
};
Vec3D vec3d = blockposition.getCenter();

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/block/BlockSign.java
+++ b/net/minecraft/world/level/block/BlockSign.java
@@ -139,7 +139,7 @@
@@ -140,7 +140,7 @@
} else if (flag1) {
return EnumInteractionResult.SUCCESS;
return EnumInteractionResult.SUCCESS_SERVER;
} 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;
return EnumInteractionResult.SUCCESS_SERVER;
} else {
return EnumInteractionResult.PASS;
@@ -185,6 +185,15 @@
@@ -186,6 +186,15 @@
}
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {
@@ -25,7 +25,7 @@
tileentitysign.setAllowedPlayerEditor(entityhuman.getUUID());
entityhuman.openTextEdit(tileentitysign, flag);
}
@@ -198,6 +207,6 @@
@@ -199,6 +208,6 @@
@Nullable
@Override
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {

View File

@@ -12,7 +12,7 @@
public class BlockSoil extends Block {
public static final MapCodec<BlockSoil> CODEC = simpleCodec(BlockSoil::new);
@@ -92,26 +97,49 @@
@@ -92,28 +97,51 @@
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
if (i > 0) {
@@ -31,25 +31,27 @@
@Override
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
+ super.fallOn(world, iblockdata, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
if (!world.isClientSide && world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
+ // CraftBukkit start - Interact soil
+ org.bukkit.event.Cancellable cancellable;
+ if (entity instanceof EntityHuman) {
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
if (world instanceof WorldServer worldserver) {
if (world.random.nextFloat() < f - 0.5F && entity instanceof EntityLiving && (entity instanceof EntityHuman || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
+ // CraftBukkit start - Interact soil
+ org.bukkit.event.Cancellable cancellable;
+ if (entity instanceof EntityHuman) {
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable.isCancelled()) {
+ return;
+ }
+ if (cancellable.isCancelled()) {
+ return;
+ }
+
+ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
turnToDirt(entity, iblockdata, world, blockposition);
+ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.DIRT.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
turnToDirt(entity, iblockdata, world, blockposition);
}
}
- super.fallOn(world, iblockdata, blockposition, entity, f);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/BlockSponge.java
+++ b/net/minecraft/world/level/block/BlockSponge.java
@@ -13,6 +13,13 @@
import net.minecraft.world.level.block.state.IBlockData;
@@ -15,6 +15,13 @@
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.redstone.Orientation;
+// CraftBukkit start
+import java.util.List;
@@ -14,7 +14,7 @@
public class BlockSponge extends Block {
public static final MapCodec<BlockSponge> CODEC = simpleCodec(BlockSponge::new);
@@ -51,7 +58,8 @@
@@ -53,7 +60,8 @@
}
private boolean removeWaterBreadthFirstSearch(World world, BlockPosition blockposition) {
@@ -24,7 +24,7 @@
EnumDirection[] aenumdirection = BlockSponge.ALL_DIRECTIONS;
int i = aenumdirection.length;
@@ -65,8 +73,10 @@
@@ -67,8 +75,10 @@
if (blockposition1.equals(blockposition)) {
return true;
} else {
@@ -37,7 +37,7 @@
if (!fluid.is(TagsFluid.WATER)) {
return false;
@@ -76,27 +86,64 @@
@@ -78,27 +88,64 @@
if (block instanceof IFluidSource) {
IFluidSource ifluidsource = (IFluidSource) block;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
@@ -30,6 +30,13 @@
@@ -29,6 +29,13 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -14,7 +14,7 @@
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
public static final MapCodec<BlockSweetBerryBush> CODEC = simpleCodec(BlockSweetBerryBush::new);
@@ -71,7 +78,7 @@
@@ -70,7 +77,7 @@
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
@@ -23,16 +23,16 @@
worldserver.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
}
@@ -86,7 +93,7 @@
double d1 = Math.abs(entity.getZ() - entity.zOld);
@@ -91,7 +98,7 @@
double d1 = Math.abs(vec3d.z());
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
- entity.hurt(world.damageSources().sweetBerryBush(), 1.0F);
+ entity.hurt(world.damageSources().sweetBerryBush().directBlock(world, blockposition), 1.0F); // CraftBukkit
}
}
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
- entity.hurtServer(worldserver, world.damageSources().sweetBerryBush(), 1.0F);
+ entity.hurtServer(worldserver, world.damageSources().sweetBerryBush().directBlock(world, blockposition), 1.0F); // CraftBukkit
}
}
@@ -109,7 +116,15 @@
@@ -118,7 +125,15 @@
if (i > 1) {
int j = 1 + world.random.nextInt(2);

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/BlockTNT.java
+++ b/net/minecraft/world/level/block/BlockTNT.java
@@ -27,6 +27,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
@@ -29,6 +29,11 @@
import net.minecraft.world.level.redstone.Orientation;
import net.minecraft.world.phys.MovingObjectPositionBlock;
+// CraftBukkit start
@@ -12,7 +12,7 @@
public class BlockTNT extends Block {
public static final MapCodec<BlockTNT> CODEC = simpleCodec(BlockTNT::new);
@@ -45,7 +50,7 @@
@@ -47,7 +52,7 @@
@Override
protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (!iblockdata1.is(iblockdata.getBlock())) {
@@ -21,16 +21,16 @@
explode(world, blockposition);
world.removeBlock(blockposition, false);
}
@@ -55,7 +60,7 @@
@@ -57,7 +62,7 @@
@Override
protected 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, @Nullable Orientation orientation, boolean flag) {
- if (world.hasNeighborSignal(blockposition)) {
+ if (world.hasNeighborSignal(blockposition) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.REDSTONE, null, blockposition1)) { // CraftBukkit - TNTPrimeEvent
+ if (world.hasNeighborSignal(blockposition) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.REDSTONE, null, null)) { // CraftBukkit - TNTPrimeEvent
explode(world, blockposition);
world.removeBlock(blockposition, false);
}
@@ -64,7 +69,7 @@
@@ -66,7 +71,7 @@
@Override
public IBlockData playerWillDestroy(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
@@ -45,7 +45,7 @@
} else {
+ // CraftBukkit start - TNTPrimeEvent
+ if (!CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.PLAYER, entityhuman, null)) {
+ return ItemInteractionResult.CONSUME;
+ return EnumInteractionResult.CONSUME;
+ }
+ // CraftBukkit end
explode(world, blockposition, entityhuman);
@@ -54,7 +54,7 @@
@@ -123,6 +133,11 @@
Entity entity = iprojectile.getOwner();
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {
if (iprojectile.isOnFire() && iprojectile.mayInteract(worldserver, blockposition)) {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState()) || !CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.PROJECTILE, iprojectile, null)) {
+ return;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTallPlant.java
+++ b/net/minecraft/world/level/block/BlockTallPlant.java
@@ -101,6 +101,11 @@
@@ -103,6 +103,11 @@
}
protected static void preventDropFromBottomPart(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
@@ -34,6 +34,8 @@
@@ -38,6 +38,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
public static final MapCodec<BlockTrapdoor> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -139,6 +141,19 @@
@@ -143,6 +145,19 @@
boolean flag1 = world.hasNeighborSignal(blockposition);
if (flag1 != (Boolean) iblockdata.getValue(BlockTrapdoor.POWERED)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTripwire.java
+++ b/net/minecraft/world/level/block/BlockTripwire.java
@@ -28,6 +28,8 @@
@@ -29,6 +29,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockTripwire extends Block {
public static final MapCodec<BlockTripwire> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -167,6 +169,40 @@
@@ -179,6 +181,40 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTripwireHook.java
+++ b/net/minecraft/world/level/block/BlockTripwireHook.java
@@ -30,6 +30,11 @@
@@ -32,6 +32,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);
@@ -174,6 +179,15 @@
@@ -176,6 +181,15 @@
emitState(world, blockposition1, flag4, flag5, flag2, flag3);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTurtleEgg.java
+++ b/net/minecraft/world/level/block/BlockTurtleEgg.java
@@ -31,6 +31,12 @@
@@ -32,6 +32,12 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -13,27 +13,27 @@
public class BlockTurtleEgg extends Block {
public static final MapCodec<BlockTurtleEgg> CODEC = simpleCodec(BlockTurtleEgg::new);
@@ -73,6 +79,19 @@
@@ -74,6 +80,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)) {
if (iblockdata.is(Blocks.TURTLE_EGG) && world instanceof WorldServer worldserver) {
if (this.canDestroyEgg(worldserver, entity) && world.random.nextInt(i) == 0) {
+ // CraftBukkit start - Step on eggs
+ org.bukkit.event.Cancellable cancellable;
+ if (entity instanceof EntityHuman) {
+ cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(world, blockposition));
+ world.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), CraftBlock.at(worldserver, blockposition));
+ worldserver.getCraftServer().getPluginManager().callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
this.decreaseEggs(world, blockposition, iblockdata);
this.decreaseEggs(worldserver, blockposition, iblockdata);
}
@@ -99,10 +118,20 @@
}
@@ -100,10 +119,20 @@
int i = (Integer) iblockdata.getValue(BlockTurtleEgg.HATCH);
if (i < 2) {
@@ -55,7 +55,7 @@
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((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(iblockdata));
@@ -115,7 +144,7 @@
@@ -116,7 +145,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);

View File

@@ -44,7 +44,7 @@
}
} else {
if (enumdirection == EnumDirection.UP && blockposition.getY() < worldserver.getMaxBuildHeight() - 1) {
if (enumdirection == EnumDirection.UP && blockposition.getY() < worldserver.getMaxY()) {
if (this.canSupportAtFace(worldserver, blockposition, enumdirection)) {
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockVine.UP, true), 2); // CraftBukkit

View File

@@ -14,7 +14,7 @@
@@ -32,6 +36,11 @@
protected void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
super.entityInside(iblockdata, world, blockposition, entity);
if (world instanceof WorldServer && entity instanceof EntityBoat) {
if (world instanceof WorldServer && entity instanceof AbstractBoat) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/block/BlockWitherRose.java
+++ b/net/minecraft/world/level/block/BlockWitherRose.java
@@ -67,7 +67,7 @@
EntityLiving entityliving = (EntityLiving) entity;
if (!entityliving.isInvulnerableTo(world.damageSources().wither())) {
@@ -66,7 +66,7 @@
if (world instanceof WorldServer worldserver) {
if (world.getDifficulty() != EnumDifficulty.PEACEFUL && entity instanceof EntityLiving entityliving) {
if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40));
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockWitherSkull.java
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
@@ -25,6 +25,10 @@
@@ -26,6 +26,10 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBuilder;
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
@@ -11,7 +11,7 @@
public class BlockWitherSkull extends BlockSkull {
public static final MapCodec<BlockWitherSkull> CODEC = simpleCodec(BlockWitherSkull::new);
@@ -57,6 +61,7 @@
@@ -58,6 +62,7 @@
}
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
@@ -19,8 +19,8 @@
if (!world.isClientSide) {
IBlockData iblockdata = tileentityskull.getBlockState();
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
@@ -68,12 +73,18 @@
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world);
@@ -69,12 +74,18 @@
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world, EntitySpawnReason.TRIGGERED);
if (entitywither != null) {
- BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection);
@@ -39,7 +39,7 @@
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -82,7 +93,7 @@
@@ -83,7 +94,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/CeilingHangingSignBlock.java
+++ b/net/minecraft/world/level/block/CeilingHangingSignBlock.java
@@ -158,6 +158,6 @@
@@ -159,6 +159,6 @@
@Nullable
@Override
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/CrafterBlock.java
+++ b/net/minecraft/world/level/block/CrafterBlock.java
@@ -39,6 +39,15 @@
@@ -40,6 +40,15 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
@@ -16,7 +16,7 @@
public class CrafterBlock extends BlockTileEntity {
public static final MapCodec<CrafterBlock> CODEC = simpleCodec(CrafterBlock::new);
@@ -188,6 +197,13 @@
@@ -189,6 +198,13 @@
RecipeHolder<RecipeCrafting> recipeholder = (RecipeHolder) optional.get();
ItemStack itemstack = ((RecipeCrafting) recipeholder.value()).assemble(craftinginput, worldserver.registryAccess());
@@ -30,7 +30,7 @@
if (itemstack.isEmpty()) {
worldserver.levelEvent(1050, blockposition, 0);
} else {
@@ -226,7 +242,25 @@
@@ -227,7 +243,25 @@
ItemStack itemstack1 = itemstack.copy();
if (iinventory != null && (iinventory instanceof CrafterBlockEntity || itemstack.getCount() > iinventory.getMaxStackSize(itemstack))) {
@@ -56,7 +56,7 @@
ItemStack itemstack2 = itemstack1.copyWithCount(1);
ItemStack itemstack3 = TileEntityHopper.addItem(crafterblockentity, iinventory, itemstack2, enumdirection.getOpposite());
@@ -237,7 +271,25 @@
@@ -238,7 +272,25 @@
itemstack1.shrink(1);
}
} else if (iinventory != null) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/block/DecoratedPotBlock.java
+++ b/net/minecraft/world/level/block/DecoratedPotBlock.java
@@ -239,6 +239,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
@@ -240,6 +240,11 @@
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
+ // CraftBukkit start - call EntityChangeBlockEvent
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, this.getFluidState(iblockdata).createLegacyBlock())) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(DecoratedPotBlock.CRACKED, true), 4);
world.destroyBlock(blockposition, true, iprojectile);
}
if (world instanceof WorldServer worldserver) {
if (iprojectile.mayInteract(worldserver, blockposition) && iprojectile.mayBreak(worldserver)) {
+ // CraftBukkit start - call EntityChangeBlockEvent
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, this.getFluidState(iblockdata).createLegacyBlock())) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(DecoratedPotBlock.CRACKED, true), 4);
world.destroyBlock(blockposition, true, iprojectile);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -17,6 +17,12 @@
@@ -18,6 +18,12 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
@@ -13,24 +13,37 @@
public class LayeredCauldronBlock extends AbstractCauldronBlock {
public static final MapCodec<LayeredCauldronBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -62,10 +68,14 @@
@Override
@@ -64,39 +70,67 @@
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
if (entity.mayInteract(world, blockposition)) {
- this.handleEntityOnFireInside(iblockdata, world, blockposition);
+ if (!lowerFillLevel(iblockdata, world, blockposition, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH)) {
+ return;
+ }
if (world instanceof WorldServer worldserver) {
if (entity.isOnFire() && this.isEntityInsideContent(iblockdata, blockposition, entity)) {
- entity.clearFire();
+ // CraftBukkit start - moved down
+ // entity.clearFire();
if (entity.mayInteract(worldserver, blockposition)) {
- this.handleEntityOnFireInside(iblockdata, world, blockposition);
+ if (this.handleEntityOnFireInside(iblockdata, world, blockposition, entity)) {
+ entity.clearFire();
+ }
+ // CraftBukkit end
}
}
+ entity.clearFire();
+ // CraftBukkit end
}
}
@@ -80,20 +90,42 @@
- private void handleEntityOnFireInside(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ private boolean handleEntityOnFireInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (this.precipitationType == BiomeBase.Precipitation.SNOW) {
- lowerFillLevel((IBlockData) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL)), world, blockposition);
+ return lowerFillLevel((IBlockData) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL)), world, blockposition, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH);
} else {
- lowerFillLevel(iblockdata, world, blockposition);
+ return lowerFillLevel(iblockdata, world, blockposition, entity, CauldronLevelChangeEvent.ChangeReason.EXTINGUISH);
+ // CraftBukkit end
}
}
public static void lowerFillLevel(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -77,7 +90,7 @@
}
}
@@ -112,8 +144,11 @@
@@ -115,8 +149,11 @@
if (!this.isFull(iblockdata)) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1);

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/block/LightningRodBlock.java
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
@@ -22,6 +22,11 @@
import net.minecraft.world.level.material.FluidType;
@@ -24,6 +24,11 @@
import net.minecraft.world.level.material.FluidTypes;
import net.minecraft.world.level.redstone.ExperimentalRedstoneUtils;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
@@ -12,7 +12,7 @@
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
public static final MapCodec<LightningRodBlock> CODEC = simpleCodec(LightningRodBlock::new);
@@ -74,6 +79,18 @@
@@ -76,6 +81,18 @@
}
public void onLightningStrike(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,18 +1,18 @@
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
@@ -133,6 +133,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
@@ -136,6 +136,11 @@
WorldServer worldserver = (WorldServer) world;
if (iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true);
if (iprojectile.mayInteract(worldserver, blockposition) && iprojectile.mayBreak(worldserver) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true);
}
}
@@ -142,7 +147,7 @@
@@ -146,7 +151,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);
}
@@ -387,15 +392,15 @@
@@ -391,15 +396,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) {
@@ -410,8 +415,8 @@
@@ -414,8 +419,8 @@
blockposition1 = blockposition.below();
}
@@ -51,7 +51,7 @@
}
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -444,7 +449,7 @@
@@ -448,7 +453,7 @@
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
return isTip(iblockdata1, flag);
@@ -60,7 +60,7 @@
}
}
@@ -560,7 +565,7 @@
@@ -564,7 +569,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
@@ -69,7 +69,7 @@
}
@Nullable
@@ -569,7 +574,7 @@
@@ -573,7 +578,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};

View File

@@ -1,13 +1,13 @@
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -77,7 +77,12 @@
@@ -73,7 +73,12 @@
entity.setIsInPowderSnow(true);
if (!world.isClientSide) {
- if (entity.isOnFire() && (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman) && entity.mayInteract(world, blockposition)) {
if (world instanceof WorldServer worldserver) {
- if (entity.isOnFire() && (worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman) && entity.mayInteract(worldserver, blockposition)) {
+ // CraftBukkit start
+ if (entity.isOnFire() && entity.mayInteract(world, blockposition)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !(world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman))) {
+ if (entity.isOnFire() && entity.mayInteract(worldserver, blockposition)) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, Blocks.AIR.defaultBlockState(), !(worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || entity instanceof EntityHuman))) {
+ return;
+ }
+ // CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkSensorBlock.java
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
@@ -43,6 +43,11 @@
@@ -44,6 +44,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);
@@ -103,6 +108,18 @@
@@ -104,6 +109,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) {
@@ -206,6 +223,15 @@
@@ -207,6 +224,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);
@@ -217,6 +243,15 @@
@@ -218,6 +244,15 @@
}
public void activate(@Nullable Entity entity, World world, BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@@ -63,7 +63,7 @@
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);
@@ -297,9 +332,16 @@
@@ -298,9 +333,16 @@
@Override
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkShriekerBlock.java
+++ b/net/minecraft/world/level/block/SculkShriekerBlock.java
@@ -62,6 +62,7 @@
@@ -63,6 +63,7 @@
EntityPlayer entityplayer = SculkShriekerBlockEntity.tryGetPlayer(entity);
if (entityplayer != null) {
@@ -8,7 +8,7 @@
worldserver.getBlockEntity(blockposition, TileEntityTypes.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> {
sculkshriekerblockentity.tryShriek(worldserver, entityplayer);
});
@@ -144,10 +145,17 @@
@@ -145,10 +146,17 @@
@Override
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

@@ -15,7 +15,7 @@
public class SculkSpreader {
public static final int MAX_GROWTH_RATE_RADIUS = 24;
@@ -56,6 +64,7 @@
@@ -57,6 +65,7 @@
private final int additionalDecayRate;
private List<SculkSpreader.a> cursors = new ArrayList();
private static final Logger LOGGER = LogUtils.getLogger();
@@ -23,7 +23,7 @@
public SculkSpreader(boolean flag, TagKey<Block> tagkey, int i, int j, int k, int l) {
this.isWorldGeneration = flag;
@@ -110,7 +119,7 @@
@@ -111,7 +120,7 @@
public void load(NBTTagCompound nbttagcompound) {
if (nbttagcompound.contains("cursors", 9)) {
this.cursors.clear();
@@ -32,7 +32,7 @@
Logger logger = SculkSpreader.LOGGER;
Objects.requireNonNull(logger);
@@ -125,7 +134,7 @@
@@ -126,7 +135,7 @@
}
public void save(NBTTagCompound nbttagcompound) {
@@ -41,7 +41,7 @@
Logger logger = SculkSpreader.LOGGER;
Objects.requireNonNull(logger);
@@ -146,6 +155,19 @@
@@ -147,6 +156,19 @@
private void addCursor(SculkSpreader.a sculkspreader_a) {
if (this.cursors.size() < 32) {
@@ -61,7 +61,7 @@
this.cursors.add(sculkspreader_a);
}
}
@@ -241,7 +263,7 @@
@@ -244,7 +266,7 @@
this.charge = i;
this.decayDelay = j;
this.updateDelay = k;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkVeinBlock.java
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
@@ -108,10 +108,11 @@
@@ -110,10 +110,11 @@
@Override
public int attemptUseCharge(SculkSpreader.a sculkspreader_a, GeneratorAccess generatoraccess, BlockPosition blockposition, RandomSource randomsource, SculkSpreader sculkspreader, boolean flag) {
@@ -14,7 +14,7 @@
IBlockData iblockdata = generatoraccess.getBlockState(blockposition);
TagKey<Block> tagkey = sculkspreader.replaceableBlocks();
Iterator iterator = EnumDirection.allShuffled(randomsource).iterator();
@@ -126,7 +127,11 @@
@@ -128,7 +129,11 @@
if (iblockdata1.is(tagkey)) {
IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/WallHangingSignBlock.java
+++ b/net/minecraft/world/level/block/WallHangingSignBlock.java
@@ -183,6 +183,6 @@
@@ -179,6 +179,6 @@
@Nullable
@Override
public <T extends TileEntity> BlockEntityTicker<T> getTicker(World world, IBlockData iblockdata, TileEntityTypes<T> tileentitytypes) {

View File

@@ -13,15 +13,15 @@
public class BrushableBlockEntity extends TileEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -156,7 +162,10 @@
EntityItem entityitem = new EntityItem(this.level, d3, d4, d5, this.item.split(this.level.random.nextInt(21) + 10));
@@ -151,7 +157,10 @@
EntityItem entityitem = new EntityItem(worldserver, d3, d4, d5, this.item.split(worldserver.random.nextInt(21) + 10));
entityitem.setDeltaMovement(Vec3D.ZERO);
- this.level.addFreshEntity(entityitem);
+ // CraftBukkit start
+ org.bukkit.block.Block bblock = CraftBlock.at(this.level, this.worldPosition);
+ CraftEventFactory.handleBlockDropItemEvent(bblock, bblock.getState(), (EntityPlayer) entityhuman, Arrays.asList(entityitem));
+ // CraftBukkit end
this.item = ItemStack.EMPTY;
}
entityitem.setDeltaMovement(Vec3D.ZERO);
- worldserver.addFreshEntity(entityitem);
+ // CraftBukkit start
+ org.bukkit.block.Block bblock = CraftBlock.at(this.level, this.worldPosition);
+ CraftEventFactory.handleBlockDropItemEvent(bblock, bblock.getState(), (EntityPlayer) entityhuman, Arrays.asList(entityitem));
+ // CraftBukkit end
this.item = ItemStack.EMPTY;
}

View File

@@ -49,7 +49,7 @@
return nbttagcompound;
}
@@ -276,12 +300,18 @@
@@ -277,12 +301,18 @@
}
public final void applyComponents(DataComponentMap datacomponentmap, DataComponentPatch datacomponentpatch) {
@@ -69,7 +69,7 @@
@Nullable
@Override
public <T> T get(DataComponentType<T> datacomponenttype) {
@@ -299,6 +329,10 @@
@@ -300,6 +330,10 @@
DataComponentPatch datacomponentpatch1 = datacomponentpatch.forget(set::contains);
this.components = datacomponentpatch1.split().added();
@@ -80,7 +80,7 @@
}
protected void collectImplicitComponents(DataComponentMap.a datacomponentmap_a) {}
@@ -333,6 +367,15 @@
@@ -334,6 +368,15 @@
}
}

View File

@@ -120,8 +120,8 @@
if (nbttagcompound.contains(s, 8)) {
MinecraftKey minecraftkey = MinecraftKey.tryParse(nbttagcompound.getString(s));
- 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)
- return minecraftkey == null ? null : (Holder) BuiltInRegistries.MOB_EFFECT.get(minecraftkey).map(TileEntityBeacon::filterEffect).orElse((Object) null);
+ return minecraftkey == null ? null : (Holder) BuiltInRegistries.MOB_EFFECT.get(minecraftkey).orElse(null); // CraftBukkit - persist manually set non-default beacon effects (SPIGOT-3598)
} else {
return null;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeehive.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeehive.java
@@ -42,6 +42,10 @@
@@ -43,6 +43,10 @@
import net.minecraft.world.level.gameevent.GameEvent;
import org.slf4j.Logger;
@@ -11,7 +11,7 @@
public class TileEntityBeehive extends TileEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -55,6 +59,7 @@
@@ -56,6 +60,7 @@
private 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);
@@ -94,7 +99,7 @@
@@ -95,7 +100,7 @@
}
public boolean isFull() {
@@ -28,7 +28,7 @@
}
public void emptyAllLivingFromHive(@Nullable EntityHuman entityhuman, IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
@@ -111,7 +116,7 @@
@@ -112,7 +117,7 @@
if (entityhuman.position().distanceToSqr(entity.position()) <= 16.0D) {
if (!this.isSedated()) {
@@ -37,7 +37,7 @@
} else {
entitybee.setStayOutOfHiveCountdown(400);
}
@@ -123,10 +128,16 @@
@@ -124,10 +129,16 @@
}
private List<Entity> releaseAllOccupants(IBlockData iblockdata, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus) {
@@ -55,7 +55,7 @@
});
if (!list.isEmpty()) {
super.setChanged();
@@ -150,7 +161,19 @@
@@ -151,7 +162,19 @@
}
public void addOccupant(Entity entity) {
@@ -76,7 +76,7 @@
entity.stopRiding();
entity.ejectPassengers();
this.storeBee(TileEntityBeehive.c.of(entity));
@@ -169,7 +192,7 @@
@@ -170,7 +193,7 @@
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, this.getBlockState()));
}
@@ -85,22 +85,22 @@
super.setChanged();
}
}
@@ -179,7 +202,13 @@
@@ -180,7 +203,13 @@
}
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) {
- if (EntityBee.isNightOrRaining(world) && tileentitybeehive_releasestatus != TileEntityBeehive.ReleaseStatus.EMERGENCY) {
+ // CraftBukkit start - This allows us to bypass the night/rain/emergency check
+ return releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_c, list, tileentitybeehive_releasestatus, blockposition1, false);
+ }
+
+ 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) {
+ if (!force && EntityBee.isNightOrRaining(world) && tileentitybeehive_releasestatus != TileEntityBeehive.ReleaseStatus.EMERGENCY) {
+ // CraftBukkit end
return false;
} else {
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockBeehive.FACING);
@@ -192,6 +221,18 @@
@@ -193,6 +222,18 @@
Entity entity = tileentitybeehive_c.createEntity(world, blockposition);
if (entity != null) {
@@ -119,7 +119,7 @@
if (entity instanceof EntityBee) {
EntityBee entitybee = (EntityBee) entity;
@@ -222,6 +263,7 @@
@@ -223,6 +264,7 @@
list.add(entitybee);
}
@@ -127,7 +127,7 @@
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 @@
@@ -230,11 +272,12 @@
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
@@ -141,7 +141,7 @@
} else {
return false;
}
@@ -258,6 +301,10 @@
@@ -259,6 +302,10 @@
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee.toOccupant(), (List) null, tileentitybeehive_releasestatus, blockposition1)) {
flag = true;
iterator.remove();
@@ -152,7 +152,7 @@
}
}
}
@@ -284,7 +331,7 @@
@@ -285,7 +332,7 @@
@Override
protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
super.loadAdditional(nbttagcompound, holderlookup_a);
@@ -161,7 +161,7 @@
if (nbttagcompound.contains("bees")) {
TileEntityBeehive.c.LIST_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("bees")).resultOrPartial((s) -> {
TileEntityBeehive.LOGGER.error("Failed to parse bees: '{}'", s);
@@ -293,7 +340,12 @@
@@ -294,7 +341,12 @@
});
}
@@ -175,7 +175,7 @@
}
@Override
@@ -303,13 +355,14 @@
@@ -304,13 +356,14 @@
if (this.hasSavedFlowerPos()) {
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
}
@@ -191,7 +191,7 @@
List<TileEntityBeehive.c> list = (List) tileentity_b.getOrDefault(DataComponents.BEES, List.of());
list.forEach(this::storeBee);
@@ -350,7 +403,7 @@
@@ -351,7 +404,7 @@
NBTTagCompound nbttagcompound = new NBTTagCompound();
entity.save(nbttagcompound);
@@ -200,7 +200,7 @@
Objects.requireNonNull(nbttagcompound);
list.forEach(nbttagcompound::remove);
@@ -369,7 +422,7 @@
@@ -370,7 +423,7 @@
@Nullable
public Entity createEntity(World world, BlockPosition blockposition) {
NBTTagCompound nbttagcompound = this.entityData.copyTag();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
@@ -23,6 +23,20 @@
@@ -24,6 +24,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;
@@ -40,6 +54,36 @@
@@ -41,6 +55,36 @@
private Item ingredient;
public int fuel;
protected final IContainerProperties dataAccess;
@@ -58,10 +58,10 @@
public TileEntityBrewingStand(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BREWING_STAND, blockposition, iblockdata);
@@ -106,8 +150,19 @@
@@ -107,8 +151,19 @@
ItemStack itemstack = (ItemStack) tileentitybrewingstand.items.get(4);
if (tileentitybrewingstand.fuel <= 0 && itemstack.is(Items.BLAZE_POWDER)) {
if (tileentitybrewingstand.fuel <= 0 && itemstack.is(TagsItem.BREWING_FUEL)) {
- tileentitybrewingstand.fuel = 20;
- itemstack.shrink(1);
+ // CraftBukkit start
@@ -80,7 +80,7 @@
setChanged(world, blockposition, iblockdata);
}
@@ -115,12 +170,17 @@
@@ -116,12 +171,17 @@
boolean flag1 = tileentitybrewingstand.brewTime > 0;
ItemStack itemstack1 = (ItemStack) tileentitybrewingstand.items.get(3);
@@ -101,7 +101,7 @@
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
tileentitybrewingstand.brewTime = 0;
}
@@ -128,7 +188,11 @@
@@ -129,7 +189,11 @@
setChanged(world, blockposition, iblockdata);
} else if (flag && tileentitybrewingstand.fuel > 0) {
--tileentitybrewingstand.fuel;
@@ -114,7 +114,7 @@
tileentitybrewingstand.ingredient = itemstack1.getItem();
setChanged(world, blockposition, iblockdata);
}
@@ -184,12 +248,34 @@
@@ -185,12 +249,34 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityCampfire.java
+++ b/net/minecraft/world/level/block/entity/TileEntityCampfire.java
@@ -30,6 +30,14 @@
@@ -31,6 +31,14 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -15,16 +15,16 @@
public class TileEntityCampfire extends TileEntity implements Clearable {
private static final int BURN_COOL_SPEED = 2;
@@ -64,6 +72,20 @@
@@ -63,6 +71,20 @@
}).orElse(itemstack);
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
if (itemstack1.isItemEnabled(worldserver.enabledFeatures())) {
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(worldserver, blockposition), source, result);
+ worldserver.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+
+ if (blockCookEvent.isCancelled()) {
+ return;
@@ -33,19 +33,19 @@
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
InventoryUtils.dropItemStack(worldserver, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
tileentitycampfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
@@ -176,7 +198,11 @@
ItemStack itemstack1 = (ItemStack) this.items.get(j);
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
@@ -177,7 +199,11 @@
return false;
}
if (itemstack1.isEmpty()) {
- this.cookingTime[j] = i;
- this.cookingTime[i] = ((RecipeCampfire) ((RecipeHolder) optional.get()).value()).cookingTime();
+ // CraftBukkit start
+ CampfireStartEvent event = new CampfireStartEvent(CraftBlock.at(this.level,this.worldPosition), CraftItemStack.asCraftMirror(itemstack), (CampfireRecipe) getCookableRecipe(itemstack).get().toBukkitRecipe());
+ CampfireStartEvent event = new CampfireStartEvent(CraftBlock.at(this.level,this.worldPosition), CraftItemStack.asCraftMirror(itemstack), (CampfireRecipe) optional.get().toBukkitRecipe());
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ this.cookingTime[j] = event.getTotalCookTime(); // i -> event.getTotalCookTime()
+ this.cookingTime[i] = event.getTotalCookTime(); // i -> event.getTotalCookTime()
+ // CraftBukkit end
this.cookingProgress[j] = 0;
this.items.set(j, itemstack.consumeAndReturn(1, entityliving));
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entityliving, this.getBlockState()));
this.cookingProgress[i] = 0;
this.items.set(i, itemstack.consumeAndReturn(1, entityliving));
worldserver.gameEvent((Holder) GameEvent.BLOCK_CHANGE, this.getBlockPos(), GameEvent.a.of(entityliving, this.getBlockState()));

View File

@@ -1,6 +1,17 @@
--- a/net/minecraft/world/level/block/entity/TileEntityConduit.java
+++ b/net/minecraft/world/level/block/entity/TileEntityConduit.java
@@ -187,8 +187,20 @@
@@ -28,6 +28,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import net.minecraft.server.level.WorldServer;
+// CraftBukkit end
+
public class TileEntityConduit extends TileEntity {
private static final int BLOCK_REFRESH_RATE = 2;
@@ -187,8 +191,20 @@
}
private static void applyEffects(World world, BlockPosition blockposition, List<BlockPosition> list) {
@@ -21,7 +32,7 @@
int k = blockposition.getX();
int l = blockposition.getY();
int i1 = blockposition.getZ();
@@ -202,7 +214,7 @@
@@ -202,7 +218,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (blockposition.closerThan(entityhuman.blockPosition(), (double) j) && entityhuman.isInWaterOrRain()) {
@@ -30,7 +41,7 @@
}
}
@@ -210,6 +222,12 @@
@@ -210,6 +226,12 @@
}
private static void updateDestroyTarget(World world, BlockPosition blockposition, IBlockData iblockdata, List<BlockPosition> list, TileEntityConduit tileentityconduit) {
@@ -43,7 +54,7 @@
EntityLiving entityliving = tileentityconduit.destroyTarget;
int i = list.size();
@@ -230,9 +248,12 @@
@@ -230,9 +252,12 @@
tileentityconduit.destroyTarget = null;
}
@@ -52,7 +63,7 @@
- tileentityconduit.destroyTarget.hurt(world.damageSources().magic(), 4.0F);
+ // CraftBukkit start
+ if (damageTarget && tileentityconduit.destroyTarget != null) {
+ if (tileentityconduit.destroyTarget.hurt(world.damageSources().magic().directBlock(world, blockposition), 4.0F)) {
+ if (tileentityconduit.destroyTarget.hurtServer((WorldServer) world, world.damageSources().magic().directBlock(world, blockposition), 4.0F)) {
+ world.playSound(null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+ // CraftBukkit end

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/entity/TileEntityContainer.java
+++ b/net/minecraft/world/level/block/entity/TileEntityContainer.java
@@ -178,4 +178,12 @@
nbttagcompound.remove("Lock");
nbttagcompound.remove("lock");
nbttagcompound.remove("Items");
}
+

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityFurnace.java
+++ b/net/minecraft/world/level/block/entity/TileEntityFurnace.java
@@ -48,6 +48,21 @@
@@ -42,6 +42,21 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -22,19 +22,14 @@
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeCraftingHolder, AutoRecipeOutput {
protected static final int SLOT_INPUT = 0;
@@ -118,7 +133,7 @@
@@ -112,9 +127,39 @@
}
};
this.recipesUsed = new Object2IntOpenHashMap();
this.recipesUsed = new Reference2IntOpenHashMap();
- this.quickCheck = CraftingManager.createCheck(recipes);
+ this.quickCheck = CraftingManager.createCheck((Recipes<RecipeCooking>) recipes); // CraftBukkit - decompile error // Eclipse fail
}
public static void invalidateCache() {
@@ -197,6 +212,40 @@
}
}
+ }
+
+ // CraftBukkit start - add fields and methods
+ private int maxStack = MAX_STACK;
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -53,8 +48,8 @@
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
}
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
@@ -63,34 +58,30 @@
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ public Object2IntOpenHashMap<MinecraftKey> getRecipesUsed() {
+ return this.recipesUsed; // PAIL private -> public
+ }
+ // CraftBukkit end
+
private static boolean isNeverAFurnaceFuel(Item item) {
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
private boolean isLit() {
return this.litTime > 0;
}
@@ -286,7 +335,7 @@
@@ -180,7 +225,7 @@
RecipeHolder recipeholder;
if (flag2) {
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse((Object) null);
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(new SingleRecipeInput(itemstack1), world).orElse(null); // CraftBukkit - decompile error
- recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, worldserver).orElse((Object) null);
+ recipeholder = (RecipeHolder) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, worldserver).orElse(null); // CraftBukkit - decompile error
} else {
recipeholder = null;
}
@@ -294,9 +343,20 @@
@@ -188,9 +233,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
- tileentityfurnace.litTime = tileentityfurnace.getBurnDuration(itemstack);
if (!tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
- tileentityfurnace.litTime = tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack);
+ // CraftBukkit start
+ CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack);
+
+ FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(CraftBlock.at(world, blockposition), fuel, tileentityfurnace.getBurnDuration(itemstack));
+ world.getCraftServer().getPluginManager().callEvent(furnaceBurnEvent);
+ FurnaceBurnEvent furnaceBurnEvent = new FurnaceBurnEvent(CraftBlock.at(worldserver, blockposition), fuel, tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack));
+ worldserver.getCraftServer().getPluginManager().callEvent(furnaceBurnEvent);
+
+ if (furnaceBurnEvent.isCancelled()) {
+ return;
@@ -104,17 +95,17 @@
flag1 = true;
if (flag3) {
Item item = itemstack.getItem();
@@ -312,11 +372,23 @@
@@ -204,11 +260,23 @@
}
if (tileentityfurnace.isLit() && canBurn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
if (tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
+ // CraftBukkit start
+ if (recipeholder != null && tileentityfurnace.cookingProgress == 0) {
+ CraftItemStack source = CraftItemStack.asCraftMirror(tileentityfurnace.items.get(0));
+ CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe();
+
+ FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(world, blockposition), source, recipe);
+ world.getCraftServer().getPluginManager().callEvent(event);
+ FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(worldserver, blockposition), source, recipe);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+
+ tileentityfurnace.cookingTotalTime = event.getTotalCookTime();
+ }
@@ -123,21 +114,21 @@
++tileentityfurnace.cookingProgress;
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingProgress = 0;
tileentityfurnace.cookingTotalTime = getTotalCookTime(world, tileentityfurnace);
- if (burn(world.registryAccess(), recipeholder, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, world.registryAccess(), recipeholder, tileentityfurnace.items, i)) { // CraftBukkit
tileentityfurnace.cookingTotalTime = getTotalCookTime(worldserver, tileentityfurnace);
- if (burn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) { // CraftBukkit
tileentityfurnace.setRecipeUsed(recipeholder);
}
@@ -355,17 +427,44 @@
@@ -247,17 +315,44 @@
}
}
- private static boolean burn(IRegistryCustom iregistrycustom, @Nullable RecipeHolder<?> recipeholder, NonNullList<ItemStack> nonnulllist, int i) {
+ private static boolean burn(World world, BlockPosition blockposition, IRegistryCustom iregistrycustom, @Nullable RecipeHolder<?> recipeholder, NonNullList<ItemStack> nonnulllist, int i) { // CraftBukkit
if (recipeholder != null && canBurn(iregistrycustom, recipeholder, nonnulllist, i)) {
- private static boolean burn(IRegistryCustom iregistrycustom, @Nullable RecipeHolder<? extends RecipeCooking> recipeholder, SingleRecipeInput singlerecipeinput, NonNullList<ItemStack> nonnulllist, int i) {
+ private static boolean burn(World world, BlockPosition blockposition, IRegistryCustom iregistrycustom, @Nullable RecipeHolder<? extends RecipeCooking> recipeholder, SingleRecipeInput singlerecipeinput, NonNullList<ItemStack> nonnulllist, int i) { // CraftBukkit
if (recipeholder != null && canBurn(iregistrycustom, recipeholder, singlerecipeinput, nonnulllist, i)) {
ItemStack itemstack = (ItemStack) nonnulllist.get(0);
ItemStack itemstack1 = recipeholder.value().getResultItem(iregistrycustom);
ItemStack itemstack1 = ((RecipeCooking) recipeholder.value()).assemble(singlerecipeinput, iregistrycustom);
ItemStack itemstack2 = (ItemStack) nonnulllist.get(2);
+ // CraftBukkit start - fire FurnaceSmeltEvent
@@ -175,15 +166,15 @@
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));
@@ -389,6 +488,7 @@
@@ -275,6 +370,7 @@
}
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
+ if (world == null) return 200; // CraftBukkit - SPIGOT-4302
private static int getTotalCookTime(WorldServer worldserver, TileEntityFurnace tileentityfurnace) {
+ if (worldserver == null) return 200; // CraftBukkit - SPIGOT-4302
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(tileentityfurnace.getItem(0));
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, world).map((recipeholder) -> {
@@ -477,8 +577,8 @@
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, worldserver).map((recipeholder) -> {
@@ -365,8 +461,8 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
@@ -194,7 +185,7 @@
entityplayer.awardRecipes(list);
Iterator iterator = list.iterator();
@@ -495,6 +595,12 @@
@@ -383,22 +479,28 @@
}
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
@@ -205,14 +196,16 @@
+ public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d, BlockPosition blockposition, EntityPlayer entityplayer, ItemStack itemstack, int amount) {
+ // CraftBukkit end
List<RecipeHolder<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
ObjectIterator objectiterator = this.recipesUsed.reference2IntEntrySet().iterator();
@@ -503,14 +609,14 @@
while (objectiterator.hasNext()) {
Entry<ResourceKey<IRecipe<?>>> entry = (Entry) objectiterator.next();
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((recipeholder) -> {
- worldserver.recipeAccess().byKey((ResourceKey) entry.getKey()).ifPresent((recipeholder) -> {
+ worldserver.recipeAccess().byKey(entry.getKey()).ifPresent((recipeholder) -> { // CraftBukkit - decompile error
list.add(recipeholder);
- createExperience(worldserver, vec3d, entry.getIntValue(), ((RecipeCooking) recipeholder.value()).getExperience());
+ createExperience(worldserver, vec3d, entry.getIntValue(), ((RecipeCooking) recipeholder.value()).getExperience(), blockposition, entityplayer, itemstack, amount); // CraftBukkit
- createExperience(worldserver, vec3d, entry.getIntValue(), ((RecipeCooking) recipeholder.value()).experience());
+ createExperience(worldserver, vec3d, entry.getIntValue(), ((RecipeCooking) recipeholder.value()).experience(), blockposition, entityplayer, itemstack, amount); // CraftBukkit
});
}
@@ -224,7 +217,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -518,6 +624,17 @@
@@ -406,6 +508,17 @@
++j;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
@@ -20,12 +20,56 @@
@@ -19,12 +19,56 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.ticks.ContainerSingleItem;
@@ -12,7 +12,7 @@
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem.a {
public class TileEntityJukeBox extends TileEntity implements ContainerSingleItem.a {
public static final String SONG_ITEM_TAG_ID = "RecordItem";
public static final String TICKS_SINCE_SONG_STARTED_TAG_ID = "ticks_since_song_started";
@@ -57,7 +57,7 @@
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
@@ -134,7 +178,7 @@
@@ -133,7 +177,7 @@
@Override
public int getMaxStackSize() {
@@ -66,7 +66,7 @@
}
@Override
@@ -153,12 +197,17 @@
@@ -152,12 +196,17 @@
}
@VisibleForTesting

View File

@@ -4,7 +4,6 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
-public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
+// CraftBukkit start
+import java.util.ArrayList;
+import java.util.Arrays;
@@ -17,7 +16,7 @@
+import org.bukkit.inventory.InventoryHolder;
+// CraftBukkit end
+
+public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory, ICommandListener { // CraftBukkit - ICommandListener
public class TileEntityLectern extends TileEntity implements Clearable, ITileInventory {
public static final int DATA_PAGE = 0;
public static final int NUM_DATA = 1;
@@ -107,50 +106,53 @@
}
}
@@ -187,6 +255,32 @@
@@ -189,6 +257,35 @@
return itemstack;
}
+ // CraftBukkit start
+ @Override
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
+ }
+ private final ICommandListener commandSource = new ICommandListener() {
+
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+ return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
+ }
+ @Override
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {
+ }
+
+ @Override
+ public boolean acceptsSuccess() {
+ return false;
+ }
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+ return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitEntity() : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, TileEntityLectern.this);
+ }
+
+ @Override
+ public boolean acceptsFailure() {
+ return false;
+ }
+ @Override
+ public boolean acceptsSuccess() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldInformAdmins() {
+ return false;
+ }
+ @Override
+ public boolean acceptsFailure() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldInformAdmins() {
+ return false;
+ }
+ };
+ // CraftBukkit end
private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman) {
+
private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman, WorldServer worldserver) {
String s;
Object object;
@@ -201,7 +295,8 @@
@@ -203,7 +300,8 @@
Vec3D vec3d = Vec3D.atCenterOf(this.worldPosition);
- return new CommandListenerWrapper(ICommandListener.NULL, vec3d, Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityhuman);
+ // CraftBukkit - this
+ return new CommandListenerWrapper(this, vec3d, Vec2F.ZERO, (WorldServer) this.level, 2, s, (IChatBaseComponent) object, this.level.getServer(), entityhuman);
- return new CommandListenerWrapper(ICommandListener.NULL, vec3d, Vec2F.ZERO, worldserver, 2, s, (IChatBaseComponent) object, worldserver.getServer(), entityhuman);
+ // CraftBukkit - commandSource
+ return new CommandListenerWrapper(commandSource, vec3d, Vec2F.ZERO, worldserver, 2, s, (IChatBaseComponent) object, worldserver.getServer(), entityhuman);
}
@Override
@@ -239,7 +334,7 @@
@@ -241,7 +339,7 @@
@Override
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {

View File

@@ -1,10 +1,9 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
@@ -36,7 +36,17 @@
@@ -36,6 +36,16 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
-public class TileEntitySign extends TileEntity {
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.server.level.EntityPlayer;
@@ -15,10 +14,9 @@
+import org.bukkit.event.block.SignChangeEvent;
+// CraftBukkit end
+
+public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements
public class TileEntitySign extends TileEntity {
private static final Logger LOGGER = LogUtils.getLogger();
private static final int MAX_TEXT_LINE_WIDTH = 90;
@@ -101,7 +111,7 @@
protected void saveAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
super.saveAdditional(nbttagcompound, holderlookup_a);
@@ -92,34 +90,37 @@
return signtext;
}
@@ -250,11 +285,37 @@
@@ -250,11 +285,40 @@
return flag1;
}
- private static CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ @Override
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {}
+ private final ICommandListener commandSource = new ICommandListener() {
+
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+ return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitSender(wrapper) : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, this);
+ }
+ @Override
+ public void sendSystemMessage(IChatBaseComponent ichatbasecomponent) {}
+
+ @Override
+ public boolean acceptsSuccess() {
+ return false;
+ }
+ @Override
+ public org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper) {
+ return wrapper.getEntity() != null ? wrapper.getEntity().getBukkitEntity() : new org.bukkit.craftbukkit.command.CraftBlockCommandSender(wrapper, TileEntitySign.this);
+ }
+
+ @Override
+ public boolean acceptsFailure() {
+ return false;
+ }
+ @Override
+ public boolean acceptsSuccess() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldInformAdmins() {
+ return false;
+ }
+ @Override
+ public boolean acceptsFailure() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldInformAdmins() {
+ return false;
+ }
+ };
+
+ private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition) {
+ // CraftBukkit end
@@ -127,12 +128,12 @@
Object object = entityhuman == null ? IChatBaseComponent.literal("Sign") : entityhuman.getDisplayName();
- return new CommandListenerWrapper(ICommandListener.NULL, Vec3D.atCenterOf(blockposition), Vec2F.ZERO, (WorldServer) world, 2, s, (IChatBaseComponent) object, world.getServer(), entityhuman);
+ // CraftBukkit - this
+ return new CommandListenerWrapper(this, Vec3D.atCenterOf(blockposition), Vec2F.ZERO, (WorldServer) world, 2, s, (IChatBaseComponent) object, world.getServer(), entityhuman);
+ // CraftBukkit - commandSource
+ return new CommandListenerWrapper(commandSource, Vec3D.atCenterOf(blockposition), Vec2F.ZERO, (WorldServer) world, 2, s, (IChatBaseComponent) object, world.getServer(), entityhuman);
}
@Override
@@ -278,12 +339,17 @@
@@ -278,12 +342,17 @@
@Nullable
public UUID getPlayerWhoMayEdit() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
+++ b/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
@@ -206,7 +206,7 @@
@@ -211,7 +211,7 @@
}
public void resetAfterBecomingOminous(TrialSpawner trialspawner, WorldServer worldserver) {
@@ -9,8 +9,8 @@
Objects.requireNonNull(worldserver);
stream.map(worldserver::getEntity).forEach((entity) -> {
@@ -218,7 +218,7 @@
entityinsentient.dropPreservedEquipment();
@@ -223,7 +223,7 @@
entityinsentient.dropPreservedEquipment(worldserver);
}
- entity.remove(Entity.RemovalReason.DISCARDED);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/vault/VaultBlockEntity.java
@@ -47,6 +47,13 @@
@@ -46,6 +46,13 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -14,7 +14,7 @@
public class VaultBlockEntity extends TileEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -97,18 +104,18 @@
@@ -96,18 +103,18 @@
dataresult = VaultServerData.CODEC.parse(dynamicops, nbttagcompound.get("server_data"));
logger = VaultBlockEntity.LOGGER;
Objects.requireNonNull(logger);
@@ -36,7 +36,7 @@
this.config = vaultconfig;
});
}
@@ -117,11 +124,11 @@
@@ -116,11 +123,11 @@
dataresult = VaultSharedData.CODEC.parse(dynamicops, nbttagcompound.get("shared_data"));
logger = VaultBlockEntity.LOGGER;
Objects.requireNonNull(logger);
@@ -50,7 +50,7 @@
}
}
@@ -321,6 +328,14 @@
@@ -320,6 +327,14 @@
if (!list.isEmpty()) {
entityhuman.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
itemstack.consume(vaultconfig.keyItem().getCount(), entityhuman);
@@ -65,7 +65,7 @@
unlock(worldserver, iblockdata, blockposition, vaultconfig, vaultserverdata, vaultshareddata, list);
vaultserverdata.addToRewardedPlayers(entityhuman);
vaultshareddata.updateConnectedPlayersWithinRange(worldserver, blockposition, vaultserverdata, vaultconfig, vaultconfig.deactivationRange());
@@ -342,6 +357,14 @@
@@ -341,6 +356,14 @@
vaultshareddata.setDisplayItem(ItemStack.EMPTY);
} else {
ItemStack itemstack = getRandomDisplayItemFromLootTable(worldserver, blockposition, (ResourceKey) vaultconfig.overrideLootTableToDisplay().orElse(vaultconfig.lootTable()));

View File

@@ -13,7 +13,7 @@
public final class WorldGenTreeProvider {
private static final Map<String, WorldGenTreeProvider> GROWERS = new Object2ObjectArrayMap();
@@ -74,21 +80,22 @@
@@ -75,21 +81,22 @@
}
}
@@ -31,20 +31,20 @@
ResourceKey<WorldGenFeatureConfigured<?, ?>> resourcekey = this.getConfiguredMegaFeature(randomsource);
if (resourcekey != null) {
- Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey).orElse(null); // CraftBukkit - decompile error
- Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(resourcekey).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder = (Holder) worldserver.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(resourcekey).orElse(null); // CraftBukkit - decompile error
if (holder != null) {
+ setTreeType(holder); // CraftBukkit
for (int i = 0; i >= -1; --i) {
for (int j = 0; j >= -1; --j) {
if (isTwoByTwoSapling(iblockdata, worldserver, blockposition, i, j)) {
@@ -119,11 +126,12 @@
@@ -120,11 +127,12 @@
if (resourcekey1 == null) {
return false;
} else {
- Holder<WorldGenFeatureConfigured<?, ?>> holder1 = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey1).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder1 = (Holder) worldserver.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE).getHolder(resourcekey1).orElse(null); // CraftBukkit - decompile error
- Holder<WorldGenFeatureConfigured<?, ?>> holder1 = (Holder) worldserver.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(resourcekey1).orElse((Object) null);
+ Holder<WorldGenFeatureConfigured<?, ?>> holder1 = (Holder) worldserver.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).get(resourcekey1).orElse(null); // CraftBukkit - decompile error
if (holder1 == null) {
return false;
@@ -53,7 +53,7 @@
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured1 = (WorldGenFeatureConfigured) holder1.value();
IBlockData iblockdata2 = worldserver.getFluidState(blockposition).createLegacyBlock();
@@ -164,11 +172,62 @@
@@ -165,11 +173,62 @@
return true;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/piston/BlockPiston.java
+++ b/net/minecraft/world/level/block/piston/BlockPiston.java
@@ -42,6 +42,14 @@
@@ -45,6 +45,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) -> {
@@ -152,6 +160,18 @@
@@ -155,6 +163,18 @@
}
}
@@ -34,7 +34,7 @@
world.blockEvent(blockposition, this, b0, enumdirection.get3DDataValue());
}
@@ -332,6 +352,48 @@
@@ -335,6 +355,48 @@
IBlockData[] aiblockdata = new IBlockData[list.size() + list2.size()];
EnumDirection enumdirection1 = flag ? enumdirection : enumdirection.getOpposite();
int i = 0;

View File

@@ -1,17 +1,18 @@
--- a/net/minecraft/world/level/block/state/BlockBase.java
+++ b/net/minecraft/world/level/block/state/BlockBase.java
@@ -81,6 +81,10 @@
@@ -84,6 +84,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
+// CraftBukkit start
+import net.minecraft.world.item.context.ItemActionContext;
+import net.minecraft.world.level.ServerExplosion;
+// CraftBukkit end
+
public abstract class BlockBase implements FeatureElement {
protected static final EnumDirection[] UPDATE_SHAPE_ORDER = new EnumDirection[]{EnumDirection.WEST, EnumDirection.EAST, EnumDirection.NORTH, EnumDirection.SOUTH, EnumDirection.DOWN, EnumDirection.UP};
@@ -156,6 +160,12 @@
@@ -158,6 +163,12 @@
protected void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {}
@@ -24,20 +25,20 @@
protected void onRemove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (iblockdata.hasBlockEntity() && !iblockdata.is(iblockdata1.getBlock())) {
world.removeBlockEntity(blockposition);
@@ -173,8 +183,10 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition) : null;
@@ -174,8 +185,10 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? worldserver.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());
- if (explosion.getBlockInteraction() == Explosion.Effect.DESTROY_WITH_DECAY) {
- lootparams_a.withParameter(LootContextParameters.EXPLOSION_RADIUS, explosion.radius());
+ // CraftBukkit start - add yield
+ if (explosion.yield < 1.0F) {
+ lootparams_a.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / explosion.yield);
+ if (explosion instanceof ServerExplosion serverExplosion && serverExplosion.yield < 1.0F) {
+ lootparams_a.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / serverExplosion.yield);
+ // CraftBukkit end
}
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag);
@@ -1066,7 +1078,13 @@
@@ -1121,7 +1134,13 @@
}
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) {