Compare commits

...

10 Commits

10 changed files with 165 additions and 99 deletions

View File

@ -1,11 +1,12 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java --- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java +++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -26,6 +26,27 @@ @@ -26,6 +26,28 @@
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger; import org.slf4j.Logger;
+// CraftBukkit start +// CraftBukkit start
+import java.util.ArrayList; +import java.util.ArrayList;
+import net.minecraft.network.protocol.game.ClientboundBlockChangedAckPacket;
+import net.minecraft.network.protocol.game.PacketPlayOutBlockChange; +import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.EnumItemSlot; +import net.minecraft.world.entity.EnumItemSlot;
@ -28,7 +29,7 @@
public class PlayerInteractManager { public class PlayerInteractManager {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -56,9 +77,16 @@ @@ -56,9 +78,16 @@
if (enumgamemode == this.gameModeForPlayer) { if (enumgamemode == this.gameModeForPlayer) {
return false; return false;
} else { } else {
@ -46,7 +47,7 @@
this.level.updateSleepingPlayerList(); this.level.updateSleepingPlayerList();
if (enumgamemode == EnumGamemode.CREATIVE) { if (enumgamemode == EnumGamemode.CREATIVE) {
this.player.resetCurrentImpulseContext(); this.player.resetCurrentImpulseContext();
@@ -92,7 +120,7 @@ @@ -92,7 +121,7 @@
} }
public void tick() { public void tick() {
@ -55,7 +56,7 @@
if (this.hasDelayedDestroy) { if (this.hasDelayedDestroy) {
IBlockData iblockdata = this.level.getBlockState(this.delayedDestroyPos); IBlockData iblockdata = this.level.getBlockState(this.delayedDestroyPos);
@@ -144,11 +172,33 @@ @@ -144,10 +173,36 @@
} else { } else {
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) { if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.level.mayInteract(this.player, blockposition)) { if (!this.level.mayInteract(this.player, blockposition)) {
@ -63,33 +64,36 @@
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getSelectedItem(), EnumHand.MAIN_HAND); + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getSelectedItem(), EnumHand.MAIN_HAND);
this.player.connection.send(new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition))); this.player.connection.send(new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
this.debugLogging(blockposition, false, j, "may not interact"); this.debugLogging(blockposition, false, j, "may not interact");
+ // SPIGOT-8042: Need to ACK above changes first
+ this.player.connection.send(new ClientboundBlockChangedAckPacket(j));
+ // Update any tile entity data for this block + // Update any tile entity data for this block
+ TileEntity tileentity = level.getBlockEntity(blockposition); + TileEntity tileentity = level.getBlockEntity(blockposition);
+ if (tileentity != null) { + if (tileentity != null) {
+ this.player.connection.send(tileentity.getUpdatePacket()); + this.player.connection.send(tileentity.getUpdatePacket());
+ } + }
+ // CraftBukkit end + // CraftBukkit end
return; + return;
} + }
+
+ // CraftBukkit start + // CraftBukkit start
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getSelectedItem(), EnumHand.MAIN_HAND); + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getSelectedItem(), EnumHand.MAIN_HAND);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ // Let the client know the block still exists + // Let the client know the block still exists
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition)); + this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
+ // SPIGOT-8042: Need to ACK above changes first
+ this.player.connection.send(new ClientboundBlockChangedAckPacket(j));
+ // Update any tile entity data for this block + // Update any tile entity data for this block
+ TileEntity tileentity = this.level.getBlockEntity(blockposition); + TileEntity tileentity = this.level.getBlockEntity(blockposition);
+ if (tileentity != null) { + if (tileentity != null) {
+ this.player.connection.send(tileentity.getUpdatePacket()); + this.player.connection.send(tileentity.getUpdatePacket());
+ } + }
+ return; return;
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
if (this.player.getAbilities().instabuild) { if (this.player.getAbilities().instabuild) {
this.destroyAndAck(blockposition, j, "creative destroy"); this.destroyAndAck(blockposition, j, "creative destroy");
return; @@ -164,7 +219,19 @@
@@ -164,7 +214,19 @@
float f = 1.0F; float f = 1.0F;
IBlockData iblockdata = this.level.getBlockState(blockposition); IBlockData iblockdata = this.level.getBlockState(blockposition);
@ -110,7 +114,7 @@
EnchantmentManager.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EnumItemSlot.MAINHAND, Vec3D.atCenterOf(blockposition), iblockdata, (item) -> { EnchantmentManager.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EnumItemSlot.MAINHAND, Vec3D.atCenterOf(blockposition), iblockdata, (item) -> {
this.player.onEquippedItemBroken(item, EnumItemSlot.MAINHAND); this.player.onEquippedItemBroken(item, EnumItemSlot.MAINHAND);
}); });
@@ -172,6 +234,26 @@ @@ -172,6 +239,26 @@
f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition); f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition);
} }
@ -137,7 +141,7 @@
if (!iblockdata.isAir() && f >= 1.0F) { if (!iblockdata.isAir() && f >= 1.0F) {
this.destroyAndAck(blockposition, j, "insta mine"); this.destroyAndAck(blockposition, j, "insta mine");
} else { } else {
@@ -216,13 +298,15 @@ @@ -216,20 +303,22 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) { } else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false; this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, blockposition)) { if (!Objects.equals(this.destroyPos, blockposition)) {
@ -154,9 +158,24 @@
} }
} }
@@ -240,10 +324,65 @@ }
public void destroyAndAck(BlockPosition blockposition, int i, String s) {
- if (this.destroyBlock(blockposition)) {
+ if (this.destroyBlock(blockposition, i)) { // CraftBukkit - add ack
this.debugLogging(blockposition, true, i, s);
} else {
this.player.connection.send(new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
@@ -239,11 +328,74 @@
}
public boolean destroyBlock(BlockPosition blockposition) { public boolean destroyBlock(BlockPosition blockposition) {
+ // CraftBukkit start
+ return this.destroyBlock(blockposition, -1);
+ }
+
+ public boolean destroyBlock(BlockPosition blockposition, int ack) {
+ // CraftBukkit end
IBlockData iblockdata = this.level.getBlockState(blockposition); IBlockData iblockdata = this.level.getBlockState(blockposition);
+ // CraftBukkit start - fire BlockBreakEvent + // CraftBukkit start - fire BlockBreakEvent
+ org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition); + org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition);
@ -203,6 +222,8 @@
+ this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir))); + this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir)));
+ } + }
+ +
+ // SPIGOT-8042: Need to ACK above changes first
+ this.player.connection.send(new ClientboundBlockChangedAckPacket(ack));
+ // Update any tile entity data for this block + // Update any tile entity data for this block
+ TileEntity tileentity = this.level.getBlockEntity(blockposition); + TileEntity tileentity = this.level.getBlockEntity(blockposition);
+ if (tileentity != null) { + if (tileentity != null) {
@ -221,7 +242,7 @@
TileEntity tileentity = this.level.getBlockEntity(blockposition); TileEntity tileentity = this.level.getBlockEntity(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@@ -253,6 +392,10 @@ @@ -253,6 +405,10 @@
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) { } else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
return false; return false;
} else { } else {
@ -232,7 +253,7 @@
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player); IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false); boolean flag = this.level.removeBlock(blockposition, false);
@@ -261,19 +404,32 @@ @@ -261,19 +417,32 @@
} }
if (this.player.preventsBlockDrops()) { if (this.player.preventsBlockDrops()) {
@ -255,20 +276,20 @@
+ // CraftBukkit start + // CraftBukkit start
+ if (event.isDropItems()) { + if (event.isDropItems()) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops); + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
+ } }
+ level.captureDrops = null; + level.captureDrops = null;
+ +
+ // Drop event experience + // Drop event experience
+ if (flag && event != null) { + if (flag && event != null) {
+ iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop()); + iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop());
} + }
+ +
+ return true; + return true;
+ // CraftBukkit end + // CraftBukkit end
} }
} }
} }
@@ -319,14 +475,53 @@ @@ -319,14 +488,53 @@
} }
} }
@ -322,7 +343,7 @@
if (itileinventory != null) { if (itileinventory != null) {
entityplayer.openMenu(itileinventory); entityplayer.openMenu(itileinventory);
@@ -357,7 +552,7 @@ @@ -357,7 +565,7 @@
} }
} }

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldServer.java --- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java +++ b/net/minecraft/server/level/WorldServer.java
@@ -169,6 +169,24 @@ @@ -169,6 +169,26 @@
import net.minecraft.world.ticks.TickListServer; import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -15,17 +15,19 @@
+import org.bukkit.WeatherType; +import org.bukkit.WeatherType;
+import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; +import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.craftbukkit.util.WorldUUID; +import org.bukkit.craftbukkit.util.WorldUUID;
+import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.server.MapInitializeEvent; +import org.bukkit.event.server.MapInitializeEvent;
+import org.bukkit.event.weather.LightningStrikeEvent; +import org.bukkit.event.weather.LightningStrikeEvent;
+import org.bukkit.event.world.SpawnChangeEvent;
+import org.bukkit.event.world.TimeSkipEvent; +import org.bukkit.event.world.TimeSkipEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public class WorldServer extends World implements ServerEntityGetter, GeneratorAccessSeed { public class WorldServer extends World implements ServerEntityGetter, GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0); public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -182,7 +200,7 @@ @@ -182,7 +202,7 @@
final List<EntityPlayer> players = Lists.newArrayList(); final List<EntityPlayer> players = Lists.newArrayList();
private final ChunkProviderServer chunkSource; private final ChunkProviderServer chunkSource;
private final MinecraftServer server; private final MinecraftServer server;
@ -34,7 +36,7 @@
private int lastSpawnChunkRadius; private int lastSpawnChunkRadius;
final EntityTickList entityTickList = new EntityTickList(); final EntityTickList entityTickList = new EntityTickList();
public final PersistentEntitySectionManager<Entity> entityManager; public final PersistentEntitySectionManager<Entity> entityManager;
@@ -209,13 +227,47 @@ @@ -209,13 +229,47 @@
private final boolean tickTime; private final boolean tickTime;
private final RandomSequences randomSequences; private final RandomSequences randomSequences;
@ -84,7 +86,7 @@
boolean flag2 = minecraftserver.forceSynchronousWrites(); boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper(); DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver); EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
@@ -243,9 +295,9 @@ @@ -243,9 +297,9 @@
long l = minecraftserver.getWorldData().worldGenOptions().seed(); long l = minecraftserver.getWorldData().worldGenOptions().seed();
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer); this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
@ -97,7 +99,7 @@
} else { } else {
this.dragonFight = null; this.dragonFight = null;
} }
@@ -255,6 +307,7 @@ @@ -255,6 +309,7 @@
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> { this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.TYPE); return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.TYPE);
}); });
@ -105,7 +107,7 @@
} }
/** @deprecated */ /** @deprecated */
@@ -299,13 +352,22 @@ @@ -299,13 +354,22 @@
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@ -130,7 +132,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) { if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle(); this.resetWeatherCycle();
} }
@@ -341,7 +403,7 @@ @@ -341,7 +405,7 @@
this.handlingTick = false; this.handlingTick = false;
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@ -139,7 +141,7 @@
if (flag1) { if (flag1) {
this.resetEmptyTime(); this.resetEmptyTime();
@@ -421,7 +483,7 @@ @@ -421,7 +485,7 @@
private void wakeUpAllPlayers() { private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers(); this.sleepStatus.removeAllSleepers();
@ -148,7 +150,7 @@
entityplayer.stopSleepInBed(false, false); entityplayer.stopSleepInBed(false, false);
}); });
} }
@@ -498,7 +560,7 @@ @@ -498,7 +562,7 @@
entityhorseskeleton.setTrap(true); entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0); entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -157,7 +159,7 @@
} }
} }
@@ -507,7 +569,7 @@ @@ -507,7 +571,7 @@
if (entitylightning != null) { if (entitylightning != null) {
entitylightning.snapTo(Vec3D.atBottomCenterOf(blockposition)); entitylightning.snapTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1); entitylightning.setVisualOnly(flag1);
@ -166,7 +168,7 @@
} }
} }
} }
@@ -522,7 +584,7 @@ @@ -522,7 +586,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value(); BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
if (biomebase.shouldFreeze(this, blockposition2)) { if (biomebase.shouldFreeze(this, blockposition2)) {
@ -175,7 +177,7 @@
} }
if (this.isRaining()) { if (this.isRaining()) {
@@ -538,10 +600,10 @@ @@ -538,10 +602,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1); IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1); Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
@ -188,7 +190,7 @@
} }
} }
@@ -698,6 +760,7 @@ @@ -698,6 +762,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F); this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
} }
@ -196,7 +198,7 @@
if (this.oRainLevel != this.rainLevel) { if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension()); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
} }
@@ -716,15 +779,48 @@ @@ -716,15 +781,48 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel)); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel)); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
} }
@ -247,7 +249,7 @@
} }
public void resetEmptyTime() { public void resetEmptyTime() {
@@ -760,6 +856,7 @@ @@ -760,6 +858,7 @@
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick(); entity.tick();
@ -255,7 +257,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
for (Entity entity1 : entity.getPassengers()) { for (Entity entity1 : entity.getPassengers()) {
@@ -780,6 +877,7 @@ @@ -780,6 +879,7 @@
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick(); entity1.rideTick();
@ -263,7 +265,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
for (Entity entity2 : entity1.getPassengers()) { for (Entity entity2 : entity1.getPassengers()) {
@@ -811,6 +909,7 @@ @@ -811,6 +911,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource(); ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) { if (!flag1) {
@ -271,7 +273,7 @@
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel")); iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
} }
@@ -828,11 +927,19 @@ @@ -828,11 +929,19 @@
} }
} }
@ -292,7 +294,7 @@
} }
WorldPersistentData worldpersistentdata = this.getChunkSource().getDataStorage(); WorldPersistentData worldpersistentdata = this.getChunkSource().getDataStorage();
@@ -901,18 +1008,40 @@ @@ -901,18 +1010,40 @@
@Override @Override
public boolean addFreshEntity(Entity entity) { public boolean addFreshEntity(Entity entity) {
@ -336,7 +338,7 @@
} }
} }
@@ -937,24 +1066,37 @@ @@ -937,24 +1068,37 @@
this.entityManager.addNewEntity(entityplayer); this.entityManager.addNewEntity(entityplayer);
} }
@ -378,14 +380,14 @@
return true; return true;
} }
} }
@@ -965,17 +1107,45 @@ @@ -965,17 +1109,45 @@
} }
public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) { public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) {
- entityplayer.remove(entity_removalreason); - entityplayer.remove(entity_removalreason);
+ entityplayer.remove(entity_removalreason, null); // CraftBukkit - add Bukkit remove cause + entityplayer.remove(entity_removalreason, null); // CraftBukkit - add Bukkit remove cause
} + }
+
+ // CraftBukkit start + // CraftBukkit start
+ public boolean strikeLightning(Entity entitylightning) { + public boolean strikeLightning(Entity entitylightning) {
+ return this.strikeLightning(entitylightning, LightningStrikeEvent.Cause.UNKNOWN); + return this.strikeLightning(entitylightning, LightningStrikeEvent.Cause.UNKNOWN);
@ -399,9 +401,9 @@
+ } + }
+ +
+ return this.addFreshEntity(entitylightning); + return this.addFreshEntity(entitylightning);
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public void destroyBlockProgress(int i, BlockPosition blockposition, int j) { public void destroyBlockProgress(int i, BlockPosition blockposition, int j) {
+ // CraftBukkit start + // CraftBukkit start
@ -425,7 +427,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
} }
@@ -1078,8 +1248,21 @@ @@ -1078,8 +1250,21 @@
if (VoxelShapes.joinIsNotEmpty(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { if (VoxelShapes.joinIsNotEmpty(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) {
List<NavigationAbstract> list = new ObjectArrayList(); List<NavigationAbstract> list = new ObjectArrayList();
@ -448,7 +450,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation(); NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) { if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1142,6 +1325,12 @@ @@ -1142,6 +1327,12 @@
@Override @Override
public void explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) { public void explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) {
@ -461,7 +463,7 @@
Explosion.Effect explosion_effect; Explosion.Effect explosion_effect;
switch (world_a) { switch (world_a) {
@@ -1160,6 +1349,11 @@ @@ -1160,6 +1351,11 @@
case TRIGGER: case TRIGGER:
explosion_effect = Explosion.Effect.TRIGGER_BLOCK; explosion_effect = Explosion.Effect.TRIGGER_BLOCK;
break; break;
@ -473,7 +475,7 @@
default: default:
throw new MatchException((String) null, (Throwable) null); throw new MatchException((String) null, (Throwable) null);
} }
@@ -1169,6 +1363,11 @@ @@ -1169,6 +1365,11 @@
ServerExplosion serverexplosion = new ServerExplosion(this, entity, damagesource, explosiondamagecalculator, vec3d, f, flag, explosion_effect1); ServerExplosion serverexplosion = new ServerExplosion(this, entity, damagesource, explosiondamagecalculator, vec3d, f, flag, explosion_effect1);
serverexplosion.explode(); serverexplosion.explode();
@ -485,7 +487,7 @@
ParticleParam particleparam2 = serverexplosion.isSmall() ? particleparam : particleparam1; ParticleParam particleparam2 = serverexplosion.isSmall() ? particleparam : particleparam1;
for (EntityPlayer entityplayer : this.players) { for (EntityPlayer entityplayer : this.players) {
@@ -1179,6 +1378,7 @@ @@ -1179,6 +1380,7 @@
} }
} }
@ -493,7 +495,7 @@
} }
private Explosion.Effect getDestroyType(GameRules.GameRuleKey<GameRules.GameRuleBoolean> gamerules_gamerulekey) { private Explosion.Effect getDestroyType(GameRules.GameRuleKey<GameRules.GameRuleBoolean> gamerules_gamerulekey) {
@@ -1239,15 +1439,22 @@ @@ -1239,15 +1441,22 @@
} }
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -517,7 +519,7 @@
if (this.sendParticles(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles)) { if (this.sendParticles(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles)) {
++j; ++j;
@@ -1300,7 +1507,7 @@ @@ -1300,7 +1509,7 @@
@Nullable @Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) { public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
@ -526,7 +528,7 @@
return null; return null;
} else { } else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(tagkey); Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(tagkey);
@@ -1342,10 +1549,21 @@ @@ -1342,10 +1551,21 @@
@Nullable @Nullable
@Override @Override
public WorldMap getMapData(MapId mapid) { public WorldMap getMapData(MapId mapid) {
@ -549,7 +551,18 @@
this.getServer().overworld().getDataStorage().set(WorldMap.type(mapid), worldmap); this.getServer().overworld().getDataStorage().set(WorldMap.type(mapid), worldmap);
} }
@@ -1557,12 +1775,12 @@ @@ -1359,6 +1579,10 @@
if (!blockposition1.equals(blockposition) || f1 != f) {
this.levelData.setSpawn(blockposition, f);
+ // CraftBukkit start - Notify anyone who's listening.
+ SpawnChangeEvent event = new SpawnChangeEvent(getWorld(), CraftLocation.toBukkit(blockposition, getWorld(), f1, 0.0F));
+ getCraftServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
this.getServer().getPlayerList().broadcastAll(new PacketPlayOutSpawnPosition(blockposition, f));
}
@@ -1557,12 +1781,12 @@
} }
public boolean isFlat() { public boolean isFlat() {
@ -564,7 +577,7 @@
} }
@Nullable @Nullable
@@ -1592,7 +1810,7 @@ @@ -1592,7 +1816,7 @@
object2intopenhashmap.addTo(s, 1); object2intopenhashmap.addTo(s, 1);
} }
@ -573,16 +586,28 @@
String s1 = (String) entry.getKey(); String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue(); return s1 + ":" + entry.getIntValue();
@@ -1754,6 +1972,8 @@ @@ -1716,7 +1940,11 @@
a() {}
- public void onCreated(Entity entity) {}
+ // CraftBukkit start - Mark entity as in world
+ public void onCreated(Entity entity) {
+ entity.inWorld = true;
+ // CraftBukkit end
+ }
public void onDestroyed(Entity entity) {
WorldServer.this.getScoreboard().entityRemoved(entity);
@@ -1754,6 +1982,7 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
+ entity.inWorld = true; // CraftBukkit - Mark entity as in world
+ entity.valid = true; // CraftBukkit + entity.valid = true; // CraftBukkit
} }
public void onTrackingEnd(Entity entity) { public void onTrackingEnd(Entity entity) {
@@ -1780,6 +2000,14 @@ @@ -1780,6 +2009,14 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);

View File

@ -215,7 +215,7 @@
+ if ((i & 1) != 0) { + if ((i & 1) != 0) {
+ this.updateNeighborsAt(blockposition, iblockdata1.getBlock()); + this.updateNeighborsAt(blockposition, iblockdata1.getBlock());
+ if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) { + if (!this.isClientSide && iblockdata.hasAnalogOutputSignal()) {
+ this.updateNeighborsAt(blockposition, newBlock.getBlock()); + this.updateNeighbourForOutputSignal(blockposition, newBlock.getBlock());
+ } + }
+ } + }
+ +

View File

@ -146,10 +146,19 @@ public enum CraftStatistic {
} }
public static net.minecraft.stats.Statistic getMaterialStatistic(org.bukkit.Statistic stat, Material material) { public static net.minecraft.stats.Statistic getMaterialStatistic(org.bukkit.Statistic stat, Material material) {
try { Type type = stat.getType();
switch (type) {
case BLOCK:
Preconditions.checkArgument(material.isBlock(), "statistic type is BLOCK but got non-block Material, %s", material);
if (stat == Statistic.MINE_BLOCK) { if (stat == Statistic.MINE_BLOCK) {
return StatisticList.BLOCK_MINED.get(CraftBlockType.bukkitToMinecraft(material)); return StatisticList.BLOCK_MINED.get(CraftBlockType.bukkitToMinecraft(material));
} }
break;
case ITEM:
Preconditions.checkArgument(material.isItem(), "statistic type is ITEM but got non-item Material, %s", material);
if (stat == Statistic.CRAFT_ITEM) { if (stat == Statistic.CRAFT_ITEM) {
return StatisticList.ITEM_CRAFTED.get(CraftItemType.bukkitToMinecraft(material)); return StatisticList.ITEM_CRAFTED.get(CraftItemType.bukkitToMinecraft(material));
} }
@ -165,10 +174,12 @@ public enum CraftStatistic {
if (stat == Statistic.DROP) { if (stat == Statistic.DROP) {
return StatisticList.ITEM_DROPPED.get(CraftItemType.bukkitToMinecraft(material)); return StatisticList.ITEM_DROPPED.get(CraftItemType.bukkitToMinecraft(material));
} }
} catch (ArrayIndexOutOfBoundsException e) { break;
return null; default:
throw new IllegalArgumentException("statistic type must be either BLOCK or ITEM, given " + type);
} }
return null;
throw new IllegalArgumentException("Unknwon material statistic " + stat);
} }
public static net.minecraft.stats.Statistic getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) { public static net.minecraft.stats.Statistic getEntityStatistic(org.bukkit.Statistic stat, EntityType entity) {

View File

@ -132,7 +132,6 @@ import org.bukkit.entity.TippedArrow;
import org.bukkit.entity.Trident; import org.bukkit.entity.Trident;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.weather.LightningStrikeEvent;
import org.bukkit.event.world.SpawnChangeEvent;
import org.bukkit.event.world.TimeSkipEvent; import org.bukkit.event.world.TimeSkipEvent;
import org.bukkit.generator.BiomeProvider; import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
@ -203,13 +202,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override @Override
public boolean setSpawnLocation(int x, int y, int z, float angle) { public boolean setSpawnLocation(int x, int y, int z, float angle) {
try { try {
Location previousLocation = getSpawnLocation(); world.setDefaultSpawnPos(new BlockPosition(x, y, z), angle);
world.levelData.setSpawn(new BlockPosition(x, y, z), angle);
// Notify anyone who's listening.
SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation);
server.getPluginManager().callEvent(event);
return true; return true;
} catch (Exception e) { } catch (Exception e) {
return false; return false;

View File

@ -29,7 +29,7 @@ public class CraftPig extends CraftAnimals implements Pig {
@Override @Override
public void setSaddle(boolean saddled) { public void setSaddle(boolean saddled) {
getHandle().setItemSlot(EnumItemSlot.SADDLE, new ItemStack(Items.SADDLE)); getHandle().setItemSlot(EnumItemSlot.SADDLE, (saddled) ? new ItemStack(Items.SADDLE) : ItemStack.EMPTY);
} }
@Override @Override

View File

@ -32,7 +32,7 @@ public class CraftStrider extends CraftAnimals implements Strider {
@Override @Override
public void setSaddle(boolean saddled) { public void setSaddle(boolean saddled) {
getHandle().setItemSlot(EnumItemSlot.SADDLE, new ItemStack(Items.SADDLE)); getHandle().setItemSlot(EnumItemSlot.SADDLE, (saddled) ? new ItemStack(Items.SADDLE) : ItemStack.EMPTY);
} }
@Override @Override

View File

@ -1981,6 +1981,11 @@ public class CraftEventFactory {
return; return;
} }
// SPIGOT-8041: Do not call event unless entity has been spawned into world
if (!entity.inWorld) {
return;
}
Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause)); Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause));
} }

View File

@ -12,6 +12,7 @@ import net.minecraft.world.inventory.InventoryMerchant;
import net.minecraft.world.level.block.BlockComposter; import net.minecraft.world.level.block.BlockComposter;
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity; import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
import net.minecraft.world.level.block.entity.CrafterBlockEntity; import net.minecraft.world.level.block.entity.CrafterBlockEntity;
import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity;
import net.minecraft.world.level.block.entity.IHopper; import net.minecraft.world.level.block.entity.IHopper;
import net.minecraft.world.level.block.entity.TileEntityBarrel; import net.minecraft.world.level.block.entity.TileEntityBarrel;
import net.minecraft.world.level.block.entity.TileEntityBlastFurnace; import net.minecraft.world.level.block.entity.TileEntityBlastFurnace;
@ -284,6 +285,10 @@ public class CraftInventory implements Inventory {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
ItemStack item = items[i]; ItemStack item = items[i];
Preconditions.checkArgument(item != null, "ItemStack cannot be null"); Preconditions.checkArgument(item != null, "ItemStack cannot be null");
// SPIGOT-8038: Cannot add/remove air. Probably should be an exception, but ignored for compatibility
if (item.getType().isAir()) {
continue;
}
while (true) { while (true) {
// Do we already have a stack of it? // Do we already have a stack of it?
int firstPartial = firstPartial(item); int firstPartial = firstPartial(item);
@ -348,6 +353,10 @@ public class CraftInventory implements Inventory {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
ItemStack item = items[i]; ItemStack item = items[i];
Preconditions.checkArgument(item != null, "ItemStack cannot be null"); Preconditions.checkArgument(item != null, "ItemStack cannot be null");
// SPIGOT-8038: Cannot add/remove air. Probably should be an exception, but ignored for compatibility
if (item.getType().isAir()) {
continue;
}
int toDelete = item.getAmount(); int toDelete = item.getAmount();
while (true) { while (true) {
@ -498,6 +507,8 @@ public class CraftInventory implements Inventory {
return InventoryType.COMPOSTER; return InventoryType.COMPOSTER;
} else if (inventory instanceof TileEntityJukeBox) { } else if (inventory instanceof TileEntityJukeBox) {
return InventoryType.JUKEBOX; return InventoryType.JUKEBOX;
} else if (inventory instanceof DecoratedPotBlockEntity) {
return InventoryType.DECORATED_POT;
} else { } else {
return InventoryType.CHEST; return InventoryType.CHEST;
} }

View File

@ -327,7 +327,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
this.lore = new ArrayList<IChatBaseComponent>(meta.lore); this.lore = new ArrayList<IChatBaseComponent>(meta.lore);
} }
if (meta.hasCustomModelData()) { if (meta.hasCustomModelDataComponent()) {
this.customModelData = new CraftCustomModelDataComponent(meta.customModelData); this.customModelData = new CraftCustomModelDataComponent(meta.customModelData);
} }
this.enchantableValue = meta.enchantableValue; this.enchantableValue = meta.enchantableValue;
@ -950,7 +950,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
itemTag.put(LORE, new ItemLore(lore)); itemTag.put(LORE, new ItemLore(lore));
} }
if (hasCustomModelData()) { if (hasCustomModelDataComponent()) {
itemTag.put(CUSTOM_MODEL_DATA, customModelData.getHandle()); itemTag.put(CUSTOM_MODEL_DATA, customModelData.getHandle());
} }
@ -1140,7 +1140,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
@Overridden @Overridden
boolean isEmpty() { boolean isEmpty() {
return !(hasDisplayName() || hasItemName() || hasLocalizedName() || hasEnchants() || (lore != null) || hasCustomModelData() || hasEnchantable() || hasBlockData() || hasRepairCost() || !unhandledTags.build().isEmpty() || !removedTags.isEmpty() || !persistentDataContainer.isEmpty() || hasItemFlags() || isHideTooltip() || hasTooltipStyle() || hasItemModel() || isUnbreakable() || hasEnchantmentGlintOverride() || isGlider() || hasDamageResistant() || hasMaxStackSize() || hasRarity() || hasUseRemainder() || hasUseCooldown() || hasFood() || hasConsumable() || hasTool() || hasBlocksAttacks() || hasWeapon() || hasJukeboxPlayable() || hasBreakSound() || hasEquippable() || hasDamage() || hasMaxDamage() || hasAttributeModifiers() || customTag != null); return !(hasDisplayName() || hasItemName() || hasLocalizedName() || hasEnchants() || (lore != null) || hasCustomModelDataComponent() || hasEnchantable() || hasBlockData() || hasRepairCost() || !unhandledTags.build().isEmpty() || !removedTags.isEmpty() || !persistentDataContainer.isEmpty() || hasItemFlags() || isHideTooltip() || hasTooltipStyle() || hasItemModel() || isUnbreakable() || hasEnchantmentGlintOverride() || isGlider() || hasDamageResistant() || hasMaxStackSize() || hasRarity() || hasUseRemainder() || hasUseCooldown() || hasFood() || hasConsumable() || hasTool() || hasBlocksAttacks() || hasWeapon() || hasJukeboxPlayable() || hasBreakSound() || hasEquippable() || hasDamage() || hasMaxDamage() || hasAttributeModifiers() || customTag != null);
} }
@Override @Override
@ -1932,7 +1932,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
&& (this.hasItemName() ? that.hasItemName() && this.itemName.equals(that.itemName) : !that.hasItemName()) && (this.hasItemName() ? that.hasItemName() && this.itemName.equals(that.itemName) : !that.hasItemName())
&& (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants()) && (this.hasEnchants() ? that.hasEnchants() && this.enchantments.equals(that.enchantments) : !that.hasEnchants())
&& (Objects.equals(this.lore, that.lore)) && (Objects.equals(this.lore, that.lore))
&& (this.hasCustomModelData() ? that.hasCustomModelData() && this.customModelData.equals(that.customModelData) : !that.hasCustomModelData()) && (this.hasCustomModelDataComponent() ? that.hasCustomModelDataComponent() && this.customModelData.equals(that.customModelData) : !that.hasCustomModelDataComponent())
&& (this.hasEnchantable() ? that.hasEnchantable() && this.enchantableValue.equals(that.enchantableValue) : !that.hasEnchantable()) && (this.hasEnchantable() ? that.hasEnchantable() && this.enchantableValue.equals(that.enchantableValue) : !that.hasEnchantable())
&& (this.hasBlockData() ? that.hasBlockData() && this.blockData.equals(that.blockData) : !that.hasBlockData()) && (this.hasBlockData() ? that.hasBlockData() && this.blockData.equals(that.blockData) : !that.hasBlockData())
&& (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost())
@ -1987,7 +1987,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
hash = 61 * hash + (hasDisplayName() ? this.displayName.hashCode() : 0); hash = 61 * hash + (hasDisplayName() ? this.displayName.hashCode() : 0);
hash = 61 * hash + (hasItemName() ? this.itemName.hashCode() : 0); hash = 61 * hash + (hasItemName() ? this.itemName.hashCode() : 0);
hash = 61 * hash + ((lore != null) ? this.lore.hashCode() : 0); hash = 61 * hash + ((lore != null) ? this.lore.hashCode() : 0);
hash = 61 * hash + (hasCustomModelData() ? this.customModelData.hashCode() : 0); hash = 61 * hash + (hasCustomModelDataComponent() ? this.customModelData.hashCode() : 0);
hash = 61 * hash + (hasEnchantable() ? this.enchantableValue.hashCode() : 0); hash = 61 * hash + (hasEnchantable() ? this.enchantableValue.hashCode() : 0);
hash = 61 * hash + (hasBlockData() ? this.blockData.hashCode() : 0); hash = 61 * hash + (hasBlockData() ? this.blockData.hashCode() : 0);
hash = 61 * hash + (hasEnchants() ? this.enchantments.hashCode() : 0); hash = 61 * hash + (hasEnchants() ? this.enchantments.hashCode() : 0);
@ -2031,7 +2031,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
if (this.lore != null) { if (this.lore != null) {
clone.lore = new ArrayList<IChatBaseComponent>(this.lore); clone.lore = new ArrayList<IChatBaseComponent>(this.lore);
} }
if (this.hasCustomModelData()) { if (this.hasCustomModelDataComponent()) {
clone.customModelData = new CraftCustomModelDataComponent(customModelData); clone.customModelData = new CraftCustomModelDataComponent(customModelData);
} }
clone.enchantableValue = this.enchantableValue; clone.enchantableValue = this.enchantableValue;
@ -2125,7 +2125,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
builder.put(LORE.BUKKIT, jsonLore); builder.put(LORE.BUKKIT, jsonLore);
} }
if (hasCustomModelData()) { if (hasCustomModelDataComponent()) {
builder.put(CUSTOM_MODEL_DATA.BUKKIT, customModelData); builder.put(CUSTOM_MODEL_DATA.BUKKIT, customModelData);
} }
if (hasEnchantable()) { if (hasEnchantable()) {