Climbing should not bypass cramming gamerule

This commit is contained in:
William Blake Galbreath 2020-08-23 20:59:00 +02:00
parent e0fe76747b
commit 22069fd885
9 changed files with 196 additions and 126 deletions

View File

@ -170,7 +170,7 @@
private static final EntityDataAccessor<Integer> DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Integer> DATA_TICKS_FROZEN = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
private EntityInLevelCallback levelCallback; private EntityInLevelCallback levelCallback;
private final VecDeltaCodec packetPositionCodec; private final VecDeltaCodec packetPositionCodec;
@@ -253,6 +386,64 @@ @@ -253,7 +386,65 @@
private final List<Entity.Movement> movementThisTick; private final List<Entity.Movement> movementThisTick;
private final Set<BlockState> blocksInside; private final Set<BlockState> blocksInside;
private final LongSet visitedBlocks; private final LongSet visitedBlocks;
@ -203,7 +203,7 @@
+ private org.bukkit.util.Vector origin; + private org.bukkit.util.Vector origin;
+ @javax.annotation.Nullable + @javax.annotation.Nullable
+ private UUID originWorld; + private UUID originWorld;
+
+ public void setOrigin(@javax.annotation.Nonnull Location location) { + public void setOrigin(@javax.annotation.Nonnull Location location) {
+ this.origin = location.toVector(); + this.origin = location.toVector();
+ this.originWorld = location.getWorld().getUID(); + this.originWorld = location.getWorld().getUID();
@ -232,9 +232,10 @@
+ return this.dimensions.makeBoundingBox(x, y, z); + return this.dimensions.makeBoundingBox(x, y, z);
+ } + }
+ // Paper end + // Paper end
+
public Entity(EntityType<?> type, Level world) { public Entity(EntityType<?> type, Level world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
this.passengers = ImmutableList.of();
@@ -261,7 +452,7 @@ @@ -261,7 +452,7 @@
this.bb = Entity.INITIAL_AABB; this.bb = Entity.INITIAL_AABB;
this.stuckSpeedMultiplier = Vec3.ZERO; this.stuckSpeedMultiplier = Vec3.ZERO;
@ -615,7 +616,16 @@
this.hasImpulse = true; this.hasImpulse = true;
} }
@@ -1861,6 +2222,12 @@ @@ -1858,9 +2219,21 @@
}
public boolean isPushable() {
+ // Paper start - Climbing should not bypass cramming gamerule
+ return isCollidable(false);
+ }
+
+ public boolean isCollidable(boolean ignoreClimbing) {
+ // Paper end - Climbing should not bypass cramming gamerule
return false; return false;
} }
@ -628,7 +638,7 @@
public void awardKillScore(Entity entityKilled, DamageSource damageSource) { public void awardKillScore(Entity entityKilled, DamageSource damageSource) {
if (entityKilled instanceof ServerPlayer) { if (entityKilled instanceof ServerPlayer) {
CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource); CriteriaTriggers.ENTITY_KILLED_PLAYER.trigger((ServerPlayer) entityKilled, this, damageSource);
@@ -1889,16 +2256,22 @@ @@ -1889,16 +2262,22 @@
} }
public boolean saveAsPassenger(CompoundTag nbt) { public boolean saveAsPassenger(CompoundTag nbt) {
@ -654,7 +664,7 @@
return true; return true;
} }
} }
@@ -1909,54 +2282,98 @@ @@ -1909,54 +2288,98 @@
} }
public CompoundTag saveWithoutId(CompoundTag nbt) { public CompoundTag saveWithoutId(CompoundTag nbt) {
@ -773,7 +783,7 @@
} }
ListTag nbttaglist; ListTag nbttaglist;
@@ -1972,10 +2389,10 @@ @@ -1972,10 +2395,10 @@
nbttaglist.add(StringTag.valueOf(s)); nbttaglist.add(StringTag.valueOf(s));
} }
@ -786,7 +796,7 @@
if (this.isVehicle()) { if (this.isVehicle()) {
nbttaglist = new ListTag(); nbttaglist = new ListTag();
iterator = this.getPassengers().iterator(); iterator = this.getPassengers().iterator();
@@ -1984,17 +2401,41 @@ @@ -1984,17 +2407,41 @@
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
CompoundTag nbttagcompound1 = new CompoundTag(); CompoundTag nbttagcompound1 = new CompoundTag();
@ -831,10 +841,11 @@
} 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");
@@ -2080,6 +2521,68 @@ @@ -2079,7 +2526,69 @@
}
} else { } else {
throw new IllegalStateException("Entity has invalid position"); throw new IllegalStateException("Entity has invalid position");
} + }
+ +
+ // CraftBukkit start + // CraftBukkit start
+ // Spigot start + // Spigot start
@ -857,7 +868,7 @@
+ boolean bukkitInvisible = nbt.getBoolean("Bukkit.invisible"); + boolean bukkitInvisible = nbt.getBoolean("Bukkit.invisible");
+ this.setInvisible(bukkitInvisible); + this.setInvisible(bukkitInvisible);
+ this.persistentInvisibility = bukkitInvisible; + this.persistentInvisibility = bukkitInvisible;
+ } }
+ // CraftBukkit end + // CraftBukkit end
+ +
+ // Paper start + // Paper start
@ -900,7 +911,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -2101,6 +2604,12 @@ @@ -2101,6 +2610,12 @@
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null; return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
} }
@ -913,7 +924,7 @@
protected abstract void readAdditionalSaveData(CompoundTag nbt); protected abstract void readAdditionalSaveData(CompoundTag nbt);
protected abstract void addAdditionalSaveData(CompoundTag nbt); protected abstract void addAdditionalSaveData(CompoundTag nbt);
@@ -2153,9 +2662,23 @@ @@ -2153,9 +2668,23 @@
if (stack.isEmpty()) { if (stack.isEmpty()) {
return null; return null;
} else { } else {
@ -938,7 +949,7 @@
world.addFreshEntity(entityitem); world.addFreshEntity(entityitem);
return entityitem; return entityitem;
} }
@@ -2184,6 +2707,12 @@ @@ -2184,6 +2713,12 @@
if (this.isAlive() && this instanceof Leashable leashable) { if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) { if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@ -951,7 +962,7 @@
if (player.hasInfiniteMaterials()) { if (player.hasInfiniteMaterials()) {
leashable.removeLeash(); leashable.removeLeash();
} else { } else {
@@ -2200,6 +2729,13 @@ @@ -2200,6 +2735,13 @@
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) { if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
@ -965,7 +976,7 @@
leashable.setLeashedTo(player, true); leashable.setLeashedTo(player, true);
} }
@@ -2265,7 +2801,7 @@ @@ -2265,7 +2807,7 @@
} }
public boolean showVehicleHealth() { public boolean showVehicleHealth() {
@ -974,7 +985,7 @@
} }
public boolean startRiding(Entity entity, boolean force) { public boolean startRiding(Entity entity, boolean force) {
@@ -2273,7 +2809,7 @@ @@ -2273,7 +2815,7 @@
return false; return false;
} else if (!entity.couldAcceptPassenger()) { } else if (!entity.couldAcceptPassenger()) {
return false; return false;
@ -983,7 +994,7 @@
return false; return false;
} else { } else {
for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) { for (Entity entity1 = entity; entity1.vehicle != null; entity1 = entity1.vehicle) {
@@ -2285,11 +2821,32 @@ @@ -2285,11 +2827,32 @@
if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) { if (!force && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false; return false;
} else { } else {
@ -1017,7 +1028,7 @@
this.vehicle = entity; this.vehicle = entity;
this.vehicle.addPassenger(this); this.vehicle.addPassenger(this);
entity.getIndirectPassengersStream().filter((entity2) -> { entity.getIndirectPassengersStream().filter((entity2) -> {
@@ -2314,19 +2871,30 @@ @@ -2314,19 +2877,30 @@
} }
public void removeVehicle() { public void removeVehicle() {
@ -1050,7 +1061,7 @@
protected void addPassenger(Entity passenger) { protected void addPassenger(Entity passenger) {
if (passenger.getVehicle() != this) { if (passenger.getVehicle() != this) {
throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)");
@@ -2349,21 +2917,53 @@ @@ -2349,21 +2923,53 @@
} }
} }
@ -1110,7 +1121,7 @@
} }
protected boolean canAddPassenger(Entity passenger) { protected boolean canAddPassenger(Entity passenger) {
@@ -2464,7 +3064,7 @@ @@ -2464,7 +3070,7 @@
if (teleporttransition != null) { if (teleporttransition != null) {
ServerLevel worldserver1 = teleporttransition.newLevel(); ServerLevel worldserver1 = teleporttransition.newLevel();
@ -1119,7 +1130,7 @@
this.teleport(teleporttransition); this.teleport(teleporttransition);
} }
} }
@@ -2547,7 +3147,7 @@ @@ -2547,7 +3153,7 @@
} }
public boolean isCrouching() { public boolean isCrouching() {
@ -1128,7 +1139,7 @@
} }
public boolean isSprinting() { public boolean isSprinting() {
@@ -2563,7 +3163,7 @@ @@ -2563,7 +3169,7 @@
} }
public boolean isVisuallySwimming() { public boolean isVisuallySwimming() {
@ -1137,7 +1148,7 @@
} }
public boolean isVisuallyCrawling() { public boolean isVisuallyCrawling() {
@@ -2571,6 +3171,13 @@ @@ -2571,6 +3177,13 @@
} }
public void setSwimming(boolean swimming) { public void setSwimming(boolean swimming) {
@ -1151,7 +1162,7 @@
this.setSharedFlag(4, swimming); this.setSharedFlag(4, swimming);
} }
@@ -2609,6 +3216,7 @@ @@ -2609,6 +3222,7 @@
@Nullable @Nullable
public PlayerTeam getTeam() { public PlayerTeam getTeam() {
@ -1159,7 +1170,7 @@
return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName()); return this.level().getScoreboard().getPlayersTeam(this.getScoreboardName());
} }
@@ -2624,8 +3232,12 @@ @@ -2624,8 +3238,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false; return this.getTeam() != null ? this.getTeam().isAlliedTo(team) : false;
} }
@ -1173,7 +1184,7 @@
} }
public boolean getSharedFlag(int index) { public boolean getSharedFlag(int index) {
@@ -2644,7 +3256,7 @@ @@ -2644,7 +3262,7 @@
} }
public int getMaxAirSupply() { public int getMaxAirSupply() {
@ -1182,7 +1193,7 @@
} }
public int getAirSupply() { public int getAirSupply() {
@@ -2652,7 +3264,18 @@ @@ -2652,7 +3270,18 @@
} }
public void setAirSupply(int air) { public void setAirSupply(int air) {
@ -1202,7 +1213,7 @@
} }
public int getTicksFrozen() { public int getTicksFrozen() {
@@ -2679,11 +3302,40 @@ @@ -2679,11 +3308,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);
@ -1245,7 +1256,7 @@
} }
public void onAboveBubbleCol(boolean drag) { public void onAboveBubbleCol(boolean drag) {
@@ -2713,7 +3365,7 @@ @@ -2713,7 +3371,7 @@
this.resetFallDistance(); this.resetFallDistance();
} }
@ -1254,7 +1265,7 @@
return true; return true;
} }
@@ -2818,7 +3470,7 @@ @@ -2818,7 +3476,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();
@ -1263,7 +1274,7 @@
} }
public final boolean isInvulnerableToBase(DamageSource damageSource) { public final boolean isInvulnerableToBase(DamageSource damageSource) {
@@ -2850,8 +3502,34 @@ @@ -2850,8 +3508,34 @@
public Entity teleport(TeleportTransition teleportTarget) { public Entity teleport(TeleportTransition teleportTarget) {
Level world = this.level(); Level world = this.level();
@ -1298,7 +1309,7 @@
ServerLevel worldserver1 = teleportTarget.newLevel(); ServerLevel worldserver1 = teleportTarget.newLevel();
boolean flag = worldserver1.dimension() != worldserver.dimension(); boolean flag = worldserver1.dimension() != worldserver.dimension();
@@ -2918,10 +3596,19 @@ @@ -2918,10 +3602,19 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
return null; return null;
} else { } else {
@ -1319,7 +1330,7 @@
Iterator iterator1 = list1.iterator(); Iterator iterator1 = list1.iterator();
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
@@ -2947,7 +3634,7 @@ @@ -2947,7 +3640,7 @@
} }
private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) { private void sendTeleportTransitionToRidingPlayers(TeleportTransition teleportTarget) {
@ -1328,7 +1339,7 @@
Iterator iterator = this.getIndirectPassengers().iterator(); Iterator iterator = this.getIndirectPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -2995,8 +3682,9 @@ @@ -2995,8 +3688,9 @@
} }
protected void removeAfterChangingDimensions() { protected void removeAfterChangingDimensions() {
@ -1339,7 +1350,7 @@
leashable.removeLeash(); leashable.removeLeash();
} }
@@ -3006,11 +3694,26 @@ @@ -3006,11 +3700,26 @@
return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose())); return PortalShape.getRelativePosition(portalRect, portalAxis, this.position(), this.getDimensions(this.getPose()));
} }
@ -1366,7 +1377,7 @@
if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) { if (from.dimension() == Level.END && to.dimension() == Level.OVERWORLD) {
Iterator iterator = this.getPassengers().iterator(); Iterator iterator = this.getPassengers().iterator();
@@ -3134,10 +3837,16 @@ @@ -3134,10 +3843,16 @@
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE); return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
} }
@ -1386,7 +1397,7 @@
return entity != null; return entity != null;
} }
@@ -3187,7 +3896,7 @@ @@ -3187,7 +3902,7 @@
/** @deprecated */ /** @deprecated */
@Deprecated @Deprecated
protected void fixupDimensions() { protected void fixupDimensions() {
@ -1395,7 +1406,7 @@
EntityDimensions entitysize = this.getDimensions(entitypose); EntityDimensions entitysize = this.getDimensions(entitypose);
this.dimensions = entitysize; this.dimensions = entitysize;
@@ -3196,7 +3905,7 @@ @@ -3196,7 +3911,7 @@
public void refreshDimensions() { public void refreshDimensions() {
EntityDimensions entitysize = this.dimensions; EntityDimensions entitysize = this.dimensions;
@ -1404,7 +1415,7 @@
EntityDimensions entitysize1 = this.getDimensions(entitypose); EntityDimensions entitysize1 = this.getDimensions(entitypose);
this.dimensions = entitysize1; this.dimensions = entitysize1;
@@ -3258,10 +3967,29 @@ @@ -3258,10 +3973,29 @@
} }
public final void setBoundingBox(AABB boundingBox) { public final void setBoundingBox(AABB boundingBox) {
@ -1436,7 +1447,7 @@
return this.getDimensions(pose).eyeHeight(); return this.getDimensions(pose).eyeHeight();
} }
@@ -3335,7 +4063,7 @@ @@ -3335,7 +4069,7 @@
} }
@Nullable @Nullable
@ -1445,7 +1456,7 @@
return null; return null;
} }
@@ -3435,7 +4163,7 @@ @@ -3435,7 +4169,7 @@
} }
public boolean isControlledByLocalInstance() { public boolean isControlledByLocalInstance() {
@ -1454,7 +1465,7 @@
if (entityliving instanceof Player entityhuman) { if (entityliving instanceof Player entityhuman) {
return entityhuman.isLocalPlayer(); return entityhuman.isLocalPlayer();
@@ -3445,7 +4173,7 @@ @@ -3445,7 +4179,7 @@
} }
public boolean isControlledByClient() { public boolean isControlledByClient() {
@ -1463,7 +1474,7 @@
return entityliving != null && entityliving.isControlledByClient(); return entityliving != null && entityliving.isControlledByClient();
} }
@@ -3463,7 +4191,7 @@ @@ -3463,7 +4197,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);
} }
@ -1472,7 +1483,7 @@
return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ()); return new Vec3(this.getX(), this.getBoundingBox().maxY, this.getZ());
} }
@@ -3488,9 +4216,38 @@ @@ -3488,9 +4222,38 @@
public int getFireImmuneTicks() { public int getFireImmuneTicks() {
return 1; return 1;
} }
@ -1512,20 +1523,19 @@
} }
public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) { public void lookAt(EntityAnchorArgument.Anchor anchorPoint, Vec3 target) {
@@ -3550,7 +4307,12 @@ @@ -3551,6 +4314,11 @@
vec3d = vec3d.add(vec3d1); vec3d = vec3d.add(vec3d1);
++k1; ++k1;
+ } }
+ // CraftBukkit start - store last lava contact location + // CraftBukkit start - store last lava contact location
+ if (tag == FluidTags.LAVA) { + if (tag == FluidTags.LAVA) {
+ this.lastLavaContact = blockposition_mutableblockposition.immutable(); + this.lastLavaContact = blockposition_mutableblockposition.immutable();
} + }
+ // CraftBukkit end + // CraftBukkit end
} }
} }
} }
@@ -3613,7 +4375,7 @@ @@ -3613,7 +4381,7 @@
return new ClientboundAddEntityPacket(this, entityTrackerEntry); return new ClientboundAddEntityPacket(this, entityTrackerEntry);
} }
@ -1534,7 +1544,7 @@
return this.type.getDimensions(); return this.type.getDimensions();
} }
@@ -3714,7 +4476,29 @@ @@ -3714,7 +4482,29 @@
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
} }
@ -1564,7 +1574,7 @@
if (this.position.x != x || this.position.y != y || this.position.z != z) { if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z); this.position = new Vec3(x, y, z);
int i = Mth.floor(x); int i = Mth.floor(x);
@@ -3732,6 +4516,12 @@ @@ -3732,6 +4522,12 @@
this.levelCallback.onMove(); this.levelCallback.onMove();
} }
@ -1577,7 +1587,7 @@
} }
public void checkDespawn() {} public void checkDespawn() {}
@@ -3818,8 +4608,16 @@ @@ -3818,8 +4614,16 @@
@Override @Override
public final void setRemoved(Entity.RemovalReason reason) { public final void setRemoved(Entity.RemovalReason reason) {
@ -1595,7 +1605,7 @@
} }
if (this.removalReason.shouldDestroy()) { if (this.removalReason.shouldDestroy()) {
@@ -3827,8 +4625,8 @@ @@ -3827,8 +4631,8 @@
} }
this.getPassengers().forEach(Entity::stopRiding); this.getPassengers().forEach(Entity::stopRiding);
@ -1606,7 +1616,7 @@
} }
public void unsetRemoved() { public void unsetRemoved() {
@@ -3887,7 +4685,7 @@ @@ -3887,7 +4691,7 @@
} }
public Vec3 getKnownMovement() { public Vec3 getKnownMovement() {
@ -1615,7 +1625,7 @@
if (entityliving instanceof Player entityhuman) { if (entityliving instanceof Player entityhuman) {
if (this.isAlive()) { if (this.isAlive()) {
@@ -3962,4 +4760,14 @@ @@ -3962,4 +4766,14 @@
void accept(Entity entity, double x, double y, double z); void accept(Entity entity, double x, double y, double z);
} }

View File

@ -15,12 +15,21 @@
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) { public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max; double d4 = max * max;
@@ -43,9 +49,9 @@ @@ -39,13 +45,18 @@
}
public static Predicate<Entity> pushableBy(Entity entity) {
+ // Paper start - Climbing should not bypass cramming gamerule
+ return pushable(entity, false);
+ }
+ public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
+ // Paper end - Climbing should not bypass cramming gamerule
PlayerTeam scoreboardteam = entity.getTeam();
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule(); Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();
return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> { return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> {
- if (!entity1.isPushable()) { - if (!entity1.isPushable()) {
+ if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API + if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
return false; return false;
- } else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { - } else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
+ } else if (entity1 instanceof Player && entity instanceof Player && !io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { // Paper - Configurable player collision + } else if (entity1 instanceof Player && entity instanceof Player && !io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { // Paper - Configurable player collision

View File

@ -17,11 +17,10 @@
import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.AxeItem; import net.minecraft.world.item.AxeItem;
@@ -135,6 +136,30 @@ @@ -136,6 +137,30 @@
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Scoreboard;
import org.slf4j.Logger; import org.slf4j.Logger;
+
+// CraftBukkit start +// CraftBukkit start
+import java.util.ArrayList; +import java.util.ArrayList;
+import java.util.HashSet; +import java.util.HashSet;
@ -45,9 +44,10 @@
+import org.bukkit.event.entity.EntityTeleportEvent; +import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent;
+// CraftBukkit end +// CraftBukkit end
+
public abstract class LivingEntity extends Entity implements Attackable { public abstract class LivingEntity extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -174,7 +199,7 @@ @@ -174,7 +199,7 @@
public static final float DEFAULT_BABY_SCALE = 0.5F; public static final float DEFAULT_BABY_SCALE = 0.5F;
public static final String ATTRIBUTES_FIELD = "attributes"; public static final String ATTRIBUTES_FIELD = "attributes";
@ -264,14 +264,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();
@ -285,15 +281,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();
@ -579,7 +575,7 @@
this.hurtCurrentlyUsedShield(amount); this.hurtCurrentlyUsedShield(amount);
f2 = amount; f2 = amount;
amount = 0.0F; amount = 0.0F;
@@ -1202,15 +1451,26 @@ @@ -1202,14 +1451,25 @@
flag = true; flag = true;
} }
@ -595,7 +591,7 @@
this.hurtHelmet(source, amount); this.hurtHelmet(source, amount);
amount *= 0.75F; amount *= 0.75F;
} }
+
+ // CraftBukkit start + // CraftBukkit start
+ EntityDamageEvent event = this.handleEntityDamage(source, amount); + EntityDamageEvent event = this.handleEntityDamage(source, amount);
+ amount = 0; + amount = 0;
@ -604,10 +600,9 @@
+ amount += (float) event.getDamage(DamageModifier.FREEZING); + amount += (float) event.getDamage(DamageModifier.FREEZING);
+ amount += (float) event.getDamage(DamageModifier.HARD_HAT); + amount += (float) event.getDamage(DamageModifier.HARD_HAT);
+ // CraftBukkit end + // CraftBukkit end
+
this.walkAnimation.setSpeed(1.5F); this.walkAnimation.setSpeed(1.5F);
if (Float.isNaN(amount) || Float.isInfinite(amount)) { if (Float.isNaN(amount) || Float.isInfinite(amount)) {
amount = Float.MAX_VALUE;
@@ -1218,18 +1478,27 @@ @@ -1218,18 +1478,27 @@
boolean flag1 = true; boolean flag1 = true;
@ -1063,7 +1058,7 @@
+ }; + };
+ float hardHatModifier = hardHat.apply((double) f).floatValue(); + float hardHatModifier = hardHat.apply((double) f).floatValue();
+ f += hardHatModifier; + f += hardHatModifier;
+
+ com.google.common.base.Function<Double, Double> blocking = new com.google.common.base.Function<Double, Double>() { + com.google.common.base.Function<Double, Double> blocking = new com.google.common.base.Function<Double, Double>() {
+ @Override + @Override
+ public Double apply(Double f) { + public Double apply(Double f) {
@ -1137,7 +1132,7 @@
+ } + }
+ // Paper end - PlayerAttackEntityCooldownResetEvent + // Paper end - PlayerAttackEntityCooldownResetEvent
+ } + }
+
+ // Resistance + // Resistance
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) { + if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE); + float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
@ -1241,26 +1236,27 @@
} }
public CombatTracker getCombatTracker() { public CombatTracker getCombatTracker() {
@@ -1935,8 +2502,18 @@ @@ -1935,9 +2502,19 @@
} }
public final void setArrowCount(int stuckArrowCount) { public final void setArrowCount(int stuckArrowCount) {
- this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, stuckArrowCount); - this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, stuckArrowCount);
+ // CraftBukkit start + // CraftBukkit start
+ this.setArrowCount(stuckArrowCount, false); + this.setArrowCount(stuckArrowCount, false);
+ } }
+
+ public final void setArrowCount(int i, boolean flag) { + public final void setArrowCount(int i, boolean flag) {
+ ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, this.getArrowCount(), i, flag); + ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, this.getArrowCount(), i, flag);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
+ return; + return;
+ } + }
+ this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, event.getNewAmount()); + this.entityData.set(LivingEntity.DATA_ARROW_COUNT_ID, event.getNewAmount());
} + }
+ // CraftBukkit end + // CraftBukkit end
+
public final int getStingerCount() { public final int getStingerCount() {
return (Integer) this.entityData.get(LivingEntity.DATA_STINGER_COUNT_ID); return (Integer) this.entityData.get(LivingEntity.DATA_STINGER_COUNT_ID);
}
@@ -1999,7 +2576,7 @@ @@ -1999,7 +2576,7 @@
this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.playSound(soundeffect, this.getSoundVolume(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
@ -1270,19 +1266,19 @@
this.setHealth(0.0F); this.setHealth(0.0F);
this.die(this.damageSources().generic()); this.die(this.damageSources().generic());
} }
@@ -2182,6 +2759,12 @@ @@ -2181,6 +2758,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 +3077,7 @@ @@ -2494,7 +3077,7 @@
} }
@ -1350,10 +1346,9 @@
} }
- ItemStack itemstack2 = itemstack1; - ItemStack itemstack2 = itemstack1;
-
- itemstack = this.getItemBySlot(enumitemslot);
+ ItemStack itemstack2 = itemstack1; final ItemStack oldEquipment = itemstack2; // Paper - PlayerArmorChangeEvent - obfhelper + ItemStack itemstack2 = itemstack1; final ItemStack oldEquipment = itemstack2; // Paper - PlayerArmorChangeEvent - obfhelper
+
- itemstack = this.getItemBySlot(enumitemslot);
+ itemstack = this.getItemBySlot(enumitemslot); final ItemStack newEquipment = itemstack;// Paper - PlayerArmorChangeEvent - obfhelper + itemstack = this.getItemBySlot(enumitemslot); final ItemStack newEquipment = itemstack;// Paper - PlayerArmorChangeEvent - obfhelper
if (this.equipmentHasChanged(itemstack2, itemstack)) { if (this.equipmentHasChanged(itemstack2, itemstack)) {
+ // Paper start - PlayerArmorChangeEvent + // Paper start - PlayerArmorChangeEvent
@ -1401,6 +1396,7 @@
- this.level().getEntities(EntityTypeTest.forClass(Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush); - this.level().getEntities(EntityTypeTest.forClass(Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
+ this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush); + this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
} else { } else {
- List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
+ // Paper start - don't run getEntities if we're not going to use its result + // Paper start - don't run getEntities if we're not going to use its result
+ if (!this.isPushable()) { + if (!this.isPushable()) {
+ return; + return;
@ -1409,14 +1405,14 @@
+ if (team != null && team.getCollisionRule() == net.minecraft.world.scores.Team.CollisionRule.NEVER) { + if (team != null && team.getCollisionRule() == net.minecraft.world.scores.Team.CollisionRule.NEVER) {
+ return; + return;
+ } + }
+
+ int i = worldserver.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); + int i = worldserver.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ if (i <= 0 && this.level().paperConfig().collisions.maxEntityCollisions <= 0) { + if (i <= 0 && this.level().paperConfig().collisions.maxEntityCollisions <= 0) {
+ return; + return;
+ } + }
+ // Paper end - don't run getEntities if we're not going to use its result + // Paper end - don't run getEntities if we're not going to use its result
List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this)); + List list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
+
if (!list.isEmpty()) { if (!list.isEmpty()) {
- int i = worldserver.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING); - int i = worldserver.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ // Paper - don't run getEntities if we're not going to use its result; moved up + // Paper - don't run getEntities if we're not going to use its result; moved up
@ -1457,7 +1453,7 @@
this.dismountVehicle(entity); this.dismountVehicle(entity);
} }
@@ -3305,15 +3920,22 @@ @@ -3305,15 +3920,29 @@
@Override @Override
public boolean isPickable() { public boolean isPickable() {
@ -1465,14 +1461,21 @@
+ return !this.isRemoved() && this.collides; // CraftBukkit + return !this.isRemoved() && this.collides; // CraftBukkit
} }
+ // Paper start - Climbing should not bypass cramming gamerule
@Override @Override
public boolean isPushable() { public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable(); - return this.isAlive() && !this.isSpectator() && !this.onClimbable();
+ return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit + return this.isCollidable(this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
} }
+ // CraftBukkit start - collidable API
@Override @Override
+ public boolean isCollidable(boolean ignoreClimbing) {
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.onClimbable()) && this.collides; // CraftBukkit
+ // Paper end - Climbing should not bypass cramming gamerule
+ }
+
+ // CraftBukkit start - collidable API
+ @Override
+ public boolean canCollideWithBukkit(Entity entity) { + public boolean canCollideWithBukkit(Entity entity) {
+ return this.isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID()); + return this.isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
+ } + }
@ -1482,7 +1485,7 @@
public float getYHeadRot() { public float getYHeadRot() {
return this.yHeadRot; return this.yHeadRot;
} }
@@ -3342,7 +3964,7 @@ @@ -3342,7 +3971,7 @@
} }
public final void setAbsorptionAmount(float absorptionAmount) { public final void setAbsorptionAmount(float absorptionAmount) {
@ -1491,7 +1494,7 @@
} }
protected void internalSetAbsorptionAmount(float absorptionAmount) { protected void internalSetAbsorptionAmount(float absorptionAmount) {
@@ -3410,9 +4032,14 @@ @@ -3410,9 +4039,14 @@
} }
public void startUsingItem(InteractionHand hand) { public void startUsingItem(InteractionHand hand) {
@ -1507,7 +1510,7 @@
this.useItem = itemstack; this.useItem = itemstack;
this.useItemRemaining = itemstack.getUseDuration(this); this.useItemRemaining = itemstack.getUseDuration(this);
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
@@ -3483,13 +4110,49 @@ @@ -3483,13 +4117,49 @@
this.releaseUsingItem(); this.releaseUsingItem();
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
@ -1558,7 +1561,7 @@
} }
} }
@@ -3544,12 +4207,69 @@ @@ -3544,11 +4214,68 @@
if (this.isUsingItem() && !this.useItem.isEmpty()) { if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem(); Item item = this.useItem.getItem();
@ -1568,7 +1571,7 @@
return null; return null;
} }
} }
+
+ // Paper start - Make shield blocking delay configurable + // Paper start - Make shield blocking delay configurable
+ public HitResult getRayTrace(int maxDistance, ClipContext.Fluid fluidCollisionOption) { + public HitResult getRayTrace(int maxDistance, ClipContext.Fluid fluidCollisionOption) {
+ if (maxDistance < 1 || maxDistance > 120) { + if (maxDistance < 1 || maxDistance > 120) {
@ -1625,11 +1628,10 @@
+ this.shieldBlockingDelay = shieldBlockingDelay; + this.shieldBlockingDelay = shieldBlockingDelay;
+ } + }
+ // Paper end - Make shield blocking delay configurable + // Paper end - Make shield blocking delay configurable
+
public boolean isSuppressingSlidingDownLadder() { public boolean isSuppressingSlidingDownLadder() {
return this.isShiftKeyDown(); return this.isShiftKeyDown();
} @@ -3568,12 +4295,18 @@
@@ -3568,12 +4288,18 @@
} }
public boolean randomTeleport(double x, double y, double z, boolean particleEffects) { public boolean randomTeleport(double x, double y, double z, boolean particleEffects) {
@ -1650,7 +1652,7 @@
Level world = this.level(); Level world = this.level();
if (world.hasChunkAt(blockposition)) { if (world.hasChunkAt(blockposition)) {
@@ -3592,18 +4318,43 @@ @@ -3592,18 +4325,43 @@
} }
if (flag2) { if (flag2) {
@ -1698,7 +1700,7 @@
world.broadcastEntityEvent(this, (byte) 46); world.broadcastEntityEvent(this, (byte) 46);
} }
@@ -3613,7 +4364,7 @@ @@ -3613,7 +4371,7 @@
entitycreature.getNavigation().stop(); entitycreature.getNavigation().stop();
} }
@ -1707,7 +1709,7 @@
} }
} }
@@ -3706,7 +4457,7 @@ @@ -3706,7 +4464,7 @@
} }
public void stopSleeping() { public void stopSleeping() {
@ -1716,7 +1718,7 @@
Level world = this.level(); Level world = this.level();
java.util.Objects.requireNonNull(world); java.util.Objects.requireNonNull(world);
@@ -3718,9 +4469,9 @@ @@ -3718,9 +4476,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(() -> {
@ -1728,7 +1730,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 +4491,7 @@ @@ -3740,7 +4498,7 @@
@Nullable @Nullable
public Direction getBedOrientation() { public Direction getBedOrientation() {
@ -1737,7 +1739,7 @@
return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null; return blockposition != null ? BedBlock.getBedOrientation(this.level(), blockposition) : null;
} }
@@ -3905,7 +4656,7 @@ @@ -3905,7 +4663,7 @@
public float maxUpStep() { public float maxUpStep() {
float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT); float f = (float) this.getAttributeValue(Attributes.STEP_HEIGHT);

View File

@ -10,6 +10,15 @@
public class Bat extends AmbientCreature { public class Bat extends AmbientCreature {
@@ -88,7 +91,7 @@
}
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return false;
}
@@ -144,13 +147,13 @@ @@ -144,13 +147,13 @@
this.yHeadRot = (float) this.random.nextInt(360); this.yHeadRot = (float) this.random.nextInt(360);
} }

View File

@ -18,12 +18,14 @@
if (player.isCreative() || !this.isInvulnerable()) { if (player.isCreative() || !this.isInvulnerable()) {
this.hurt(this.damageSources().playerAttack(player), Float.MAX_VALUE); this.hurt(this.damageSources().playerAttack(player), Float.MAX_VALUE);
} }
@@ -363,7 +363,7 @@ @@ -362,8 +362,8 @@
}
@Override @Override
public boolean isPushable() { - public boolean isPushable() {
- return true; - return true;
+ return super.isPushable(); // CraftBukkit - collidable API + public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
} }
@Override @Override

View File

@ -73,6 +73,15 @@
protected AbstractHorse(EntityType<? extends AbstractHorse> type, Level world) { protected AbstractHorse(EntityType<? extends AbstractHorse> type, Level world) {
super(type, world); super(type, world);
@@ -312,7 +369,7 @@
}
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return !this.isVehicle();
}
@@ -366,7 +423,7 @@ @@ -366,7 +423,7 @@
public void createInventory() { public void createInventory() {
SimpleContainer inventorysubcontainer = this.inventory; SimpleContainer inventorysubcontainer = this.inventory;
@ -117,14 +126,15 @@
if (!this.inventory.getItem(0).isEmpty()) { if (!this.inventory.getItem(0).isEmpty()) {
nbt.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess())); nbt.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess()));
@@ -910,6 +968,11 @@ @@ -909,7 +967,12 @@
if (uuid != null) { if (uuid != null) {
this.setOwnerUUID(uuid); this.setOwnerUUID(uuid);
} + }
+ // CraftBukkit start + // CraftBukkit start
+ if (nbt.contains("Bukkit.MaxDomestication")) { + if (nbt.contains("Bukkit.MaxDomestication")) {
+ this.maxDomestication = nbt.getInt("Bukkit.MaxDomestication"); + this.maxDomestication = nbt.getInt("Bukkit.MaxDomestication");
+ } }
+ // CraftBukkit end + // CraftBukkit end
if (nbt.contains("SaddleItem", 10)) { if (nbt.contains("SaddleItem", 10)) {

View File

@ -81,18 +81,18 @@
- return slot != EquipmentSlot.BODY && !this.isDisabled(slot); - return slot != EquipmentSlot.BODY && !this.isDisabled(slot);
+ public boolean canUseSlot(net.minecraft.world.entity.EquipmentSlot slot) { + public boolean canUseSlot(net.minecraft.world.entity.EquipmentSlot slot) {
+ return slot != net.minecraft.world.entity.EquipmentSlot.BODY && !this.isDisabled(slot); + return slot != net.minecraft.world.entity.EquipmentSlot.BODY && !this.isDisabled(slot);
+ }
+
+ @Override
+ public void setItemSlot(net.minecraft.world.entity.EquipmentSlot slot, ItemStack stack) {
+ // CraftBukkit start
+ this.setItemSlot(slot, stack, false);
} }
@Override @Override
- public void setItemSlot(EquipmentSlot slot, ItemStack stack) { - public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
- this.verifyEquippedItem(stack); - this.verifyEquippedItem(stack);
- switch (slot.getType()) { - switch (slot.getType()) {
+ public void setItemSlot(net.minecraft.world.entity.EquipmentSlot slot, ItemStack stack) {
+ // CraftBukkit start
+ this.setItemSlot(slot, stack, false);
+ }
+
+ @Override
+ public void setItemSlot(net.minecraft.world.entity.EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) { + public void setItemSlot(net.minecraft.world.entity.EquipmentSlot enumitemslot, ItemStack itemstack, boolean silent) {
+ // CraftBukkit end + // CraftBukkit end
+ this.verifyEquippedItem(itemstack); + this.verifyEquippedItem(itemstack);
@ -131,6 +131,15 @@
CompoundTag nbttagcompound2 = nbt.getCompound("Pose"); CompoundTag nbttagcompound2 = nbt.getCompound("Pose");
this.readPose(nbttagcompound2); this.readPose(nbttagcompound2);
@@ -318,7 +354,7 @@
}
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return false;
}
@@ -327,6 +363,7 @@ @@ -327,6 +363,7 @@
@Override @Override

View File

@ -30,6 +30,15 @@
public AbstractBoat(EntityType<? extends AbstractBoat> type, Level world, Supplier<Item> itemSupplier) { public AbstractBoat(EntityType<? extends AbstractBoat> type, Level world, Supplier<Item> itemSupplier) {
super(type, world); super(type, world);
this.dropItem = itemSupplier; this.dropItem = itemSupplier;
@@ -128,7 +144,7 @@
}
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return true;
}
@@ -182,9 +198,29 @@ @@ -182,9 +198,29 @@
public void push(Entity entity) { public void push(Entity entity) {
if (entity instanceof AbstractBoat) { if (entity instanceof AbstractBoat) {

View File

@ -41,6 +41,15 @@
if (t0 != null) { if (t0 != null) {
t0.setInitialPos(x, y, z); t0.setInitialPos(x, y, z);
@@ -143,7 +161,7 @@
}
@Override
- public boolean isPushable() {
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
return true;
}
@@ -262,6 +280,14 @@ @@ -262,6 +280,14 @@
@Override @Override
@ -112,15 +121,16 @@
double d0 = entity.getX() - this.getX(); double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ(); double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1; double d2 = d0 * d0 + d1 * d1;
@@ -645,4 +695,26 @@ @@ -644,5 +694,27 @@
public boolean isFurnace() { public boolean isFurnace() {
return false; return false;
} + }
+ +
+ // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers + // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers
+ public Vector getFlyingVelocityMod() { + public Vector getFlyingVelocityMod() {
+ return new Vector(this.flyingX, this.flyingY, this.flyingZ); + return new Vector(this.flyingX, this.flyingY, this.flyingZ);
+ } }
+ +
+ public void setFlyingVelocityMod(Vector flying) { + public void setFlyingVelocityMod(Vector flying) {
+ this.flyingX = flying.getX(); + this.flyingX = flying.getX();