geforkt von Mirrors/Paper
force entity dismount during teleportation
Entities must be dismounted before teleportation in order to avoid multiple issues in the server with regards to teleportation, shamefully, too many plugins rely on the events firing, which means that not firing these events caues more issues than it solves; In order to counteract this, Entity dismount/exit vehicle events have been modified to supress cancellation (and has a method to allow plugins to check if this has been set), noting that cancellation will be silently surpressed given that plugins are not expecting this event to not be cancellable. This is a far from ideal scenario, however: given the current state of this event and other alternatives causing issues elsewhere, I believe that this is going to be the best soultion all around. Improvements/suggestions welcome!
Dieser Commit ist enthalten in:
Ursprung
f944b0b8d6
Commit
373c8ff0b2
@ -114,7 +114,7 @@
|
|||||||
@Nullable
|
@Nullable
|
||||||
private Vec3 startingToFallPosition;
|
private Vec3 startingToFallPosition;
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -258,6 +293,30 @@
|
@@ -258,7 +293,31 @@
|
||||||
private final CommandSource commandSource;
|
private final CommandSource commandSource;
|
||||||
private int containerCounter;
|
private int containerCounter;
|
||||||
public boolean wonGame;
|
public boolean wonGame;
|
||||||
@ -123,7 +123,7 @@
|
|||||||
+ public boolean queueHealthUpdatePacket;
|
+ public boolean queueHealthUpdatePacket;
|
||||||
+ public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
+ public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
||||||
+ // Paper end - cancellable death event
|
+ // Paper end - cancellable death event
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
+ public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
||||||
+ public String displayName;
|
+ public String displayName;
|
||||||
@ -142,9 +142,10 @@
|
|||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ public boolean isRealPlayer; // Paper
|
+ public boolean isRealPlayer; // Paper
|
||||||
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||||
|
+
|
||||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||||
|
this.chatVisibility = ChatVisiblity.FULL;
|
||||||
@@ -266,7 +325,7 @@
|
@@ -266,7 +325,7 @@
|
||||||
this.canChatColor = true;
|
this.canChatColor = true;
|
||||||
this.lastActionTime = Util.getMillis();
|
this.lastActionTime = Util.getMillis();
|
||||||
@ -379,10 +380,12 @@
|
|||||||
Logger logger = ServerPlayer.LOGGER;
|
Logger logger = ServerPlayer.LOGGER;
|
||||||
|
|
||||||
Objects.requireNonNull(logger);
|
Objects.requireNonNull(logger);
|
||||||
@@ -686,6 +835,29 @@
|
@@ -684,7 +833,30 @@
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||||
+ public void spawnIn(Level world) {
|
+ public void spawnIn(Level world) {
|
||||||
+ this.setLevel(world);
|
+ this.setLevel(world);
|
||||||
@ -403,12 +406,11 @@
|
|||||||
+ this.setPos(position);
|
+ this.setPos(position);
|
||||||
+ }
|
+ }
|
||||||
+ this.gameMode.setLevel((ServerLevel) world);
|
+ this.gameMode.setLevel((ServerLevel) world);
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public void setExperiencePoints(int points) {
|
public void setExperiencePoints(int points) {
|
||||||
float f = (float) this.getXpNeededForNextLevel();
|
float f = (float) this.getXpNeededForNextLevel();
|
||||||
float f1 = (f - 1.0F) / f;
|
|
||||||
@@ -744,6 +916,11 @@
|
@@ -744,6 +916,11 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -524,7 +526,7 @@
|
|||||||
+ // SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
|
+ // SPIGOT-5071: manually add player loot tables (SPIGOT-5195 - ignores keepInventory rule)
|
||||||
+ this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0);
|
+ this.dropFromLootTable(this.serverLevel(), damageSource, this.lastHurtByPlayerTime > 0);
|
||||||
+ this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
|
+ this.dropCustomDeathLoot(this.serverLevel(), damageSource, flag);
|
||||||
+
|
|
||||||
+ loot.addAll(this.drops);
|
+ loot.addAll(this.drops);
|
||||||
+ this.drops.clear(); // SPIGOT-5188: make sure to clear
|
+ this.drops.clear(); // SPIGOT-5188: make sure to clear
|
||||||
+
|
+
|
||||||
@ -548,7 +550,7 @@
|
|||||||
+ if (this.containerMenu != this.inventoryMenu) {
|
+ if (this.containerMenu != this.inventoryMenu) {
|
||||||
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DEATH); // Paper - Inventory close reason
|
+ this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DEATH); // Paper - Inventory close reason
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
|
+ net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure
|
||||||
+
|
+
|
||||||
+ if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override?
|
+ if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override?
|
||||||
@ -844,7 +846,7 @@
|
|||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
+ }
|
}
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
@ -855,7 +857,7 @@
|
|||||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
|
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
|
||||||
+ return null;
|
+ return null;
|
||||||
}
|
+ }
|
||||||
+ return new CraftPortalEvent(event);
|
+ return new CraftPortalEvent(event);
|
||||||
}
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
@ -1430,7 +1432,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.awardStat(Stats.DROP);
|
this.awardStat(Stats.DROP);
|
||||||
@@ -2375,10 +2906,12 @@
|
@@ -2275,9 +2806,15 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopRiding() {
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.stopRiding(false);
|
||||||
|
+ }
|
||||||
|
+ @Override
|
||||||
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
Entity entity = this.getVehicle();
|
||||||
|
|
||||||
|
- super.stopRiding();
|
||||||
|
+ super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||||
|
if (entity instanceof LivingEntity entityliving) {
|
||||||
|
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||||
|
|
||||||
|
@@ -2375,16 +2912,161 @@
|
||||||
return TicketType.ENDER_PEARL.timeout();
|
return TicketType.ENDER_PEARL.timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1446,10 +1465,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
|
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
|
||||||
@@ -2387,4 +2920,147 @@
|
Vec3 vec3d1 = Vec3.atBottomCenterOf(currentPos).subtract(respawnPos).normalize();
|
||||||
|
|
||||||
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Add per-player time and weather.
|
+ // CraftBukkit start - Add per-player time and weather.
|
||||||
+ public long timeOffset = 0;
|
+ public long timeOffset = 0;
|
||||||
@ -1462,8 +1482,8 @@
|
|||||||
+ } else {
|
+ } else {
|
||||||
+ // Adds timeOffset to the beginning of this day.
|
+ // Adds timeOffset to the beginning of this day.
|
||||||
+ return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset;
|
+ return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset;
|
||||||
+ }
|
}
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ public WeatherType weather = null;
|
+ public WeatherType weather = null;
|
||||||
+
|
+
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
+// CraftBukkit end
|
+// CraftBukkit end
|
||||||
|
|
||||||
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
|
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder {
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private static final int CURRENT_LEVEL = 2;
|
+ private static final int CURRENT_LEVEL = 2;
|
||||||
+ static boolean isLevelAtLeast(CompoundTag tag, int level) {
|
+ static boolean isLevelAtLeast(CompoundTag tag, int level) {
|
||||||
@ -140,7 +140,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Share random for entities to make them more random
|
+ // Paper end - Share random for entities to make them more random
|
||||||
+
|
|
||||||
+ private CraftEntity bukkitEntity;
|
+ private CraftEntity bukkitEntity;
|
||||||
+
|
+
|
||||||
+ public CraftEntity getBukkitEntity() {
|
+ public CraftEntity getBukkitEntity() {
|
||||||
@ -210,7 +210,7 @@
|
|||||||
+ public org.bukkit.util.Vector getOriginVector() {
|
+ public org.bukkit.util.Vector getOriginVector() {
|
||||||
+ return this.origin != null ? this.origin.clone() : null;
|
+ return this.origin != null ? this.origin.clone() : null;
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
+ @javax.annotation.Nullable
|
+ @javax.annotation.Nullable
|
||||||
+ public UUID getOriginWorld() {
|
+ public UUID getOriginWorld() {
|
||||||
+ return this.originWorld;
|
+ return this.originWorld;
|
||||||
@ -219,7 +219,7 @@
|
|||||||
+ public float getBukkitYaw() {
|
+ public float getBukkitYaw() {
|
||||||
+ return this.yRot;
|
+ return this.yRot;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
+ public boolean isChunkLoaded() {
|
+ public boolean isChunkLoaded() {
|
||||||
+ return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4);
|
+ return this.level.hasChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4);
|
||||||
+ }
|
+ }
|
||||||
@ -507,10 +507,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
public boolean isFree(double offsetX, double offsetY, double offsetZ) {
|
||||||
@@ -750,6 +1050,28 @@
|
@@ -747,8 +1047,30 @@
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (movement.y != vec3d1.y) {
|
||||||
|
block.updateEntityMovementAfterFallOn(this.level(), this);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) {
|
+ if (this.horizontalCollision && this.getBukkitEntity() instanceof Vehicle) {
|
||||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||||
@ -524,18 +527,17 @@
|
|||||||
+ bl = bl.getRelative(BlockFace.SOUTH);
|
+ bl = bl.getRelative(BlockFace.SOUTH);
|
||||||
+ } else if (movement.z < vec3d1.z) {
|
+ } else if (movement.z < vec3d1.z) {
|
||||||
+ bl = bl.getRelative(BlockFace.NORTH);
|
+ bl = bl.getRelative(BlockFace.NORTH);
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ if (!bl.getType().isAir()) {
|
+ if (!bl.getType().isAir()) {
|
||||||
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
|
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
|
||||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
if (!this.level().isClientSide() || this.isControlledByLocalInstance()) {
|
||||||
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
Entity.MovementEmission entity_movementemission = this.getMovementEmission();
|
||||||
|
|
||||||
@@ -1133,6 +1455,20 @@
|
@@ -1133,6 +1455,20 @@
|
||||||
return SoundEvents.GENERIC_SPLASH;
|
return SoundEvents.GENERIC_SPLASH;
|
||||||
}
|
}
|
||||||
@ -798,11 +800,10 @@
|
|||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being saved");
|
||||||
@@ -2079,7 +2504,67 @@
|
@@ -2080,6 +2505,66 @@
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Entity has invalid position");
|
throw new IllegalStateException("Entity has invalid position");
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
@ -858,7 +859,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ this.originWorld = originWorld;
|
+ this.originWorld = originWorld;
|
||||||
+ origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
+ origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
+ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@ -981,22 +982,49 @@
|
|||||||
this.vehicle = entity;
|
this.vehicle = entity;
|
||||||
this.vehicle.addPassenger(this);
|
this.vehicle.addPassenger(this);
|
||||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||||
@@ -2318,7 +2856,7 @@
|
@@ -2314,19 +2852,30 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeVehicle() {
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.removeVehicle(false);
|
||||||
|
+ }
|
||||||
|
+ public void removeVehicle(boolean suppressCancellation) {
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
if (this.vehicle != null) {
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
- entity.removePassenger(this);
|
- entity.removePassenger(this);
|
||||||
+ if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
|
+ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper - Force entity dismount during teleportation
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2349,21 +2887,50 @@
|
|
||||||
|
public void stopRiding() {
|
||||||
|
- this.removeVehicle();
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.stopRiding(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
|
+ this.removeVehicle(suppressCancellation);
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
protected void addPassenger(Entity passenger) {
|
||||||
|
if (passenger.getVehicle() != this) {
|
||||||
|
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
|
||||||
|
@@ -2349,21 +2898,53 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- protected void removePassenger(Entity passenger) {
|
- protected void removePassenger(Entity passenger) {
|
||||||
- if (passenger.getVehicle() == this) {
|
- if (passenger.getVehicle() == this) {
|
||||||
+ protected boolean removePassenger(Entity entity) { // CraftBukkit
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);}
|
||||||
|
+ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
+ if (entity.getVehicle() == this) {
|
+ if (entity.getVehicle() == this) {
|
||||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||||
} else {
|
} else {
|
||||||
@ -1007,7 +1035,7 @@
|
|||||||
+ if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
+ if (this.getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
|
||||||
+ VehicleExitEvent event = new VehicleExitEvent(
|
+ VehicleExitEvent event = new VehicleExitEvent(
|
||||||
+ (Vehicle) this.getBukkitEntity(),
|
+ (Vehicle) this.getBukkitEntity(),
|
||||||
+ (LivingEntity) entity.getBukkitEntity()
|
+ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper - Force entity dismount during teleportation
|
||||||
+ );
|
+ );
|
||||||
+ // Suppress during worldgen
|
+ // Suppress during worldgen
|
||||||
+ if (this.valid) {
|
+ if (this.valid) {
|
||||||
@ -1020,7 +1048,7 @@
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
+ EntityDismountEvent event = new EntityDismountEvent(entity.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);
|
+ Bukkit.getPluginManager().callEvent(event);
|
||||||
@ -1047,7 +1075,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canAddPassenger(Entity passenger) {
|
protected boolean canAddPassenger(Entity passenger) {
|
||||||
@@ -2464,7 +3031,7 @@
|
@@ -2464,7 +3045,7 @@
|
||||||
if (teleporttransition != null) {
|
if (teleporttransition != null) {
|
||||||
ServerLevel worldserver1 = teleporttransition.newLevel();
|
ServerLevel worldserver1 = teleporttransition.newLevel();
|
||||||
|
|
||||||
@ -1056,7 +1084,7 @@
|
|||||||
this.teleport(teleporttransition);
|
this.teleport(teleporttransition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2547,7 +3114,7 @@
|
@@ -2547,7 +3128,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCrouching() {
|
public boolean isCrouching() {
|
||||||
@ -1065,7 +1093,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSprinting() {
|
public boolean isSprinting() {
|
||||||
@@ -2563,7 +3130,7 @@
|
@@ -2563,7 +3144,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallySwimming() {
|
public boolean isVisuallySwimming() {
|
||||||
@ -1074,7 +1102,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisuallyCrawling() {
|
public boolean isVisuallyCrawling() {
|
||||||
@@ -2571,6 +3138,13 @@
|
@@ -2571,6 +3152,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSwimming(boolean swimming) {
|
public void setSwimming(boolean swimming) {
|
||||||
@ -1088,7 +1116,7 @@
|
|||||||
this.setSharedFlag(4, swimming);
|
this.setSharedFlag(4, swimming);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2609,6 +3183,7 @@
|
@@ -2609,6 +3197,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public PlayerTeam getTeam() {
|
public PlayerTeam getTeam() {
|
||||||
@ -1096,7 +1124,7 @@
|
|||||||
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2624,8 +3199,12 @@
|
@@ -2624,8 +3213,12 @@
|
||||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,7 +1138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getSharedFlag(int index) {
|
public boolean getSharedFlag(int index) {
|
||||||
@@ -2644,7 +3223,7 @@
|
@@ -2644,7 +3237,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxAirSupply() {
|
public int getMaxAirSupply() {
|
||||||
@ -1119,7 +1147,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getAirSupply() {
|
public int getAirSupply() {
|
||||||
@@ -2652,7 +3231,18 @@
|
@@ -2652,7 +3245,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAirSupply(int air) {
|
public void setAirSupply(int air) {
|
||||||
@ -1139,7 +1167,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getTicksFrozen() {
|
public int getTicksFrozen() {
|
||||||
@@ -2679,11 +3269,40 @@
|
@@ -2679,11 +3283,40 @@
|
||||||
|
|
||||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||||
@ -1182,7 +1210,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onAboveBubbleCol(boolean drag) {
|
public void onAboveBubbleCol(boolean drag) {
|
||||||
@@ -2713,7 +3332,7 @@
|
@@ -2713,7 +3346,7 @@
|
||||||
this.resetFallDistance();
|
this.resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,7 +1219,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2818,7 +3437,7 @@
|
@@ -2818,7 +3451,7 @@
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
String s = this.level() == null ? "~NULL~" : this.level().toString();
|
||||||
|
|
||||||
@ -1200,7 +1228,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
public final boolean isInvulnerableToBase(DamageSource damageSource) {
|
||||||
@@ -2852,6 +3471,26 @@
|
@@ -2852,6 +3485,26 @@
|
||||||
|
|
||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
if (!this.isRemoved()) {
|
if (!this.isRemoved()) {
|
||||||
@ -1227,7 +1255,7 @@
|
|||||||
ServerLevel worldserver1 = teleportTarget.newLevel();
|
ServerLevel worldserver1 = teleportTarget.newLevel();
|
||||||
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
boolean flag = worldserver1.dimension() != worldserver.dimension();
|
||||||
|
|
||||||
@@ -2920,8 +3559,12 @@
|
@@ -2920,8 +3573,12 @@
|
||||||
} else {
|
} else {
|
||||||
entity.restoreFrom(this);
|
entity.restoreFrom(this);
|
||||||
this.removeAfterChangingDimensions();
|
this.removeAfterChangingDimensions();
|
||||||
@ -1241,7 +1269,7 @@
|
|||||||
Iterator iterator1 = list1.iterator();
|
Iterator iterator1 = list1.iterator();
|
||||||
|
|
||||||
while (iterator1.hasNext()) {
|
while (iterator1.hasNext()) {
|
||||||
@@ -2947,7 +3590,7 @@
|
@@ -2947,7 +3604,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
|
||||||
@ -1250,7 +1278,7 @@
|
|||||||
Iterator iterator = this.getIndirectPassengers().iterator();
|
Iterator iterator = this.getIndirectPassengers().iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -2995,8 +3638,9 @@
|
@@ -2995,8 +3652,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void removeAfterChangingDimensions() {
|
protected void removeAfterChangingDimensions() {
|
||||||
@ -1261,10 +1289,12 @@
|
|||||||
leashable.removeLeash();
|
leashable.removeLeash();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3006,6 +3650,20 @@
|
@@ -3004,7 +3662,21 @@
|
||||||
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public Vec3 getRelativePortalPosition(Direction.Axis portalAxis, BlockUtil.FoundRectangle portalRect) {
|
||||||
|
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||||
@ -1276,13 +1306,12 @@
|
|||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
+ return new CraftPortalEvent(event);
|
+ return new CraftPortalEvent(event);
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public boolean canUsePortal(boolean allowVehicles) {
|
public boolean canUsePortal(boolean allowVehicles) {
|
||||||
return (allowVehicles || !this.isPassenger()) && this.isAlive();
|
return (allowVehicles || !this.isPassenger()) && this.isAlive();
|
||||||
}
|
@@ -3134,10 +3806,16 @@
|
||||||
@@ -3134,10 +3792,16 @@
|
|
||||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1302,7 +1331,7 @@
|
|||||||
return entity != null;
|
return entity != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3187,7 +3851,7 @@
|
@@ -3187,7 +3865,7 @@
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
@Deprecated
|
@Deprecated
|
||||||
protected void fixupDimensions() {
|
protected void fixupDimensions() {
|
||||||
@ -1311,7 +1340,7 @@
|
|||||||
EntityDimensions entitysize = this.getDimensions(entitypose);
|
EntityDimensions entitysize = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize;
|
this.dimensions = entitysize;
|
||||||
@@ -3196,7 +3860,7 @@
|
@@ -3196,7 +3874,7 @@
|
||||||
|
|
||||||
public void refreshDimensions() {
|
public void refreshDimensions() {
|
||||||
EntityDimensions entitysize = this.dimensions;
|
EntityDimensions entitysize = this.dimensions;
|
||||||
@ -1320,7 +1349,7 @@
|
|||||||
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
EntityDimensions entitysize1 = this.getDimensions(entitypose);
|
||||||
|
|
||||||
this.dimensions = entitysize1;
|
this.dimensions = entitysize1;
|
||||||
@@ -3258,10 +3922,29 @@
|
@@ -3258,10 +3936,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setBoundingBox(AABB boundingBox) {
|
public final void setBoundingBox(AABB boundingBox) {
|
||||||
@ -1352,7 +1381,7 @@
|
|||||||
return this.getDimensions(pose).eyeHeight();
|
return this.getDimensions(pose).eyeHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3335,7 +4018,7 @@
|
@@ -3335,7 +4032,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@ -1361,7 +1390,7 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3435,7 +4118,7 @@
|
@@ -3435,7 +4132,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByLocalInstance() {
|
public boolean isControlledByLocalInstance() {
|
||||||
@ -1370,7 +1399,7 @@
|
|||||||
|
|
||||||
if (entityliving instanceof Player entityhuman) {
|
if (entityliving instanceof Player entityhuman) {
|
||||||
return entityhuman.isLocalPlayer();
|
return entityhuman.isLocalPlayer();
|
||||||
@@ -3445,7 +4128,7 @@
|
@@ -3445,7 +4142,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isControlledByClient() {
|
public boolean isControlledByClient() {
|
||||||
@ -1379,7 +1408,7 @@
|
|||||||
|
|
||||||
return entityliving != null && entityliving.isControlledByClient();
|
return entityliving != null && entityliving.isControlledByClient();
|
||||||
}
|
}
|
||||||
@@ -3463,7 +4146,7 @@
|
@@ -3463,7 +4160,7 @@
|
||||||
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
return new Vec3((double) f1 * d2 / (double) f3, 0.0D, (double) f2 * d2 / (double) f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1388,10 +1417,11 @@
|
|||||||
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3489,8 +4172,37 @@
|
@@ -3488,9 +4185,38 @@
|
||||||
|
public int getFireImmuneTicks() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private final CommandSource commandSource = new CommandSource() {
|
+ private final CommandSource commandSource = new CommandSource() {
|
||||||
+
|
+
|
||||||
@ -1420,14 +1450,14 @@
|
|||||||
+ }
|
+ }
|
||||||
+ };
|
+ };
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel world) {
|
public CommandSourceStack createCommandSourceStackForNameResolution(ServerLevel world) {
|
||||||
- return new CommandSourceStack(CommandSource.NULL, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this);
|
- return new CommandSourceStack(CommandSource.NULL, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this);
|
||||||
+ return new CommandSourceStack(this.commandSource, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); // CraftBukkit
|
+ return new CommandSourceStack(this.commandSource, this.position(), this.getRotationVector(), world, 0, this.getName().getString(), this.getDisplayName(), world.getServer(), this); // CraftBukkit
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
|
||||||
@@ -3551,6 +4263,11 @@
|
@@ -3551,6 +4277,11 @@
|
||||||
vec3d = vec3d.add(vec3d1);
|
vec3d = vec3d.add(vec3d1);
|
||||||
++k1;
|
++k1;
|
||||||
}
|
}
|
||||||
@ -1439,7 +1469,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3613,7 +4330,7 @@
|
@@ -3613,7 +4344,7 @@
|
||||||
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
return new ClientboundAddEntityPacket(this, entityTrackerEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1448,7 +1478,7 @@
|
|||||||
return this.type.getDimensions();
|
return this.type.getDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3818,8 +4535,16 @@
|
@@ -3818,8 +4549,16 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void setRemoved(Entity.RemovalReason reason) {
|
public final void setRemoved(Entity.RemovalReason reason) {
|
||||||
@ -1466,7 +1496,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.removalReason.shouldDestroy()) {
|
if (this.removalReason.shouldDestroy()) {
|
||||||
@@ -3827,8 +4552,8 @@
|
@@ -3827,8 +4566,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getPassengers().forEach(Entity::stopRiding);
|
this.getPassengers().forEach(Entity::stopRiding);
|
||||||
@ -1477,7 +1507,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unsetRemoved() {
|
public void unsetRemoved() {
|
||||||
@@ -3887,7 +4612,7 @@
|
@@ -3887,7 +4626,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 getKnownMovement() {
|
public Vec3 getKnownMovement() {
|
||||||
|
@ -162,24 +162,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEquipItem(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
public void onEquipItem(EquipmentSlot slot, ItemStack oldStack, ItemStack newStack) {
|
||||||
- if (!this.level().isClientSide() && !this.isSpectator()) {
|
|
||||||
- boolean flag = newStack.isEmpty() && oldStack.isEmpty();
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ this.onEquipItem(slot, oldStack, newStack, false);
|
+ this.onEquipItem(slot, oldStack, newStack, false);
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
|
||||||
|
+ // CraftBukkit end
|
||||||
|
if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||||
|
- boolean flag = newStack.isEmpty() && oldStack.isEmpty();
|
||||||
|
+ boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||||
|
|
||||||
- if (!flag && !ItemStack.isSameItemSameComponents(oldStack, newStack) && !this.firstTick) {
|
- if (!flag && !ItemStack.isSameItemSameComponents(oldStack, newStack) && !this.firstTick) {
|
||||||
- Equippable equippable = (Equippable) newStack.get(DataComponents.EQUIPPABLE);
|
- Equippable equippable = (Equippable) newStack.get(DataComponents.EQUIPPABLE);
|
||||||
+ public void onEquipItem(EquipmentSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1, boolean silent) {
|
+ if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
||||||
+ // CraftBukkit end
|
+ Equippable equippable = (Equippable) itemstack1.get(DataComponents.EQUIPPABLE);
|
||||||
+ if (!this.level().isClientSide() && !this.isSpectator()) {
|
|
||||||
+ boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
|
||||||
|
|
||||||
- if (!this.isSilent() && equippable != null && slot == equippable.slot()) {
|
- if (!this.isSilent() && equippable != null && slot == equippable.slot()) {
|
||||||
- this.level().playSeededSound((Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
- this.level().playSeededSound((Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||||
+ if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
|
||||||
+ Equippable equippable = (Equippable) itemstack1.get(DataComponents.EQUIPPABLE);
|
|
||||||
+
|
|
||||||
+ if (!this.isSilent() && equippable != null && enumitemslot == equippable.slot() && !silent) { // CraftBukkit
|
+ if (!this.isSilent() && equippable != null && enumitemslot == equippable.slot() && !silent) { // CraftBukkit
|
||||||
+ this.level().playSeededSound((net.minecraft.world.entity.player.Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
+ this.level().playSeededSound((net.minecraft.world.entity.player.Player) null, this.getX(), this.getY(), this.getZ(), equippable.equipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||||
}
|
}
|
||||||
@ -266,14 +265,10 @@
|
|||||||
boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
@@ -815,13 +902,36 @@
|
@@ -819,9 +906,32 @@
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (nbt.contains("Brain", 10)) {
|
|
||||||
this.brain = this.makeBrain(new Dynamic(NbtOps.INSTANCE, nbt.get("Brain")));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ private boolean isTickingEffects = false;
|
+ private boolean isTickingEffects = false;
|
||||||
+ private List<ProcessableEffect> effectsToProcess = Lists.newArrayList();
|
+ private List<ProcessableEffect> effectsToProcess = Lists.newArrayList();
|
||||||
@ -287,15 +282,15 @@
|
|||||||
+ private ProcessableEffect(MobEffectInstance effect, EntityPotionEffectEvent.Cause cause) {
|
+ private ProcessableEffect(MobEffectInstance effect, EntityPotionEffectEvent.Cause cause) {
|
||||||
+ this.effect = effect;
|
+ this.effect = effect;
|
||||||
+ this.cause = cause;
|
+ this.cause = cause;
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ private ProcessableEffect(Holder<MobEffect> type, EntityPotionEffectEvent.Cause cause) {
|
+ private ProcessableEffect(Holder<MobEffect> type, EntityPotionEffectEvent.Cause cause) {
|
||||||
+ this.type = type;
|
+ this.type = type;
|
||||||
+ this.cause = cause;
|
+ this.cause = cause;
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
protected void tickEffects() {
|
protected void tickEffects() {
|
||||||
Iterator<Holder<MobEffect>> iterator = this.activeEffects.keySet().iterator();
|
Iterator<Holder<MobEffect>> iterator = this.activeEffects.keySet().iterator();
|
||||||
|
|
||||||
@ -963,16 +958,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1682,6 +2053,20 @@
|
@@ -1681,8 +2052,22 @@
|
||||||
|
|
||||||
public LivingEntity.Fallsounds getFallSounds() {
|
public LivingEntity.Fallsounds getFallSounds() {
|
||||||
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
return new LivingEntity.Fallsounds(SoundEvents.GENERIC_SMALL_FALL, SoundEvents.GENERIC_BIG_FALL);
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Add delegate methods
|
+ // CraftBukkit start - Add delegate methods
|
||||||
+ public SoundEvent getHurtSound0(DamageSource damagesource) {
|
+ public SoundEvent getHurtSound0(DamageSource damagesource) {
|
||||||
+ return this.getHurtSound(damagesource);
|
+ return this.getHurtSound(damagesource);
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ public SoundEvent getDeathSound0() {
|
+ public SoundEvent getDeathSound0() {
|
||||||
+ return this.getDeathSound();
|
+ return this.getDeathSound();
|
||||||
+ }
|
+ }
|
||||||
@ -981,9 +977,10 @@
|
|||||||
+ return this.getFallDamageSound(fallHeight);
|
+ return this.getFallDamageSound(fallHeight);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public Optional<BlockPos> getLastClimbablePos() {
|
public Optional<BlockPos> getLastClimbablePos() {
|
||||||
return this.lastClimbablePos;
|
return this.lastClimbablePos;
|
||||||
|
}
|
||||||
@@ -1757,9 +2142,14 @@
|
@@ -1757,9 +2142,14 @@
|
||||||
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
int i = this.calculateFallDamage(fallDistance, damageMultiplier);
|
||||||
|
|
||||||
@ -1092,7 +1089,7 @@
|
|||||||
+ };
|
+ };
|
||||||
+ float resistanceModifier = resistance.apply((double) f).floatValue();
|
+ float resistanceModifier = resistance.apply((double) f).floatValue();
|
||||||
+ f += resistanceModifier;
|
+ f += resistanceModifier;
|
||||||
|
+
|
||||||
+ com.google.common.base.Function<Double, Double> magic = new com.google.common.base.Function<Double, Double>() {
|
+ com.google.common.base.Function<Double, Double> magic = new com.google.common.base.Function<Double, Double>() {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Double apply(Double f) {
|
+ public Double apply(Double f) {
|
||||||
@ -1101,7 +1098,7 @@
|
|||||||
+ };
|
+ };
|
||||||
+ float magicModifier = magic.apply((double) f).floatValue();
|
+ float magicModifier = magic.apply((double) f).floatValue();
|
||||||
+ f += magicModifier;
|
+ f += magicModifier;
|
||||||
+
|
|
||||||
+ com.google.common.base.Function<Double, Double> absorption = new com.google.common.base.Function<Double, Double>() {
|
+ com.google.common.base.Function<Double, Double> absorption = new com.google.common.base.Function<Double, Double>() {
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Double apply(Double f) {
|
+ public Double apply(Double f) {
|
||||||
@ -1256,19 +1253,19 @@
|
|||||||
this.setHealth(0.0F);
|
this.setHealth(0.0F);
|
||||||
this.die(this.damageSources().generic());
|
this.die(this.damageSources().generic());
|
||||||
}
|
}
|
||||||
@@ -2182,6 +2744,12 @@
|
@@ -2181,6 +2743,12 @@
|
||||||
|
public abstract Iterable<ItemStack> getArmorSlots();
|
||||||
|
|
||||||
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
public abstract ItemStack getItemBySlot(EquipmentSlot slot);
|
||||||
|
+
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
+ public void setItemSlot(EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
|
||||||
+ this.setItemSlot(enumitemslot, itemstack);
|
+ this.setItemSlot(enumitemslot, itemstack);
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack);
|
||||||
|
|
||||||
public Iterable<ItemStack> getHandSlots() {
|
|
||||||
@@ -2494,7 +3062,7 @@
|
@@ -2494,7 +3062,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1381,19 +1378,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Iterator iterator1 = list.iterator();
|
Iterator iterator1 = list.iterator();
|
||||||
-
|
|
||||||
- while (iterator1.hasNext()) {
|
|
||||||
- Entity entity1 = (Entity) iterator1.next();
|
|
||||||
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper - Cap entity collisions
|
+ this.numCollisions = Math.max(0, this.numCollisions - this.level().paperConfig().collisions.maxEntityCollisions); // Paper - Cap entity collisions
|
||||||
|
|
||||||
|
- while (iterator1.hasNext()) {
|
||||||
+ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper - Cap entity collisions
|
+ while (iterator1.hasNext() && this.numCollisions < this.level().paperConfig().collisions.maxEntityCollisions) { // Paper - Cap entity collisions
|
||||||
+ Entity entity1 = (Entity) iterator1.next();
|
Entity entity1 = (Entity) iterator1.next();
|
||||||
|
-
|
||||||
+ entity1.numCollisions++; // Paper - Cap entity collisions
|
+ entity1.numCollisions++; // Paper - Cap entity collisions
|
||||||
+ this.numCollisions++; // Paper - Cap entity collisions
|
+ this.numCollisions++; // Paper - Cap entity collisions
|
||||||
this.doPush(entity1);
|
this.doPush(entity1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3305,15 +3883,22 @@
|
@@ -3190,9 +3768,15 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopRiding() {
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.stopRiding(false);
|
||||||
|
+ }
|
||||||
|
+ @Override
|
||||||
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
Entity entity = this.getVehicle();
|
||||||
|
|
||||||
|
- super.stopRiding();
|
||||||
|
+ super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||||
|
if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
|
||||||
|
this.dismountVehicle(entity);
|
||||||
|
}
|
||||||
|
@@ -3305,15 +3889,22 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPickable() {
|
public boolean isPickable() {
|
||||||
@ -1418,7 +1431,7 @@
|
|||||||
public float getYHeadRot() {
|
public float getYHeadRot() {
|
||||||
return this.yHeadRot;
|
return this.yHeadRot;
|
||||||
}
|
}
|
||||||
@@ -3342,7 +3927,7 @@
|
@@ -3342,7 +3933,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setAbsorptionAmount(float absorptionAmount) {
|
public final void setAbsorptionAmount(float absorptionAmount) {
|
||||||
@ -1427,7 +1440,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void internalSetAbsorptionAmount(float absorptionAmount) {
|
protected void internalSetAbsorptionAmount(float absorptionAmount) {
|
||||||
@@ -3483,13 +4068,48 @@
|
@@ -3483,13 +4074,48 @@
|
||||||
this.releaseUsingItem();
|
this.releaseUsingItem();
|
||||||
} else {
|
} else {
|
||||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||||
@ -1477,7 +1490,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3544,12 +4164,69 @@
|
@@ -3544,12 +4170,69 @@
|
||||||
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||||
Item item = this.useItem.getItem();
|
Item item = this.useItem.getItem();
|
||||||
|
|
||||||
@ -1548,7 +1561,7 @@
|
|||||||
public boolean isSuppressingSlidingDownLadder() {
|
public boolean isSuppressingSlidingDownLadder() {
|
||||||
return this.isShiftKeyDown();
|
return this.isShiftKeyDown();
|
||||||
}
|
}
|
||||||
@@ -3568,12 +4245,18 @@
|
@@ -3568,12 +4251,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
|
||||||
@ -1569,7 +1582,7 @@
|
|||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
if (world.hasChunkAt(blockposition)) {
|
if (world.hasChunkAt(blockposition)) {
|
||||||
@@ -3592,18 +4275,43 @@
|
@@ -3592,18 +4281,43 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag2) {
|
if (flag2) {
|
||||||
@ -1581,7 +1594,7 @@
|
|||||||
+ this.setPos(d0, d6, d2);
|
+ this.setPos(d0, d6, d2);
|
||||||
if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) {
|
if (world.noCollision((Entity) this) && !world.containsAnyLiquid(this.getBoundingBox())) {
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
+ }
|
}
|
||||||
+ // now revert and call event if the teleport place is valid
|
+ // now revert and call event if the teleport place is valid
|
||||||
+ this.setPos(d3, d4, d5);
|
+ this.setPos(d3, d4, d5);
|
||||||
+
|
+
|
||||||
@ -1601,7 +1614,7 @@
|
|||||||
+ return Optional.empty();
|
+ return Optional.empty();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
}
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1617,7 +1630,7 @@
|
|||||||
world.broadcastEntityEvent(this, (byte) 46);
|
world.broadcastEntityEvent(this, (byte) 46);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3613,7 +4321,7 @@
|
@@ -3613,7 +4327,7 @@
|
||||||
entitycreature.getNavigation().stop();
|
entitycreature.getNavigation().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1626,7 +1639,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3706,7 +4414,7 @@
|
@@ -3706,7 +4420,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopSleeping() {
|
public void stopSleeping() {
|
||||||
@ -1635,7 +1648,7 @@
|
|||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
java.util.Objects.requireNonNull(world);
|
java.util.Objects.requireNonNull(world);
|
||||||
@@ -3718,9 +4426,9 @@
|
@@ -3718,9 +4432,9 @@
|
||||||
|
|
||||||
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
this.level().setBlock(blockposition, (BlockState) iblockdata.setValue(BedBlock.OCCUPIED, false), 3);
|
||||||
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
Vec3 vec3d = (Vec3) BedBlock.findStandUpPosition(this.getType(), this.level(), blockposition, enumdirection, this.getYRot()).orElseGet(() -> {
|
||||||
@ -1647,7 +1660,7 @@
|
|||||||
});
|
});
|
||||||
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||||
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
float f = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||||
@@ -3740,7 +4448,7 @@
|
@@ -3740,7 +4454,7 @@
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public Direction getBedOrientation() {
|
public Direction getBedOrientation() {
|
||||||
@ -1656,7 +1669,7 @@
|
|||||||
|
|
||||||
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
|
||||||
}
|
}
|
||||||
@@ -3905,7 +4613,7 @@
|
@@ -3905,7 +4619,7 @@
|
||||||
public float maxUpStep() {
|
public float maxUpStep() {
|
||||||
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);
|
||||||
|
|
||||||
|
@ -13,7 +13,22 @@
|
|||||||
|
|
||||||
public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, Enemy {
|
public class Shulker extends AbstractGolem implements VariantHolder<Optional<DyeColor>>, Enemy {
|
||||||
|
|
||||||
@@ -402,6 +408,14 @@
|
@@ -283,7 +289,13 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopRiding() {
|
||||||
|
- super.stopRiding();
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.stopRiding(false);
|
||||||
|
+ }
|
||||||
|
+ @Override
|
||||||
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
|
+ super.stopRiding(suppressCancellation);
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
if (this.level().isClientSide) {
|
||||||
|
this.clientOldAttachPosition = this.blockPosition();
|
||||||
|
}
|
||||||
|
@@ -402,6 +414,14 @@
|
||||||
Direction enumdirection = this.findAttachableSurface(blockposition1);
|
Direction enumdirection = this.findAttachableSurface(blockposition1);
|
||||||
|
|
||||||
if (enumdirection != null) {
|
if (enumdirection != null) {
|
||||||
@ -28,7 +43,7 @@
|
|||||||
this.unRide();
|
this.unRide();
|
||||||
this.setAttachFace(enumdirection);
|
this.setAttachFace(enumdirection);
|
||||||
this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F);
|
this.playSound(SoundEvents.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||||
@@ -472,7 +486,7 @@
|
@@ -472,7 +492,7 @@
|
||||||
if (entityshulker != null) {
|
if (entityshulker != null) {
|
||||||
entityshulker.setVariant(this.getVariant());
|
entityshulker.setVariant(this.getVariant());
|
||||||
entityshulker.moveTo(vec3d);
|
entityshulker.moveTo(vec3d);
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
public final InventoryMenu inventoryMenu;
|
public final InventoryMenu inventoryMenu;
|
||||||
public AbstractContainerMenu containerMenu;
|
public AbstractContainerMenu containerMenu;
|
||||||
protected FoodData foodData = new FoodData();
|
protected FoodData foodData = new FoodData();
|
||||||
@@ -188,6 +198,17 @@
|
@@ -188,7 +198,18 @@
|
||||||
public Entity currentExplosionCause;
|
public Entity currentExplosionCause;
|
||||||
private boolean ignoreFallDamageFromCurrentImpulse;
|
private boolean ignoreFallDamageFromCurrentImpulse;
|
||||||
private int currentImpulseContextResetGraceTime;
|
private int currentImpulseContextResetGraceTime;
|
||||||
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public boolean fauxSleeping;
|
+ public boolean fauxSleeping;
|
||||||
+ public int oldLevel = -1;
|
+ public int oldLevel = -1;
|
||||||
@ -50,9 +50,10 @@
|
|||||||
+ return (CraftHumanEntity) super.getBukkitEntity();
|
+ return (CraftHumanEntity) super.getBukkitEntity();
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
+
|
||||||
public Player(Level world, BlockPos pos, float yaw, GameProfile gameProfile) {
|
public Player(Level world, BlockPos pos, float yaw, GameProfile gameProfile) {
|
||||||
super(EntityType.PLAYER, world);
|
super(EntityType.PLAYER, world);
|
||||||
|
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||||
@@ -261,7 +282,7 @@
|
@@ -261,7 +282,7 @@
|
||||||
this.updateIsUnderwater();
|
this.updateIsUnderwater();
|
||||||
super.tick();
|
super.tick();
|
||||||
@ -71,21 +72,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEquipped(Item item) {
|
private boolean isEquipped(Item item) {
|
||||||
@@ -511,7 +532,14 @@
|
@@ -513,6 +534,13 @@
|
||||||
super.handleEntityEvent(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Paper start - Inventory close reason; unused code, but to keep signatures aligned
|
+ // Paper start - Inventory close reason; unused code, but to keep signatures aligned
|
||||||
+ public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
+ public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) {
|
||||||
+ closeContainer();
|
+ closeContainer();
|
||||||
+ this.containerMenu = this.inventoryMenu;
|
+ this.containerMenu = this.inventoryMenu;
|
||||||
}
|
+ }
|
||||||
+ // Paper end - Inventory close reason
|
+ // Paper end - Inventory close reason
|
||||||
|
+
|
||||||
public void closeContainer() {
|
public void closeContainer() {
|
||||||
this.containerMenu = this.inventoryMenu;
|
this.containerMenu = this.inventoryMenu;
|
||||||
|
}
|
||||||
@@ -523,8 +551,14 @@
|
@@ -523,8 +551,14 @@
|
||||||
public void rideTick() {
|
public void rideTick() {
|
||||||
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
|
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
|
||||||
@ -268,7 +268,22 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTextFilteringEnabled() {
|
public boolean isTextFilteringEnabled() {
|
||||||
@@ -1144,10 +1217,15 @@
|
@@ -1061,7 +1134,13 @@
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeVehicle() {
|
||||||
|
- super.removeVehicle();
|
||||||
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
|
+ this.removeVehicle(false);
|
||||||
|
+ }
|
||||||
|
+ @Override
|
||||||
|
+ public void removeVehicle(boolean suppressCancellation) {
|
||||||
|
+ super.removeVehicle(suppressCancellation);
|
||||||
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
|
this.boardingCooldown = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1144,10 +1223,15 @@
|
||||||
|
|
||||||
f *= 0.2F + f2 * f2 * 0.8F;
|
f *= 0.2F + f2 * f2 * 0.8F;
|
||||||
f1 *= f2;
|
f1 *= f2;
|
||||||
@ -285,7 +300,7 @@
|
|||||||
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
|
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());
|
this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
|
||||||
return;
|
return;
|
||||||
@@ -1159,7 +1237,7 @@
|
@@ -1159,7 +1243,7 @@
|
||||||
boolean flag1;
|
boolean flag1;
|
||||||
|
|
||||||
if (this.isSprinting() && flag) {
|
if (this.isSprinting() && flag) {
|
||||||
@ -294,7 +309,7 @@
|
|||||||
flag1 = true;
|
flag1 = true;
|
||||||
} else {
|
} else {
|
||||||
flag1 = false;
|
flag1 = false;
|
||||||
@@ -1168,6 +1246,7 @@
|
@@ -1168,6 +1252,7 @@
|
||||||
f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource);
|
f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource);
|
||||||
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
|
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
|
||||||
|
|
||||||
@ -302,7 +317,7 @@
|
|||||||
if (flag2) {
|
if (flag2) {
|
||||||
f *= 1.5F;
|
f *= 1.5F;
|
||||||
}
|
}
|
||||||
@@ -1202,13 +1281,17 @@
|
@@ -1202,13 +1287,17 @@
|
||||||
if (target instanceof LivingEntity) {
|
if (target instanceof LivingEntity) {
|
||||||
LivingEntity entityliving1 = (LivingEntity) target;
|
LivingEntity entityliving1 = (LivingEntity) target;
|
||||||
|
|
||||||
@ -322,7 +337,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity entityliving2;
|
LivingEntity entityliving2;
|
||||||
@@ -1223,8 +1306,13 @@
|
@@ -1223,8 +1312,13 @@
|
||||||
if (entityliving2 != this && entityliving2 != target && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof ArmorStand) || !((ArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
|
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;
|
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
|
||||||
|
|
||||||
@ -338,7 +353,7 @@
|
|||||||
Level world = this.level();
|
Level world = this.level();
|
||||||
|
|
||||||
if (world instanceof ServerLevel) {
|
if (world instanceof ServerLevel) {
|
||||||
@@ -1235,26 +1323,43 @@
|
@@ -1235,26 +1329,43 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,7 +401,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,9 +1413,14 @@
|
@@ -1308,9 +1419,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -403,7 +418,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1351,7 +1461,14 @@
|
@@ -1351,7 +1467,14 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Entity.RemovalReason reason) {
|
public void remove(Entity.RemovalReason reason) {
|
||||||
@ -419,7 +434,7 @@
|
|||||||
this.inventoryMenu.removed(this);
|
this.inventoryMenu.removed(this);
|
||||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||||
this.doCloseContainer();
|
this.doCloseContainer();
|
||||||
@@ -1391,7 +1508,13 @@
|
@@ -1391,7 +1514,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos pos) {
|
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos pos) {
|
||||||
@ -434,7 +449,7 @@
|
|||||||
this.sleepCounter = 0;
|
this.sleepCounter = 0;
|
||||||
return Either.right(Unit.INSTANCE);
|
return Either.right(Unit.INSTANCE);
|
||||||
}
|
}
|
||||||
@@ -1545,12 +1668,24 @@
|
@@ -1545,12 +1674,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startFallFlying() {
|
public void startFallFlying() {
|
||||||
@ -460,7 +475,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1664,11 +1799,30 @@
|
@@ -1664,11 +1805,30 @@
|
||||||
public int getXpNeededForNextLevel() {
|
public int getXpNeededForNextLevel() {
|
||||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||||
}
|
}
|
||||||
@ -492,7 +507,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1748,13 +1902,20 @@
|
@@ -1748,13 +1908,20 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
|
public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
|
||||||
@ -520,7 +535,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1798,26 +1959,55 @@
|
@@ -1798,26 +1965,55 @@
|
||||||
|
|
||||||
public void removeEntitiesOnShoulder() {
|
public void removeEntitiesOnShoulder() {
|
||||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||||
@ -583,12 +598,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2003,20 +2193,31 @@
|
@@ -2005,18 +2201,29 @@
|
||||||
@Override
|
|
||||||
public ImmutableList<Pose> getDismountPoses() {
|
|
||||||
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
|
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ // Paper start - PlayerReadyArrowEvent
|
+ // Paper start - PlayerReadyArrowEvent
|
||||||
+ protected boolean tryReadyArrow(ItemStack bow, ItemStack itemstack) {
|
+ protected boolean tryReadyArrow(ItemStack bow, ItemStack itemstack) {
|
||||||
+ return !(this instanceof ServerPlayer) ||
|
+ return !(this instanceof ServerPlayer) ||
|
||||||
@ -597,9 +610,9 @@
|
|||||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(bow),
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(bow),
|
||||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)
|
||||||
+ ).callEvent();
|
+ ).callEvent();
|
||||||
}
|
+ }
|
||||||
+ // Paper end - PlayerReadyArrowEvent
|
+ // Paper end - PlayerReadyArrowEvent
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getProjectile(ItemStack stack) {
|
public ItemStack getProjectile(ItemStack stack) {
|
||||||
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren