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