Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
@@ -38,6 +38,11 @@
@@ -45,6 +45,11 @@
@Override
public 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
@@ -41,6 +41,11 @@
@@ -42,6 +42,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -11,8 +11,8 @@
+
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
private static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
@@ -109,7 +114,7 @@
public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new);
@@ -116,7 +121,7 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
@@ -21,7 +21,7 @@
}
@Override
@@ -168,7 +173,20 @@
@@ -175,7 +180,20 @@
public 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 @@
}
}
@@ -182,9 +200,9 @@
@@ -189,9 +207,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);
}
@@ -210,8 +228,10 @@
@@ -217,8 +235,10 @@
return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
}
@@ -68,7 +68,7 @@
if (soundeffect != null) {
playTiltSound(world, blockposition, soundeffect);
}
@@ -225,14 +245,21 @@
@@ -232,14 +252,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);
@@ -240,6 +267,7 @@
@@ -247,6 +274,7 @@
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockposition);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -342,7 +342,13 @@
@@ -349,7 +349,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
@@ -15,7 +15,7 @@
}
}
@@ -368,7 +374,7 @@
@@ -375,7 +381,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);
}
@@ -504,17 +510,25 @@
@@ -512,17 +518,25 @@
return this.builtInRegistryHolder;
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBamboo.java
+++ b/net/minecraft/world/level/block/BlockBamboo.java
@@ -180,7 +180,7 @@
@@ -187,7 +187,7 @@
BlockPosition blockposition1 = blockposition.above(i);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
@@ -9,7 +9,7 @@
return;
}
@@ -201,14 +201,18 @@
@@ -208,14 +208,18 @@
BlockPosition blockposition1 = blockposition.below(2);
IBlockData iblockdata2 = world.getBlockState(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@@ -30,7 +30,7 @@
}
}
} else {
@@ -219,7 +223,14 @@
@@ -226,7 +230,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
@@ -88,6 +88,6 @@
@@ -95,6 +95,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
@@ -84,7 +84,8 @@
@@ -94,7 +94,8 @@
}
}
@@ -10,7 +10,7 @@
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -103,7 +104,16 @@
@@ -113,7 +114,16 @@
return EnumInteractionResult.SUCCESS;
} else {
@@ -27,7 +27,7 @@
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -114,8 +124,29 @@
@@ -124,8 +134,29 @@
}
}
@@ -58,7 +58,7 @@
}
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
@@ -314,6 +345,11 @@
@@ -324,6 +355,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
@@ -112,7 +112,7 @@
@@ -119,7 +119,7 @@
if (entitybee.getTarget() == null) {
EntityHuman entityhuman = (EntityHuman) SystemUtils.getRandom(list1, world.random);
@@ -9,20 +9,3 @@
}
}
}
@@ -338,4 +338,16 @@
return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
}
+
+ // CraftBukkit start - fix MC-227255
+ @Override
+ public IBlockData rotate(IBlockData iblockdata, EnumBlockRotation enumblockrotation) {
+ return iblockdata.setValue(BlockBeehive.FACING, enumblockrotation.rotate(iblockdata.getValue(BlockBeehive.FACING)));
+ }
+
+ @Override
+ public IBlockData mirror(IBlockData iblockdata, EnumBlockMirror enumblockmirror) {
+ return iblockdata.rotate(enumblockmirror.getRotation(iblockdata.getValue(BlockBeehive.FACING)));
+ }
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBell.java
+++ b/net/minecraft/world/level/block/BlockBell.java
@@ -136,6 +136,11 @@
@@ -146,6 +146,11 @@
if (enumdirection == null) {
enumdirection = (EnumDirection) world.getBlockState(blockposition).getValue(BlockBell.FACING);
}
@@ -12,20 +12,3 @@
((TileEntityBell) tileentity).onHit(enumdirection);
world.playSound((EntityHuman) null, blockposition, SoundEffects.BELL_BLOCK, SoundCategory.BLOCKS, 2.0F, 1.0F);
@@ -262,4 +267,16 @@
public boolean isPathfindable(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) {
return false;
}
+
+ // CraftBukkit start - fix MC-253819
+ @Override
+ public IBlockData rotate(IBlockData iblockdata, EnumBlockRotation enumblockrotation) {
+ return iblockdata.setValue(BlockBell.FACING, enumblockrotation.rotate(iblockdata.getValue(BlockBell.FACING)));
+ }
+
+ @Override
+ public IBlockData mirror(IBlockData iblockdata, EnumBlockMirror enumblockmirror) {
+ return iblockdata.rotate(enumblockmirror.getRotation(iblockdata.getValue(BlockBell.FACING)));
+ }
+ // CraftBukkit end
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
@@ -27,6 +27,11 @@
@@ -33,6 +33,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,8 +11,8 @@
+
public class BlockButtonAbstract extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -108,6 +113,19 @@
public static final MapCodec<BlockButtonAbstract> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -124,6 +129,19 @@
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
return EnumInteractionResult.CONSUME;
} else {
@@ -32,12 +32,12 @@
this.press(iblockdata, world, blockposition);
this.playSound(entityhuman, world, blockposition, true);
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
@@ -170,11 +188,36 @@
@@ -195,11 +213,36 @@
}
protected void checkPressed(IBlockData iblockdata, World world, BlockPosition blockposition) {
- EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse((Object) null) : null;
+ EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse(null) : null; // CraftBukkit - decompile error
- EntityArrow entityarrow = this.type.canButtonBeActivatedByArrows() ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse((Object) null) : null;
+ EntityArrow entityarrow = this.type.canButtonBeActivatedByArrows() ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse(null) : null; // CraftBukkit - decompile error
boolean flag = entityarrow != null;
boolean flag1 = (Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCactus.java
+++ b/net/minecraft/world/level/block/BlockCactus.java
@@ -21,6 +21,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
@@ -57,7 +59,7 @@
public static final MapCodec<BlockCactus> CODEC = simpleCodec(BlockCactus::new);
@@ -64,7 +66,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);
@@ -112,7 +114,9 @@
@@ -119,7 +121,9 @@
@Override
public 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
@@ -85,7 +85,18 @@
@@ -92,7 +92,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
@@ -47,6 +47,10 @@
@@ -50,6 +50,10 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -10,8 +10,8 @@
+
public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged {
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
@@ -91,7 +95,9 @@
public static final MapCodec<BlockCampfire> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -106,7 +110,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
@@ -21,7 +21,7 @@
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -201,6 +207,11 @@
@@ -216,6 +222,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCauldron.java
+++ b/net/minecraft/world/level/block/BlockCauldron.java
@@ -11,6 +11,10 @@
@@ -12,6 +12,10 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
@@ -10,8 +10,8 @@
+
public class BlockCauldron extends AbstractCauldronBlock {
private static final float RAIN_FILL_CHANCE = 0.05F;
@@ -54,13 +58,11 @@
public static final MapCodec<BlockCauldron> CODEC = simpleCodec(BlockCauldron::new);
@@ -61,13 +65,11 @@
if (fluidtype == FluidTypes.WATER) {
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChest.java
+++ b/net/minecraft/world/level/block/BlockChest.java
@@ -87,24 +87,7 @@
@@ -93,24 +93,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) {
@@ -117,6 +100,38 @@
@@ -123,6 +106,38 @@
}
};
@@ -62,10 +62,10 @@
+ };
+ // CraftBukkit end
+
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
super(blockbase_info, supplier);
this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(BlockChest.FACING, EnumDirection.NORTH)).setValue(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).setValue(BlockChest.WATERLOGGED, false));
@@ -275,7 +290,7 @@
@Override
public MapCodec<? extends BlockChest> codec() {
return BlockChest.CODEC;
@@ -278,7 +293,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) -> {
@@ -291,7 +306,14 @@
@@ -294,7 +309,14 @@
@Nullable
@Override
public 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
@@ -20,6 +20,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -8,23 +8,23 @@
+
public class BlockChorusFlower extends Block {
public static final int DEAD_AGE = 5;
@@ -90,8 +92,12 @@
public static final MapCodec<BlockChorusFlower> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -102,8 +104,12 @@
}
if (flag && allNeighborsEmpty(worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmptyBlock(blockposition.above(2))) {
- worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
- worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
- this.placeGrownFlower(worldserver, blockposition1, i);
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
+ worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
+ worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
+ this.placeGrownFlower(worldserver, blockposition1, i);
+ }
+ // CraftBukkit end
} else if (i < 4) {
j = randomsource.nextInt(4);
if (flag1) {
@@ -105,18 +111,30 @@
@@ -117,18 +123,30 @@
BlockPosition blockposition2 = blockposition.relative(enumdirection);
if (worldserver.isEmptyBlock(blockposition2) && worldserver.isEmptyBlock(blockposition2.below()) && allNeighborsEmpty(worldserver, blockposition2, enumdirection.getOpposite())) {
@@ -40,7 +40,7 @@
}
if (flag2) {
worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
} else {
- this.placeDeadFlower(worldserver, blockposition);
+ // CraftBukkit start - add event
@@ -59,10 +59,10 @@
}
}
@@ -253,6 +271,11 @@
@@ -265,6 +283,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.getType().is(TagsEntity.IMPACT_PROJECTILES)) {
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCocoa.java
+++ b/net/minecraft/world/level/block/BlockCocoa.java
@@ -20,6 +20,8 @@
@@ -21,6 +21,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockCocoa extends BlockFacingHorizontal implements IBlockFragilePlantElement {
public static final int MAX_AGE = 2;
@@ -54,7 +56,7 @@
public static final MapCodec<BlockCocoa> CODEC = simpleCodec(BlockCocoa::new);
@@ -61,7 +63,7 @@
int i = (Integer) iblockdata.getValue(BlockCocoa.AGE);
if (i < 2) {
@@ -18,7 +18,7 @@
}
}
@@ -124,7 +126,7 @@
@@ -131,7 +133,7 @@
@Override
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCommand.java
+++ b/net/minecraft/world/level/block/BlockCommand.java
@@ -27,6 +27,8 @@
@@ -30,6 +30,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
@@ -8,8 +8,8 @@
+
public class BlockCommand extends BlockTileEntity implements GameMasterBlock {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -57,6 +59,15 @@
public static final MapCodec<BlockCommand> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -70,6 +72,15 @@
TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
boolean flag1 = world.hasNeighborSignal(blockposition);
boolean flag2 = tileentitycommand.isPowered();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockComposter.java
+++ b/net/minecraft/world/level/block/BlockComposter.java
@@ -40,6 +40,11 @@
@@ -41,6 +41,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -11,8 +11,8 @@
+
public class BlockComposter extends Block implements IInventoryHolder {
public static final int READY = 8;
@@ -248,7 +253,14 @@
public static final MapCodec<BlockComposter> CODEC = simpleCodec(BlockComposter::new);
@@ -255,7 +260,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;
@@ -258,6 +270,14 @@
@@ -265,6 +277,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));
@@ -281,10 +301,16 @@
@@ -288,10 +308,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;
@@ -333,7 +359,8 @@
@@ -340,7 +366,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 {
@@ -348,6 +375,7 @@
@@ -355,6 +382,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -79,7 +79,7 @@
}
@Override
@@ -372,8 +400,15 @@
@@ -379,8 +407,15 @@
@Override
public void setChanged() {
@@ -95,7 +95,7 @@
}
}
@@ -386,6 +421,7 @@
@@ -393,6 +428,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@@ -103,7 +103,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -428,8 +464,9 @@
@@ -435,8 +471,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
@@ -11,6 +11,12 @@
@@ -14,6 +14,12 @@
import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
@@ -12,21 +12,21 @@
+
public class BlockConcretePowder extends BlockFalling {
private final IBlockData concrete;
@@ -23,7 +29,7 @@
public static final MapCodec<BlockConcretePowder> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -36,7 +42,7 @@
@Override
public void onLand(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, EntityFallingBlock entityfallingblock) {
if (shouldSolidify(world, blockposition, iblockdata1)) {
- world.setBlock(blockposition, this.concrete, 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.concrete, 3); // CraftBukkit
- world.setBlock(blockposition, this.concrete.defaultBlockState(), 3);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, blockposition, this.concrete.defaultBlockState(), 3); // CraftBukkit
}
}
@@ -34,7 +40,24 @@
@@ -47,7 +53,24 @@
BlockPosition blockposition = blockactioncontext.getClickedPos();
IBlockData iblockdata = world.getBlockState(blockposition);
- return shouldSolidify(world, blockposition, iblockdata) ? this.concrete : super.getStateForPlacement(blockactioncontext);
- return shouldSolidify(world, blockposition, iblockdata) ? this.concrete.defaultBlockState() : super.getStateForPlacement(blockactioncontext);
+ // CraftBukkit start
+ if (!shouldSolidify(world, blockposition, iblockdata)) {
+ return super.getStateForPlacement(blockactioncontext);
@@ -34,7 +34,7 @@
+
+ // TODO: An event factory call for methods like this
+ CraftBlockState blockState = CraftBlockStates.getBlockState(world, blockposition);
+ blockState.setData(this.concrete);
+ blockState.setData(this.concrete.defaultBlockState());
+
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ world.getServer().server.getPluginManager().callEvent(event);
@@ -48,19 +48,19 @@
}
private static boolean shouldSolidify(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata) {
@@ -70,7 +93,25 @@
@@ -83,7 +106,25 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
- return touchesLiquid(generatoraccess, blockposition) ? this.concrete : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
- return touchesLiquid(generatoraccess, blockposition) ? this.concrete.defaultBlockState() : super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
+ // CraftBukkit start
+ if (touchesLiquid(generatoraccess, blockposition)) {
+ // Suppress during worldgen
+ if (!(generatoraccess instanceof World)) {
+ return this.concrete;
+ return this.concrete.defaultBlockState();
+ }
+ CraftBlockState blockState = CraftBlockStates.getBlockState(generatoraccess, blockposition);
+ blockState.setData(this.concrete);
+ blockState.setData(this.concrete.defaultBlockState());
+
+ BlockFormEvent event = new BlockFormEvent(blockState.getBlock(), blockState);
+ ((World) generatoraccess).getCraftServer().getPluginManager().callEvent(event);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCoral.java
+++ b/net/minecraft/world/level/block/BlockCoral.java
@@ -25,6 +25,11 @@
@@ -39,6 +39,11 @@
@Override
public 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
@@ -28,6 +28,11 @@
@@ -40,6 +40,11 @@
@Override
public 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
@@ -28,6 +28,11 @@
@@ -40,6 +40,11 @@
@Override
public 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
@@ -33,6 +33,11 @@
@@ -45,6 +45,11 @@
@Override
public 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/BlockCrops.java
+++ b/net/minecraft/world/level/block/BlockCrops.java
@@ -21,6 +21,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockCrops extends BlockPlant implements IBlockFragilePlantElement {
public static final int MAX_AGE = 7;
@@ -76,7 +78,7 @@
public static final MapCodec<BlockCrops> CODEC = simpleCodec(BlockCrops::new);
@@ -83,7 +85,7 @@
float f = getGrowthSpeed(this, worldserver, blockposition);
if (randomsource.nextInt((int) (25.0F / f) + 1) == 0) {
@@ -18,7 +18,7 @@
}
}
}
@@ -91,7 +93,7 @@
@@ -98,7 +100,7 @@
i = j;
}
@@ -27,7 +27,7 @@
}
protected int getBonemealAgeIncrease(World world) {
@@ -153,7 +155,7 @@
@@ -160,7 +162,7 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDaylightDetector.java
+++ b/net/minecraft/world/level/block/BlockDaylightDetector.java
@@ -67,6 +67,7 @@
@@ -74,6 +74,7 @@
i = MathHelper.clamp(i, 0, 15);
if ((Integer) iblockdata.getValue(BlockDaylightDetector.POWER) != i) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDiodeAbstract.java
+++ b/net/minecraft/world/level/block/BlockDiodeAbstract.java
@@ -20,6 +20,8 @@
@@ -21,6 +21,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);
@@ -52,8 +54,18 @@
@@ -56,8 +58,18 @@
boolean flag1 = this.shouldTurnOn(worldserver, blockposition, iblockdata);
if (flag && !flag1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
+++ b/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java
@@ -40,6 +40,11 @@
@@ -44,6 +44,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!canBeGrass(iblockdata, worldserver, blockposition)) {
@@ -12,7 +12,7 @@
worldserver.setBlockAndUpdate(blockposition, Blocks.DIRT.defaultBlockState());
} else {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9) {
@@ -49,7 +54,7 @@
@@ -53,7 +58,7 @@
BlockPosition blockposition1 = blockposition.offset(randomsource.nextInt(3) - 1, randomsource.nextInt(5) - 3, randomsource.nextInt(3) - 1);
if (worldserver.getBlockState(blockposition1).is(Blocks.DIRT) && canPropagate(iblockdata1, worldserver, blockposition1)) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/level/block/BlockDispenser.java
+++ b/net/minecraft/world/level/block/BlockDispenser.java
@@ -48,6 +48,7 @@
@@ -49,6 +49,7 @@
object2objectopenhashmap.defaultReturnValue(new DispenseBehaviorItem());
});
private static final int TRIGGER_DURATION = 4;
+ public static boolean eventFired = false; // CraftBukkit
public static void registerBehavior(IMaterial imaterial, IDispenseBehavior idispensebehavior) {
BlockDispenser.DISPENSER_REGISTRY.put(imaterial.asItem(), idispensebehavior);
@@ -79,7 +80,7 @@
@Override
public MapCodec<? extends BlockDispenser> codec() {
@@ -85,7 +86,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);
@@ -95,6 +96,7 @@
@@ -101,6 +102,7 @@
IDispenseBehavior idispensebehavior = this.getDispenseMethod(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
@@ -33,6 +33,8 @@
@@ -37,6 +37,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockDoor extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -189,9 +191,24 @@
public static final MapCodec<BlockDoor> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -220,9 +222,24 @@
@Override
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDragonEgg.java
+++ b/net/minecraft/world/level/block/BlockDragonEgg.java
@@ -16,6 +16,8 @@
@@ -17,6 +17,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockDragonEgg extends BlockFalling {
protected static final VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
@@ -47,6 +49,18 @@
public static final MapCodec<BlockDragonEgg> CODEC = simpleCodec(BlockDragonEgg::new);
@@ -54,6 +56,18 @@
BlockPosition blockposition1 = blockposition.offset(world.random.nextInt(16) - world.random.nextInt(16), world.random.nextInt(8) - world.random.nextInt(8), world.random.nextInt(16) - world.random.nextInt(16));
if (world.getBlockState(blockposition1).isAir() && worldborder.isWithinBounds(blockposition1)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockDropper.java
+++ b/net/minecraft/world/level/block/BlockDropper.java
@@ -18,10 +18,16 @@
@@ -19,11 +19,17 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
@@ -13,12 +13,13 @@
public class BlockDropper extends BlockDispenser {
private static final Logger LOGGER = LogUtils.getLogger();
public static final MapCodec<BlockDropper> CODEC = simpleCodec(BlockDropper::new);
- private static final IDispenseBehavior DISPENSE_BEHAVIOUR = new DispenseBehaviorItem();
+ private static final IDispenseBehavior DISPENSE_BEHAVIOUR = new DispenseBehaviorItem(true); // CraftBukkit
public BlockDropper(BlockBase.Info blockbase_info) {
super(blockbase_info);
@@ -39,7 +45,7 @@
@Override
public MapCodec<BlockDropper> codec() {
@@ -46,7 +52,7 @@
@Override
public void dispenseFrom(WorldServer worldserver, IBlockData iblockdata, BlockPosition blockposition) {
@@ -27,7 +28,7 @@
if (tileentitydispenser == null) {
BlockDropper.LOGGER.warn("Ignoring dispensing attempt for Dropper without matching block entity at {}", blockposition);
@@ -60,8 +66,25 @@
@@ -67,8 +73,25 @@
if (iinventory == null) {
itemstack1 = BlockDropper.DISPENSE_BEHAVIOUR.dispense(sourceblock, itemstack);
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockEnderPortal.java
+++ b/net/minecraft/world/level/block/BlockEnderPortal.java
@@ -19,6 +19,13 @@
@@ -21,6 +21,13 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -13,8 +13,8 @@
+
public class BlockEnderPortal extends BlockTileEntity {
protected static final VoxelShape SHAPE = Block.box(0.0D, 6.0D, 0.0D, 16.0D, 12.0D, 16.0D);
@@ -40,13 +47,22 @@
public static final MapCodec<BlockEnderPortal> CODEC = simpleCodec(BlockEnderPortal::new);
@@ -48,13 +55,22 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (world instanceof WorldServer && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFire.java
+++ b/net/minecraft/world/level/block/BlockFire.java
@@ -28,6 +28,14 @@
@@ -29,6 +29,14 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -14,8 +14,8 @@
+
public class BlockFire extends BlockFireAbstract {
public static final int MAX_AGE = 15;
@@ -93,7 +101,24 @@
public static final MapCodec<BlockFire> CODEC = simpleCodec(BlockFire::new);
@@ -100,7 +108,24 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
@@ -41,7 +41,7 @@
}
@Override
@@ -142,7 +167,7 @@
@@ -149,7 +174,7 @@
worldserver.scheduleTick(blockposition, (Block) this, getFireTickDelay(worldserver.random));
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
if (!iblockdata.canSurvive(worldserver, blockposition)) {
@@ -50,7 +50,7 @@
}
IBlockData iblockdata1 = worldserver.getBlockState(blockposition.below());
@@ -150,7 +175,7 @@
@@ -157,7 +182,7 @@
int i = (Integer) iblockdata.getValue(BlockFire.AGE);
if (!flag && worldserver.isRaining() && this.isNearRain(worldserver, blockposition) && randomsource.nextFloat() < 0.2F + (float) i * 0.03F) {
@@ -59,7 +59,7 @@
} else {
int j = Math.min(15, i + randomsource.nextInt(3) / 2);
@@ -164,14 +189,14 @@
@@ -171,14 +196,14 @@
BlockPosition blockposition1 = blockposition.below();
if (!worldserver.getBlockState(blockposition1).isFaceSturdy(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
@@ -76,7 +76,7 @@
return;
}
}
@@ -179,12 +204,14 @@
@@ -186,12 +211,14 @@
boolean flag1 = worldserver.getBiome(blockposition).is(BiomeTags.INCREASED_FIRE_BURNOUT);
int k = flag1 ? -50 : 0;
@@ -97,7 +97,7 @@
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l = -1; l <= 1; ++l) {
@@ -210,7 +237,15 @@
@@ -217,7 +244,15 @@
if (i2 > 0 && randomsource.nextInt(k1) <= i2 && (!worldserver.isRaining() || !this.isNearRain(worldserver, blockposition_mutableblockposition))) {
int j2 = Math.min(15, i + randomsource.nextInt(5) / 4);
@@ -114,7 +114,7 @@
}
}
}
@@ -234,12 +269,28 @@
@@ -241,12 +276,28 @@
return iblockdata.hasProperty(BlockProperties.WATERLOGGED) && (Boolean) iblockdata.getValue(BlockProperties.WATERLOGGED) ? 0 : this.igniteOdds.getInt(iblockdata.getBlock());
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFireAbstract.java
+++ b/net/minecraft/world/level/block/BlockFireAbstract.java
@@ -123,7 +123,14 @@
@@ -127,7 +127,14 @@
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
@@ -16,7 +16,7 @@
}
}
@@ -144,14 +151,14 @@
@@ -148,14 +155,14 @@
}
if (!iblockdata.canSurvive(world, blockposition)) {
@@ -33,7 +33,7 @@
}
@Override
@@ -199,4 +206,12 @@
@@ -203,4 +210,12 @@
}
}
}

View File

@@ -1,6 +1,15 @@
--- a/net/minecraft/world/level/block/BlockFluids.java
+++ b/net/minecraft/world/level/block/BlockFluids.java
@@ -142,14 +142,20 @@
@@ -39,7 +39,7 @@
public class BlockFluids extends Block implements IFluidSource {
private static final Codec<FluidTypeFlowing> FLOWING_FLUID = BuiltInRegistries.FLUID.byNameCodec().comapFlatMap((fluidtype) -> {
- DataResult dataresult;
+ DataResult<FluidTypeFlowing> dataresult; // CraftBukkit - decompile error
if (fluidtype instanceof FluidTypeFlowing) {
FluidTypeFlowing fluidtypeflowing = (FluidTypeFlowing) fluidtype;
@@ -174,14 +174,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/BlockFungi.java
+++ b/net/minecraft/world/level/block/BlockFungi.java
@@ -59,6 +59,13 @@
@@ -74,6 +74,13 @@
@Override
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {
this.getFeature(worldserver).ifPresent((holder) -> {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockGrassPath.java
+++ b/net/minecraft/world/level/block/BlockGrassPath.java
@@ -44,6 +44,11 @@
@@ -51,6 +51,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockGrowingTop.java
+++ b/net/minecraft/world/level/block/BlockGrowingTop.java
@@ -44,7 +44,7 @@
@@ -48,7 +48,7 @@
BlockPosition blockposition1 = blockposition.relative(this.growthDirection);
if (this.canGrowInto(worldserver.getBlockState(blockposition1))) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockIce.java
+++ b/net/minecraft/world/level/block/BlockIce.java
@@ -51,6 +51,11 @@
@@ -59,6 +59,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
@@ -24,6 +24,8 @@
@@ -25,6 +25,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,8 +8,8 @@
+
public class BlockLeaves extends Block implements IBlockWaterlogged {
public static final int DECAY_DISTANCE = 7;
@@ -50,6 +52,14 @@
public static final MapCodec<BlockLeaves> CODEC = simpleCodec(BlockLeaves::new);
@@ -57,6 +59,14 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
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
@@ -200,12 +200,13 @@
@@ -207,12 +207,13 @@
}
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
@@ -24,6 +24,8 @@
@@ -28,6 +28,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockLever extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -91,6 +93,20 @@
public static final MapCodec<BlockLever> CODEC = simpleCodec(BlockLever::new);
@@ -101,6 +103,20 @@
return EnumInteractionResult.SUCCESS;
} else {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMinecartDetector.java
+++ b/net/minecraft/world/level/block/BlockMinecartDetector.java
@@ -25,6 +25,8 @@
@@ -26,6 +26,8 @@
import net.minecraft.world.level.block.state.properties.IBlockState;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -8,8 +8,8 @@
+
public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.RAIL_SHAPE_STRAIGHT;
@@ -80,6 +82,16 @@
public static final MapCodec<BlockMinecartDetector> CODEC = simpleCodec(BlockMinecartDetector::new);
@@ -87,6 +89,16 @@
}
IBlockData iblockdata1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockMobSpawner.java
+++ b/net/minecraft/world/level/block/BlockMobSpawner.java
@@ -43,12 +43,20 @@
@@ -45,12 +45,20 @@
@Override
public 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/BlockMonsterEggs.java
+++ b/net/minecraft/world/level/block/BlockMonsterEggs.java
@@ -16,6 +16,8 @@
@@ -19,6 +19,8 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -8,8 +8,8 @@
+
public class BlockMonsterEggs extends Block {
private final Block hostBlock;
@@ -42,7 +44,7 @@
public static final MapCodec<BlockMonsterEggs> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -53,7 +55,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/BlockMushroom.java
+++ b/net/minecraft/world/level/block/BlockMushroom.java
@@ -18,6 +18,10 @@
@@ -20,6 +20,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -10,8 +10,8 @@
+
public class BlockMushroom extends BlockPlant implements IBlockFragilePlantElement {
protected static final float AABB_OFFSET = 3.0F;
@@ -63,7 +67,7 @@
public static final MapCodec<BlockMushroom> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -75,7 +79,7 @@
}
if (worldserver.isEmptyBlock(blockposition2) && iblockdata.canSurvive(worldserver, blockposition2)) {
@@ -20,7 +20,7 @@
}
}
@@ -89,6 +93,7 @@
@@ -101,6 +105,7 @@
return false;
} else {
worldserver.removeBlock(blockposition, false);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNetherWart.java
+++ b/net/minecraft/world/level/block/BlockNetherWart.java
@@ -46,7 +46,7 @@
@@ -54,7 +54,7 @@
if (i < 3 && randomsource.nextInt(10) == 0) {
iblockdata = (IBlockData) iblockdata.setValue(BlockNetherWart.AGE, i + 1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -75,6 +75,7 @@
@@ -82,6 +82,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);
@@ -84,6 +85,12 @@
@@ -91,6 +92,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,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNylium.java
+++ b/net/minecraft/world/level/block/BlockNylium.java
@@ -33,6 +33,11 @@
@@ -41,6 +41,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (!canBeNylium(iblockdata, worldserver, blockposition)) {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPlant.java
+++ b/net/minecraft/world/level/block/BlockPlant.java
@@ -22,7 +22,14 @@
@@ -26,7 +26,14 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPortal.java
+++ b/net/minecraft/world/level/block/BlockPortal.java
@@ -24,6 +24,10 @@
@@ -26,6 +26,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -10,8 +10,8 @@
+
public class BlockPortal extends Block {
public static final BlockStateEnum<EnumDirection.EnumAxis> AXIS = BlockProperties.HORIZONTAL_AXIS;
@@ -55,7 +59,8 @@
public static final MapCodec<BlockPortal> CODEC = simpleCodec(BlockPortal::new);
@@ -63,7 +67,8 @@
}
if (worldserver.getBlockState(blockposition).isValidSpawn(worldserver, blockposition, EntityTypes.ZOMBIFIED_PIGLIN)) {
@@ -21,7 +21,7 @@
if (entity != null) {
entity.setPortalCooldown();
@@ -77,6 +82,10 @@
@@ -85,6 +90,10 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (entity.canChangeDimensions()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPoweredRail.java
+++ b/net/minecraft/world/level/block/BlockPoweredRail.java
@@ -11,6 +11,8 @@
@@ -12,6 +12,8 @@
import net.minecraft.world.level.block.state.properties.BlockStateEnum;
import net.minecraft.world.level.block.state.properties.IBlockState;
@@ -8,8 +8,8 @@
+
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
public static final BlockStateEnum<BlockPropertyTrackPosition> SHAPE = BlockProperties.RAIL_SHAPE_STRAIGHT;
@@ -113,6 +115,13 @@
public static final MapCodec<BlockPoweredRail> CODEC = simpleCodec(BlockPoweredRail::new);
@@ -120,6 +122,13 @@
boolean flag1 = world.hasNeighborSignal(blockposition) || this.findPoweredRailSignal(world, blockposition, iblockdata, true, 0) || this.findPoweredRailSignal(world, blockposition, iblockdata, false, 0);
if (flag1 != flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
@@ -21,6 +21,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public abstract class BlockPressurePlateAbstract extends Block {
protected static final VoxelShape PRESSED_AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 0.5D, 15.0D);
@@ -86,6 +88,19 @@
@@ -90,6 +92,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;
@@ -29,7 +29,7 @@
if (i != j) {
IBlockData iblockdata1 = this.setSignalForState(iblockdata, j);
@@ -140,9 +155,15 @@
@@ -144,9 +159,15 @@
}
protected static int getEntityCount(World world, AxisAlignedBB axisalignedbb, Class<? extends Entity> oclass) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateBinary.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateBinary.java
@@ -11,6 +11,11 @@
@@ -13,6 +13,11 @@
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
@@ -11,19 +11,19 @@
+
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -34,7 +39,7 @@
public static final MapCodec<BlockPressurePlateBinary> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -44,7 +49,7 @@
@Override
protected int getSignalStrength(World world, BlockPosition blockposition) {
- Class oclass;
+ Class<? extends Entity> oclass; // CraftBukkit
switch (this.sensitivity) {
switch (this.type.pressurePlateSensitivity()) {
case EVERYTHING:
@@ -49,7 +54,31 @@
@@ -59,7 +64,31 @@
Class oclass1 = oclass;
Class<? extends Entity> oclass1 = oclass;
- return getEntityCount(world, BlockPressurePlateBinary.TOUCH_AABB.move(blockposition), oclass1) > 0 ? 15 : 0;
+ // CraftBukkit start - Call interact event when turning on a pressure plate

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateWeighted.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateWeighted.java
@@ -11,6 +11,11 @@
@@ -14,6 +14,11 @@
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.BlockStateInteger;
@@ -11,8 +11,8 @@
+
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
public static final BlockStateInteger POWER = BlockProperties.POWER;
@@ -24,7 +29,27 @@
public static final MapCodec<BlockPressurePlateWeighted> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -39,7 +44,27 @@
@Override
protected int getSignalStrength(World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPumpkinCarved.java
+++ b/net/minecraft/world/level/block/BlockPumpkinCarved.java
@@ -23,6 +23,10 @@
@@ -24,6 +24,10 @@
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
import net.minecraft.world.level.block.state.properties.BlockStateDirection;
@@ -10,8 +10,8 @@
+
public class BlockPumpkinCarved extends BlockFacingHorizontal {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -79,9 +83,14 @@
public static final MapCodec<BlockPumpkinCarved> CODEC = simpleCodec(BlockPumpkinCarved::new);
@@ -86,9 +90,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;
@@ -8,8 +8,8 @@
+
public class BlockRedstoneComparator extends BlockDiodeAbstract implements ITileEntity {
public static final BlockStateEnum<BlockPropertyComparatorMode> MODE = BlockProperties.MODE_COMPARATOR;
@@ -103,7 +105,8 @@
public static final MapCodec<BlockRedstoneComparator> CODEC = simpleCodec(BlockRedstoneComparator::new);
@@ -110,7 +112,8 @@
@Nullable
private EntityItemFrame getItemFrame(World world, EnumDirection enumdirection, BlockPosition blockposition) {
@@ -19,7 +19,7 @@
return entityitemframe != null && entityitemframe.getDirection() == enumdirection;
});
@@ -158,8 +161,18 @@
@@ -165,8 +168,18 @@
boolean flag1 = (Boolean) iblockdata.getValue(BlockRedstoneComparator.POWERED);
if (flag1 && !flag) {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockRedstoneOre.java
+++ b/net/minecraft/world/level/block/BlockRedstoneOre.java
@@ -21,6 +21,11 @@
@@ -22,6 +22,11 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import net.minecraft.world.phys.MovingObjectPositionBlock;
@@ -11,8 +11,8 @@
+
public class BlockRedstoneOre extends Block {
public static final BlockStateBoolean LIT = BlockRedstoneTorch.LIT;
@@ -32,14 +37,27 @@
public static final MapCodec<BlockRedstoneOre> CODEC = simpleCodec(BlockRedstoneOre::new);
@@ -39,14 +44,27 @@
@Override
public void attack(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman) {
@@ -42,7 +42,7 @@
}
super.stepOn(world, blockposition, iblockdata, entity);
@@ -50,7 +68,7 @@
@@ -57,7 +75,7 @@
if (world.isClientSide) {
spawnParticles(world, blockposition);
} else {
@@ -51,7 +51,7 @@
}
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -58,9 +76,14 @@
@@ -65,9 +83,14 @@
return itemstack.getItem() instanceof ItemBlock && (new BlockActionContext(entityhuman, enumhand, itemstack, movingobjectpositionblock)).canPlace() ? EnumInteractionResult.PASS : EnumInteractionResult.SUCCESS;
}
@@ -67,7 +67,7 @@
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, true), 3);
}
@@ -74,6 +97,11 @@
@@ -81,6 +104,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if ((Boolean) iblockdata.getValue(BlockRedstoneOre.LIT)) {
@@ -79,7 +79,7 @@
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneOre.LIT, false), 3);
}
@@ -82,12 +110,20 @@
@@ -89,12 +117,20 @@
@Override
public void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/block/BlockRedstoneTorch.java
+++ b/net/minecraft/world/level/block/BlockRedstoneTorch.java
@@ -18,6 +18,8 @@
@@ -19,6 +19,8 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneTorch extends BlockTorch {
public class BlockRedstoneTorch extends BaseTorchBlock {
public static final BlockStateBoolean LIT = BlockProperties.LIT;
@@ -78,8 +80,24 @@
public static final MapCodec<BlockRedstoneTorch> CODEC = simpleCodec(BlockRedstoneTorch::new);
@@ -85,8 +87,24 @@
list.remove(0);
}
@@ -34,7 +34,7 @@
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockRedstoneTorch.LIT, false), 3);
if (isToggledTooFrequently(worldserver, blockposition, true)) {
worldserver.levelEvent(1502, blockposition, 0);
@@ -87,6 +105,15 @@
@@ -94,6 +112,15 @@
}
}
} else if (!flag && !isToggledTooFrequently(worldserver, blockposition, false)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockRedstoneWire.java
+++ b/net/minecraft/world/level/block/BlockRedstoneWire.java
@@ -36,6 +36,8 @@
@@ -37,6 +37,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,8 +8,8 @@
+
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockPropertyRedstoneSide> NORTH = BlockProperties.NORTH_REDSTONE;
@@ -254,7 +256,16 @@
public static final MapCodec<BlockRedstoneWire> CODEC = simpleCodec(BlockRedstoneWire::new);
@@ -261,7 +263,16 @@
private void updatePowerStrength(World world, BlockPosition blockposition, IBlockData iblockdata) {
int i = this.calculateTargetStrength(world, blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockReed.java
+++ b/net/minecraft/world/level/block/BlockReed.java
@@ -56,7 +56,7 @@
@@ -63,7 +63,7 @@
int j = (Integer) iblockdata.getValue(BlockReed.AGE);
if (j == 15) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockRespawnAnchor.java
+++ b/net/minecraft/world/level/block/BlockRespawnAnchor.java
@@ -80,7 +80,7 @@
@@ -87,7 +87,7 @@
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
if (entityplayer.getRespawnDimension() != world.dimension() || !blockposition.equals(entityplayer.getRespawnPosition())) {
@@ -9,7 +9,7 @@
world.playSound((EntityHuman) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, SoundEffects.RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
return EnumInteractionResult.SUCCESS;
}
@@ -120,7 +120,7 @@
@@ -127,7 +127,7 @@
private void explode(IBlockData iblockdata, World world, final BlockPosition blockposition) {
world.removeBlock(blockposition, false);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSapling.java
+++ b/net/minecraft/world/level/block/BlockSapling.java
@@ -15,12 +15,21 @@
@@ -17,6 +17,14 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -14,15 +14,16 @@
+
public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement {
public static final BlockStateInteger STAGE = BlockProperties.STAGE;
public static final MapCodec<BlockSapling> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -28,6 +36,7 @@
protected static final float AABB_OFFSET = 6.0F;
protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D);
private final WorldGenTreeProvider treeGrower;
protected final WorldGenTreeProvider treeGrower;
+ public static TreeType treeType; // CraftBukkit
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
super(blockbase_info);
@@ -45,7 +54,32 @@
@Override
public MapCodec<? extends BlockSapling> codec() {
@@ -57,7 +66,32 @@
if ((Integer) iblockdata.getValue(BlockSapling.STAGE) == 0) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockSapling.STAGE), 4);
} else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockScaffolding.java
+++ b/net/minecraft/world/level/block/BlockScaffolding.java
@@ -96,7 +96,7 @@
@@ -103,7 +103,7 @@
int i = getDistance(worldserver, blockposition);
IBlockData iblockdata1 = (IBlockData) ((IBlockData) iblockdata.setValue(BlockScaffolding.DISTANCE, i)).setValue(BlockScaffolding.BOTTOM, this.isBottom(worldserver, blockposition, i));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSign.java
+++ b/net/minecraft/world/level/block/BlockSign.java
@@ -115,7 +115,7 @@
@@ -118,7 +118,7 @@
} else if (flag2) {
return EnumInteractionResult.SUCCESS;
} else if (!this.otherPlayerIsEditingSign(entityhuman, tileentitysign) && entityhuman.mayBuild() && this.hasEditableText(entityhuman, tileentitysign, flag1)) {
@@ -9,7 +9,7 @@
return this.getInteractionResult(flag);
} else {
return EnumInteractionResult.PASS;
@@ -168,6 +168,15 @@
@@ -171,6 +171,15 @@
}
public void openTextEdit(EntityHuman entityhuman, TileEntitySign tileentitysign, boolean flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSnow.java
+++ b/net/minecraft/world/level/block/BlockSnow.java
@@ -92,6 +92,11 @@
@@ -99,6 +99,11 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSoil.java
+++ b/net/minecraft/world/level/block/BlockSoil.java
@@ -28,6 +28,11 @@
@@ -29,6 +29,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,8 +11,8 @@
+
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
@@ -84,26 +89,49 @@
public static final MapCodec<BlockSoil> CODEC = simpleCodec(BlockSoil::new);
@@ -91,26 +96,49 @@
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
if (i > 0) {

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockStem.java
+++ b/net/minecraft/world/level/block/BlockStem.java
@@ -21,6 +21,8 @@
@@ -27,6 +27,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockStem extends BlockPlant implements IBlockFragilePlantElement {
public static final int MAX_AGE = 7;
@@ -57,14 +59,18 @@
public static final MapCodec<BlockStem> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -79,7 +81,7 @@
if (i < 7) {
iblockdata = (IBlockData) iblockdata.setValue(BlockStem.AGE, i + 1);
@@ -18,19 +18,20 @@
} else {
EnumDirection enumdirection = EnumDirection.EnumDirectionLimit.HORIZONTAL.getRandomDirection(randomsource);
BlockPosition blockposition1 = blockposition.relative(enumdirection);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1.below());
@@ -91,7 +93,11 @@
Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
if (worldserver.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(TagsBlock.DIRT))) {
- worldserver.setBlockAndUpdate(blockposition1, this.fruit.defaultBlockState());
+ // CraftBukkit start
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, this.fruit.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlockAndUpdate(blockposition, (IBlockData) this.fruit.getAttachedStem().defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
if (optional.isPresent() && optional1.isPresent()) {
- worldserver.setBlockAndUpdate(blockposition1, ((Block) optional.get()).defaultBlockState());
+ // CraftBukkit start
+ if (!CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition1, ((Block) optional.get()).defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
worldserver.setBlockAndUpdate(blockposition, (IBlockData) ((Block) optional1.get()).defaultBlockState().setValue(BlockFacingHorizontal.FACING, enumdirection));
}
}
}
@@ -93,7 +99,7 @@
@@ -121,7 +127,7 @@
int i = Math.min(7, (Integer) iblockdata.getValue(BlockStem.AGE) + MathHelper.nextInt(worldserver.random, 2, 5));
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockStem.AGE, i);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
@@ -27,6 +27,14 @@
@@ -28,6 +28,14 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -14,8 +14,8 @@
+
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
private static final float HURT_SPEED_THRESHOLD = 0.003F;
@@ -62,7 +70,7 @@
public static final MapCodec<BlockSweetBerryBush> CODEC = simpleCodec(BlockSweetBerryBush::new);
@@ -69,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);
@@ -24,7 +24,7 @@
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
}
@@ -77,7 +85,9 @@
@@ -84,7 +92,9 @@
double d1 = Math.abs(entity.getZ() - entity.zOld);
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
@@ -34,7 +34,7 @@
}
}
@@ -94,7 +104,15 @@
@@ -101,7 +111,15 @@
} else if (i > 1) {
int j = 1 + world.random.nextInt(2);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTNT.java
+++ b/net/minecraft/world/level/block/BlockTNT.java
@@ -25,6 +25,11 @@
@@ -26,6 +26,11 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.MovingObjectPositionBlock;
@@ -11,8 +11,8 @@
+
public class BlockTNT extends Block {
public static final BlockStateBoolean UNSTABLE = BlockProperties.UNSTABLE;
@@ -37,7 +42,7 @@
public static final MapCodec<BlockTNT> CODEC = simpleCodec(BlockTNT::new);
@@ -44,7 +49,7 @@
@Override
public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) {
if (!iblockdata1.is(iblockdata.getBlock())) {
@@ -21,7 +21,7 @@
explode(world, blockposition);
world.removeBlock(blockposition, false);
}
@@ -47,7 +52,7 @@
@@ -54,7 +59,7 @@
@Override
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
@@ -30,16 +30,16 @@
explode(world, blockposition);
world.removeBlock(blockposition, false);
}
@@ -56,7 +61,7 @@
@@ -63,7 +68,7 @@
@Override
public void playerWillDestroy(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
public IBlockData playerWillDestroy(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
- if (!world.isClientSide() && !entityhuman.isCreative() && (Boolean) iblockdata.getValue(BlockTNT.UNSTABLE)) {
+ if (!world.isClientSide() && !entityhuman.isCreative() && (Boolean) iblockdata.getValue(BlockTNT.UNSTABLE) && CraftEventFactory.callTNTPrimeEvent(world, blockposition, PrimeCause.BLOCK_BREAK, entityhuman, null)) { // CraftBukkit - TNTPrimeEvent
explode(world, blockposition);
}
@@ -95,6 +100,11 @@
@@ -102,6 +107,11 @@
if (!itemstack.is(Items.FLINT_AND_STEEL) && !itemstack.is(Items.FIRE_CHARGE)) {
return super.use(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock);
} else {
@@ -51,7 +51,7 @@
explode(world, blockposition, entityhuman);
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 11);
Item item = itemstack.getItem();
@@ -121,6 +131,11 @@
@@ -128,6 +138,11 @@
Entity entity = iprojectile.getOwner();
if (iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition)) {

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/level/block/BlockTallPlant.java
+++ b/net/minecraft/world/level/block/BlockTallPlant.java
@@ -94,6 +94,11 @@
@@ -101,6 +101,11 @@
}
protected static void preventCreativeDropFromBottomPart(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
protected static void preventDropFromBottomPart(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
+ return;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTrapdoor.java
+++ b/net/minecraft/world/level/block/BlockTrapdoor.java
@@ -29,6 +29,8 @@
@@ -34,6 +34,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
@@ -110,6 +112,19 @@
public static final MapCodec<BlockTrapdoor> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -139,6 +141,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
@@ -24,6 +24,8 @@
@@ -27,6 +27,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -8,8 +8,8 @@
+
public class BlockTripwire extends Block {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -153,6 +155,40 @@
public static final MapCodec<BlockTripwire> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -166,6 +168,40 @@
}
}

View File

@@ -1,29 +1,30 @@
--- a/net/minecraft/world/level/block/BlockTripwireHook.java
+++ b/net/minecraft/world/level/block/BlockTripwireHook.java
@@ -27,6 +27,8 @@
@@ -29,6 +29,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockRedstoneEvent;
+// CraftBukkit end
+
public class BlockTripwireHook extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -161,6 +163,17 @@
this.emitState(world, blockposition1, flag4, flag5, flag2, flag3);
}
public static final MapCodec<BlockTripwireHook> CODEC = simpleCodec(BlockTripwireHook::new);
@@ -173,6 +178,15 @@
emitState(world, blockposition1, flag4, flag5, flag2, flag3);
}
+ // CraftBukkit start
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ // CraftBukkit start
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(CraftBlock.at(world, blockposition), 15, 0);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
+ }
+ // CraftBukkit end
+
+ if (eventRedstone.getNewCurrent() > 0) {
+ return;
+ }
+ // CraftBukkit end
+
this.emitState(world, blockposition, flag4, flag5, flag2, flag3);
if (!flag) {
world.setBlock(blockposition, (IBlockData) iblockdata3.setValue(BlockTripwireHook.FACING, enumdirection), 3);
emitState(world, blockposition, flag4, flag5, flag2, flag3);
if (!flag) {
world.setBlock(blockposition, (IBlockData) iblockdata3.setValue(BlockTripwireHook.FACING, enumdirection), 3);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockTurtleEgg.java
+++ b/net/minecraft/world/level/block/BlockTurtleEgg.java
@@ -29,6 +29,12 @@
@@ -30,6 +30,12 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,8 +12,8 @@
+
public class BlockTurtleEgg extends Block {
public static final int MAX_HATCH_LEVEL = 2;
@@ -65,6 +71,19 @@
public static final MapCodec<BlockTurtleEgg> CODEC = simpleCodec(BlockTurtleEgg::new);
@@ -72,6 +78,19 @@
private void destroyEgg(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, int i) {
if (this.canDestroyEgg(world, entity)) {
if (!world.isClientSide && world.random.nextInt(i) == 0 && iblockdata.is(Blocks.TURTLE_EGG)) {
@@ -33,7 +33,7 @@
this.decreaseEggs(world, blockposition, iblockdata);
}
@@ -91,10 +110,20 @@
@@ -98,10 +117,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(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(iblockdata));
@@ -107,7 +136,7 @@
@@ -114,7 +143,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

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockVine.java
+++ b/net/minecraft/world/level/block/BlockVine.java
@@ -24,6 +24,8 @@
@@ -25,6 +25,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -8,8 +8,8 @@
+
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.UP;
@@ -196,30 +198,34 @@
public static final MapCodec<BlockVine> CODEC = simpleCodec(BlockVine::new);
@@ -203,30 +205,34 @@
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
@@ -51,7 +51,7 @@
return;
}
@@ -239,7 +245,7 @@
@@ -246,7 +252,7 @@
}
if (this.hasHorizontalConnection(iblockdata2)) {
@@ -60,7 +60,7 @@
}
return;
@@ -254,7 +260,7 @@
@@ -261,7 +267,7 @@
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource);
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockWaterLily.java
+++ b/net/minecraft/world/level/block/BlockWaterLily.java
@@ -13,6 +13,10 @@
@@ -14,6 +14,10 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -10,8 +10,8 @@
+
public class BlockWaterLily extends BlockPlant {
protected static final VoxelShape AABB = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 1.5D, 15.0D);
@@ -25,6 +29,11 @@
public static final MapCodec<BlockWaterLily> CODEC = simpleCodec(BlockWaterLily::new);
@@ -32,6 +36,11 @@
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
super.entityInside(iblockdata, world, blockposition, entity);
if (world instanceof WorldServer && entity instanceof EntityBoat) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockWitherRose.java
+++ b/net/minecraft/world/level/block/BlockWitherRose.java
@@ -50,7 +50,7 @@
@@ -66,7 +66,7 @@
EntityLiving entityliving = (EntityLiving) entity;
if (!entityliving.isInvulnerableTo(world.damageSources().wither())) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockWitherSkull.java
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
@@ -24,6 +24,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBuilder;
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
@@ -10,8 +10,8 @@
+
public class BlockWitherSkull extends BlockSkull {
@Nullable
@@ -47,6 +51,7 @@
public static final MapCodec<BlockWitherSkull> CODEC = simpleCodec(BlockWitherSkull::new);
@@ -54,6 +58,7 @@
}
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
@@ -19,7 +19,7 @@
if (!world.isClientSide) {
IBlockData iblockdata = tileentityskull.getBlockState();
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
@@ -58,12 +63,18 @@
@@ -65,12 +70,18 @@
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world);
if (entitywither != null) {
@@ -39,7 +39,7 @@
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -72,7 +83,7 @@
@@ -79,7 +90,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -38,7 +38,7 @@
@@ -45,7 +45,7 @@
if (block != null) {
IBlockData iblockdata2 = (IBlockData) ((IBlockData) block.defaultBlockState().setValue(AmethystClusterBlock.FACING, enumdirection)).setValue(AmethystClusterBlock.WATERLOGGED, iblockdata1.getFluidState().getType() == FluidTypes.WATER);

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/block/ChangeOverTimeBlock.java
+++ b/net/minecraft/world/level/block/ChangeOverTimeBlock.java
@@ -69,7 +69,7 @@
@@ -20,7 +20,7 @@
if (randomsource.nextFloat() < f1) {
this.getNext(iblockdata).ifPresent((iblockdata2) -> {
- worldserver.setBlockAndUpdate(blockposition, iblockdata2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, iblockdata2); // CraftBukkit
if (randomsource.nextFloat() < 0.05688889F) {
this.getNextState(iblockdata, worldserver, blockposition, randomsource).ifPresent((iblockdata1) -> {
- worldserver.setBlockAndUpdate(blockposition, iblockdata1);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(worldserver, blockposition, iblockdata1); // CraftBukkit
});
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/DropExperienceBlock.java
+++ b/net/minecraft/world/level/block/DropExperienceBlock.java
@@ -24,9 +24,16 @@
@@ -31,9 +31,16 @@
@Override
public 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/LayeredCauldronBlock.java
+++ b/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -17,6 +17,12 @@
@@ -16,6 +16,12 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
@@ -12,8 +12,8 @@
+
public class LayeredCauldronBlock extends AbstractCauldronBlock {
public static final int MIN_FILL_LEVEL = 1;
@@ -56,10 +62,14 @@
public static final MapCodec<LayeredCauldronBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -61,10 +67,14 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!world.isClientSide && entity.isOnFire() && this.isEntityInsideContent(iblockdata, blockposition, entity)) {
@@ -30,7 +30,7 @@
}
}
@@ -69,20 +79,42 @@
@@ -79,20 +89,42 @@
}
public static void lowerFillLevel(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -68,7 +68,7 @@
+
@Override
public void handlePrecipitation(IBlockData iblockdata, World world, BlockPosition blockposition, BiomeBase.Precipitation biomebase_precipitation) {
if (BlockCauldron.shouldHandlePrecipitation(world, biomebase_precipitation) && (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && this.fillPredicate.test(biomebase_precipitation)) {
if (BlockCauldron.shouldHandlePrecipitation(world, biomebase_precipitation) && (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && biomebase_precipitation == this.precipitationType) {
IBlockData iblockdata1 = (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL);
- world.setBlockAndUpdate(blockposition, iblockdata1);
@@ -77,7 +77,7 @@
}
}
@@ -101,8 +133,11 @@
@@ -111,8 +143,11 @@
if (!this.isFull(iblockdata)) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(LayeredCauldronBlock.LEVEL, (Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) + 1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/LightningRodBlock.java
+++ b/net/minecraft/world/level/block/LightningRodBlock.java
@@ -32,6 +32,11 @@
@@ -33,6 +33,11 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
@@ -11,8 +11,8 @@
+
public class LightningRodBlock extends RodBlock implements IBlockWaterlogged {
public static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
@@ -78,6 +83,18 @@
public static final MapCodec<LightningRodBlock> CODEC = simpleCodec(LightningRodBlock::new);
@@ -85,6 +90,18 @@
}
public void onLightningStrike(IBlockData iblockdata, World world, BlockPosition blockposition) {
@@ -31,7 +31,7 @@
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(LightningRodBlock.POWERED, true), 3);
this.updateNeighbours(iblockdata, world, blockposition);
world.scheduleTick(blockposition, (Block) this, 8);
@@ -135,7 +152,7 @@
@@ -142,7 +159,7 @@
Entity entity = iprojectile.getOwner();
entitylightning.setCause(entity instanceof EntityPlayer ? (EntityPlayer) entity : null);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/PointedDripstoneBlock.java
+++ b/net/minecraft/world/level/block/PointedDripstoneBlock.java
@@ -42,6 +42,11 @@
@@ -43,6 +43,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -11,20 +11,20 @@
+
public class PointedDripstoneBlock extends Block implements Fallable, IBlockWaterlogged {
public static final BlockStateDirection TIP_DIRECTION = BlockProperties.VERTICAL_DIRECTION;
@@ -124,6 +129,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
public static final MapCodec<PointedDripstoneBlock> CODEC = simpleCodec(PointedDripstoneBlock::new);
@@ -132,6 +137,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true);
}
if (iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world) && iprojectile instanceof EntityThrownTrident && iprojectile.getDeltaMovement().length() > 0.6D) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;
+ }
+ // CraftBukkit end
world.destroyBlock(blockposition, true);
}
@@ -132,7 +142,9 @@
@@ -141,7 +151,9 @@
@Override
public void fallOn(World world, IBlockData iblockdata, BlockPosition blockposition, Entity entity, float f) {
if (iblockdata.getValue(PointedDripstoneBlock.TIP_DIRECTION) == EnumDirection.UP && iblockdata.getValue(PointedDripstoneBlock.THICKNESS) == DripstoneThickness.TIP) {
@@ -34,7 +34,7 @@
} else {
super.fallOn(world, iblockdata, blockposition, entity, f);
}
@@ -377,15 +389,15 @@
@@ -386,15 +398,15 @@
if (isUnmergedTipWithDirection(iblockdata, enumdirection.getOpposite())) {
createMergedTips(iblockdata, worldserver, blockposition1);
} else if (iblockdata.isAir() || iblockdata.is(Blocks.WATER)) {
@@ -53,7 +53,7 @@
}
private static void createMergedTips(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
@@ -400,8 +412,8 @@
@@ -409,8 +421,8 @@
blockposition1 = blockposition.below();
}
@@ -64,7 +64,7 @@
}
public static void spawnDripParticle(World world, BlockPosition blockposition, IBlockData iblockdata) {
@@ -434,7 +446,7 @@
@@ -443,7 +455,7 @@
return (BlockPosition) findBlockVertical(generatoraccess, blockposition, enumdirection.getAxisDirection(), bipredicate, (iblockdata1) -> {
return isTip(iblockdata1, flag);
@@ -73,7 +73,7 @@
}
}
@@ -550,7 +562,7 @@
@@ -559,7 +571,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};
@@ -82,7 +82,7 @@
}
@Nullable
@@ -559,7 +571,7 @@
@@ -568,7 +580,7 @@
return canDripThrough(world, blockposition1, iblockdata);
};

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/PowderSnowBlock.java
+++ b/net/minecraft/world/level/block/PowderSnowBlock.java
@@ -70,7 +70,12 @@
@@ -77,7 +77,12 @@
entity.setIsInPowderSnow(true);
if (!world.isClientSide) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/RootedDirtBlock.java
+++ b/net/minecraft/world/level/block/RootedDirtBlock.java
@@ -26,6 +26,6 @@
@@ -34,6 +34,6 @@
@Override
public void performBonemeal(WorldServer worldserver, RandomSource randomsource, BlockPosition blockposition, IBlockData iblockdata) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkBlock.java
+++ b/net/minecraft/world/level/block/SculkBlock.java
@@ -35,8 +35,11 @@
@@ -43,8 +43,11 @@
BlockPosition blockposition2 = blockposition1.above();
IBlockData iblockdata = this.getRandomGrowthState(generatoraccess, blockposition2, randomsource, sculkspreader.isWorldGeneration());

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkCatalystBlock.java
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
@@ -61,9 +61,16 @@
@@ -68,9 +68,16 @@
@Override
public 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/SculkSensorBlock.java
+++ b/net/minecraft/world/level/block/SculkSensorBlock.java
@@ -41,6 +41,11 @@
@@ -42,6 +42,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -11,8 +11,8 @@
+
public class SculkSensorBlock extends BlockTileEntity implements IBlockWaterlogged {
public static final int ACTIVE_TICKS = 30;
@@ -95,6 +100,18 @@
public static final MapCodec<SculkSensorBlock> CODEC = simpleCodec(SculkSensorBlock::new);
@@ -102,6 +107,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) {
@@ -198,6 +215,15 @@
@@ -205,6 +222,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);
@@ -209,6 +235,15 @@
@@ -216,6 +242,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);
@@ -291,9 +326,16 @@
@@ -298,9 +333,16 @@
@Override
public 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
@@ -56,6 +56,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);
});
@@ -140,10 +141,17 @@
@@ -147,10 +148,17 @@
@Override
public 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/SculkVeinBlock.java
+++ b/net/minecraft/world/level/block/SculkVeinBlock.java
@@ -101,10 +101,11 @@
@@ -108,10 +108,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();
@@ -119,7 +120,11 @@
@@ -126,7 +127,11 @@
if (iblockdata1.is(tagkey)) {
IBlockData iblockdata2 = Blocks.SCULK.defaultBlockState();

View File

@@ -0,0 +1,62 @@
--- a/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
@@ -21,6 +21,12 @@
import net.minecraft.world.level.block.CrafterBlock;
import net.minecraft.world.level.block.state.IBlockData;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class CrafterBlockEntity extends TileEntityLootable implements InventoryCrafting {
public static final int CONTAINER_WIDTH = 3;
@@ -33,6 +39,46 @@
private NonNullList<ItemStack> items;
public int craftingTicksRemaining;
protected final IContainerProperties containerData;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = 1;
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.items;
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public Location getLocation() {
+ if (level == null) return null;
+ return new org.bukkit.Location(level.getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ }
+ // CraftBukkit end
public CrafterBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.CRAFTER, blockposition, iblockdata);

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
@@ -24,6 +24,13 @@
@@ -22,6 +22,14 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.ticks.ContainerSingleItem;
+// CraftBukkit start
+import java.util.Collections;
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -14,7 +15,7 @@
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem {
private static final int SONG_END_PADDING = 20;
@@ -32,6 +39,42 @@
@@ -30,6 +38,42 @@
public long tickCount;
public long recordStartedTick;
public boolean isPlaying;
@@ -25,7 +26,7 @@
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.items;
+ return Collections.singletonList(item);
+ }
+
+ @Override
@@ -57,7 +58,7 @@
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
@@ -152,7 +195,7 @@
@@ -150,7 +194,7 @@
@Override
public int getMaxStackSize() {
@@ -66,10 +67,10 @@
}
@Override
@@ -205,7 +248,11 @@
@@ -203,7 +247,11 @@
@VisibleForTesting
public void setRecordWithoutPlaying(ItemStack itemstack) {
this.items.set(0, itemstack);
this.item = itemstack;
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
+ // CraftBukkit start - add null check for level
+ if (level != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
@@ -31,7 +31,17 @@
@@ -33,7 +33,17 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -19,7 +19,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
private static final int MAX_TEXT_LINE_WIDTH = 90;
@@ -100,7 +110,7 @@
@@ -98,7 +108,7 @@
@Override
protected void saveAdditional(NBTTagCompound nbttagcompound) {
super.saveAdditional(nbttagcompound);
@@ -28,7 +28,7 @@
Logger logger = TileEntitySign.LOGGER;
Objects.requireNonNull(logger);
@@ -119,7 +129,7 @@
@@ -117,7 +127,7 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);
@@ -37,7 +37,7 @@
Logger logger;
if (nbttagcompound.contains("front_text")) {
@@ -173,12 +183,13 @@
@@ -171,12 +181,13 @@
public void updateSignText(EntityHuman entityhuman, boolean flag, List<FilteredText> list) {
if (!this.isWaxed() && entityhuman.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) {
this.updateText((signtext) -> {
@@ -52,7 +52,7 @@
}
}
@@ -188,7 +199,8 @@
@@ -186,7 +197,8 @@
return this.setText((SignText) unaryoperator.apply(signtext), flag);
}
@@ -62,7 +62,7 @@
for (int i = 0; i < list.size(); ++i) {
FilteredText filteredtext = (FilteredText) list.get(i);
ChatModifier chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
@@ -200,6 +212,29 @@
@@ -198,6 +210,29 @@
}
}
@@ -92,7 +92,7 @@
return signtext;
}
@@ -250,11 +285,37 @@
@@ -248,11 +283,37 @@
return flag1;
}
@@ -132,7 +132,7 @@
}
@Override
@@ -283,7 +344,7 @@
@@ -281,7 +342,7 @@
private void markUpdated() {
this.setChanged();

Some files were not shown because too many files have changed in this diff Show More