Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -83,10 +83,10 @@
+ continue;
+ }
+ // CraftBukkit end
double d14 = d13;
double d14;
if (entity instanceof EntityLiving) {
@@ -254,6 +301,51 @@
@@ -263,6 +310,51 @@
SystemUtils.shuffle(this.toBlow, this.level.random);
ObjectListIterator objectlistiterator = this.toBlow.iterator();
@@ -138,7 +138,7 @@
while (objectlistiterator.hasNext()) {
BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
@@ -272,8 +364,8 @@
@@ -281,8 +373,8 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
@@ -149,7 +149,7 @@
}
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
@@ -305,7 +397,11 @@
@@ -314,7 +406,11 @@
BlockPosition blockposition2 = (BlockPosition) objectlistiterator1.next();
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
@@ -162,7 +162,7 @@
}
}
}
@@ -317,6 +413,7 @@
@@ -326,6 +422,7 @@
}
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -126,7 +126,7 @@
@@ -128,7 +128,7 @@
}
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -9,7 +9,7 @@
}
public NBTTagCompound createTag() {
@@ -140,7 +140,7 @@
@@ -142,7 +142,7 @@
private void loadFromTag(DynamicLike<?> dynamiclike) {
this.rules.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
@@ -18,7 +18,7 @@
Objects.requireNonNull(gamerules_gamerulevalue);
optional.ifPresent(gamerules_gamerulevalue::deserialize);
@@ -160,8 +160,8 @@
@@ -162,8 +162,8 @@
}
private static <T extends GameRules.GameRuleValue<T>> void callVisitorCap(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
@@ -29,7 +29,7 @@
}
public void assignFrom(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
@@ -253,7 +253,7 @@
@@ -255,7 +255,7 @@
}
public T createRule() {
@@ -38,7 +38,7 @@
}
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -283,7 +283,7 @@
@@ -285,7 +285,7 @@
}
@@ -47,7 +47,7 @@
public abstract String serialize();
@@ -349,7 +349,7 @@
@@ -351,7 +351,7 @@
}
@Override
@@ -56,7 +56,7 @@
this.value = Boolean.parseBoolean(s);
}
@@ -414,7 +414,7 @@
@@ -416,7 +416,7 @@
}
@Override

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/level/StructureManager.java
+++ b/net/minecraft/world/level/StructureManager.java
@@ -32,7 +32,7 @@
public class StructureManager {
- private final GeneratorAccess level;
+ public final GeneratorAccess level; // PAIL private -> public
private final WorldOptions worldOptions;
private final StructureCheck structureCheck;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -70,6 +70,31 @@
@@ -72,6 +72,31 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.Scoreboard;
@@ -32,11 +32,11 @@
public abstract class World implements GeneratorAccess, AutoCloseable {
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
@@ -111,7 +136,43 @@
private final ResourceKey<World> dimension;
@@ -115,7 +140,43 @@
private final DamageSources damageSources;
private long subTickCount;
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j) {
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, IRegistryCustom iregistrycustom, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j) {
+ // CraftBukkit start Added the following
+ private final CraftWorld world;
+ public boolean pvpMode;
@@ -62,7 +62,7 @@
+
+ public abstract ResourceKey<WorldDimension> getTypeKey();
+
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, IRegistryCustom iregistrycustom, Holder<DimensionManager> holder, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
+ this.generator = gen;
+ this.world = new CraftWorld((WorldServer) this, gen, biomeProvider, env);
+
@@ -77,7 +77,7 @@
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
@@ -126,12 +187,12 @@
@@ -130,12 +191,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
@@ -92,10 +92,10 @@
}
};
} else {
@@ -142,6 +203,42 @@
this.biomeManager = new BiomeManager(this, i);
this.isDebug = flag1;
@@ -148,6 +209,42 @@
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
this.registryAccess = iregistrycustom;
this.damageSources = new DamageSources(iregistrycustom);
+ // CraftBukkit start
+ getWorldBorder().world = (WorldServer) this;
+ // From PlayerList.setPlayerFileData
@@ -135,7 +135,7 @@
}
@Override
@@ -199,6 +296,17 @@
@@ -205,6 +302,17 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@@ -153,7 +153,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -206,9 +314,24 @@
@@ -212,9 +320,24 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@@ -179,7 +179,7 @@
return false;
} else {
IBlockData iblockdata2 = this.getBlockState(blockposition);
@@ -219,6 +342,7 @@
@@ -225,6 +348,7 @@
this.getProfiler().pop();
}
@@ -187,7 +187,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -245,12 +369,69 @@
@@ -251,12 +375,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@@ -257,7 +257,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -336,6 +517,14 @@
@@ -342,6 +523,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@@ -272,7 +272,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -527,6 +716,16 @@
@@ -533,6 +722,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@@ -289,7 +289,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -534,6 +733,12 @@
@@ -540,6 +739,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@@ -302,7 +302,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -664,7 +869,7 @@
@@ -670,7 +875,7 @@
for (int k = 0; k < j; ++k) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBed.java
+++ b/net/minecraft/world/level/block/BlockBed.java
@@ -86,7 +86,8 @@
@@ -85,7 +85,8 @@
}
}
@@ -10,7 +10,7 @@
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -105,7 +106,16 @@
@@ -104,7 +105,16 @@
return EnumInteractionResult.SUCCESS;
} else {
@@ -27,7 +27,7 @@
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -116,8 +126,29 @@
@@ -115,8 +125,29 @@
}
}
@@ -44,7 +44,7 @@
+
+ Vec3D vec3d = blockposition.getCenter();
+
+ world.explode((Entity) null, DamageSource.badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK);
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK);
+ return EnumInteractionResult.SUCCESS;
+ }
+ }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
@@ -26,6 +26,11 @@
@@ -27,6 +27,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,7 +12,7 @@
public class BlockButtonAbstract extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -109,6 +114,19 @@
@@ -108,6 +113,19 @@
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
return EnumInteractionResult.CONSUME;
} else {
@@ -32,7 +32,7 @@
this.press(iblockdata, world, blockposition);
this.playSound(entityhuman, world, blockposition, true);
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
@@ -171,11 +189,36 @@
@@ -170,11 +188,36 @@
}
protected void checkPressed(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCactus.java
+++ b/net/minecraft/world/level/block/BlockCactus.java
@@ -22,6 +22,8 @@
@@ -21,6 +21,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -9,7 +9,7 @@
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
@@ -58,7 +60,7 @@
@@ -57,7 +59,7 @@
int j = (Integer) iblockdata.getValue(BlockCactus.AGE);
if (j == 15) {
@@ -18,12 +18,12 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
worldserver.setBlock(blockposition, iblockdata1, 4);
@@ -115,7 +117,9 @@
@@ -114,7 +116,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
+ CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
entity.hurt(DamageSource.CACTUS, 1.0F);
entity.hurt(world.damageSources().cactus(), 1.0F);
+ CraftEventFactory.blockDamage = null; // CraftBukkit
}

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 @@
@@ -46,6 +46,10 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -11,17 +11,17 @@
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 @@
@@ -90,7 +94,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)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
entity.hurt(DamageSource.IN_FIRE, (float) this.fireDamage);
entity.hurt(world.damageSources().inFire(), (float) this.fireDamage);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -201,6 +207,11 @@
@@ -200,6 +206,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/BlockComposter.java
+++ b/net/minecraft/world/level/block/BlockComposter.java
@@ -37,6 +37,12 @@
@@ -40,6 +40,12 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -13,61 +13,46 @@
public class BlockComposter extends Block implements IInventoryHolder {
public static final int READY = 8;
@@ -227,18 +233,25 @@
return EnumInteractionResult.sidedSuccess(world.isClientSide);
} else if (i == 8) {
- extractProduce(iblockdata, world, blockposition);
+ extractProduce(iblockdata, world, blockposition, (Entity) null); // CraftBukkit - no event for players
return EnumInteractionResult.sidedSuccess(world.isClientSide);
} else {
return EnumInteractionResult.PASS;
}
}
- public static IBlockData insertItem(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition) {
+ public static IBlockData insertItem(IBlockData iblockdata, WorldServer worldserver, ItemStack itemstack, BlockPosition blockposition, Entity entity) { // CraftBukkit
@@ -246,7 +252,14 @@
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
if (i < 7 && BlockComposter.COMPOSTABLES.containsKey(itemstack.getItem())) {
- IBlockData iblockdata1 = addItem(iblockdata, worldserver, blockposition, itemstack);
- IBlockData iblockdata1 = addItem(entity, iblockdata, worldserver, blockposition, itemstack);
+ // CraftBukkit start
+ double rand = worldserver.getRandom().nextDouble();
+ IBlockData iblockdata1 = addItem(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
+ IBlockData iblockdata1 = addItem(entity, iblockdata, DummyGeneratorAccess.INSTANCE, blockposition, itemstack, rand);
+ if (iblockdata == iblockdata1 || org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
+ return iblockdata;
+ }
+ iblockdata1 = addItem(iblockdata, (GeneratorAccess) worldserver, blockposition, itemstack, rand);
+ iblockdata1 = addItem(entity, iblockdata, worldserver, blockposition, itemstack, rand);
+ // CraftBukkit end
itemstack.shrink(1);
return iblockdata1;
@@ -247,7 +260,15 @@
}
@@ -256,6 +269,14 @@
}
- public static IBlockData extractProduce(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ public static IBlockData extractProduce(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
+ if (entity != null) {
+ IBlockData iblockdata1 = empty(iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
public static IBlockData extractProduce(Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ if (entity != null && !(entity instanceof EntityHuman)) {
+ IBlockData iblockdata1 = empty(entity, iblockdata, DummyGeneratorAccess.INSTANCE, blockposition);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition, iblockdata1).isCancelled()) {
+ return iblockdata;
+ }
+ }
+ // CraftBukkit end
if (!world.isClientSide) {
float f = 0.7F;
double d0 = (double) (world.random.nextFloat() * 0.7F) + 0.15000000596046448D;
@@ -273,10 +294,16 @@
Vec3D vec3d = Vec3D.atLowerCornerWithOffset(blockposition, 0.5D, 1.01D, 0.5D).offsetRandom(world.random, 0.7F);
EntityItem entityitem = new EntityItem(world, vec3d.x(), vec3d.y(), vec3d.z(), new ItemStack(Items.BONE_MEAL));
@@ -279,10 +300,16 @@
}
static IBlockData addItem(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack) {
+ // CraftBukkit start
+ return addItem(iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
+ return addItem(entity, iblockdata, generatoraccess, blockposition, itemstack, generatoraccess.getRandom().nextDouble());
+ }
+
+ static IBlockData addItem(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
+ static IBlockData addItem(@Nullable Entity entity, IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, ItemStack itemstack, double rand) {
+ // CraftBukkit end
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
float f = BlockComposter.COMPOSTABLES.getFloat(itemstack.getItem());
@@ -77,7 +62,7 @@
return iblockdata;
} else {
int j = i + 1;
@@ -324,7 +351,8 @@
@@ -331,7 +358,8 @@
public IWorldInventory getContainer(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
int i = (Integer) iblockdata.getValue(BlockComposter.LEVEL);
@@ -87,7 +72,7 @@
}
public static class ContainerOutput extends InventorySubcontainer implements IWorldInventory {
@@ -339,6 +367,7 @@
@@ -346,6 +374,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -95,15 +80,15 @@
}
@Override
@@ -363,8 +392,15 @@
@@ -370,8 +399,15 @@
@Override
public void setChanged() {
- BlockComposter.empty(this.state, this.level, this.pos);
- BlockComposter.empty((Entity) null, this.state, this.level, this.pos);
- this.changed = true;
+ // CraftBukkit start - allow putting items back (eg cancelled InventoryMoveItemEvent)
+ if (this.isEmpty()) {
+ BlockComposter.empty(this.state, this.level, this.pos);
+ BlockComposter.empty((Entity) null, this.state, this.level, this.pos);
+ this.changed = true;
+ } else {
+ this.level.setBlock(this.pos, this.state, 3);
@@ -113,7 +98,7 @@
}
}
@@ -377,6 +413,7 @@
@@ -384,6 +420,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@@ -121,7 +106,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -419,8 +456,9 @@
@@ -426,8 +463,9 @@
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {

View File

@@ -2,7 +2,7 @@
+++ b/net/minecraft/world/level/block/BlockDaylightDetector.java
@@ -67,6 +67,7 @@
i = MathHelper.clamp(i, (int) 0, (int) 15);
i = MathHelper.clamp(i, 0, 15);
if ((Integer) iblockdata.getValue(BlockDaylightDetector.POWER) != i) {
+ i = org.bukkit.craftbukkit.event.CraftEventFactory.callRedstoneChange(world, blockposition, ((Integer) iblockdata.getValue(POWER)), i).getNewCurrent(); // CraftBukkit - Call BlockRedstoneEvent
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockDaylightDetector.POWER, i), 3);

View File

@@ -9,7 +9,7 @@
public class BlockDoor extends Block {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -189,9 +191,24 @@
@@ -187,9 +189,24 @@
@Override
public void neighborChanged(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {

View File

@@ -17,7 +17,7 @@
@@ -40,13 +47,22 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
if (world instanceof WorldServer && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
- ResourceKey<World> resourcekey = world.dimension() == World.END ? World.OVERWORLD : World.END;
+ ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockFenceGate.java
+++ b/net/minecraft/world/level/block/BlockFenceGate.java
@@ -142,6 +142,17 @@
@@ -140,6 +140,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
@@ -27,6 +27,14 @@
@@ -28,6 +28,14 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -15,7 +15,7 @@
public class BlockFire extends BlockFireAbstract {
public static final int MAX_AGE = 15;
@@ -92,7 +100,24 @@
@@ -93,7 +101,24 @@
@Override
public IBlockData updateShape(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
@@ -41,7 +41,7 @@
}
@Override
@@ -141,7 +166,7 @@
@@ -142,7 +167,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());
@@ -149,7 +174,7 @@
@@ -150,7 +175,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);
@@ -163,14 +188,14 @@
@@ -164,14 +189,14 @@
BlockPosition blockposition1 = blockposition.below();
if (!worldserver.getBlockState(blockposition1).isFaceSturdy(worldserver, blockposition1, EnumDirection.UP) || i > 3) {
@@ -76,8 +76,8 @@
return;
}
}
@@ -178,12 +203,14 @@
boolean flag1 = worldserver.isHumidAt(blockposition);
@@ -179,12 +204,14 @@
boolean flag1 = worldserver.getBiome(blockposition).is(BiomeTags.INCREASED_FIRE_BURNOUT);
int k = flag1 ? -50 : 0;
- this.checkBurnOut(worldserver, blockposition.east(), 300 + k, randomsource, i);
@@ -97,7 +97,7 @@
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
for (int l = -1; l <= 1; ++l) {
@@ -209,7 +236,15 @@
@@ -210,7 +237,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 @@
}
}
}
@@ -233,12 +268,24 @@
@@ -234,12 +269,24 @@
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
@@ -124,7 +124,14 @@
@@ -123,7 +123,14 @@
if (!entity.fireImmune()) {
entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1);
if (entity.getRemainingFireTicks() == 0) {
@@ -16,7 +16,7 @@
}
}
@@ -145,14 +152,14 @@
@@ -144,14 +151,14 @@
}
if (!iblockdata.canSurvive(world, blockposition)) {
@@ -33,7 +33,7 @@
}
@Override
@@ -200,4 +207,12 @@
@@ -199,4 +206,12 @@
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockGrassPath.java
+++ b/net/minecraft/world/level/block/BlockGrassPath.java
@@ -43,6 +43,11 @@
@@ -44,6 +44,11 @@
@Override
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
@@ -9,6 +9,6 @@
+ return;
+ }
+ // CraftBukkit end
BlockSoil.turnToDirt(iblockdata, worldserver, blockposition);
BlockSoil.turnToDirt((Entity) null, iblockdata, worldserver, blockposition);
}

View File

@@ -1,17 +0,0 @@
--- a/net/minecraft/world/level/block/BlockJukeBox.java
+++ b/net/minecraft/world/level/block/BlockJukeBox.java
@@ -67,7 +67,13 @@
if (tileentity instanceof TileEntityJukeBox) {
TileEntityJukeBox tileentityjukebox = (TileEntityJukeBox) tileentity;
- tileentityjukebox.setRecord(itemstack.copy());
+ // CraftBukkit start - There can only be one
+ itemstack = itemstack.copy();
+ if (!itemstack.isEmpty()) {
+ itemstack.setCount(1);
+ }
+ tileentityjukebox.setRecord(itemstack);
+ // CraftBukkit end
tileentityjukebox.playRecord();
generatoraccess.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockJukeBox.HAS_RECORD, true), 2);
generatoraccess.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, iblockdata));

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockLeaves.java
+++ b/net/minecraft/world/level/block/BlockLeaves.java
@@ -22,6 +22,8 @@
@@ -23,6 +23,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -9,7 +9,7 @@
public class BlockLeaves extends Block implements IBlockWaterlogged {
public static final int DECAY_DISTANCE = 7;
@@ -48,6 +50,14 @@
@@ -49,6 +51,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
@@ -198,12 +198,13 @@
@@ -200,12 +200,13 @@
}
private void popBook(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/level/block/BlockMagma.java
+++ b/net/minecraft/world/level/block/BlockMagma.java
@@ -29,7 +29,9 @@
@@ -28,7 +28,9 @@
@Override
public void stepOn(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) {
if (!entity.isSteppingCarefully() && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); // CraftBukkit
entity.hurt(DamageSource.HOT_FLOOR, 1.0F);
entity.hurt(world.damageSources().hotFloor(), 1.0F);
+ org.bukkit.craftbukkit.event.CraftEventFactory.blockDamage = null; // CraftBukkit
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockNote.java
+++ b/net/minecraft/world/level/block/BlockNote.java
@@ -77,6 +77,7 @@
@@ -79,6 +79,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);
@@ -86,6 +87,12 @@
@@ -88,6 +89,12 @@
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
if (!((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).requiresAirAbove() || world.getBlockState(blockposition.above()).isAir()) {

View File

@@ -24,7 +24,7 @@
@@ -77,6 +82,10 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions()) {
if (entity.canChangeDimensions()) {
+ // CraftBukkit start - Entity in portal
+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()));
+ world.getCraftServer().getPluginManager().callEvent(event);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateAbstract.java
@@ -18,6 +18,8 @@
@@ -21,6 +21,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);
@@ -81,6 +83,19 @@
@@ -86,6 +88,19 @@
boolean flag = i > 0;
boolean flag1 = j > 0;

View File

@@ -1,15 +1,18 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateBinary.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateBinary.java
@@ -17,6 +17,8 @@
@@ -14,6 +14,11 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import net.minecraft.world.phys.AxisAlignedBB;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+// CraftBukkit start
+import net.minecraft.world.entity.player.EntityHuman;
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
+
public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -74,6 +76,26 @@
@@ -57,6 +62,26 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@@ -1,15 +1,18 @@
--- a/net/minecraft/world/level/block/BlockPressurePlateWeighted.java
+++ b/net/minecraft/world/level/block/BlockPressurePlateWeighted.java
@@ -14,6 +14,8 @@
import net.minecraft.world.level.block.state.properties.BlockProperties;
@@ -11,6 +11,11 @@
import net.minecraft.world.level.block.state.properties.BlockSetType;
import net.minecraft.world.level.block.state.properties.BlockStateInteger;
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+// CraftBukkit start
+import net.minecraft.world.entity.player.EntityHuman;
+import org.bukkit.event.entity.EntityInteractEvent;
+// CraftBukkit end
+
public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract {
public static final BlockStateInteger POWER = BlockProperties.POWER;
@@ -31,7 +33,31 @@
@@ -24,7 +29,31 @@
@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
@@ -26,6 +26,10 @@
@@ -27,6 +27,10 @@
import net.minecraft.world.level.block.state.properties.BlockStateDirection;
import net.minecraft.world.level.material.Material;
@@ -8,10 +8,10 @@
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockPumpkinCarved extends BlockFacingHorizontal implements ItemWearable {
public class BlockPumpkinCarved extends BlockFacingHorizontal implements Equipable {
public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING;
@@ -82,9 +86,14 @@
@@ -83,9 +87,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/BlockSoil.java
+++ b/net/minecraft/world/level/block/BlockSoil.java
@@ -25,6 +25,11 @@
@@ -27,6 +27,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -12,14 +12,14 @@
public class BlockSoil extends Block {
public static final BlockStateInteger MOISTURE = BlockProperties.MOISTURE;
@@ -81,26 +86,49 @@
@@ -83,26 +88,49 @@
if (!isNearWater(worldserver, blockposition) && !worldserver.isRainingAt(blockposition.above())) {
if (i > 0) {
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, i - 1), 2); // CraftBukkit
} else if (!isUnderCrops(worldserver, blockposition)) {
turnToDirt(iblockdata, worldserver, blockposition);
turnToDirt((Entity) null, iblockdata, worldserver, blockposition);
}
} else if (i < 7) {
- worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockSoil.MOISTURE, 7), 2);
@@ -49,19 +49,19 @@
+ return;
+ }
+ // CraftBukkit end
turnToDirt(iblockdata, world, blockposition);
turnToDirt(entity, iblockdata, world, blockposition);
}
- super.fallOn(world, iblockdata, blockposition, entity, f);
+ // super.fallOn(world, iblockdata, blockposition, entity, f); // CraftBukkit - moved up
}
public static void turnToDirt(IBlockData iblockdata, World world, BlockPosition blockposition) {
public static void turnToDirt(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
+ // CraftBukkit start
+ if (CraftEventFactory.callBlockFadeEvent(world, blockposition, Blocks.DIRT.defaultBlockState()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlockAndUpdate(blockposition, pushEntitiesUp(iblockdata, Blocks.DIRT.defaultBlockState(), world, blockposition));
}
IBlockData iblockdata1 = pushEntitiesUp(iblockdata, Blocks.DIRT.defaultBlockState(), world, blockposition);
world.setBlockAndUpdate(blockposition, iblockdata1);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockSweetBerryBush.java
+++ b/net/minecraft/world/level/block/BlockSweetBerryBush.java
@@ -28,6 +28,14 @@
@@ -27,6 +27,14 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -15,7 +15,7 @@
public class BlockSweetBerryBush extends BlockPlant implements IBlockFragilePlantElement {
private static final float HURT_SPEED_THRESHOLD = 0.003F;
@@ -63,7 +71,7 @@
@@ -62,7 +70,7 @@
if (i < 3 && randomsource.nextInt(5) == 0 && worldserver.getRawBrightness(blockposition.above(), 0) >= 9) {
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSweetBerryBush.AGE, i + 1);
@@ -24,17 +24,17 @@
worldserver.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(iblockdata1));
}
@@ -78,7 +86,9 @@
@@ -77,7 +85,9 @@
double d1 = Math.abs(entity.getZ() - entity.zOld);
if (d0 >= 0.003000000026077032D || d1 >= 0.003000000026077032D) {
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
entity.hurt(DamageSource.SWEET_BERRY_BUSH, 1.0F);
entity.hurt(world.damageSources().sweetBerryBush(), 1.0F);
+ CraftEventFactory.blockDamage = null; // CraftBukkit
}
}
@@ -95,7 +105,15 @@
@@ -94,7 +104,15 @@
} else if (i > 1) {
int j = 1 + world.random.nextInt(2);

View File

@@ -9,7 +9,7 @@
public class BlockTrapdoor extends BlockFacingHorizontal implements IBlockWaterlogged {
public static final BlockStateBoolean OPEN = BlockProperties.OPEN;
@@ -113,6 +115,19 @@
@@ -111,6 +113,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/BlockVine.java
+++ b/net/minecraft/world/level/block/BlockVine.java
@@ -23,6 +23,8 @@
@@ -24,6 +24,8 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@@ -9,51 +9,51 @@
public class BlockVine extends Block {
public static final BlockStateBoolean UP = BlockSprawling.UP;
@@ -194,20 +196,24 @@
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
@@ -196,20 +198,24 @@
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
+
if (flag && isAcceptableNeighbour(worldserver, blockposition3, enumdirection1)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
} else if (flag1 && isAcceptableNeighbour(worldserver, blockposition4, enumdirection2)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
} else {
EnumDirection enumdirection3 = enumdirection.getOpposite();
if (flag && isAcceptableNeighbour(worldserver, blockposition3, enumdirection1)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
} else if (flag1 && isAcceptableNeighbour(worldserver, blockposition4, enumdirection2)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
} else {
EnumDirection enumdirection3 = enumdirection.getOpposite();
if (flag && worldserver.isEmptyBlock(blockposition3) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection1), enumdirection3)) {
- worldserver.setBlock(blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
} else if (flag1 && worldserver.isEmptyBlock(blockposition4) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection2), enumdirection3)) {
- worldserver.setBlock(blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
} else if ((double) randomsource.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
if (flag && worldserver.isEmptyBlock(blockposition3) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection1), enumdirection3)) {
- worldserver.setBlock(blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
} else if (flag1 && worldserver.isEmptyBlock(blockposition4) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection2), enumdirection3)) {
- worldserver.setBlock(blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2);
} else if ((double) randomsource.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) {
- worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2);
}
+ // CraftBukkit end
}
} else if (isAcceptableNeighbour(worldserver, blockposition2, enumdirection)) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2);
@@ -239,7 +245,7 @@
}
+ // CraftBukkit end
}
} else if (isAcceptableNeighbour(worldserver, blockposition2, enumdirection)) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2);
@@ -237,7 +243,7 @@
}
if (this.hasHorizontalConnection(iblockdata2)) {
- worldserver.setBlock(blockposition1, iblockdata2, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
}
if (this.hasHorizontalConnection(iblockdata2)) {
- worldserver.setBlock(blockposition1, iblockdata2, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
}
return;
@@ -252,7 +258,7 @@
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource);
return;
@@ -254,7 +260,7 @@
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource);
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
- worldserver.setBlock(blockposition2, iblockdata4, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
- worldserver.setBlock(blockposition2, iblockdata4, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
}
}
}
}

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/level/block/BlockWitherRose.java
+++ b/net/minecraft/world/level/block/BlockWitherRose.java
@@ -51,7 +51,7 @@
@@ -50,7 +50,7 @@
EntityLiving entityliving = (EntityLiving) entity;
if (!entityliving.isInvulnerableTo(DamageSource.WITHER)) {
if (!entityliving.isInvulnerableTo(world.damageSources().wither())) {
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40));
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/block/CaveVines.java
+++ b/net/minecraft/world/level/block/CaveVines.java
@@ -15,14 +15,39 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
@@ -18,6 +18,14 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.shapes.VoxelShape;
+// CraftBukkit start
@@ -15,10 +15,9 @@
public interface CaveVines {
VoxelShape SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
BlockStateBoolean BERRIES = BlockProperties.BERRIES;
@@ -25,7 +33,24 @@
- static EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition) {
+ static EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
static EnumInteractionResult use(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
if ((Boolean) iblockdata.getValue(CaveVines.BERRIES)) {
- Block.popResource(world, blockposition, new ItemStack(Items.GLOW_BERRIES, 1));
+ // CraftBukkit start

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -58,7 +58,7 @@
@Override
public EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
- return CaveVines.use(iblockdata, world, blockposition);
+ return CaveVines.use(iblockdata, world, blockposition, entityhuman); // CraftBukkit
}
@Override

View File

@@ -1,11 +0,0 @@
--- a/net/minecraft/world/level/block/CaveVinesPlantBlock.java
+++ b/net/minecraft/world/level/block/CaveVinesPlantBlock.java
@@ -41,7 +41,7 @@
@Override
public EnumInteractionResult use(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
- return CaveVines.use(iblockdata, world, blockposition);
+ return CaveVines.use(iblockdata, world, blockposition, entityhuman); // CraftBukkit
}
@Override

View File

@@ -29,7 +29,7 @@
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) {
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition); // CraftBukkit
entity.causeFallDamage(f + 2.0F, 2.0F, DamageSource.STALAGMITE);
entity.causeFallDamage(f + 2.0F, 2.0F, world.damageSources().stalagmite());
+ CraftEventFactory.blockDamage = null; // CraftBukkit
} else {
super.fallOn(world, iblockdata, blockposition, entity, f);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBrewingStand.java
@@ -24,6 +24,20 @@
@@ -25,6 +25,20 @@
import net.minecraft.world.level.block.BlockBrewingStand;
import net.minecraft.world.level.block.state.IBlockData;
@@ -21,7 +21,7 @@
public class TileEntityBrewingStand extends TileEntityContainer implements IWorldInventory {
private static final int INGREDIENT_SLOT = 3;
@@ -41,6 +55,36 @@
@@ -42,6 +56,36 @@
private Item ingredient;
public int fuel;
protected final IContainerProperties dataAccess;
@@ -58,7 +58,7 @@
public TileEntityBrewingStand(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BREWING_STAND, blockposition, iblockdata);
@@ -108,8 +152,19 @@
@@ -109,8 +153,19 @@
ItemStack itemstack = (ItemStack) tileentitybrewingstand.items.get(4);
if (tileentitybrewingstand.fuel <= 0 && itemstack.is(Items.BLAZE_POWDER)) {
@@ -80,7 +80,7 @@
setChanged(world, blockposition, iblockdata);
}
@@ -117,12 +172,17 @@
@@ -118,12 +173,17 @@
boolean flag1 = tileentitybrewingstand.brewTime > 0;
ItemStack itemstack1 = (ItemStack) tileentitybrewingstand.items.get(3);
@@ -101,7 +101,7 @@
setChanged(world, blockposition, iblockdata);
} else if (!flag || !itemstack1.is(tileentitybrewingstand.ingredient)) {
tileentitybrewingstand.brewTime = 0;
@@ -130,7 +190,11 @@
@@ -131,7 +191,11 @@
}
} else if (flag && tileentitybrewingstand.fuel > 0) {
--tileentitybrewingstand.fuel;
@@ -114,7 +114,7 @@
tileentitybrewingstand.ingredient = itemstack1.getItem();
setChanged(world, blockposition, iblockdata);
}
@@ -186,11 +250,33 @@
@@ -187,11 +251,33 @@
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityConduit.java
+++ b/net/minecraft/world/level/block/entity/TileEntityConduit.java
@@ -28,6 +28,11 @@
@@ -27,6 +27,11 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@@ -12,7 +12,7 @@
public class TileEntityConduit extends TileEntity {
private static final int BLOCK_REFRESH_RATE = 2;
@@ -202,7 +207,7 @@
@@ -201,7 +206,7 @@
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (blockposition.closerThan(entityhuman.blockPosition(), (double) j) && entityhuman.isInWaterOrRain()) {
@@ -21,15 +21,15 @@
}
}
@@ -231,8 +236,13 @@
@@ -230,8 +235,13 @@
}
if (tileentityconduit.destroyTarget != null) {
- world.playSound((EntityHuman) null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
- tileentityconduit.destroyTarget.hurt(DamageSource.MAGIC, 4.0F);
- tileentityconduit.destroyTarget.hurt(world.damageSources().magic(), 4.0F);
+ // CraftBukkit start
+ CraftEventFactory.blockDamage = CraftBlock.at(world, blockposition);
+ if (tileentityconduit.destroyTarget.hurt(DamageSource.MAGIC, 4.0F)) {
+ if (tileentityconduit.destroyTarget.hurt(world.damageSources().magic(), 4.0F)) {
+ world.playSound((EntityHuman) null, tileentityconduit.destroyTarget.getX(), tileentityconduit.destroyTarget.getY(), tileentityconduit.destroyTarget.getZ(), SoundEffects.CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F);
+ }
+ CraftEventFactory.blockDamage = null;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityFurnace.java
+++ b/net/minecraft/world/level/block/entity/TileEntityFurnace.java
@@ -46,6 +46,20 @@
@@ -47,6 +47,20 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@@ -21,7 +21,7 @@
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput {
protected static final int SLOT_INPUT = 0;
@@ -114,7 +128,7 @@
@@ -115,7 +129,7 @@
}
};
this.recipesUsed = new Object2IntOpenHashMap();
@@ -30,7 +30,7 @@
}
public static Map<Item, Integer> getFuel() {
@@ -182,6 +196,40 @@
@@ -183,6 +197,40 @@
return map;
}
@@ -71,7 +71,7 @@
private static boolean isNeverAFurnaceFuel(Item item) {
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
}
@@ -270,7 +318,7 @@
@@ -271,7 +319,7 @@
IRecipe irecipe;
if (flag2) {
@@ -80,10 +80,10 @@
} else {
irecipe = null;
}
@@ -278,9 +326,20 @@
@@ -279,9 +327,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
if (!tileentityfurnace.isLit() && canBurn(world.registryAccess(), irecipe, tileentityfurnace.items, i)) {
- tileentityfurnace.litTime = tileentityfurnace.getBurnDuration(itemstack);
+ // CraftBukkit start
+ CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack);
@@ -103,10 +103,10 @@
flag1 = true;
if (flag3) {
Item item = itemstack.getItem();
@@ -296,11 +355,23 @@
@@ -297,11 +356,23 @@
}
if (tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
if (tileentityfurnace.isLit() && canBurn(world.registryAccess(), irecipe, tileentityfurnace.items, i)) {
+ // CraftBukkit start
+ if (irecipe != null && tileentityfurnace.cookingProgress == 0) {
+ CraftItemStack source = CraftItemStack.asCraftMirror(tileentityfurnace.items.get(0));
@@ -123,20 +123,20 @@
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingProgress = 0;
tileentityfurnace.cookingTotalTime = getTotalCookTime(world, tileentityfurnace);
- if (burn(irecipe, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, irecipe, tileentityfurnace.items, i)) { // CraftBukkit
- if (burn(world.registryAccess(), irecipe, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, world.registryAccess(), irecipe, tileentityfurnace.items, i)) { // CraftBukkit
tileentityfurnace.setRecipeUsed(irecipe);
}
@@ -339,17 +410,44 @@
@@ -340,17 +411,44 @@
}
}
- private static boolean burn(@Nullable IRecipe<?> irecipe, NonNullList<ItemStack> nonnulllist, int i) {
+ private static boolean burn(World world, BlockPosition blockposition, @Nullable IRecipe<?> irecipe, NonNullList<ItemStack> nonnulllist, int i) { // CraftBukkit
if (irecipe != null && canBurn(irecipe, nonnulllist, i)) {
- private static boolean burn(IRegistryCustom iregistrycustom, @Nullable IRecipe<?> irecipe, NonNullList<ItemStack> nonnulllist, int i) {
+ private static boolean burn(World world, BlockPosition blockposition, IRegistryCustom iregistrycustom, @Nullable IRecipe<?> irecipe, NonNullList<ItemStack> nonnulllist, int i) { // CraftBukkit
if (irecipe != null && canBurn(iregistrycustom, irecipe, nonnulllist, i)) {
ItemStack itemstack = (ItemStack) nonnulllist.get(0);
ItemStack itemstack1 = irecipe.getResultItem();
ItemStack itemstack1 = irecipe.getResultItem(iregistrycustom);
ItemStack itemstack2 = (ItemStack) nonnulllist.get(2);
+ // CraftBukkit start - fire FurnaceSmeltEvent
@@ -174,7 +174,7 @@
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
@@ -373,7 +471,7 @@
@@ -374,7 +472,7 @@
}
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
@@ -183,7 +183,7 @@
}
public static boolean isFuel(ItemStack itemstack) {
@@ -492,14 +590,20 @@
@@ -493,14 +591,20 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman) {}
@@ -206,7 +206,7 @@
List<IRecipe<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
@@ -508,14 +612,14 @@
@@ -509,14 +613,14 @@
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe);
@@ -223,7 +223,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -523,6 +627,17 @@
@@ -524,6 +628,17 @@
++j;
}

View File

@@ -109,9 +109,9 @@
if (itemstack1.isEmpty()) {
iinventory1.setChanged();
@@ -226,7 +294,36 @@
@@ -226,7 +294,34 @@
if (!itemstack.isEmpty() && canTakeItemFromContainer(iinventory, itemstack, i, enumdirection)) {
if (!itemstack.isEmpty() && canTakeItemFromContainer(ihopper, iinventory, itemstack, i, enumdirection)) {
ItemStack itemstack1 = itemstack.copy();
- ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
+ // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null);
@@ -136,8 +136,6 @@
+
+ if (ihopper instanceof TileEntityHopper) {
+ ((TileEntityHopper) ihopper).setCooldown(8); // Delay hopper checks
+ } else if (ihopper instanceof EntityMinecartHopper) {
+ ((EntityMinecartHopper) ihopper).setCooldown(4); // Delay hopper minecart checks
+ }
+
+ return false;
@@ -147,7 +145,7 @@
if (itemstack2.isEmpty()) {
iinventory.setChanged();
@@ -241,6 +338,13 @@
@@ -241,6 +336,13 @@
public static boolean addItem(IInventory iinventory, EntityItem entityitem) {
boolean flag = false;
@@ -161,7 +159,7 @@
ItemStack itemstack = entityitem.getItem().copy();
ItemStack itemstack1 = addItem((IInventory) null, iinventory, itemstack, (EnumDirection) null);
@@ -327,16 +431,40 @@
@@ -366,16 +468,40 @@
return itemstack;
}
@@ -196,7 +194,7 @@
+ // CraftBukkit start
+ IInventory inventory = getContainerAt(world, ihopper.getLevelX(), ihopper.getLevelY() + 1.0D, ihopper.getLevelZ());
+
+ BlockPosition blockPosition = new BlockPosition(ihopper.getLevelX(), ihopper.getLevelY(), ihopper.getLevelZ());
+ BlockPosition blockPosition = BlockPosition.containing(ihopper.getLevelX(), ihopper.getLevelY(), ihopper.getLevelZ());
+ CraftBlock hopper = CraftBlock.at(world, blockPosition);
+ CraftBlock container = CraftBlock.at(world, blockPosition.above());
+ return runHopperInventorySearchEvent(inventory, hopper, container, HopperInventorySearchEvent.ContainerType.SOURCE);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityLectern.java
+++ b/net/minecraft/world/level/block/entity/TileEntityLectern.java
@@ -24,13 +24,71 @@
@@ -25,13 +25,71 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -74,7 +74,7 @@
@Override
public int getContainerSize() {
return 1;
@@ -75,11 +133,20 @@
@@ -76,11 +134,20 @@
}
@Override
@@ -84,7 +84,7 @@
+ if (i == 0) {
+ TileEntityLectern.this.setBook(itemstack);
+ if (TileEntityLectern.this.getLevel() != null) {
+ BlockLectern.resetBookState(TileEntityLectern.this.getLevel(), TileEntityLectern.this.getBlockPos(), TileEntityLectern.this.getBlockState(), TileEntityLectern.this.hasBook());
+ BlockLectern.resetBookState(null, TileEntityLectern.this.getLevel(), TileEntityLectern.this.getBlockPos(), TileEntityLectern.this.getBlockState(), TileEntityLectern.this.hasBook());
+ }
+ }
+ }
@@ -97,7 +97,7 @@
}
@Override
@@ -159,7 +226,7 @@
@@ -160,7 +227,7 @@
if (j != this.page) {
this.page = j;
this.setChanged();
@@ -106,7 +106,7 @@
}
}
@@ -182,6 +249,32 @@
@@ -183,6 +250,32 @@
return itemstack;
}
@@ -139,7 +139,7 @@
private CommandListenerWrapper createCommandSourceStack(@Nullable EntityHuman entityhuman) {
String s;
Object object;
@@ -196,7 +289,8 @@
@@ -197,7 +290,8 @@
Vec3D vec3d = Vec3D.atCenterOf(this.worldPosition);
@@ -149,7 +149,7 @@
}
@Override
@@ -234,7 +328,7 @@
@@ -235,7 +329,7 @@
@Override
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {

View File

@@ -1,26 +0,0 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySkull.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySkull.java
@@ -33,7 +33,7 @@
@Nullable
public GameProfile owner;
@Nullable
- private MinecraftKey noteBlockSound;
+ public MinecraftKey noteBlockSound; // PAIL private->public
private int animationTickCount;
private boolean isAnimating;
@@ -148,9 +148,12 @@
gameprofile1 = TileEntitySkull.sessionService.fillProfileProperties(gameprofile1, true);
}
+ // CraftBukkit start - decompile error
+ final GameProfile finalgameprofile1 = gameprofile1;
TileEntitySkull.mainThreadExecutor.execute(() -> {
- TileEntitySkull.profileCache.add(gameprofile1);
- consumer.accept(gameprofile1);
+ TileEntitySkull.profileCache.add(finalgameprofile1);
+ consumer.accept(finalgameprofile1);
+ // CraftBukkit end
});
}, () -> {
TileEntitySkull.mainThreadExecutor.execute(() -> {

View File

@@ -27,7 +27,7 @@
WorldGenFeatureConfigured<?, ?> worldgenfeatureconfigured = (WorldGenFeatureConfigured) holder.value();
IBlockData iblockdata1 = worldserver.getFluidState(blockposition).createLegacyBlock();
@@ -65,4 +72,53 @@
@@ -65,4 +72,55 @@
return true;
}
@@ -75,6 +75,8 @@
+ BlockSapling.treeType = TreeType.MANGROVE;
+ } else if (worldgentreeabstract == TreeFeatures.TALL_MANGROVE) {
+ BlockSapling.treeType = TreeType.TALL_MANGROVE;
+ } else if (worldgentreeabstract == TreeFeatures.CHERRY || worldgentreeabstract == TreeFeatures.CHERRY_BEES_005) {
+ BlockSapling.treeType = TreeType.CHERRY;
+ } else {
+ throw new IllegalArgumentException("Unknown tree generator " + worldgentreeabstract);
+ }

View File

@@ -174,7 +174,7 @@
public boolean isEmpty() {
return false;
}
@@ -682,7 +773,7 @@
@@ -694,7 +785,7 @@
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
IBlockData iblockdata = t0.getBlockState();
@@ -183,7 +183,7 @@
if (blockentityticker == null) {
this.removeBlockEntityTicker(t0.getBlockPos());
@@ -775,7 +866,7 @@
@@ -787,7 +878,7 @@
private boolean loggedInvalidBlockState;
a(TileEntity tileentity, BlockEntityTicker blockentityticker) {

View File

@@ -14,7 +14,7 @@
this.bottomBlockY = getBottomBlockY(i);
this.states = datapaletteblock;
this.biomes = palettedcontainerro;
@@ -193,6 +195,12 @@
@@ -200,6 +202,12 @@
return (Holder) this.biomes.get(i, j, k);
}

View File

@@ -83,8 +83,8 @@
+
public static NBTTagCompound write(WorldServer worldserver, IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -340,7 +353,7 @@
NBTTagCompound nbttagcompound = GameProfileSerializer.addCurrentDataVersion(new NBTTagCompound());
@@ -339,7 +352,7 @@
nbttagcompound.putLong("InhabitedTime", ichunkaccess.getInhabitedTime());
nbttagcompound.putString("Status", ichunkaccess.getStatus().getName());
BlendingData blendingdata = ichunkaccess.getBlendingData();
@@ -93,7 +93,7 @@
Logger logger;
if (blendingdata != null) {
@@ -387,7 +400,7 @@
@@ -386,7 +399,7 @@
if (flag1) {
ChunkSection chunksection = achunksection[j];
@@ -102,7 +102,7 @@
Logger logger1 = ChunkRegionLoader.LOGGER;
Objects.requireNonNull(logger1);
@@ -471,6 +484,11 @@
@@ -470,6 +483,11 @@
nbttagcompound.put("Heightmaps", nbttagcompound3);
nbttagcompound.put("structures", packStructureData(StructurePieceSerializationContext.fromLevel(worldserver), chunkcoordintpair, ichunkaccess.getAllStarts(), ichunkaccess.getAllReferences()));

View File

@@ -69,7 +69,7 @@
+ // CraftBukkit end
+
if (i < 1493) {
nbttagcompound = GameProfileSerializer.update(this.fixerUpper, DataFixTypes.CHUNK, nbttagcompound, i, 1493);
nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493);
if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
@@ -58,7 +111,7 @@
return nbttagcompound;

View File

@@ -18,7 +18,7 @@
@@ -22,6 +30,14 @@
public void post(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
int i = gameevent.getNotificationRadius();
BlockPosition blockposition = new BlockPosition(vec3d);
BlockPosition blockposition = BlockPosition.containing(vec3d);
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), new Location(level.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ level.getCraftServer().getPluginManager().callEvent(event);

View File

@@ -14,7 +14,7 @@
public class VibrationListener implements GameEventListener {
@VisibleForTesting
@@ -96,7 +103,7 @@
@@ -98,7 +105,7 @@
}), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter((vibrationlistener) -> {
return vibrationlistener.travelTimeInTicks;
})).apply(instance, (positionsource, integer, optional, vibrationselector, integer1) -> {
@@ -23,24 +23,25 @@
});
});
}
@@ -138,7 +145,7 @@
@@ -140,7 +147,8 @@
--this.travelTimeInTicks;
if (this.travelTimeInTicks <= 0) {
this.travelTimeInTicks = 0;
- this.config.onSignalReceive(worldserver, this, new BlockPosition(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse((Object) null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse((Object) null), this.currentVibration.distance());
+ this.config.onSignalReceive(worldserver, this, new BlockPosition(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse(null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse(null), this.currentVibration.distance()); // CraftBukkit - decompile error
- this.config.onSignalReceive(worldserver, this, BlockPosition.containing(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse((Object) null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse((Object) null), this.currentVibration.distance());
+ // CraftBukkit - decompile error
+ this.config.onSignalReceive(worldserver, this, BlockPosition.containing(this.currentVibration.pos()), this.currentVibration.gameEvent(), (Entity) this.currentVibration.getEntity(worldserver).orElse(null), (Entity) this.currentVibration.getProjectileOwner(worldserver).orElse(null), this.currentVibration.distance());
this.currentVibration = null;
}
}
@@ -170,7 +177,14 @@
@@ -172,7 +180,14 @@
} else {
Vec3D vec3d1 = (Vec3D) optional.get();
- if (!this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a)) {
- if (!this.config.shouldListen(worldserver, this, BlockPosition.containing(vec3d), gameevent, gameevent_a)) {
+ // CraftBukkit start
+ boolean defaultCancel = !this.config.shouldListen(worldserver, this, new BlockPosition(vec3d), gameevent, gameevent_a);
+ boolean defaultCancel = !this.config.shouldListen(worldserver, this, BlockPosition.containing(vec3d), gameevent, gameevent_a);
+ Entity entity = gameevent_a.sourceEntity();
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), CraftBlock.at(worldserver, new BlockPosition(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ BlockReceiveGameEvent event = new BlockReceiveGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), CraftBlock.at(worldserver, BlockPosition.containing(vec3d1)), (entity == null) ? null : entity.getBukkitEntity());
+ event.setCancelled(defaultCancel);
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
+++ b/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java
@@ -52,6 +52,12 @@
@@ -51,6 +51,12 @@
import net.minecraft.world.phys.shapes.VoxelShapeBitSet;
import net.minecraft.world.phys.shapes.VoxelShapeDiscrete;
@@ -13,7 +13,7 @@
public class DefinedStructure {
public static final String PALETTE_TAG = "palette";
@@ -71,6 +77,11 @@
@@ -69,6 +75,11 @@
private BaseBlockPosition size;
private String author;
@@ -25,7 +25,7 @@
public DefinedStructure() {
this.size = BaseBlockPosition.ZERO;
this.author = "?";
@@ -144,7 +155,7 @@
@@ -142,7 +153,7 @@
}
private static List<DefinedStructure.BlockInfo> buildInfoList(List<DefinedStructure.BlockInfo> list, List<DefinedStructure.BlockInfo> list1, List<DefinedStructure.BlockInfo> list2) {
@@ -34,7 +34,7 @@
return definedstructure_blockinfo.pos.getY();
}).thenComparingInt((definedstructure_blockinfo) -> {
return definedstructure_blockinfo.pos.getX();
@@ -465,11 +476,13 @@
@@ -471,11 +482,13 @@
}
private static Optional<Entity> createEntityIgnoreException(WorldAccess worldaccess, NBTTagCompound nbttagcompound) {
@@ -52,21 +52,19 @@
}
public BaseBlockPosition getSize(EnumBlockRotation enumblockrotation) {
@@ -684,6 +697,13 @@
@@ -689,6 +702,11 @@
nbttagcompound.put("entities", nbttaglist3);
nbttagcompound.put("size", this.newIntegerList(this.size.getX(), this.size.getY(), this.size.getZ()));
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
+
+ // CraftBukkit Start - PDC
+ // CraftBukkit start - PDC
+ if (!this.persistentDataContainer.isEmpty()) {
+ nbttagcompound.put("BukkitValues", this.persistentDataContainer.toTagCompound());
+ }
+ // CraftBukkit end
+
return nbttagcompound;
return GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
}
@@ -723,6 +743,12 @@
@@ -728,6 +746,12 @@
}
}
@@ -79,7 +77,7 @@
}
private void loadPalette(HolderGetter<Block> holdergetter, NBTTagList nbttaglist, NBTTagList nbttaglist1) {
@@ -862,7 +888,7 @@
@@ -867,7 +891,7 @@
public IBlockData stateFor(int i) {
IBlockData iblockdata = (IBlockData) this.ids.byId(i);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/Convertable.java
+++ b/net/minecraft/world/level/storage/Convertable.java
@@ -69,6 +69,10 @@
@@ -68,6 +68,10 @@
import net.minecraft.world.level.levelgen.WorldDimensions;
import org.slf4j.Logger;
@@ -11,7 +11,7 @@
public class Convertable {
static final Logger LOGGER = LogUtils.getLogger();
@@ -115,7 +119,7 @@
@@ -114,7 +118,7 @@
}
private static WorldDataConfiguration readDataConfig(Dynamic<?> dynamic) {
@@ -20,7 +20,7 @@
Logger logger = Convertable.LOGGER;
Objects.requireNonNull(logger);
@@ -253,6 +257,7 @@
@@ -252,6 +256,7 @@
WorldDimensions.b worlddimensions_b = generatorsettings.dimensions().bake(iregistry);
Lifecycle lifecycle1 = worlddimensions_b.lifecycle().add(lifecycle);
WorldDataServer worlddataserver = WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, worlddimensions_b.specialWorldProperty(), generatorsettings.options(), lifecycle1);
@@ -28,7 +28,7 @@
return Pair.of(worlddataserver, worlddimensions_b);
};
@@ -334,9 +339,23 @@
@@ -333,9 +338,23 @@
return this.backupDir;
}
@@ -54,7 +54,7 @@
public static record a(List<Convertable.b> levels) implements Iterable<Convertable.b> {
@@ -389,8 +408,12 @@
@@ -388,8 +407,12 @@
public final Convertable.b levelDirectory;
private final String levelId;
private final Map<SavedFile, Path> resources = Maps.newHashMap();
@@ -68,7 +68,7 @@
this.levelId = s;
this.levelDirectory = new Convertable.b(Convertable.this.baseDir.resolve(s));
this.lock = SessionLock.create(this.levelDirectory.path());
@@ -401,7 +424,7 @@
@@ -400,7 +423,7 @@
}
public Path getLevelPath(SavedFile savedfile) {
@@ -77,7 +77,7 @@
Convertable.b convertable_b = this.levelDirectory;
Objects.requireNonNull(this.levelDirectory);
@@ -409,7 +432,7 @@
@@ -408,7 +431,7 @@
}
public Path getDimensionPath(ResourceKey<World> resourcekey) {

View File

@@ -42,8 +42,8 @@
private WorldDataServer(@Nullable DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound, boolean flag, int j, int k, int l, float f, long i1, long j1, int k1, int l1, int i2, boolean flag1, int j2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int k2, int l2, @Nullable UUID uuid, Set<String> set, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, NBTTagCompound nbttagcompound2, WorldSettings worldsettings, WorldOptions worldoptions, WorldDataServer.a worlddataserver_a, Lifecycle lifecycle) {
this.fixerUpper = datafixer;
@@ -127,7 +154,8 @@
return (NBTBase) dynamic.get("DimensionData").get("1").get("DragonFight").orElseEmptyMap().getValue();
});
return dynamic.get("DimensionData").get("1").get("DragonFight").orElseEmptyMap();
})).convert(DynamicOpsNBT.INSTANCE).getValue();
- return new WorldDataServer(datafixer, i, nbttagcompound, dynamic.get("WasModded").asBoolean(false), dynamic.get("SpawnX").asInt(0), dynamic.get("SpawnY").asInt(0), dynamic.get("SpawnZ").asInt(0), dynamic.get("SpawnAngle").asFloat(0.0F), j, dynamic.get("DayTime").asLong(j), levelversion.levelDataVersion(), dynamic.get("clearWeatherTime").asInt(0), dynamic.get("rainTime").asInt(0), dynamic.get("raining").asBoolean(false), dynamic.get("thunderTime").asInt(0), dynamic.get("thundering").asBoolean(false), dynamic.get("initialized").asBoolean(true), dynamic.get("DifficultyLocked").asBoolean(false), WorldBorder.c.read(dynamic, WorldBorder.DEFAULT_SETTINGS), dynamic.get("WanderingTraderSpawnDelay").asInt(0), dynamic.get("WanderingTraderSpawnChance").asInt(0), (UUID) dynamic.get("WanderingTraderId").read(UUIDUtil.CODEC).result().orElse((Object) null), (Set) dynamic.get("ServerBrands").asStream().flatMap((dynamic1) -> {
+ // CraftBukkit - decompile error
@@ -62,7 +62,7 @@
stream.forEach(nbttaglist::add);
@@ -162,7 +190,7 @@
nbttagcompound.put("Version", nbttagcompound2);
nbttagcompound.putInt("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) iregistrycustom);
- DataResult dataresult = GeneratorSettings.encode(dynamicops, this.worldOptions, iregistrycustom);
+ DataResult<NBTBase> dataresult = GeneratorSettings.encode(dynamicops, this.worldOptions, new WorldDimensions(this.customDimensions != null ? this.customDimensions : iregistrycustom.registryOrThrow(Registries.LEVEL_STEM))); // CraftBukkit

View File

@@ -28,9 +28,9 @@
+ }
+ }
+ // CraftBukkit end
int i = nbttagcompound.contains("DataVersion", 3) ? nbttagcompound.getInt("DataVersion") : -1;
int i = GameProfileSerializer.getDataVersion(nbttagcompound, -1);
entityhuman.load(GameProfileSerializer.update(this.fixerUpper, DataFixTypes.PLAYER, nbttagcompound, i));
entityhuman.load(DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i));
@@ -63,6 +80,22 @@
return nbttagcompound;
}