Update to Minecraft 1.21.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-12-04 03:20:00 +11:00
parent 267ae64dd6
commit 5381ea78f7
125 changed files with 1383 additions and 1093 deletions

View File

@@ -93,7 +93,7 @@
+ vec3d = (event.isCancelled()) ? Vec3D.ZERO : new Vec3D(event.getFinalKnockback().getX(), event.getFinalKnockback().getY(), event.getFinalKnockback().getZ()).subtract(entity.getDeltaMovement());
+ }
+ // CraftBukkit end
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d));
entity.push(vec3d);
if (entity instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) entity;
@@ -235,10 +290,62 @@

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -80,6 +80,28 @@
@@ -81,6 +81,28 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.Scoreboard;
@@ -29,7 +29,7 @@
public abstract class World implements GeneratorAccess, AutoCloseable {
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
@@ -120,7 +142,42 @@
@@ -121,7 +143,42 @@
private final DamageSources damageSources;
private long subTickCount;
@@ -73,7 +73,7 @@
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
final DimensionManager dimensionmanager = (DimensionManager) holder.value();
@@ -128,15 +185,15 @@
@@ -129,15 +186,15 @@
this.dimension = resourcekey;
this.isClientSide = flag;
if (dimensionmanager.coordinateScale() != 1.0D) {
@@ -92,7 +92,7 @@
}
};
} else {
@@ -149,6 +206,42 @@
@@ -150,6 +207,42 @@
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
this.registryAccess = iregistrycustom;
this.damageSources = new DamageSources(iregistrycustom);
@@ -135,7 +135,7 @@
}
@Override
@@ -206,6 +299,18 @@
@@ -207,6 +300,18 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@@ -154,7 +154,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -213,13 +318,29 @@
@@ -214,13 +319,29 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@@ -185,7 +185,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -246,12 +367,69 @@
@@ -247,12 +368,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@@ -255,7 +255,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -339,6 +517,14 @@
@@ -340,6 +518,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@@ -270,7 +270,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -509,6 +695,16 @@
@@ -510,6 +696,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@@ -287,7 +287,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -516,6 +712,12 @@
@@ -517,6 +713,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@@ -300,7 +300,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -645,7 +847,7 @@
@@ -643,7 +845,7 @@
for (int k = 0; k < j; ++k) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];

View File

@@ -24,7 +24,7 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -494,15 +500,23 @@
@@ -490,15 +496,23 @@
return this.builtInRegistryHolder;
}

View File

@@ -59,7 +59,7 @@
}
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
@@ -325,6 +357,11 @@
@@ -320,6 +352,11 @@
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);

View File

@@ -9,7 +9,7 @@
}
}
}
@@ -302,7 +302,7 @@
@@ -297,7 +297,7 @@
ItemStack itemstack = new ItemStack(this);
itemstack.applyComponents(tileentitybeehive.collectComponents());
@@ -18,3 +18,12 @@
EntityItem entityitem = new EntityItem(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
entityitem.setDefaultPickUpDelay();
@@ -332,7 +332,7 @@
ItemStack itemstack = super.getCloneItemStack(iworldreader, blockposition, iblockdata, flag);
if (flag) {
- itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, (Comparable) ((Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL))));
+ itemstack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(BlockBeehive.HONEY_LEVEL, ((Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL)))); // CraftBukkit - decompile error
}
return itemstack;

View File

@@ -9,7 +9,7 @@
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -224,6 +224,11 @@
@@ -219,6 +219,11 @@
if (world instanceof WorldServer worldserver) {
if (iprojectile.isOnFire() && iprojectile.mayInteract(worldserver, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {

View File

@@ -65,7 +65,7 @@
@Override
public MapCodec<? extends BlockChest> codec() {
return BlockChest.CODEC;
@@ -262,7 +277,7 @@
@@ -257,7 +272,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) -> {
@@ -278,7 +293,14 @@
@@ -273,7 +288,14 @@
@Nullable
@Override
protected ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {

View File

@@ -12,7 +12,7 @@
public class BlockComposter extends Block implements IInventoryHolder {
public static final MapCodec<BlockComposter> CODEC = simpleCodec(BlockComposter::new);
@@ -267,7 +272,14 @@
@@ -269,7 +274,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;
@@ -277,6 +289,14 @@
@@ -279,6 +291,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));
@@ -300,10 +320,16 @@
@@ -302,10 +322,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;
@@ -352,7 +378,8 @@
@@ -354,7 +380,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 {
@@ -367,6 +394,7 @@
@@ -369,6 +396,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -79,7 +79,7 @@
}
@Override
@@ -391,8 +419,15 @@
@@ -393,8 +421,15 @@
@Override
public void setChanged() {
@@ -95,7 +95,7 @@
}
}
@@ -405,6 +440,7 @@
@@ -407,6 +442,7 @@
public ContainerInput(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) {
super(1);
@@ -103,7 +103,7 @@
this.state = iblockdata;
this.level = generatoraccess;
this.pos = blockposition;
@@ -447,8 +483,9 @@
@@ -449,8 +485,9 @@
public static class ContainerEmpty extends InventorySubcontainer implements IWorldInventory {

View File

@@ -16,8 +16,8 @@
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)) {
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW)));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, worldserver.getBlockState(blockposition1.above()).is(Blocks.SNOW))); // CraftBukkit
- worldserver.setBlockAndUpdate(blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, isSnowySetting(worldserver.getBlockState(blockposition1.above()))));
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.setValue(BlockDirtSnowSpreadable.SNOWY, isSnowySetting(worldserver.getBlockState(blockposition1.above())))); // CraftBukkit
}
}
}

View File

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

View File

@@ -26,7 +26,7 @@
@@ -67,8 +75,10 @@
if (blockposition1.equals(blockposition)) {
return true;
return BlockPosition.b.ACCEPT;
} else {
- IBlockData iblockdata = world.getBlockState(blockposition1);
- Fluid fluid = world.getFluidState(blockposition1);
@@ -36,14 +36,14 @@
+ // CraftBukkit end
if (!fluid.is(TagsFluid.WATER)) {
return false;
return BlockPosition.b.SKIP;
@@ -78,27 +88,64 @@
if (block instanceof IFluidSource) {
IFluidSource ifluidsource = (IFluidSource) block;
- if (!ifluidsource.pickupBlock((EntityHuman) null, world, blockposition1, iblockdata).isEmpty()) {
+ if (!ifluidsource.pickupBlock((EntityHuman) null, blockList, blockposition1, iblockdata).isEmpty()) { // CraftBukkit
return true;
return BlockPosition.b.ACCEPT;
}
}
@@ -52,7 +52,7 @@
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3); // CraftBukkit
} else {
if (!iblockdata.is(Blocks.KELP) && !iblockdata.is(Blocks.KELP_PLANT) && !iblockdata.is(Blocks.SEAGRASS) && !iblockdata.is(Blocks.TALL_SEAGRASS)) {
return false;
return BlockPosition.b.SKIP;
}
- TileEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
@@ -66,7 +66,7 @@
+ // CraftBukkit end
}
return true;
return BlockPosition.b.ACCEPT;
}
}
- }) > 1;

View File

@@ -4,8 +4,8 @@
if (world instanceof WorldServer worldserver) {
if (world.getDifficulty() != EnumDifficulty.PEACEFUL && entity instanceof EntityLiving entityliving) {
if (!entityliving.isInvulnerableTo(worldserver, world.damageSources().wither())) {
- entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40));
+ entityliving.addEffect(new MobEffect(MobEffects.WITHER, 40), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
- entityliving.addEffect(this.getBeeInteractionEffect());
+ entityliving.addEffect(this.getBeeInteractionEffect(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.WITHER_ROSE); // CraftBukkit
}
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/SculkCatalystBlock.java
+++ b/net/minecraft/world/level/block/SculkCatalystBlock.java
@@ -68,9 +68,16 @@
@@ -63,9 +63,16 @@
@Override
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

@@ -31,7 +31,7 @@
TileEntity tileentity = world.getBlockEntity(blockposition);
if (tileentity instanceof SculkSensorBlockEntity) {
@@ -207,6 +224,15 @@
@@ -202,6 +219,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);
@@ -218,6 +244,15 @@
@@ -213,6 +239,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);
@@ -298,9 +333,16 @@
@@ -293,9 +328,16 @@
@Override
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

@@ -8,7 +8,7 @@
worldserver.getBlockEntity(blockposition, TileEntityTypes.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> {
sculkshriekerblockentity.tryShriek(worldserver, entityplayer);
});
@@ -145,10 +146,17 @@
@@ -140,10 +141,17 @@
@Override
protected void spawnAfterBreak(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, ItemStack itemstack, boolean flag) {
super.spawnAfterBreak(iblockdata, worldserver, blockposition, itemstack, flag);

View File

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

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntity.java
+++ b/net/minecraft/world/level/block/entity/TileEntity.java
@@ -27,8 +27,18 @@
@@ -26,8 +26,18 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.slf4j.Logger;
@@ -19,7 +19,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
private final TileEntityTypes<?> type;
@Nullable
@@ -75,7 +85,16 @@
@@ -74,7 +84,16 @@
return this.level != null;
}
@@ -37,7 +37,7 @@
public final void loadWithComponents(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
this.loadAdditional(nbttagcompound, holderlookup_a);
@@ -115,6 +134,11 @@
@@ -114,6 +133,11 @@
}).ifPresent((nbtbase) -> {
nbttagcompound.merge((NBTTagCompound) nbtbase);
});
@@ -49,7 +49,7 @@
return nbttagcompound;
}
@@ -277,12 +301,18 @@
@@ -263,13 +287,19 @@
}
public final void applyComponents(DataComponentMap datacomponentmap, DataComponentPatch datacomponentpatch) {
@@ -62,6 +62,7 @@
final Set<DataComponentType<?>> set = new HashSet();
set.add(DataComponents.BLOCK_ENTITY_DATA);
set.add(DataComponents.BLOCK_STATE);
final PatchedDataComponentMap patcheddatacomponentmap = PatchedDataComponentMap.fromPatch(datacomponentmap, datacomponentpatch);
- this.applyImplicitComponents(new TileEntity.b(this) {
@@ -69,7 +70,7 @@
@Nullable
@Override
public <T> T get(DataComponentType<T> datacomponenttype) {
@@ -300,6 +330,10 @@
@@ -287,6 +317,10 @@
DataComponentPatch datacomponentpatch1 = datacomponentpatch.forget(set::contains);
this.components = datacomponentpatch1.split().added();
@@ -80,7 +81,7 @@
}
protected void collectImplicitComponents(DataComponentMap.a datacomponentmap_a) {}
@@ -334,6 +368,15 @@
@@ -321,6 +355,15 @@
}
}

View File

@@ -11,7 +11,7 @@
public class TileEntityBanner extends TileEntity implements INamableTileEntity {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -80,7 +84,7 @@
@@ -74,7 +78,7 @@
BannerPatternLayers.CODEC.parse(holderlookup_a.createSerializationContext(DynamicOpsNBT.INSTANCE), nbttagcompound.get("patterns")).resultOrPartial((s) -> {
TileEntityBanner.LOGGER.error("Failed to parse banner patterns: '{}'", s);
}).ifPresent((bannerpatternlayers) -> {
@@ -20,7 +20,7 @@
});
}
@@ -114,7 +118,7 @@
@@ -108,7 +112,7 @@
@Override
protected void applyImplicitComponents(TileEntity.b tileentity_b) {
super.applyImplicitComponents(tileentity_b);
@@ -29,7 +29,7 @@
this.name = (IChatBaseComponent) tileentity_b.get(DataComponents.CUSTOM_NAME);
}
@@ -130,4 +134,13 @@
@@ -124,4 +128,13 @@
nbttagcompound.remove("patterns");
nbttagcompound.remove("CustomName");
}

View File

@@ -55,37 +55,35 @@
});
if (!list.isEmpty()) {
super.setChanged();
@@ -151,7 +162,19 @@
@@ -151,7 +162,17 @@
}
public void addOccupant(Entity entity) {
public void addOccupant(EntityBee entitybee) {
- if (this.stored.size() < 3) {
+ if (this.stored.size() < this.maxBees) { // CraftBukkit
+ // CraftBukkit start
+ if (this.level != null) {
+ org.bukkit.event.entity.EntityEnterBlockEvent event = new org.bukkit.event.entity.EntityEnterBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, getBlockPos()));
+ org.bukkit.event.entity.EntityEnterBlockEvent event = new org.bukkit.event.entity.EntityEnterBlockEvent(entitybee.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, getBlockPos()));
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ if (entity instanceof EntityBee) {
+ ((EntityBee) entity).setStayOutOfHiveCountdown(400);
+ }
+ entitybee.setStayOutOfHiveCountdown(400);
+ return;
+ }
+ }
+ // CraftBukkit end
entity.stopRiding();
entity.ejectPassengers();
this.storeBee(TileEntityBeehive.c.of(entity));
@@ -170,7 +193,7 @@
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entity, this.getBlockState()));
entitybee.stopRiding();
entitybee.ejectPassengers();
entitybee.dropLeash();
@@ -167,7 +188,7 @@
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entitybee, this.getBlockState()));
}
- entity.discard();
+ entity.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
- entitybee.discard();
+ entitybee.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
super.setChanged();
}
}
@@ -180,7 +203,13 @@
@@ -177,7 +198,13 @@
}
private static boolean releaseOccupant(World world, BlockPosition blockposition, IBlockData iblockdata, TileEntityBeehive.c tileentitybeehive_c, @Nullable List<Entity> list, TileEntityBeehive.ReleaseStatus tileentitybeehive_releasestatus, @Nullable BlockPosition blockposition1) {
@@ -100,7 +98,7 @@
return false;
} else {
EnumDirection enumdirection = (EnumDirection) iblockdata.getValue(BlockBeehive.FACING);
@@ -193,6 +222,18 @@
@@ -190,6 +217,18 @@
Entity entity = tileentitybeehive_c.createEntity(world, blockposition);
if (entity != null) {
@@ -119,7 +117,7 @@
if (entity instanceof EntityBee) {
EntityBee entitybee = (EntityBee) entity;
@@ -223,6 +264,7 @@
@@ -220,6 +259,7 @@
list.add(entitybee);
}
@@ -127,7 +125,7 @@
float f = entity.getBbWidth();
double d0 = flag ? 0.0D : 0.55D + (double) (f / 2.0F);
double d1 = (double) blockposition.getX() + 0.5D + d0 * (double) enumdirection.getStepX();
@@ -230,11 +272,12 @@
@@ -227,11 +267,12 @@
double d3 = (double) blockposition.getZ() + 0.5D + d0 * (double) enumdirection.getStepZ();
entity.moveTo(d1, d2, d3, entity.getYRot(), entity.getXRot());
@@ -141,7 +139,7 @@
} else {
return false;
}
@@ -259,6 +302,10 @@
@@ -256,6 +297,10 @@
if (releaseOccupant(world, blockposition, iblockdata, tileentitybeehive_hivebee.toOccupant(), (List) null, tileentitybeehive_releasestatus, blockposition1)) {
flag = true;
iterator.remove();
@@ -152,7 +150,7 @@
}
}
}
@@ -285,7 +332,7 @@
@@ -282,7 +327,7 @@
@Override
protected void loadAdditional(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
super.loadAdditional(nbttagcompound, holderlookup_a);
@@ -161,7 +159,7 @@
if (nbttagcompound.contains("bees")) {
TileEntityBeehive.c.LIST_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("bees")).resultOrPartial((s) -> {
TileEntityBeehive.LOGGER.error("Failed to parse bees: '{}'", s);
@@ -294,7 +341,12 @@
@@ -291,7 +336,12 @@
});
}
@@ -175,7 +173,7 @@
}
@Override
@@ -304,13 +356,14 @@
@@ -301,13 +351,14 @@
if (this.hasSavedFlowerPos()) {
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.savedFlowerPos));
}
@@ -191,7 +189,7 @@
List<TileEntityBeehive.c> list = (List) tileentity_b.getOrDefault(DataComponents.BEES, List.of());
list.forEach(this::storeBee);
@@ -351,7 +404,7 @@
@@ -348,7 +399,7 @@
NBTTagCompound nbttagcompound = new NBTTagCompound();
entity.save(nbttagcompound);
@@ -200,7 +198,7 @@
Objects.requireNonNull(nbttagcompound);
list.forEach(nbttagcompound::remove);
@@ -370,7 +423,7 @@
@@ -367,7 +418,7 @@
@Nullable
public Entity createEntity(World world, BlockPosition blockposition) {
NBTTagCompound nbttagcompound = this.entityData.copyTag();

View File

@@ -50,15 +50,3 @@
protected TileEntityChest(TileEntityTypes<?> tileentitytypes, BlockPosition blockposition, IBlockData iblockdata) {
super(tileentitytypes, blockposition, iblockdata);
this.items = NonNullList.withSize(27, ItemStack.EMPTY);
@@ -199,4 +235,11 @@
world.blockEvent(blockposition, block, 1, j);
}
+
+ // CraftBukkit start
+ @Override
+ public boolean onlyOpCanSetNbt() {
+ return true;
+ }
+ // CraftBukkit end
}

View File

@@ -22,7 +22,7 @@
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeCraftingHolder, AutoRecipeOutput {
protected static final int SLOT_INPUT = 0;
@@ -112,9 +127,39 @@
@@ -110,9 +125,39 @@
}
};
this.recipesUsed = new Reference2IntOpenHashMap();
@@ -61,9 +61,9 @@
+ // CraftBukkit end
+
private boolean isLit() {
return this.litTime > 0;
return this.litTimeRemaining > 0;
}
@@ -180,7 +225,7 @@
@@ -175,7 +220,7 @@
RecipeHolder recipeholder;
if (flag2) {
@@ -72,11 +72,11 @@
} else {
recipeholder = null;
}
@@ -188,9 +233,20 @@
@@ -183,9 +228,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
- tileentityfurnace.litTime = tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack);
- tileentityfurnace.litTimeRemaining = tileentityfurnace.getBurnDuration(worldserver.fuelValues(), itemstack);
+ // CraftBukkit start
+ CraftItemStack fuel = CraftItemStack.asCraftMirror(itemstack);
+
@@ -87,20 +87,20 @@
+ return;
+ }
+
+ tileentityfurnace.litTime = furnaceBurnEvent.getBurnTime();
tileentityfurnace.litDuration = tileentityfurnace.litTime;
+ tileentityfurnace.litTimeRemaining = furnaceBurnEvent.getBurnTime();
tileentityfurnace.litTotalTime = tileentityfurnace.litTimeRemaining;
- if (tileentityfurnace.isLit()) {
+ if (tileentityfurnace.isLit() && furnaceBurnEvent.isBurning()) {
+ // CraftBukkit end
flag1 = true;
if (flag3) {
Item item = itemstack.getItem();
@@ -204,11 +260,23 @@
@@ -199,11 +255,23 @@
}
if (tileentityfurnace.isLit() && canBurn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
+ // CraftBukkit start
+ if (recipeholder != null && tileentityfurnace.cookingProgress == 0) {
+ if (recipeholder != null && tileentityfurnace.cookingTimer == 0) {
+ CraftItemStack source = CraftItemStack.asCraftMirror(tileentityfurnace.items.get(0));
+ CookingRecipe<?> recipe = (CookingRecipe<?>) recipeholder.toBukkitRecipe();
+
@@ -111,16 +111,16 @@
+ }
+ // CraftBukkit end
+
++tileentityfurnace.cookingProgress;
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingProgress = 0;
++tileentityfurnace.cookingTimer;
if (tileentityfurnace.cookingTimer == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingTimer = 0;
tileentityfurnace.cookingTotalTime = getTotalCookTime(worldserver, tileentityfurnace);
- if (burn(worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) {
+ if (burn(tileentityfurnace.level, tileentityfurnace.worldPosition, worldserver.registryAccess(), recipeholder, singlerecipeinput, tileentityfurnace.items, i)) { // CraftBukkit
tileentityfurnace.setRecipeUsed(recipeholder);
}
@@ -247,17 +315,44 @@
@@ -242,17 +310,44 @@
}
}
@@ -166,7 +166,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));
@@ -275,6 +370,7 @@
@@ -270,6 +365,7 @@
}
private static int getTotalCookTime(WorldServer worldserver, TileEntityFurnace tileentityfurnace) {
@@ -174,7 +174,7 @@
SingleRecipeInput singlerecipeinput = new SingleRecipeInput(tileentityfurnace.getItem(0));
return (Integer) tileentityfurnace.quickCheck.getRecipeFor(singlerecipeinput, worldserver).map((recipeholder) -> {
@@ -365,8 +461,8 @@
@@ -360,8 +456,8 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman, List<ItemStack> list) {}
@@ -185,7 +185,7 @@
entityplayer.awardRecipes(list);
Iterator iterator = list.iterator();
@@ -383,22 +479,28 @@
@@ -378,22 +474,28 @@
}
public List<RecipeHolder<?>> getRecipesToAwardAndPopExperience(WorldServer worldserver, Vec3D vec3d) {
@@ -217,7 +217,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -406,6 +508,17 @@
@@ -401,6 +503,17 @@
++j;
}

View File

@@ -57,7 +57,7 @@
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
@@ -133,7 +177,7 @@
@@ -137,7 +181,7 @@
@Override
public int getMaxStackSize() {
@@ -66,7 +66,7 @@
}
@Override
@@ -152,12 +196,17 @@
@@ -156,12 +200,17 @@
}
@VisibleForTesting

View File

@@ -152,7 +152,7 @@
}
@Override
@@ -241,7 +339,7 @@
@@ -236,7 +334,7 @@
@Override
public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) {

View File

@@ -50,7 +50,7 @@
public TileEntityShulkerBox(@Nullable EnumColor enumcolor, BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.SHULKER_BOX, blockposition, iblockdata);
this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
@@ -173,6 +209,7 @@
@@ -184,6 +220,7 @@
}
++this.openCount;
@@ -58,7 +58,7 @@
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);
if (this.openCount == 1) {
this.level.gameEvent((Entity) entityhuman, (Holder) GameEvent.CONTAINER_OPEN, this.worldPosition);
@@ -186,6 +223,7 @@
@@ -197,6 +234,7 @@
public void stopOpen(EntityHuman entityhuman) {
if (!this.remove && !entityhuman.isSpectator()) {
--this.openCount;

View File

@@ -133,7 +133,7 @@
}
@Override
@@ -278,12 +342,17 @@
@@ -273,12 +337,17 @@
@Nullable
public UUID getPlayerWhoMayEdit() {

View File

@@ -0,0 +1,20 @@
--- a/net/minecraft/world/level/block/entity/TileEntityTypes.java
+++ b/net/minecraft/world/level/block/entity/TileEntityTypes.java
@@ -66,7 +66,7 @@
public static final TileEntityTypes<CrafterBlockEntity> CRAFTER = register("crafter", CrafterBlockEntity::new, Blocks.CRAFTER);
public static final TileEntityTypes<TrialSpawnerBlockEntity> TRIAL_SPAWNER = register("trial_spawner", TrialSpawnerBlockEntity::new, Blocks.TRIAL_SPAWNER);
public static final TileEntityTypes<VaultBlockEntity> VAULT = register("vault", VaultBlockEntity::new, Blocks.VAULT);
- private static final Set<TileEntityTypes<?>> OP_ONLY_CUSTOM_DATA = Set.of(TileEntityTypes.COMMAND_BLOCK, TileEntityTypes.LECTERN, TileEntityTypes.SIGN, TileEntityTypes.HANGING_SIGN, TileEntityTypes.MOB_SPAWNER, TileEntityTypes.TRIAL_SPAWNER);
+ private static final Set<TileEntityTypes<?>> OP_ONLY_CUSTOM_DATA = Set.of(TileEntityTypes.COMMAND_BLOCK, TileEntityTypes.LECTERN, TileEntityTypes.SIGN, TileEntityTypes.HANGING_SIGN, TileEntityTypes.MOB_SPAWNER, TileEntityTypes.TRIAL_SPAWNER, TileEntityTypes.CHEST); // CraftBukkit
private final TileEntityTypes.a<? extends T> factory;
private final Set<Block> validBlocks;
private final Holder.c<TileEntityTypes<?>> builtInRegistryHolder;
@@ -110,7 +110,7 @@
public T getBlockEntity(IBlockAccess iblockaccess, BlockPosition blockposition) {
TileEntity tileentity = iblockaccess.getBlockEntity(blockposition);
- return tileentity != null && tileentity.getType() == this ? tileentity : null;
+ return tileentity != null && tileentity.getType() == this ? (T) tileentity : null; // CraftBukkit - decompile error
}
public boolean onlyOpCanSetNbt() {

View File

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

View File

@@ -38,7 +38,7 @@
}
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag);
@@ -1121,7 +1134,13 @@
@@ -1125,7 +1138,13 @@
}
public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/Chunk.java
+++ b/net/minecraft/world/level/chunk/Chunk.java
@@ -78,7 +78,7 @@
@@ -79,7 +79,7 @@
};
private final Map<BlockPosition, Chunk.d> tickersInLevel;
public boolean loaded;
@@ -9,7 +9,7 @@
@Nullable
private Supplier<FullChunkStatus> fullStatus;
@Nullable
@@ -97,7 +97,7 @@
@@ -98,7 +98,7 @@
this.tickersInLevel = Maps.newHashMap();
this.unsavedListener = (chunkcoordintpair1) -> {
};
@@ -18,7 +18,7 @@
this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap();
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
int j = aheightmap_type.length;
@@ -115,6 +115,11 @@
@@ -116,6 +116,11 @@
this.fluidTicks = levelchunkticks1;
}
@@ -29,8 +29,8 @@
+
public Chunk(WorldServer worldserver, ProtoChunk protochunk, @Nullable Chunk.c chunk_c) {
this(worldserver, protochunk.getPos(), protochunk.getUpgradeData(), protochunk.unpackBlockTicks(), protochunk.unpackFluidTicks(), protochunk.getInhabitedTime(), protochunk.getSections(), chunk_c, protochunk.getBlendingData());
Iterator iterator = protochunk.getBlockEntities().values().iterator();
@@ -146,6 +151,10 @@
if (!Collections.disjoint(protochunk.pendingBlockEntities.keySet(), protochunk.blockEntities.keySet())) {
@@ -151,6 +156,10 @@
this.skyLightSources = protochunk.skyLightSources;
this.setLightCorrect(protochunk.isLightCorrect());
this.markUnsaved();
@@ -41,7 +41,7 @@
}
public void setUnsavedListener(Chunk.e chunk_e) {
@@ -267,9 +276,16 @@
@@ -272,9 +281,16 @@
}
}
@@ -58,7 +58,7 @@
int i = blockposition.getY();
ChunkSection chunksection = this.getSection(this.getSectionIndex(i));
boolean flag1 = chunksection.hasOnlyAir();
@@ -319,7 +335,8 @@
@@ -324,7 +340,8 @@
if (!chunksection.getBlockState(j, k, l).is(block)) {
return null;
} else {
@@ -68,7 +68,7 @@
iblockdata.onPlace(this.level, blockposition, iblockdata1, flag);
}
@@ -370,7 +387,12 @@
@@ -375,7 +392,12 @@
@Nullable
public TileEntity getBlockEntity(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -82,7 +82,7 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.pendingBlockEntities.remove(blockposition);
@@ -442,6 +464,7 @@
@@ -447,6 +469,7 @@
if (!iblockdata.hasBlockEntity()) {
Chunk.LOGGER.warn("Trying to set block entity {} at position {}, but state {} does not allow it", new Object[]{tileentity, blockposition, iblockdata});
@@ -90,7 +90,7 @@
} else {
IBlockData iblockdata1 = tileentity.getBlockState();
@@ -495,6 +518,12 @@
@@ -500,6 +523,12 @@
if (this.isInLevel()) {
TileEntity tileentity = (TileEntity) this.blockEntities.remove(blockposition);
@@ -103,7 +103,7 @@
if (tileentity != null) {
World world = this.level;
@@ -548,6 +577,57 @@
@@ -553,6 +582,57 @@
}
@@ -161,7 +161,7 @@
public boolean isEmpty() {
return false;
}
@@ -745,7 +825,7 @@
@@ -750,7 +830,7 @@
private <T extends TileEntity> void updateBlockEntityTicker(T t0) {
IBlockData iblockdata = t0.getBlockState();
@@ -170,7 +170,7 @@
if (blockentityticker == null) {
this.removeBlockEntityTicker(t0.getBlockPos());
@@ -836,7 +916,7 @@
@@ -841,7 +921,7 @@
private boolean loggedInvalidBlockState;
a(final TileEntity tileentity, final BlockEntityTicker blockentityticker) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -311,7 +311,7 @@
@@ -312,7 +312,7 @@
}
}
@@ -9,7 +9,7 @@
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
if (!SharedConstants.debugVoidTerrain(chunkcoordintpair)) {
@@ -333,7 +333,7 @@
@@ -334,7 +334,7 @@
for (int k = 0; k < j; ++k) {
ChunkSection chunksection = achunksection[k];
@@ -18,7 +18,7 @@
Objects.requireNonNull(set);
palettedcontainerro.getAll(set::add);
@@ -444,6 +444,33 @@
@@ -445,6 +445,33 @@
}
}
@@ -52,8 +52,8 @@
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
int i = chunkcoordintpair.getMinBlockX();
@@ -581,6 +608,14 @@
StructureStart structurestart = structure.generate(iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
@@ -582,6 +609,14 @@
StructureStart structurestart = structure.generate(structureset_a.structure(), resourcekey, iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
if (structurestart.isValid()) {
+ // CraftBukkit start

View File

@@ -41,7 +41,7 @@
}
public abstract ChunkStatus getPersistedStatus();
@@ -458,6 +468,27 @@
@@ -463,6 +473,27 @@
}
}

View File

@@ -6,7 +6,7 @@
- if (worldserver.getServer().getWorldData().worldGenOptions().generateStructures()) {
+ if (worldserver.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager());
worldgencontext.generator().createStructures(worldserver.registryAccess(), worldserver.getChunkSource().getGeneratorState(), worldserver.structureManager(), ichunkaccess, worldgencontext.structureManager(), worldserver.dimension());
}
@@ -170,7 +170,17 @@