remove all the rest of the import hunks

This commit is contained in:
Jake Potrebic 2024-12-15 11:42:40 -08:00
parent 62b6e85d1a
commit 8cca65b8ac
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
12 changed files with 102 additions and 354 deletions

View file

@ -1,46 +1,11 @@
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -54,7 +_,6 @@
import net.minecraft.network.protocol.game.ClientboundDamageEventPacket;
import net.minecraft.network.protocol.game.ClientboundEntityEventPacket;
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
-import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
import net.minecraft.network.protocol.game.ClientboundLevelEventPacket;
import net.minecraft.network.protocol.game.ClientboundLevelParticlesPacket;
import net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket;
@@ -120,6 +_,7 @@
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
+import net.minecraft.world.level.biome.BiomeSource;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SnowLayerBlock;
@@ -145,7 +_,9 @@
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.gameevent.GameEventDispatcher;
+import net.minecraft.world.level.levelgen.FlatLevelSource;
import net.minecraft.world.level.levelgen.Heightmap;
+import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.StructureCheck;
@@ -161,7 +_,7 @@
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource;
-import net.minecraft.world.level.storage.ServerLevelData;
+import net.minecraft.world.level.storage.PrimaryLevelData;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
@@ -182,7 +_,7 @@ @@ -182,7 +_,7 @@
final List<ServerPlayer> players = Lists.newArrayList(); final List<ServerPlayer> players = Lists.newArrayList();
public final ServerChunkCache chunkSource; public final ServerChunkCache chunkSource;
private final MinecraftServer server; private final MinecraftServer server;
- public final ServerLevelData serverLevelData; - public final ServerLevelData serverLevelData;
+ public final PrimaryLevelData serverLevelData; // CraftBukkit - type + public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type
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;
@ -204,11 +169,11 @@
+ this.serverLevelData.setWorld(this); + this.serverLevelData.setWorld(this);
+ +
+ if (biomeProvider != null) { + if (biomeProvider != null) {
+ BiomeSource worldChunkManager = new org.bukkit.craftbukkit.generator.CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME), chunkGenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider + net.minecraft.world.level.biome.BiomeSource worldChunkManager = new org.bukkit.craftbukkit.generator.CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME), chunkGenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider
+ if (chunkGenerator instanceof NoiseBasedChunkGenerator cga) { + if (chunkGenerator instanceof net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator cga) {
+ chunkGenerator = new NoiseBasedChunkGenerator(worldChunkManager, cga.settings); + chunkGenerator = new net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator(worldChunkManager, cga.settings);
+ } else if (chunkGenerator instanceof FlatLevelSource cpf) { + } else if (chunkGenerator instanceof net.minecraft.world.level.levelgen.FlatLevelSource cpf) {
+ chunkGenerator = new FlatLevelSource(cpf.settings(), worldChunkManager); + chunkGenerator = new net.minecraft.world.level.levelgen.FlatLevelSource(cpf.settings(), worldChunkManager);
+ } + }
+ } + }
+ +

View file

@ -1,14 +1,5 @@
--- a/net/minecraft/server/players/GameProfileCache.java --- a/net/minecraft/server/players/GameProfileCache.java
+++ b/net/minecraft/server/players/GameProfileCache.java +++ b/net/minecraft/server/players/GameProfileCache.java
@@ -17,8 +_,6 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
@@ -56,6 +_,10 @@ @@ -56,6 +_,10 @@
private final AtomicLong operationCount = new AtomicLong(); private final AtomicLong operationCount = new AtomicLong();
@Nullable @Nullable
@ -135,15 +126,6 @@
} }
public void setExecutor(Executor exectutor) { public void setExecutor(Executor exectutor) {
@@ -193,7 +_,7 @@
try {
Object var9;
- try (Reader reader = Files.newReader(this.file, StandardCharsets.UTF_8)) {
+ try (java.io.Reader reader = Files.newReader(this.file, StandardCharsets.UTF_8)) {
JsonArray jsonArray = this.gson.fromJson(reader, JsonArray.class);
if (jsonArray != null) {
DateFormat dateFormat = createDateFormat();
@@ -206,6 +_,11 @@ @@ -206,6 +_,11 @@
return (List<GameProfileCache.GameProfileInfo>)var9; return (List<GameProfileCache.GameProfileInfo>)var9;
@ -169,8 +151,7 @@
String string = this.gson.toJson((JsonElement)jsonArray); String string = this.gson.toJson((JsonElement)jsonArray);
+ Runnable save = () -> { // Paper - Perf: Async GameProfileCache saving + Runnable save = () -> { // Paper - Perf: Async GameProfileCache saving
- try (Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) { try (Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
+ try (java.io.Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
writer.write(string); writer.write(string);
} catch (IOException var9) { } catch (IOException var9) {
} }

View file

@ -1,63 +1,8 @@
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -55,6 +_,8 @@ @@ -136,6 +_,114 @@
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ClientboundAddEntityPacket;
+import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
+import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket;
import net.minecraft.network.protocol.game.VecDeltaCodec;
import net.minecraft.network.syncher.EntityDataAccessor;
@@ -97,8 +_,6 @@
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Explosion;
-import net.minecraft.world.level.ItemLike;
-import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FenceGateBlock;
@@ -135,7 +_,151 @@
import net.minecraft.world.scores.Team;
import org.slf4j.Logger; import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.GameRules;
+import net.minecraft.world.level.ItemLike;
+import net.minecraft.world.level.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Hanging;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
+import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
+import org.bukkit.event.vehicle.VehicleEnterEvent;
+import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.entity.CraftEntity;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityAirChangeEvent;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityDismountEvent;
+import org.bukkit.event.entity.EntityDropItemEvent;
+import org.bukkit.event.entity.EntityMountEvent;
+import org.bukkit.event.entity.EntityPortalEvent;
+import org.bukkit.event.entity.EntityPoseChangeEvent;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.event.entity.EntityUnleashEvent;
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.plugin.PluginManager;
+// CraftBukkit end
+
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder { public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
+ +
+ // CraftBukkit start + // CraftBukkit start
@ -141,14 +86,14 @@
+ // Paper end - Share random for entities to make them more random + // Paper end - Share random for entities to make them more random
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason + public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
+ +
+ private CraftEntity bukkitEntity; + private org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity;
+ +
+ public CraftEntity getBukkitEntity() { + public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntity() {
+ if (this.bukkitEntity == null) { + if (this.bukkitEntity == null) {
+ // Paper start - Folia schedulers + // Paper start - Folia schedulers
+ synchronized (this) { + synchronized (this) {
+ if (this.bukkitEntity == null) { + if (this.bukkitEntity == null) {
+ return this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); + return this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.level.getCraftServer(), this);
+ } + }
+ } + }
+ // Paper end - Folia schedulers + // Paper end - Folia schedulers
@ -156,7 +101,7 @@
+ return this.bukkitEntity; + return this.bukkitEntity;
+ } + }
+ // Paper start + // Paper start
+ public CraftEntity getBukkitEntityRaw() { + public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntityRaw() {
+ return this.bukkitEntity; + return this.bukkitEntity;
+ } + }
+ // Paper end + // Paper end
@ -226,7 +171,7 @@
+ public boolean fixedPose = false; // Paper - Expand Pose API + public boolean fixedPose = false; // Paper - Expand Pose API
+ private final int despawnTime; // Paper - entity despawn time limit + private final int despawnTime; // Paper - entity despawn time limit
+ +
+ public void setOrigin(@javax.annotation.Nonnull Location location) { + public void setOrigin(@javax.annotation.Nonnull org.bukkit.Location location) {
+ this.origin = location.toVector(); + this.origin = location.toVector();
+ this.originWorld = location.getWorld().getUID(); + this.originWorld = location.getWorld().getUID();
+ } + }
@ -293,7 +238,7 @@
public void kill(ServerLevel level) { public void kill(ServerLevel level) {
- this.remove(Entity.RemovalReason.KILLED); - this.remove(Entity.RemovalReason.KILLED);
+ this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause + this.remove(Entity.RemovalReason.KILLED, org.bukkit.event.entity.EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
} }
@ -303,7 +248,7 @@
+ this.discard(null); + this.discard(null);
+ } + }
+ +
+ public final void discard(EntityRemoveEvent.Cause cause) { + public final void discard(org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
+ this.remove(Entity.RemovalReason.DISCARDED, cause); + this.remove(Entity.RemovalReason.DISCARDED, cause);
+ // CraftBukkit end + // CraftBukkit end
} }
@ -318,7 +263,7 @@
+ List<SynchedEntityData.DataValue<?>> list = this.entityData.packAll(); // Paper - Update EVERYTHING not just not default + List<SynchedEntityData.DataValue<?>> list = this.entityData.packAll(); // Paper - Update EVERYTHING not just not default
+ +
+ if (list != null && to.getBukkitEntity().canSee(this.getBukkitEntity())) { // Paper + if (list != null && to.getBukkitEntity().canSee(this.getBukkitEntity())) { // Paper
+ to.connection.send(new ClientboundSetEntityDataPacket(this.getId(), list)); + to.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket(this.getId(), list));
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -351,7 +296,7 @@
+ values.add(synchedValue.value()); + values.add(synchedValue.value());
+ } + }
+ +
+ to.connection.send(new ClientboundSetEntityDataPacket(this.id, values)); + to.connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket(this.id, values));
+ } + }
+ // Paper end + // Paper end
+ +
@ -367,7 +312,7 @@
+ this.setRemoved(reason, null); + this.setRemoved(reason, null);
+ } + }
+ +
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { + public void remove(Entity.RemovalReason entity_removalreason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
+ this.setRemoved(entity_removalreason, cause); + this.setRemoved(entity_removalreason, cause);
+ // CraftBukkit end + // CraftBukkit end
} }
@ -385,7 +330,7 @@
+ } + }
+ // Paper start - Don't fire sync event during generation + // Paper start - Don't fire sync event during generation
+ if (!this.generation) { + if (!this.generation) {
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), org.bukkit.entity.Pose.values()[pose.ordinal()])); + this.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.entity.EntityPoseChangeEvent(this.getBukkitEntity(), org.bukkit.entity.Pose.values()[pose.ordinal()]));
+ } + }
+ // Paper end - Don't fire sync event during generation + // Paper end - Don't fire sync event during generation
+ // CraftBukkit end + // CraftBukkit end
@ -405,7 +350,7 @@
+ if (yRot == Float.POSITIVE_INFINITY || yRot == Float.NEGATIVE_INFINITY) { + if (yRot == Float.POSITIVE_INFINITY || yRot == Float.NEGATIVE_INFINITY) {
+ if (this instanceof ServerPlayer) { + if (this instanceof ServerPlayer) {
+ this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid yaw"); + this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid yaw");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)"); + ((org.bukkit.craftbukkit.entity.CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)");
+ } + }
+ yRot = 0; + yRot = 0;
+ } + }
@ -418,7 +363,7 @@
+ if (xRot == Float.POSITIVE_INFINITY || xRot == Float.NEGATIVE_INFINITY) { + if (xRot == Float.POSITIVE_INFINITY || xRot == Float.NEGATIVE_INFINITY) {
+ if (this instanceof ServerPlayer) { + if (this instanceof ServerPlayer) {
+ this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid pitch"); + this.level.getCraftServer().getLogger().warning(this.getScoreboardName() + " was caught trying to crash the server with an invalid pitch");
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)"); + ((org.bukkit.craftbukkit.entity.CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)");
+ } + }
+ xRot = 0; + xRot = 0;
+ } + }
@ -519,7 +464,7 @@
+ // not on fire yet + // not on fire yet
+ org.bukkit.block.Block damager = (this.lastLavaContact == null) ? null : org.bukkit.craftbukkit.block.CraftBlock.at(this.level, this.lastLavaContact); + org.bukkit.block.Block damager = (this.lastLavaContact == null) ? null : org.bukkit.craftbukkit.block.CraftBlock.at(this.level, this.lastLavaContact);
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity();
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15); + org.bukkit.event.entity.EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
+ this.level.getCraftServer().getPluginManager().callEvent(combustEvent); + this.level.getCraftServer().getPluginManager().callEvent(combustEvent);
+ +
+ if (!combustEvent.isCancelled()) { + if (!combustEvent.isCancelled()) {
@ -547,7 +492,7 @@
+ +
+ public final void igniteForSeconds(float f, boolean callEvent) { + public final void igniteForSeconds(float f, boolean callEvent) {
+ if (callEvent) { + if (callEvent) {
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), f); + org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustEvent(this.getBukkitEntity(), f);
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);
+ +
+ if (event.isCancelled()) { + if (event.isCancelled()) {
@ -566,7 +511,7 @@
protected void onBelowWorld() { protected void onBelowWorld() {
- this.discard(); - this.discard();
+ this.discard(EntityRemoveEvent.Cause.OUT_OF_WORLD); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.OUT_OF_WORLD); // CraftBukkit - add Bukkit remove cause
} }
public boolean isFree(double x, double y, double z) { public boolean isFree(double x, double y, double z) {
@ -583,22 +528,22 @@
} }
+ // CraftBukkit start + // CraftBukkit start
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) { + if (this.horizontalCollision && this.getBukkitEntity() instanceof org.bukkit.entity.Vehicle) {
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + org.bukkit.entity.Vehicle vehicle = (org.bukkit.entity.Vehicle) this.getBukkitEntity();
+ org.bukkit.block.Block bl = this.level.getWorld().getBlockAt(Mth.floor(this.getX()), Mth.floor(this.getY()), Mth.floor(this.getZ())); + org.bukkit.block.Block bl = this.level.getWorld().getBlockAt(Mth.floor(this.getX()), Mth.floor(this.getY()), Mth.floor(this.getZ()));
+ +
+ if (movement.x > vec3.x) { + if (movement.x > vec3.x) {
+ bl = bl.getRelative(BlockFace.EAST); + bl = bl.getRelative(org.bukkit.block.BlockFace.EAST);
+ } else if (movement.x < vec3.x) { + } else if (movement.x < vec3.x) {
+ bl = bl.getRelative(BlockFace.WEST); + bl = bl.getRelative(org.bukkit.block.BlockFace.WEST);
+ } else if (movement.z > vec3.z) { + } else if (movement.z > vec3.z) {
+ bl = bl.getRelative(BlockFace.SOUTH); + bl = bl.getRelative(org.bukkit.block.BlockFace.SOUTH);
+ } else if (movement.z < vec3.z) { + } else if (movement.z < vec3.z) {
+ bl = bl.getRelative(BlockFace.NORTH); + bl = bl.getRelative(org.bukkit.block.BlockFace.NORTH);
+ } + }
+ +
+ if (!bl.getType().isAir()) { + if (!bl.getType().isAir()) {
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity + org.bukkit.event.vehicle.VehicleBlockCollisionEvent event = new org.bukkit.event.vehicle.VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);
+ } + }
+ } + }
@ -1021,8 +966,8 @@
+ { + {
+ // Paper end - Call EntityDropItemEvent + // Paper end - Call EntityDropItemEvent
+ // CraftBukkit start + // CraftBukkit start
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) itemEntity.getBukkitEntity()); + org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) itemEntity.getBukkitEntity());
+ Bukkit.getPluginManager().callEvent(event); + org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return null; + return null;
+ } + }
@ -1037,10 +982,10 @@
- if (player.hasInfiniteMaterials()) { - if (player.hasInfiniteMaterials()) {
+ // CraftBukkit start - fire PlayerUnleashEntityEvent + // CraftBukkit start - fire PlayerUnleashEntityEvent
+ // Paper start - Expand EntityUnleashEvent + // Paper start - Expand EntityUnleashEvent
+ org.bukkit.event.player.PlayerUnleashEntityEvent event = CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials()); + org.bukkit.event.player.PlayerUnleashEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials());
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ // Paper end - Expand EntityUnleashEvent + // Paper end - Expand EntityUnleashEvent
+ ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder())); + ((ServerPlayer) player).connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder()));
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -1053,9 +998,9 @@
if (itemInHand.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { if (itemInHand.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
+ // CraftBukkit start - fire PlayerLeashEntityEvent + // CraftBukkit start - fire PlayerLeashEntityEvent
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) {
+ // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - Fix inventory desync + // ((ServerPlayer) player).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item // Paper - Fix inventory desync
+ ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder())); + ((ServerPlayer) player).connection.send(new net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket(this, leashable.getLeashHolder()));
+ player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync + player.containerMenu.sendAllDataToRemote(); // Paper - Fix inventory desync
+ return InteractionResult.PASS; + return InteractionResult.PASS;
+ } + }
@ -1082,21 +1027,21 @@
if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) { if (force || this.canRide(vehicle) && vehicle.canAddPassenger(this)) {
+ // CraftBukkit start + // CraftBukkit start
+ if (vehicle.getBukkitEntity() instanceof Vehicle && this.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) { + if (vehicle.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && this.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) vehicle.getBukkitEntity(), this.getBukkitEntity()); + org.bukkit.event.vehicle.VehicleEnterEvent event = new org.bukkit.event.vehicle.VehicleEnterEvent((org.bukkit.entity.Vehicle) vehicle.getBukkitEntity(), this.getBukkitEntity());
+ // Suppress during worldgen + // Suppress during worldgen
+ if (this.valid) { + if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event); + org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ } + }
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return false; + return false;
+ } + }
+ } + }
+ +
+ EntityMountEvent event = new EntityMountEvent(this.getBukkitEntity(), vehicle.getBukkitEntity()); + org.bukkit.event.entity.EntityMountEvent event = new org.bukkit.event.entity.EntityMountEvent(this.getBukkitEntity(), vehicle.getBukkitEntity());
+ // Suppress during worldgen + // Suppress during worldgen
+ if (this.valid) { + if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event); + org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ } + }
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return false; + return false;
@ -1149,28 +1094,28 @@
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
} else { } else {
+ // CraftBukkit start + // CraftBukkit start
+ CraftEntity craft = (CraftEntity) passenger.getBukkitEntity().getVehicle(); + org.bukkit.craftbukkit.entity.CraftEntity craft = (org.bukkit.craftbukkit.entity.CraftEntity) passenger.getBukkitEntity().getVehicle();
+ Entity orig = craft == null ? null : craft.getHandle(); + Entity orig = craft == null ? null : craft.getHandle();
+ if (this.getBukkitEntity() instanceof Vehicle && passenger.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) { + if (this.getBukkitEntity() instanceof org.bukkit.entity.Vehicle && passenger.getBukkitEntity() instanceof org.bukkit.entity.LivingEntity) {
+ VehicleExitEvent event = new VehicleExitEvent( + org.bukkit.event.vehicle.VehicleExitEvent event = new org.bukkit.event.vehicle.VehicleExitEvent(
+ (Vehicle) this.getBukkitEntity(), + (org.bukkit.entity.Vehicle) this.getBukkitEntity(),
+ (org.bukkit.entity.LivingEntity) passenger.getBukkitEntity(), !suppressCancellation // Paper - Force entity dismount during teleportation + (org.bukkit.entity.LivingEntity) passenger.getBukkitEntity(), !suppressCancellation // Paper - Force entity dismount during teleportation
+ ); + );
+ // Suppress during worldgen + // Suppress during worldgen
+ if (this.valid) { + if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event); + org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ } + }
+ CraftEntity craftn = (CraftEntity) passenger.getBukkitEntity().getVehicle(); + org.bukkit.craftbukkit.entity.CraftEntity craftn = (org.bukkit.craftbukkit.entity.CraftEntity) passenger.getBukkitEntity().getVehicle();
+ Entity n = craftn == null ? null : craftn.getHandle(); + Entity n = craftn == null ? null : craftn.getHandle();
+ if (event.isCancelled() || n != orig) { + if (event.isCancelled() || n != orig) {
+ return false; + return false;
+ } + }
+ } + }
+ +
+ EntityDismountEvent event = new EntityDismountEvent(passenger.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - Force entity dismount during teleportation + org.bukkit.event.entity.EntityDismountEvent event = new org.bukkit.event.entity.EntityDismountEvent(passenger.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - Force entity dismount during teleportation
+ // Suppress during worldgen + // Suppress during worldgen
+ if (this.valid) { + if (this.valid) {
+ Bukkit.getPluginManager().callEvent(event); + org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ } + }
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return false; + return false;
@ -1220,7 +1165,7 @@
public void setSwimming(boolean swimming) { public void setSwimming(boolean swimming) {
+ // CraftBukkit start + // CraftBukkit start
+ if (this.valid && this.isSwimming() != swimming && this instanceof net.minecraft.world.entity.LivingEntity) { + if (this.valid && this.isSwimming() != swimming && this instanceof net.minecraft.world.entity.LivingEntity) {
+ if (CraftEventFactory.callToggleSwimEvent((net.minecraft.world.entity.LivingEntity) this, swimming).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callToggleSwimEvent((net.minecraft.world.entity.LivingEntity) this, swimming).isCancelled()) {
+ return; + return;
+ } + }
+ } + }
@ -1264,7 +1209,7 @@
public void setAirSupply(int air) { public void setAirSupply(int air) {
- this.entityData.set(DATA_AIR_SUPPLY_ID, air); - this.entityData.set(DATA_AIR_SUPPLY_ID, air);
+ // CraftBukkit start + // CraftBukkit start
+ EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), air); + org.bukkit.event.entity.EntityAirChangeEvent event = new org.bukkit.event.entity.EntityAirChangeEvent(this.getBukkitEntity(), air);
+ // Suppress during worldgen + // Suppress during worldgen
+ if (this.valid) { + if (this.valid) {
+ event.getEntity().getServer().getPluginManager().callEvent(event); + event.getEntity().getServer().getPluginManager().callEvent(event);
@ -1285,7 +1230,7 @@
+ // CraftBukkit start + // CraftBukkit start
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity(); + final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
+ final org.bukkit.entity.Entity stormBukkitEntity = lightning.getBukkitEntity(); + final org.bukkit.entity.Entity stormBukkitEntity = lightning.getBukkitEntity();
+ final PluginManager pluginManager = Bukkit.getPluginManager(); + final org.bukkit.plugin.PluginManager pluginManager = org.bukkit.Bukkit.getPluginManager();
+ // CraftBukkit end + // CraftBukkit end
if (this.remainingFireTicks == 0) { if (this.remainingFireTicks == 0) {
- this.igniteForSeconds(8.0F); - this.igniteForSeconds(8.0F);
@ -1293,7 +1238,7 @@
- -
- this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F); - this.hurtServer(level, this.damageSources().lightningBolt(), 5.0F);
+ // CraftBukkit start - Call a combust event when lightning strikes + // CraftBukkit start - Call a combust event when lightning strikes
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F); + org.bukkit.event.entity.EntityCombustByEntityEvent entityCombustEvent = new org.bukkit.event.entity.EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
+ pluginManager.callEvent(entityCombustEvent); + pluginManager.callEvent(entityCombustEvent);
+ if (!entityCombustEvent.isCancelled()) { + if (!entityCombustEvent.isCancelled()) {
+ this.igniteForSeconds(entityCombustEvent.getDuration(), false); + this.igniteForSeconds(entityCombustEvent.getDuration(), false);
@ -1306,8 +1251,8 @@
+ } + }
+ +
+ // CraftBukkit start + // CraftBukkit start
+ if (thisBukkitEntity instanceof Hanging) { + if (thisBukkitEntity instanceof org.bukkit.entity.Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity); + org.bukkit.event.hanging.HangingBreakByEntityEvent hangingEvent = new org.bukkit.event.hanging.HangingBreakByEntityEvent((org.bukkit.entity.Hanging) thisBukkitEntity, stormBukkitEntity);
+ pluginManager.callEvent(hangingEvent); + pluginManager.callEvent(hangingEvent);
+ +
+ if (hangingEvent.isCancelled()) { + if (hangingEvent.isCancelled()) {
@ -1365,7 +1310,7 @@
public void restoreFrom(Entity entity) { public void restoreFrom(Entity entity) {
+ // Paper start - Forward CraftEntity in teleport command + // Paper start - Forward CraftEntity in teleport command
+ CraftEntity bukkitEntity = entity.bukkitEntity; + org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.bukkitEntity;
+ if (bukkitEntity != null) { + if (bukkitEntity != null) {
+ bukkitEntity.setHandle(this); + bukkitEntity.setHandle(this);
+ this.bukkitEntity = bukkitEntity; + this.bukkitEntity = bukkitEntity;
@ -1388,14 +1333,14 @@
+ // CraftBukkit start + // CraftBukkit start
+ PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); + PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
+ Vec3 velocity = absolutePosition.deltaMovement(); // Paper + Vec3 velocity = absolutePosition.deltaMovement(); // Paper
+ Location to = CraftLocation.toBukkit(absolutePosition.position(), teleportTransition.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot()); + org.bukkit.Location to = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(absolutePosition.position(), teleportTransition.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot());
+ // Paper start - gateway-specific teleport event + // Paper start - gateway-specific teleport event
+ final EntityTeleportEvent teleEvent; + final org.bukkit.event.entity.EntityTeleportEvent teleEvent;
+ if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) { + if (this.portalProcess != null && this.portalProcess.isSamePortal(((net.minecraft.world.level.block.EndGatewayBlock) net.minecraft.world.level.block.Blocks.END_GATEWAY)) && this.level.getBlockEntity(this.portalProcess.getEntryPosition()) instanceof net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity theEndGatewayBlockEntity) {
+ teleEvent = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), to, new org.bukkit.craftbukkit.block.CraftEndGateway(to.getWorld(), theEndGatewayBlockEntity)); + teleEvent = new com.destroystokyo.paper.event.entity.EntityTeleportEndGatewayEvent(this.getBukkitEntity(), this.getBukkitEntity().getLocation(), to, new org.bukkit.craftbukkit.block.CraftEndGateway(to.getWorld(), theEndGatewayBlockEntity));
+ teleEvent.callEvent(); + teleEvent.callEvent();
+ } else { + } else {
+ teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to); + teleEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTeleportEvent(this, to);
+ } + }
+ // Paper end - gateway-specific teleport event + // Paper end - gateway-specific teleport event
+ if (teleEvent.isCancelled() || teleEvent.getTo() == null) { + if (teleEvent.isCancelled() || teleEvent.getTo() == null) {
@ -1403,12 +1348,12 @@
+ } + }
+ if (!to.equals(teleEvent.getTo())) { + if (!to.equals(teleEvent.getTo())) {
+ to = teleEvent.getTo(); + to = teleEvent.getTo();
+ teleportTransition = new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), Vec3.ZERO, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause()); + teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3D(to), Vec3.ZERO, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause());
+ // Paper start - Call EntityPortalExitEvent + // Paper start - Call EntityPortalExitEvent
+ velocity = Vec3.ZERO; + velocity = Vec3.ZERO;
+ } + }
+ if (this.portalProcess != null) { // if in a portal + if (this.portalProcess != null) { // if in a portal
+ CraftEntity bukkitEntity = this.getBukkitEntity(); + org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = this.getBukkitEntity();
+ org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent( + org.bukkit.event.entity.EntityPortalExitEvent event = new org.bukkit.event.entity.EntityPortalExitEvent(
+ bukkitEntity, + bukkitEntity,
+ bukkitEntity.getLocation(), to.clone(), + bukkitEntity.getLocation(), to.clone(),
@ -1420,7 +1365,7 @@
+ if (!event.isCancelled() && event.getTo() != null && (!event.getTo().equals(event.getFrom()) || !event.getAfter().equals(event.getBefore()))) { + if (!event.isCancelled() && event.getTo() != null && (!event.getTo().equals(event.getFrom()) || !event.getAfter().equals(event.getBefore()))) {
+ to = event.getTo().clone(); + to = event.getTo().clone();
+ velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter()); + velocity = org.bukkit.craftbukkit.util.CraftVector.toNMS(event.getAfter());
+ teleportTransition = new TeleportTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause()); + teleportTransition = new TeleportTransition(((org.bukkit.craftbukkit.CraftWorld) to.getWorld()).getHandle(), org.bukkit.craftbukkit.util.CraftLocation.toVec3D(to), velocity, to.getYaw(), to.getPitch(), teleportTransition.missingRespawnBlock(), teleportTransition.asPassenger(), Set.of(), teleportTransition.postTeleportTransition(), teleportTransition.cause());
+ } + }
+ } + }
+ if (this.isRemoved()) { + if (this.isRemoved()) {
@ -1462,7 +1407,7 @@
+ this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause + this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
+ if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed + if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed
+ // Paper start - Expand EntityUnleashEvent + // Paper start - Expand EntityUnleashEvent
+ final EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, false); // CraftBukkit + final org.bukkit.event.entity.EntityUnleashEvent event = new org.bukkit.event.entity.EntityUnleashEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityUnleashEvent.UnleashReason.UNKNOWN, false); // CraftBukkit
+ event.callEvent(); + event.callEvent();
+ if (!event.isDropLeash()) { + if (!event.isDropLeash()) {
+ leashable.removeLeash(); + leashable.removeLeash();
@ -1478,9 +1423,9 @@
} }
+ // CraftBukkit start + // CraftBukkit start
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) { + public org.bukkit.craftbukkit.event.CraftPortalEvent callPortalEvent(Entity entity, org.bukkit.Location exit, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); + org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
+ Location enter = bukkitEntity.getLocation(); + org.bukkit.Location enter = bukkitEntity.getLocation();
+ +
+ // Paper start + // Paper start
+ final org.bukkit.PortalType portalType = switch (cause) { + final org.bukkit.PortalType portalType = switch (cause) {
@ -1489,13 +1434,13 @@
+ case END_GATEWAY -> org.bukkit.PortalType.END_GATEWAY; // not actually used yet + case END_GATEWAY -> org.bukkit.PortalType.END_GATEWAY; // not actually used yet
+ default -> org.bukkit.PortalType.CUSTOM; + default -> org.bukkit.PortalType.CUSTOM;
+ }; + };
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius, portalType); + org.bukkit.event.entity.EntityPortalEvent event = new org.bukkit.event.entity.EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius, portalType);
+ // Paper end + // Paper end
+ event.getEntity().getServer().getPluginManager().callEvent(event); + event.getEntity().getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) { + if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) {
+ return null; + return null;
+ } + }
+ return new CraftPortalEvent(event); + return new org.bukkit.craftbukkit.event.CraftPortalEvent(event);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
@ -1515,7 +1460,7 @@
- public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) { - public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) {
+ // CraftBukkit start + // CraftBukkit start
+ public final boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) { + public final boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera) {
+ return this.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, PlayerTeleportEvent.TeleportCause.UNKNOWN); + return this.teleportTo(level, x, y, z, relativeMovements, yaw, pitch, setCamera, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.UNKNOWN);
+ } + }
+ public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) { + public boolean teleportTo(ServerLevel level, double x, double y, double z, Set<Relative> relativeMovements, float yaw, float pitch, boolean setCamera, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause cause) {
+ // CraftBukkit end + // CraftBukkit end
@ -1629,13 +1574,13 @@
+ } + }
+ +
+ @Override + @Override
+ public CommandSender getBukkitSender(CommandSourceStack wrapper) { + public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) {
+ return Entity.this.getBukkitEntity(); + return Entity.this.getBukkitEntity();
+ } + }
+ +
+ @Override + @Override
+ public boolean acceptsSuccess() { + public boolean acceptsSuccess() {
+ return ((ServerLevel) Entity.this.level()).getGameRules().getBoolean(GameRules.RULE_SENDCOMMANDFEEDBACK); + return ((ServerLevel) Entity.this.level()).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_SENDCOMMANDFEEDBACK);
+ } + }
+ +
+ @Override + @Override
@ -1731,8 +1676,8 @@
+ } + }
+ +
+ @Override + @Override
+ public final void setRemoved(Entity.RemovalReason removalReason, EntityRemoveEvent.Cause cause) { + public final void setRemoved(Entity.RemovalReason removalReason, org.bukkit.event.entity.EntityRemoveEvent.Cause cause) {
+ CraftEventFactory.callEntityRemoveEvent(this, cause); + org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause);
+ // CraftBukkit end + // CraftBukkit end
+ final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers + final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
if (this.removalReason == null) { if (this.removalReason == null) {

View file

@ -1,60 +1,5 @@
--- a/net/minecraft/world/entity/item/ItemEntity.java --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -3,18 +_,6 @@
import java.util.Objects;
import java.util.UUID;
import javax.annotation.Nullable;
-import net.minecraft.core.BlockPos;
-import net.minecraft.nbt.CompoundTag;
-import net.minecraft.network.chat.Component;
-import net.minecraft.network.syncher.EntityDataAccessor;
-import net.minecraft.network.syncher.EntityDataSerializers;
-import net.minecraft.network.syncher.SynchedEntityData;
-import net.minecraft.server.level.ServerLevel;
-import net.minecraft.sounds.SoundSource;
-import net.minecraft.stats.Stats;
-import net.minecraft.tags.FluidTags;
-import net.minecraft.tags.ItemTags;
-import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -22,7 +_,6 @@
import net.minecraft.world.entity.MoverType;
import net.minecraft.world.entity.SlotAccess;
import net.minecraft.world.entity.TraceableEntity;
-import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Explosion;
@@ -31,6 +_,27 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.portal.TeleportTransition;
import net.minecraft.world.phys.Vec3;
+import net.minecraft.core.BlockPos;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.network.chat.Component;
+import net.minecraft.network.syncher.EntityDataAccessor;
+import net.minecraft.network.syncher.EntityDataSerializers;
+import net.minecraft.network.syncher.SynchedEntityData;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.sounds.SoundSource;
+import net.minecraft.stats.Stats;
+import net.minecraft.tags.FluidTags;
+import net.minecraft.tags.ItemTags;
+import net.minecraft.util.Mth;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityPickupItemEvent;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.player.PlayerPickupItemEvent;
+// CraftBukkit end
+import org.bukkit.event.player.PlayerAttemptPickupItemEvent; // Paper
public class ItemEntity extends Entity implements TraceableEntity {
private static final EntityDataAccessor<ItemStack> DATA_ITEM = SynchedEntityData.defineId(ItemEntity.class, EntityDataSerializers.ITEM_STACK);
@@ -49,6 +_,9 @@ @@ -49,6 +_,9 @@
@Nullable @Nullable
public UUID target; public UUID target;
@ -84,7 +29,7 @@
public void tick() { public void tick() {
if (this.getItem().isEmpty()) { if (this.getItem().isEmpty()) {
- this.discard(); - this.discard();
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else { } else {
super.tick(); super.tick();
if (this.pickupDelay > 0 && this.pickupDelay != 32767) { if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
@ -117,12 +62,12 @@
- } - }
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate + if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
+ // CraftBukkit start - fire ItemDespawnEvent + // CraftBukkit start - fire ItemDespawnEvent
+ if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0; + this.age = 0;
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ } + }
+ } + }
+ } + }
@ -146,7 +91,7 @@
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ } + }
+ } + }
+ // Spigot end + // Spigot end
@ -196,7 +141,7 @@
private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) { private static void merge(ItemEntity destinationEntity, ItemStack destinationStack, ItemEntity originEntity, ItemStack originStack) {
+ // CraftBukkit start + // CraftBukkit start
+ if (!CraftEventFactory.callItemMergeEvent(originEntity, destinationEntity)) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callItemMergeEvent(originEntity, destinationEntity)) {
+ return; + return;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -205,7 +150,7 @@
destinationEntity.age = Math.min(destinationEntity.age, originEntity.age); destinationEntity.age = Math.min(destinationEntity.age, originEntity.age);
if (originStack.isEmpty()) { if (originStack.isEmpty()) {
- originEntity.discard(); - originEntity.discard();
+ originEntity.discard(EntityRemoveEvent.Cause.MERGE); // CraftBukkit - add Bukkit remove cause + originEntity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.MERGE); // CraftBukkit - add Bukkit remove cause
} }
} }
@ -214,7 +159,7 @@
return false; return false;
} else { } else {
+ // CraftBukkit start + // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damageSource, amount)) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damageSource, amount)) {
+ return false; + return false;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -224,7 +169,7 @@
if (this.health <= 0) { if (this.health <= 0) {
this.getItem().onDestroyed(this); this.getItem().onDestroyed(this);
- this.discard(); - this.discard();
+ this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause
} }
return true; return true;
@ -240,7 +185,7 @@
compound.putShort("Health", (short)this.health); compound.putShort("Health", (short)this.health);
compound.putShort("Age", (short)this.age); compound.putShort("Age", (short)this.age);
compound.putShort("PickupDelay", (short)this.pickupDelay); compound.putShort("PickupDelay", (short)this.pickupDelay);
@@ -347,22 +_,95 @@ @@ -347,9 +_,19 @@
} else { } else {
this.setItem(ItemStack.EMPTY); this.setItem(ItemStack.EMPTY);
} }
@ -261,10 +206,7 @@
} }
} }
@Override @@ -359,10 +_,73 @@
- public void playerTouch(Player entity) {
+ public void playerTouch(net.minecraft.world.entity.player.Player entity) {
if (!this.level().isClientSide) {
ItemStack item = this.getItem(); ItemStack item = this.getItem();
Item item1 = item.getItem(); Item item1 = item.getItem();
int count = item.getCount(); int count = item.getCount();
@ -275,7 +217,7 @@
+ +
+ // Paper start - PlayerAttemptPickupItemEvent + // Paper start - PlayerAttemptPickupItemEvent
+ if (this.pickupDelay <= 0) { + if (this.pickupDelay <= 0) {
+ PlayerAttemptPickupItemEvent attemptEvent = new PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + org.bukkit.event.player.PlayerAttemptPickupItemEvent attemptEvent = new org.bukkit.event.player.PlayerAttemptPickupItemEvent((org.bukkit.entity.Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ this.level().getCraftServer().getPluginManager().callEvent(attemptEvent); + this.level().getCraftServer().getPluginManager().callEvent(attemptEvent);
+ +
+ flyAtPlayer = attemptEvent.getFlyAtPlayer(); + flyAtPlayer = attemptEvent.getFlyAtPlayer();
@ -291,7 +233,7 @@
+ if (this.pickupDelay <= 0 && canHold > 0) { + if (this.pickupDelay <= 0 && canHold > 0) {
+ item.setCount(canHold); + item.setCount(canHold);
+ // Call legacy event + // Call legacy event
+ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + org.bukkit.event.player.PlayerPickupItemEvent playerEvent = new org.bukkit.event.player.PlayerPickupItemEvent((org.bukkit.entity.Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); + playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems());
+ this.level().getCraftServer().getPluginManager().callEvent(playerEvent); + this.level().getCraftServer().getPluginManager().callEvent(playerEvent);
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper + flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
@ -306,7 +248,7 @@
+ } + }
+ +
+ // Call newer event afterwards + // Call newer event afterwards
+ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((Player) entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); + org.bukkit.event.entity.EntityPickupItemEvent entityEvent = new org.bukkit.event.entity.EntityPickupItemEvent(entity.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
+ entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems()); + entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems());
+ this.level().getCraftServer().getPluginManager().callEvent(entityEvent); + this.level().getCraftServer().getPluginManager().callEvent(entityEvent);
+ if (entityEvent.isCancelled()) { + if (entityEvent.isCancelled()) {
@ -335,7 +277,7 @@
entity.take(this, count); entity.take(this, count);
if (item.isEmpty()) { if (item.isEmpty()) {
- this.discard(); - this.discard();
+ this.discard(EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause + this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.PICKUP); // CraftBukkit - add Bukkit remove cause
item.setCount(count); item.setCount(count);
} }

View file

@ -1,20 +1,5 @@
--- a/net/minecraft/world/inventory/BrewingStandMenu.java --- a/net/minecraft/world/inventory/BrewingStandMenu.java
+++ b/net/minecraft/world/inventory/BrewingStandMenu.java +++ b/net/minecraft/world/inventory/BrewingStandMenu.java
@@ -1,6 +_,5 @@
package net.minecraft.world.inventory;
-import java.util.Optional;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.Holder;
import net.minecraft.core.component.DataComponents;
@@ -16,6 +_,7 @@
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionBrewing;
import net.minecraft.world.item.alchemy.PotionContents;
+import java.util.Optional;
public class BrewingStandMenu extends AbstractContainerMenu {
static final ResourceLocation EMPTY_SLOT_FUEL = ResourceLocation.withDefaultNamespace("container/slot/brewing_fuel");
@@ -33,29 +_,50 @@ @@ -33,29 +_,50 @@
private final Container brewingStand; private final Container brewingStand;
public final ContainerData brewingStandData; public final ContainerData brewingStandData;

View file

@ -1,29 +1,11 @@
--- a/net/minecraft/world/level/chunk/storage/ChunkStorage.java --- a/net/minecraft/world/level/chunk/storage/ChunkStorage.java
+++ b/net/minecraft/world/level/chunk/storage/ChunkStorage.java +++ b/net/minecraft/world/level/chunk/storage/ChunkStorage.java
@@ -15,10 +_,16 @@
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.server.level.ServerChunkCache;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.world.level.ChunkPos;
-import net.minecraft.world.level.Level;
+import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.chunk.ChunkGenerator;
+// CraftBukkit start
+import java.util.concurrent.ExecutionException;
+import net.minecraft.world.level.chunk.status.ChunkStatus;
+import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.levelgen.structure.LegacyStructureDataHandler;
import net.minecraft.world.level.storage.DimensionDataStorage;
@@ -38,17 +_,63 @@ @@ -38,17 +_,63 @@
return this.worker.isOldChunkAround(pos, radius); return this.worker.isOldChunkAround(pos, radius);
} }
+ // CraftBukkit start + // CraftBukkit start
+ private boolean check(ServerChunkCache cps, int x, int z) { + private boolean check(net.minecraft.server.level.ServerChunkCache cps, int x, int z) {
+ if (true) return true; // Paper - Perf: this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full" + if (true) return true; // Paper - Perf: this isn't even needed anymore, light is purged updating to 1.14+, why are we holding up the conversion process reading chunk data off disk - return true, we need to set light populated to true so the converter recognizes the chunk as being "full"
+ ChunkPos pos = new ChunkPos(x, z); + ChunkPos pos = new ChunkPos(x, z);
+ if (cps != null) { + if (cps != null) {
@ -36,7 +18,7 @@
+ CompoundTag nbt; + CompoundTag nbt;
+ try { + try {
+ nbt = this.read(pos).get().orElse(null); + nbt = this.read(pos).get().orElse(null);
+ } catch (InterruptedException | ExecutionException ex) { + } catch (InterruptedException | java.util.concurrent.ExecutionException ex) {
+ throw new RuntimeException(ex); + throw new RuntimeException(ex);
+ } + }
+ if (nbt != null) { + if (nbt != null) {
@ -45,8 +27,8 @@
+ return true; + return true;
+ } + }
+ +
+ ChunkStatus status = ChunkStatus.byName(level.getString("Status")); + net.minecraft.world.level.chunk.status.ChunkStatus status = net.minecraft.world.level.chunk.status.ChunkStatus.byName(level.getString("Status"));
+ if (status != null && status.isOrAfter(ChunkStatus.FEATURES)) { + if (status != null && status.isOrAfter(net.minecraft.world.level.chunk.status.ChunkStatus.FEATURES)) {
+ return true; + return true;
+ } + }
+ } + }
@ -56,13 +38,13 @@
+ +
public CompoundTag upgradeChunkTag( public CompoundTag upgradeChunkTag(
- ResourceKey<Level> levelKey, - ResourceKey<Level> levelKey,
+ ResourceKey<LevelStem> levelKey, + ResourceKey<net.minecraft.world.level.dimension.LevelStem> levelKey,
Supplier<DimensionDataStorage> storage, Supplier<DimensionDataStorage> storage,
CompoundTag chunkData, CompoundTag chunkData,
- Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey - Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey
+ Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey, + Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey,
+ ChunkPos pos, + ChunkPos pos,
+ @Nullable LevelAccessor generatoraccess + @Nullable net.minecraft.world.level.LevelAccessor generatoraccess
+ // CraftBukkit end + // CraftBukkit end
) { ) {
int version = getVersion(chunkData); int version = getVersion(chunkData);
@ -74,7 +56,7 @@
+ if (version < 1466) { + if (version < 1466) {
+ CompoundTag level = chunkData.getCompound("Level"); + CompoundTag level = chunkData.getCompound("Level");
+ if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) { + if (level.getBoolean("TerrainPopulated") && !level.getBoolean("LightPopulated")) {
+ ServerChunkCache cps = (generatoraccess == null) ? null : ((ServerLevel) generatoraccess).getChunkSource(); + net.minecraft.server.level.ServerChunkCache cps = (generatoraccess == null) ? null : ((net.minecraft.server.level.ServerLevel) generatoraccess).getChunkSource();
+ if (this.check(cps, pos.x - 1, pos.z) && this.check(cps, pos.x - 1, pos.z - 1) && this.check(cps, pos.x, pos.z - 1)) { + if (this.check(cps, pos.x - 1, pos.z) && this.check(cps, pos.x - 1, pos.z - 1) && this.check(cps, pos.x, pos.z - 1)) {
+ level.putBoolean("LightPopulated", true); + level.putBoolean("LightPopulated", true);
+ } + }
@ -90,7 +72,7 @@
+ // Spigot start - SPIGOT-6806: Quick and dirty way to prevent below zero generation in old chunks, by setting the status to heightmap instead of empty + // Spigot start - SPIGOT-6806: Quick and dirty way to prevent below zero generation in old chunks, by setting the status to heightmap instead of empty
+ boolean stopBelowZero = false; + boolean stopBelowZero = false;
+ boolean belowZeroGenerationInExistingChunks = (generatoraccess != null) ? ((ServerLevel) generatoraccess).spigotConfig.belowZeroGenerationInExistingChunks : org.spigotmc.SpigotConfig.belowZeroGenerationInExistingChunks; + boolean belowZeroGenerationInExistingChunks = (generatoraccess != null) ? ((net.minecraft.server.level.ServerLevel) generatoraccess).spigotConfig.belowZeroGenerationInExistingChunks : org.spigotmc.SpigotConfig.belowZeroGenerationInExistingChunks;
+ +
+ if (version <= 2730 && !belowZeroGenerationInExistingChunks) { + if (version <= 2730 && !belowZeroGenerationInExistingChunks) {
+ stopBelowZero = "full".equals(chunkData.getCompound("Level").getString("Status")); + stopBelowZero = "full".equals(chunkData.getCompound("Level").getString("Status"));
@ -101,7 +83,7 @@
chunkData = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, chunkData, Math.max(1493, version)); chunkData = DataFixTypes.CHUNK.updateToCurrentVersion(this.fixerUpper, chunkData, Math.max(1493, version));
+ // Spigot start + // Spigot start
+ if (stopBelowZero) { + if (stopBelowZero) {
+ chunkData.putString("Status", net.minecraft.core.registries.BuiltInRegistries.CHUNK_STATUS.getKey(ChunkStatus.SPAWN).toString()); + chunkData.putString("Status", net.minecraft.core.registries.BuiltInRegistries.CHUNK_STATUS.getKey(net.minecraft.world.level.chunk.status.ChunkStatus.SPAWN).toString());
+ } + }
+ // Spigot end + // Spigot end
removeDatafixingContext(chunkData); removeDatafixingContext(chunkData);
@ -112,7 +94,7 @@
} }
- private LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<Level> level, Supplier<DimensionDataStorage> storage) { - private LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<Level> level, Supplier<DimensionDataStorage> storage) {
+ private LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<LevelStem> level, Supplier<DimensionDataStorage> storage) { // CraftBukkit + private LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<net.minecraft.world.level.dimension.LevelStem> level, Supplier<DimensionDataStorage> storage) { // CraftBukkit
LegacyStructureDataHandler legacyStructureDataHandler = this.legacyStructureHandler; LegacyStructureDataHandler legacyStructureDataHandler = this.legacyStructureHandler;
if (legacyStructureDataHandler == null) { if (legacyStructureDataHandler == null) {
synchronized (this) { synchronized (this) {
@ -121,7 +103,7 @@
public static void injectDatafixingContext( public static void injectDatafixingContext(
- CompoundTag chunkData, ResourceKey<Level> levelKey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey - CompoundTag chunkData, ResourceKey<Level> levelKey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey
+ CompoundTag chunkData, ResourceKey<LevelStem> levelKey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey // CraftBukkit + CompoundTag chunkData, ResourceKey<net.minecraft.world.level.dimension.LevelStem> levelKey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> chunkGeneratorKey // CraftBukkit
) { ) {
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();
compoundTag.putString("dimension", levelKey.location().toString()); compoundTag.putString("dimension", levelKey.location().toString());

View file

@ -1,33 +1,24 @@
--- a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java --- a/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java
+++ b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java +++ b/net/minecraft/world/level/levelgen/structure/LegacyStructureDataHandler.java
@@ -18,7 +_,7 @@
import net.minecraft.resources.ResourceKey;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.world.level.ChunkPos;
-import net.minecraft.world.level.Level;
+import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.storage.DimensionDataStorage;
public class LegacyStructureDataHandler {
@@ -217,17 +_,17 @@ @@ -217,17 +_,17 @@
} }
} }
- public static LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<Level> level, @Nullable DimensionDataStorage storage) { - public static LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<Level> level, @Nullable DimensionDataStorage storage) {
- if (level == Level.OVERWORLD) { - if (level == Level.OVERWORLD) {
+ public static LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<LevelStem> level, @Nullable DimensionDataStorage storage) { // CraftBukkit + public static LegacyStructureDataHandler getLegacyStructureHandler(ResourceKey<net.minecraft.world.level.dimension.LevelStem> level, @Nullable DimensionDataStorage storage) { // CraftBukkit
+ if (level == LevelStem.OVERWORLD) { // CraftBukkit + if (level == net.minecraft.world.level.dimension.LevelStem.OVERWORLD) { // CraftBukkit
return new LegacyStructureDataHandler( return new LegacyStructureDataHandler(
storage, storage,
ImmutableList.of("Monument", "Stronghold", "Village", "Mineshaft", "Temple", "Mansion"), ImmutableList.of("Monument", "Stronghold", "Village", "Mineshaft", "Temple", "Mansion"),
ImmutableList.of("Village", "Mineshaft", "Mansion", "Igloo", "Desert_Pyramid", "Jungle_Pyramid", "Swamp_Hut", "Stronghold", "Monument") ImmutableList.of("Village", "Mineshaft", "Mansion", "Igloo", "Desert_Pyramid", "Jungle_Pyramid", "Swamp_Hut", "Stronghold", "Monument")
); );
- } else if (level == Level.NETHER) { - } else if (level == Level.NETHER) {
+ } else if (level == LevelStem.NETHER) { // CraftBukkit + } else if (level == net.minecraft.world.level.dimension.LevelStem.NETHER) { // CraftBukkit
List<String> list = ImmutableList.of("Fortress"); List<String> list = ImmutableList.of("Fortress");
return new LegacyStructureDataHandler(storage, list, list); return new LegacyStructureDataHandler(storage, list, list);
- } else if (level == Level.END) { - } else if (level == Level.END) {
+ } else if (level == LevelStem.END) { // CraftBukkit + } else if (level == net.minecraft.world.level.dimension.LevelStem.END) { // CraftBukkit
List<String> list = ImmutableList.of("EndCity"); List<String> list = ImmutableList.of("EndCity");
return new LegacyStructureDataHandler(storage, list, list); return new LegacyStructureDataHandler(storage, list, list);
} else { } else {

View file

@ -1,14 +1,5 @@
--- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java --- a/net/minecraft/world/level/levelgen/structure/StructurePiece.java
+++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java +++ b/net/minecraft/world/level/levelgen/structure/StructurePiece.java
@@ -26,8 +_,6 @@
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
-import net.minecraft.world.level.block.entity.DispenserBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
@@ -47,7 +_,7 @@ @@ -47,7 +_,7 @@
private Rotation rotation; private Rotation rotation;
protected int genDepth; protected int genDepth;

View file

@ -1,14 +1,5 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java --- a/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/IglooPieces.java
@@ -13,8 +_,6 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
-import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
@@ -102,10 +_,13 @@ @@ -102,10 +_,13 @@
protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) { protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) {
if ("chest".equals(name)) { if ("chest".equals(name)) {

View file

@ -1,14 +1,5 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java --- a/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/OceanRuinPieces.java
@@ -25,8 +_,6 @@
import net.minecraft.world.level.block.ChestBlock;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
-import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.Heightmap;
@@ -314,14 +_,20 @@ @@ -314,14 +_,20 @@
@Override @Override
protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) { protected void handleDataMarker(String name, BlockPos pos, ServerLevelAccessor level, RandomSource random, BoundingBox box) {

View file

@ -1,13 +1,5 @@
--- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java --- a/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
+++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java +++ b/net/minecraft/world/level/levelgen/structure/structures/StrongholdPieces.java
@@ -7,7 +_,6 @@
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.RandomSource;
-import net.minecraft.world.entity.EntityType;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.WorldGenLevel;
@@ -870,10 +_,13 @@ @@ -870,10 +_,13 @@
BlockPos worldPos = this.getWorldPos(5, 3, 6); BlockPos worldPos = this.getWorldPos(5, 3, 6);
if (box.isInside(worldPos)) { if (box.isInside(worldPos)) {

View file

@ -1,13 +1,5 @@
--- a/net/minecraft/world/level/storage/LevelStorageSource.java --- a/net/minecraft/world/level/storage/LevelStorageSource.java
+++ b/net/minecraft/world/level/storage/LevelStorageSource.java +++ b/net/minecraft/world/level/storage/LevelStorageSource.java
@@ -66,7 +_,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelSettings;
import net.minecraft.world.level.WorldDataConfiguration;
-import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.levelgen.WorldDimensions;
import net.minecraft.world.level.levelgen.WorldGenSettings;
@@ -145,6 +_,7 @@ @@ -145,6 +_,7 @@
PrimaryLevelData primaryLevelData = PrimaryLevelData.parse( PrimaryLevelData primaryLevelData = PrimaryLevelData.parse(
dynamic, levelSettings, complete.specialWorldProperty(), worldGenSettings.options(), lifecycle dynamic, levelSettings, complete.specialWorldProperty(), worldGenSettings.options(), lifecycle