Remap CraftBukkit to Mojang+Yarn Mappings

By: Initial Source <noreply+automated@papermc.io>
This commit is contained in:
CraftBukkit/Spigot
2024-12-11 22:26:55 +01:00
parent a265d64138
commit 30e4583dbe
1780 changed files with 44628 additions and 41274 deletions

View File

@@ -1,435 +0,0 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -119,6 +119,19 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftVector;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityExhaustionEvent;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.player.PlayerVelocityEvent;
+// CraftBukkit end
+
public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -139,7 +152,8 @@
private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS = 40;
public static final Vec3D DEFAULT_VEHICLE_ATTACHMENT = new Vec3D(0.0D, 0.6D, 0.0D);
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F).withEyeHeight(1.62F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT));
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT))).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT))).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
protected static final DataWatcherObject<Byte> DATA_PLAYER_MODE_CUSTOMISATION = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.BYTE);
@@ -149,7 +163,7 @@
public static final int CLIENT_LOADED_TIMEOUT_TIME = 60;
private long timeEntitySatOnShoulder;
final PlayerInventory inventory = new PlayerInventory(this);
- protected InventoryEnderChest enderChestInventory = new InventoryEnderChest();
+ protected InventoryEnderChest enderChestInventory = new InventoryEnderChest(this); // CraftBukkit - add "this" to constructor
public final ContainerPlayer inventoryMenu;
public Container containerMenu;
protected FoodMetaData foodData = new FoodMetaData();
@@ -189,6 +203,16 @@
private boolean ignoreFallDamageFromCurrentImpulse;
private int currentImpulseContextResetGraceTime;
+ // CraftBukkit start
+ public boolean fauxSleeping;
+ public int oldLevel = -1;
+
+ @Override
+ public CraftHumanEntity getBukkitEntity() {
+ return (CraftHumanEntity) super.getBukkitEntity();
+ }
+ // CraftBukkit end
+
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -353,7 +377,7 @@
}
private void turtleHelmetTick() {
- this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true));
+ this.addEffect(new MobEffect(MobEffects.WATER_BREATHING, 200, 0, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TURTLE_HELMET); // CraftBukkit
}
private boolean isEquipped(Item item) {
@@ -523,8 +547,14 @@
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
- this.setShiftKeyDown(false);
- } else {
+ // CraftBukkit start - SPIGOT-7316: no longer passenger, dismount and return
+ if (!this.isPassenger()) {
+ this.setShiftKeyDown(false);
+ return;
+ }
+ }
+ {
+ // CraftBukkit end
super.rideTick();
this.oBob = this.bob;
this.bob = 0.0F;
@@ -719,6 +749,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
+ // CraftBukkit start - SPIGOT-2942: Add boolean to call event
+ return drop(itemstack, flag, flag1, true);
+ }
+
+ @Nullable
+ public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1, boolean callEvent) {
+ // CraftBukkit end
if (!itemstack.isEmpty() && this.level().isClientSide) {
this.swing(EnumHand.MAIN_HAND);
}
@@ -809,7 +846,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
- DataResult dataresult = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation"));
+ DataResult<GlobalPos> dataresult = GlobalPos.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("LastDeathLocation")); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -817,7 +854,7 @@
}
if (nbttagcompound.contains("current_explosion_impact_pos", 9)) {
- DataResult dataresult1 = Vec3D.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("current_explosion_impact_pos"));
+ DataResult<Vec3D> dataresult1 = Vec3D.CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("current_explosion_impact_pos")); // CraftBukkit - decompile error
Logger logger1 = EntityHuman.LOGGER;
Objects.requireNonNull(logger1);
@@ -854,7 +891,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
- DataResult dataresult = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos);
+ DataResult<NBTBase> dataresult = GlobalPos.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, globalpos); // CraftBukkit - decompile error
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -886,10 +923,10 @@
if (this.isDeadOrDying()) {
return false;
} else {
- this.removeEntitiesOnShoulder();
+ // this.removeEntitiesOnShoulder(); // CraftBukkit - moved down
if (damagesource.scalesWithDifficulty()) {
if (worldserver.getDifficulty() == EnumDifficulty.PEACEFUL) {
- f = 0.0F;
+ return false; // CraftBukkit - f = 0.0f -> return false
}
if (worldserver.getDifficulty() == EnumDifficulty.EASY) {
@@ -901,7 +938,13 @@
}
}
- return f == 0.0F ? false : super.hurtServer(worldserver, damagesource, f);
+ // CraftBukkit start - Don't filter out 0 damage
+ boolean damaged = super.hurtServer(worldserver, damagesource, f);
+ if (damaged) {
+ this.removeEntitiesOnShoulder();
+ }
+ return damaged;
+ // CraftBukkit end
}
}
}
@@ -923,10 +966,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
- ScoreboardTeam scoreboardteam = this.getTeam();
- ScoreboardTeam scoreboardteam1 = entityhuman.getTeam();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
+ if (entityhuman instanceof EntityPlayer) {
+ EntityPlayer thatPlayer = (EntityPlayer) entityhuman;
+ team = thatPlayer.getBukkitEntity().getScoreboard().getPlayerTeam(thatPlayer.getBukkitEntity());
+ if (team == null || team.allowFriendlyFire()) {
+ return true;
+ }
+ } else {
+ // This should never be called, but is implemented anyway
+ org.bukkit.OfflinePlayer thisPlayer = entityhuman.level().getCraftServer().getOfflinePlayer(entityhuman.getScoreboardName());
+ team = entityhuman.level().getCraftServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
+ if (team == null || team.allowFriendlyFire()) {
+ return true;
+ }
+ }
- return scoreboardteam == null ? true : (!scoreboardteam.isAlliedTo(scoreboardteam1) ? true : scoreboardteam.isAllowFriendlyFire());
+ if (this instanceof EntityPlayer) {
+ return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
+ }
+ return !team.hasPlayer(this.level().getCraftServer().getOfflinePlayer(this.getScoreboardName()));
+ // CraftBukkit end
}
@Override
@@ -966,8 +1028,13 @@
}
}
+ // CraftBukkit start
@Override
- protected void actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f) {
+ protected boolean actuallyHurt(WorldServer worldserver, DamageSource damagesource, float f, EntityDamageEvent event) { // void -> boolean
+ if (true) {
+ return super.actuallyHurt(worldserver, damagesource, f, event);
+ }
+ // CraftBukkit end
if (!this.isInvulnerableTo(worldserver, damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -982,7 +1049,7 @@
}
if (f != 0.0F) {
- this.causeFoodExhaustion(damagesource.getFoodExhaustion());
+ this.causeFoodExhaustion(damagesource.getFoodExhaustion(), EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
this.getCombatTracker().recordDamage(damagesource, f);
this.setHealth(this.getHealth() - f);
if (f < 3.4028235E37F) {
@@ -992,6 +1059,7 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
+ return false; // CraftBukkit
}
public boolean isTextFilteringEnabled() {
@@ -1144,10 +1212,15 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
- this.resetAttackStrengthTicker();
+ // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (entity.getType().is(TagsEntity.REDIRECTABLE_PROJECTILE) && entity instanceof IProjectile) {
IProjectile iprojectile = (IProjectile) entity;
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(entity, damagesource, f1, false)) {
+ return;
+ }
+ // CraftBukkit end
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
return;
@@ -1223,8 +1296,13 @@
if (entityliving2 != this && entityliving2 != entity && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof EntityArmorStand) || !((EntityArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (!entityliving2.hurtServer((WorldServer) this.level(), this.damageSources().playerAttack(this).sweep(), f7)) {
+ continue;
+ }
+ // CraftBukkit end
entityliving2.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
- entityliving2.hurt(damagesource, f7);
+ // entityliving2.hurt(damagesource, f7); // CraftBukkit - moved up
World world = this.level();
if (world instanceof WorldServer) {
@@ -1240,9 +1318,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
+ // CraftBukkit start - Add Velocity Event
+ boolean cancelled = false;
+ Player player = (Player) entity.getBukkitEntity();
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;
+ } else if (!velocity.equals(event.getVelocity())) {
+ player.setVelocity(event.getVelocity());
+ }
+
+ if (!cancelled) {
((EntityPlayer) entity).connection.send(new PacketPlayOutEntityVelocity(entity));
entity.hurtMarked = false;
entity.setDeltaMovement(vec3d);
+ }
+ // CraftBukkit end
}
if (flag2) {
@@ -1308,9 +1403,14 @@
}
}
- this.causeFoodExhaustion(0.1F);
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
} else {
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
+ // CraftBukkit start - resync on cancelled event
+ if (this instanceof EntityPlayer) {
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
+ }
+ // CraftBukkit end
}
}
@@ -1351,7 +1451,14 @@
@Override
public void remove(Entity.RemovalReason entity_removalreason) {
- super.remove(entity_removalreason);
+ // CraftBukkit start - add Bukkit remove cause
+ this.remove(entity_removalreason, null);
+ }
+
+ @Override
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
+ super.remove(entity_removalreason, cause);
+ // CraftBukkit end
this.inventoryMenu.removed(this);
if (this.containerMenu != null && this.hasContainerOpen()) {
this.doCloseContainer();
@@ -1391,6 +1498,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
+ // CraftBukkit start
+ return this.startSleepInBed(blockposition, false);
+ }
+
+ public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition, boolean force) {
+ // CraftBukkit end
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1545,12 +1658,24 @@
}
public void startFallFlying() {
- this.setSharedFlag(7, true);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) {
+ this.setSharedFlag(7, true);
+ } else {
+ // SPIGOT-5542: must toggle like below
+ this.setSharedFlag(7, true);
+ this.setSharedFlag(7, false);
+ }
+ // CraftBukkit end
}
public void stopFallFlying() {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) {
this.setSharedFlag(7, true);
this.setSharedFlag(7, false);
+ }
+ // CraftBukkit end
}
@Override
@@ -1665,10 +1790,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
+ // CraftBukkit start
public void causeFoodExhaustion(float f) {
+ this.causeFoodExhaustion(f, EntityExhaustionEvent.ExhaustionReason.UNKNOWN);
+ }
+
+ public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {
+ // CraftBukkit end
if (!this.abilities.invulnerable) {
if (!this.level().isClientSide) {
- this.foodData.addExhaustion(f);
+ // CraftBukkit start
+ EntityExhaustionEvent event = CraftEventFactory.callPlayerExhaustionEvent(this, reason, f);
+ if (!event.isCancelled()) {
+ this.foodData.addExhaustion(event.getExhaustion());
+ }
+ // CraftBukkit end
}
}
@@ -1748,13 +1884,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
+ // CraftBukkit start
+ setItemSlot(enumitemslot, itemstack, false);
+ }
+
+ @Override
+ public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack, boolean silent) {
+ // CraftBukkit end
this.verifyEquippedItem(itemstack);
if (enumitemslot == EnumItemSlot.MAINHAND) {
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
} else if (enumitemslot.getType() == EnumItemSlot.Function.HUMANOID_ARMOR) {
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack);
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
}
@@ -1798,26 +1941,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
- this.respawnEntityOnShoulder(this.getShoulderEntityLeft());
- this.setShoulderEntityLeft(new NBTTagCompound());
- this.respawnEntityOnShoulder(this.getShoulderEntityRight());
- this.setShoulderEntityRight(new NBTTagCompound());
+ // CraftBukkit start
+ if (this.respawnEntityOnShoulder(this.getShoulderEntityLeft())) {
+ this.setShoulderEntityLeft(new NBTTagCompound());
+ }
+ if (this.respawnEntityOnShoulder(this.getShoulderEntityRight())) {
+ this.setShoulderEntityRight(new NBTTagCompound());
+ }
+ // CraftBukkit end
}
}
- private void respawnEntityOnShoulder(NBTTagCompound nbttagcompound) {
+ private boolean respawnEntityOnShoulder(NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean
if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
- EntityTypes.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).ifPresent((entity) -> {
+ return EntityTypes.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit
if (entity instanceof EntityTameableAnimal) {
((EntityTameableAnimal) entity).setOwnerUUID(this.uuid);
}
entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ());
- ((WorldServer) this.level()).addWithUUID(entity);
- });
+ return ((WorldServer) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
+ }).orElse(true); // CraftBukkit
}
+ return true; // CraftBukkit
}
@Override

View File

@@ -1,29 +1,29 @@
--- a/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/net/minecraft/world/entity/player/PlayerInventory.java
@@ -24,6 +24,13 @@
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -23,6 +23,12 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.block.state.BlockState;
+// CraftBukkit start
+import java.util.ArrayList;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class PlayerInventory implements IInventory, INamableTileEntity {
public static final int POP_TIME_DURATION = 5;
@@ -39,6 +46,54 @@
public final EntityHuman player;
public class Inventory implements Container, Nameable {
@@ -38,7 +44,55 @@
public int selected;
public final Player player;
private int timesChanged;
+
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public List<ItemStack> getContents() {
+ List<ItemStack> combined = new ArrayList<ItemStack>(items.size() + armor.size() + offhand.size());
+ List<ItemStack> combined = new ArrayList<ItemStack>(this.items.size() + this.armor.size() + this.offhand.size());
+ for (List<net.minecraft.world.item.ItemStack> sub : this.compartments) {
+ combined.addAll(sub);
+ }
@@ -36,41 +36,41 @@
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ this.transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ this.transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ return this.transaction;
+ }
+
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return this.player.getBukkitEntity();
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ return this.maxStack;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ this.maxStack = size;
+ }
+
+ @Override
+ public Location getLocation() {
+ return player.getBukkitEntity().getLocation();
+ return this.player.getBukkitEntity().getLocation();
+ }
+ // CraftBukkit end
+
public PlayerInventory(EntityHuman entityhuman) {
public Inventory(Player player) {
this.items = NonNullList.withSize(36, ItemStack.EMPTY);
this.armor = NonNullList.withSize(4, ItemStack.EMPTY);
@@ -59,6 +114,28 @@
return !itemstack.isEmpty() && ItemStack.isSameItemSameComponents(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < this.getMaxStackSize(itemstack);
@@ -59,6 +113,28 @@
return !existingStack.isEmpty() && ItemStack.isSameItemSameComponents(existingStack, stack) && existingStack.isStackable() && existingStack.getCount() < this.getMaxStackSize(existingStack);
}
+ // CraftBukkit start - Watch method above! :D

View File

@@ -0,0 +1,462 @@
--- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java
@@ -118,6 +118,15 @@
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.Scoreboard;
import org.slf4j.Logger;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.util.CraftVector;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityExhaustionEvent;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.player.PlayerVelocityEvent;
+// CraftBukkit end
public abstract class Player extends LivingEntity {
@@ -139,7 +148,8 @@
private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS = 40;
public static final Vec3 DEFAULT_VEHICLE_ATTACHMENT = new Vec3(0.0D, 0.6D, 0.0D);
public static final EntityDimensions STANDING_DIMENSIONS = EntityDimensions.scalable(0.6F, 1.8F).withEyeHeight(1.62F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, Player.DEFAULT_VEHICLE_ATTACHMENT));
- private static final Map<Pose, EntityDimensions> POSES = ImmutableMap.builder().put(Pose.STANDING, Player.STANDING_DIMENSIONS).put(Pose.SLEEPING, Player.SLEEPING_DIMENSIONS).put(Pose.FALL_FLYING, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.SWIMMING, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.SPIN_ATTACK, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.CROUCHING, EntityDimensions.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, Player.DEFAULT_VEHICLE_ATTACHMENT))).put(Pose.DYING, EntityDimensions.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<Pose, EntityDimensions> POSES = ImmutableMap.<Pose, EntityDimensions>builder().put(Pose.STANDING, Player.STANDING_DIMENSIONS).put(Pose.SLEEPING, Player.SLEEPING_DIMENSIONS).put(Pose.FALL_FLYING, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.SWIMMING, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.SPIN_ATTACK, EntityDimensions.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(Pose.CROUCHING, EntityDimensions.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, Player.DEFAULT_VEHICLE_ATTACHMENT))).put(Pose.DYING, EntityDimensions.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
private static final EntityDataAccessor<Float> DATA_PLAYER_ABSORPTION_ID = SynchedEntityData.defineId(Player.class, EntityDataSerializers.FLOAT);
private static final EntityDataAccessor<Integer> DATA_SCORE_ID = SynchedEntityData.defineId(Player.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Byte> DATA_PLAYER_MODE_CUSTOMISATION = SynchedEntityData.defineId(Player.class, EntityDataSerializers.BYTE);
@@ -149,7 +159,7 @@
public static final int CLIENT_LOADED_TIMEOUT_TIME = 60;
private long timeEntitySatOnShoulder;
final Inventory inventory = new Inventory(this);
- protected PlayerEnderChestContainer enderChestInventory = new PlayerEnderChestContainer();
+ protected PlayerEnderChestContainer enderChestInventory = new PlayerEnderChestContainer(this); // CraftBukkit - add "this" to constructor
public final InventoryMenu inventoryMenu;
public AbstractContainerMenu containerMenu;
protected FoodData foodData = new FoodData();
@@ -188,7 +198,17 @@
public Entity currentExplosionCause;
private boolean ignoreFallDamageFromCurrentImpulse;
private int currentImpulseContextResetGraceTime;
+
+ // CraftBukkit start
+ public boolean fauxSleeping;
+ public int oldLevel = -1;
+ @Override
+ public CraftHumanEntity getBukkitEntity() {
+ return (CraftHumanEntity) super.getBukkitEntity();
+ }
+ // CraftBukkit end
+
public Player(Level world, BlockPos pos, float yaw, GameProfile gameProfile) {
super(EntityType.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -353,7 +373,7 @@
}
private void turtleHelmetTick() {
- this.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true));
+ this.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 200, 0, false, false, true), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TURTLE_HELMET); // CraftBukkit
}
private boolean isEquipped(Item item) {
@@ -523,8 +543,14 @@
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
- this.setShiftKeyDown(false);
- } else {
+ // CraftBukkit start - SPIGOT-7316: no longer passenger, dismount and return
+ if (!this.isPassenger()) {
+ this.setShiftKeyDown(false);
+ return;
+ }
+ }
+ {
+ // CraftBukkit end
super.rideTick();
this.oBob = this.bob;
this.bob = 0.0F;
@@ -719,7 +745,14 @@
@Nullable
public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) {
- if (!stack.isEmpty() && this.level().isClientSide) {
+ // CraftBukkit start - SPIGOT-2942: Add boolean to call event
+ return this.drop(stack, throwRandomly, retainOwnership, true);
+ }
+
+ @Nullable
+ public ItemEntity drop(ItemStack itemstack, boolean flag, boolean flag1, boolean callEvent) {
+ // CraftBukkit end
+ if (!itemstack.isEmpty() && this.level().isClientSide) {
this.swing(InteractionHand.MAIN_HAND);
}
@@ -809,7 +842,7 @@
}
if (nbt.contains("LastDeathLocation", 10)) {
- DataResult dataresult = GlobalPos.CODEC.parse(NbtOps.INSTANCE, nbt.get("LastDeathLocation"));
+ DataResult<GlobalPos> dataresult = GlobalPos.CODEC.parse(NbtOps.INSTANCE, nbt.get("LastDeathLocation")); // CraftBukkit - decompile error
Logger logger = Player.LOGGER;
Objects.requireNonNull(logger);
@@ -817,7 +850,7 @@
}
if (nbt.contains("current_explosion_impact_pos", 9)) {
- DataResult dataresult1 = Vec3.CODEC.parse(NbtOps.INSTANCE, nbt.get("current_explosion_impact_pos"));
+ DataResult<Vec3> dataresult1 = Vec3.CODEC.parse(NbtOps.INSTANCE, nbt.get("current_explosion_impact_pos")); // CraftBukkit - decompile error
Logger logger1 = Player.LOGGER;
Objects.requireNonNull(logger1);
@@ -854,7 +887,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
- DataResult dataresult = GlobalPos.CODEC.encodeStart(NbtOps.INSTANCE, globalpos);
+ DataResult<Tag> dataresult = GlobalPos.CODEC.encodeStart(NbtOps.INSTANCE, globalpos); // CraftBukkit - decompile error
Logger logger = Player.LOGGER;
Objects.requireNonNull(logger);
@@ -886,10 +919,10 @@
if (this.isDeadOrDying()) {
return false;
} else {
- this.removeEntitiesOnShoulder();
+ // this.removeEntitiesOnShoulder(); // CraftBukkit - moved down
if (source.scalesWithDifficulty()) {
if (world.getDifficulty() == Difficulty.PEACEFUL) {
- amount = 0.0F;
+ return false; // CraftBukkit - f = 0.0f -> return false
}
if (world.getDifficulty() == Difficulty.EASY) {
@@ -901,7 +934,13 @@
}
}
- return amount == 0.0F ? false : super.hurtServer(world, source, amount);
+ // CraftBukkit start - Don't filter out 0 damage
+ boolean damaged = super.hurtServer(world, source, amount);
+ if (damaged) {
+ this.removeEntitiesOnShoulder();
+ }
+ return damaged;
+ // CraftBukkit end
}
}
}
@@ -923,10 +962,29 @@
}
public boolean canHarmPlayer(Player player) {
- PlayerTeam scoreboardteam = this.getTeam();
- PlayerTeam scoreboardteam1 = player.getTeam();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
+ if (player instanceof ServerPlayer) {
+ ServerPlayer thatPlayer = (ServerPlayer) player;
+ team = thatPlayer.getBukkitEntity().getScoreboard().getPlayerTeam(thatPlayer.getBukkitEntity());
+ if (team == null || team.allowFriendlyFire()) {
+ return true;
+ }
+ } else {
+ // This should never be called, but is implemented anyway
+ org.bukkit.OfflinePlayer thisPlayer = player.level().getCraftServer().getOfflinePlayer(player.getScoreboardName());
+ team = player.level().getCraftServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer);
+ if (team == null || team.allowFriendlyFire()) {
+ return true;
+ }
+ }
- return scoreboardteam == null ? true : (!scoreboardteam.isAlliedTo(scoreboardteam1) ? true : scoreboardteam.isAllowFriendlyFire());
+ if (this instanceof ServerPlayer) {
+ return !team.hasPlayer(((ServerPlayer) this).getBukkitEntity());
+ }
+ return !team.hasPlayer(this.level().getCraftServer().getOfflinePlayer(this.getScoreboardName()));
+ // CraftBukkit end
}
@Override
@@ -966,32 +1024,38 @@
}
}
+ // CraftBukkit start
@Override
- protected void actuallyHurt(ServerLevel world, DamageSource source, float amount) {
- if (!this.isInvulnerableTo(world, source)) {
- amount = this.getDamageAfterArmorAbsorb(source, amount);
- amount = this.getDamageAfterMagicAbsorb(source, amount);
- float f1 = amount;
+ protected boolean actuallyHurt(ServerLevel worldserver, DamageSource damagesource, float f, EntityDamageEvent event) { // void -> boolean
+ if (true) {
+ return super.actuallyHurt(worldserver, damagesource, f, event);
+ }
+ // CraftBukkit end
+ if (!this.isInvulnerableTo(worldserver, damagesource)) {
+ f = this.getDamageAfterArmorAbsorb(damagesource, f);
+ f = this.getDamageAfterMagicAbsorb(damagesource, f);
+ float f1 = f;
- amount = Math.max(amount - this.getAbsorptionAmount(), 0.0F);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - amount));
- float f2 = f1 - amount;
+ f = Math.max(f - this.getAbsorptionAmount(), 0.0F);
+ this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - f));
+ float f2 = f1 - f;
if (f2 > 0.0F && f2 < 3.4028235E37F) {
this.awardStat(Stats.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
}
- if (amount != 0.0F) {
- this.causeFoodExhaustion(source.getFoodExhaustion());
- this.getCombatTracker().recordDamage(source, amount);
- this.setHealth(this.getHealth() - amount);
- if (amount < 3.4028235E37F) {
- this.awardStat(Stats.DAMAGE_TAKEN, Math.round(amount * 10.0F));
+ if (f != 0.0F) {
+ this.causeFoodExhaustion(damagesource.getFoodExhaustion(), EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
+ this.getCombatTracker().recordDamage(damagesource, f);
+ this.setHealth(this.getHealth() - f);
+ if (f < 3.4028235E37F) {
+ this.awardStat(Stats.DAMAGE_TAKEN, Math.round(f * 10.0F));
}
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
+ return false; // CraftBukkit
}
public boolean isTextFilteringEnabled() {
@@ -1144,10 +1208,15 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
- this.resetAttackStrengthTicker();
+ // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && target instanceof Projectile) {
Projectile iprojectile = (Projectile) target;
+ // CraftBukkit start
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(target, damagesource, f1, false)) {
+ return;
+ }
+ // CraftBukkit end
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
return;
@@ -1223,8 +1292,13 @@
if (entityliving2 != this && entityliving2 != target && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof ArmorStand) || !((ArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
+ // CraftBukkit start - Only apply knockback if the damage hits
+ if (!entityliving2.hurtServer((ServerLevel) this.level(), this.damageSources().playerAttack(this).sweep(), f7)) {
+ continue;
+ }
+ // CraftBukkit end
entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)));
- entityliving2.hurt(damagesource, f7);
+ // entityliving2.hurt(damagesource, f7); // CraftBukkit - moved up
Level world = this.level();
if (world instanceof ServerLevel) {
@@ -1240,9 +1314,26 @@
}
if (target instanceof ServerPlayer && target.hurtMarked) {
+ // CraftBukkit start - Add Velocity Event
+ boolean cancelled = false;
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) target.getBukkitEntity();
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
+
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ cancelled = true;
+ } else if (!velocity.equals(event.getVelocity())) {
+ player.setVelocity(event.getVelocity());
+ }
+
+ if (!cancelled) {
((ServerPlayer) target).connection.send(new ClientboundSetEntityMotionPacket(target));
target.hurtMarked = false;
target.setDeltaMovement(vec3d);
+ }
+ // CraftBukkit end
}
if (flag2) {
@@ -1308,9 +1399,14 @@
}
}
- this.causeFoodExhaustion(0.1F);
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
} else {
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
+ // CraftBukkit start - resync on cancelled event
+ if (this instanceof ServerPlayer) {
+ ((ServerPlayer) this).getBukkitEntity().updateInventory();
+ }
+ // CraftBukkit end
}
}
@@ -1351,7 +1447,14 @@
@Override
public void remove(Entity.RemovalReason reason) {
- super.remove(reason);
+ // CraftBukkit start - add Bukkit remove cause
+ this.remove(reason, null);
+ }
+
+ @Override
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
+ super.remove(entity_removalreason, cause);
+ // CraftBukkit end
this.inventoryMenu.removed(this);
if (this.containerMenu != null && this.hasContainerOpen()) {
this.doCloseContainer();
@@ -1391,7 +1494,13 @@
}
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos pos) {
- this.startSleeping(pos);
+ // CraftBukkit start
+ return this.startSleepInBed(pos, false);
+ }
+
+ public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos blockposition, boolean force) {
+ // CraftBukkit end
+ this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
}
@@ -1545,12 +1654,24 @@
}
public void startFallFlying() {
- this.setSharedFlag(7, true);
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, true).isCancelled()) {
+ this.setSharedFlag(7, true);
+ } else {
+ // SPIGOT-5542: must toggle like below
+ this.setSharedFlag(7, true);
+ this.setSharedFlag(7, false);
+ }
+ // CraftBukkit end
}
public void stopFallFlying() {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) {
this.setSharedFlag(7, true);
this.setSharedFlag(7, false);
+ }
+ // CraftBukkit end
}
@Override
@@ -1665,10 +1786,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
+ // CraftBukkit start
public void causeFoodExhaustion(float exhaustion) {
+ this.causeFoodExhaustion(exhaustion, EntityExhaustionEvent.ExhaustionReason.UNKNOWN);
+ }
+
+ public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {
+ // CraftBukkit end
if (!this.abilities.invulnerable) {
if (!this.level().isClientSide) {
- this.foodData.addExhaustion(exhaustion);
+ // CraftBukkit start
+ EntityExhaustionEvent event = CraftEventFactory.callPlayerExhaustionEvent(this, reason, f);
+ if (!event.isCancelled()) {
+ this.foodData.addExhaustion(event.getExhaustion());
+ }
+ // CraftBukkit end
}
}
@@ -1748,13 +1880,20 @@
@Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
- this.verifyEquippedItem(stack);
- if (slot == EquipmentSlot.MAINHAND) {
- this.onEquipItem(slot, (ItemStack) this.inventory.items.set(this.inventory.selected, stack), stack);
- } else if (slot == EquipmentSlot.OFFHAND) {
- this.onEquipItem(slot, (ItemStack) this.inventory.offhand.set(0, stack), stack);
- } else if (slot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
- this.onEquipItem(slot, (ItemStack) this.inventory.armor.set(slot.getIndex(), stack), stack);
+ // CraftBukkit start
+ this.setItemSlot(slot, stack, false);
+ }
+
+ @Override
+ public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
+ // CraftBukkit end
+ this.verifyEquippedItem(itemstack);
+ if (enumitemslot == EquipmentSlot.MAINHAND) {
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.items.set(this.inventory.selected, itemstack), itemstack, silent); // CraftBukkit
+ } else if (enumitemslot == EquipmentSlot.OFFHAND) {
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
+ } else if (enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
}
}
@@ -1798,26 +1937,31 @@
public void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
- this.respawnEntityOnShoulder(this.getShoulderEntityLeft());
- this.setShoulderEntityLeft(new CompoundTag());
- this.respawnEntityOnShoulder(this.getShoulderEntityRight());
- this.setShoulderEntityRight(new CompoundTag());
+ // CraftBukkit start
+ if (this.respawnEntityOnShoulder(this.getShoulderEntityLeft())) {
+ this.setShoulderEntityLeft(new CompoundTag());
+ }
+ if (this.respawnEntityOnShoulder(this.getShoulderEntityRight())) {
+ this.setShoulderEntityRight(new CompoundTag());
+ }
+ // CraftBukkit end
}
}
- private void respawnEntityOnShoulder(CompoundTag entityNbt) {
- if (!this.level().isClientSide && !entityNbt.isEmpty()) {
- EntityType.create(entityNbt, this.level(), EntitySpawnReason.LOAD).ifPresent((entity) -> {
+ private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
+ if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
+ return EntityType.create(nbttagcompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit
if (entity instanceof TamableAnimal) {
((TamableAnimal) entity).setOwnerUUID(this.uuid);
}
entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ());
- ((ServerLevel) this.level()).addWithUUID(entity);
- });
+ return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
+ }).orElse(true); // CraftBukkit
}
+ return true; // CraftBukkit
}
@Override