2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
|
|
|
Date: Sun, 23 Aug 2020 20:59:00 +0200
|
|
|
|
Subject: [PATCH] Climbing should not bypass cramming gamerule
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-01-23 01:59:56 +01:00
|
|
|
index f46d0d22b99582070747e2fde3c6328b0ab6d707..b9164fb28a49ccc3113f7010786960ec36080df6 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2021-11-29 12:55:13 +01:00
|
|
|
@@ -94,6 +94,11 @@ public class PaperWorldConfig {
|
2021-06-11 14:02:28 +02:00
|
|
|
wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax);
|
|
|
|
}
|
2021-06-14 18:58:00 +02:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public boolean fixClimbingBypassingCrammingRule = false;
|
|
|
|
+ private void fixClimbingBypassingCrammingRule() {
|
|
|
|
+ fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
|
|
|
+ }
|
2021-06-14 18:58:00 +02:00
|
|
|
+
|
|
|
|
public short keepLoadedRange;
|
|
|
|
private void keepLoadedRange() {
|
|
|
|
keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16);
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2022-02-18 19:16:41 +01:00
|
|
|
index 56c138d69423cd7fc99003ff4ddf124ede1c5b95..925f9b57e347bb609c159bb9d750a528ad2b87dd 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2022-01-23 01:59:56 +01:00
|
|
|
@@ -1743,6 +1743,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isPushable() {
|
|
|
|
+ // Paper start
|
|
|
|
+ return isCollidable(false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) {
|
|
|
|
+ // Paper end
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index 22f36cd3df49160f1b6668befdd05c2268edaa49..e39965c2e50bc8ee424ea07819346e0611398e28 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
2021-11-24 17:39:04 +01:00
|
|
|
@@ -45,11 +45,17 @@ public final class EntitySelector {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static Predicate<Entity> pushableBy(Entity entity) {
|
|
|
|
+ // Paper start - ignoreClimbing param
|
|
|
|
+ return pushable(entity, false);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
|
|
|
|
+ // Paper end
|
|
|
|
Team scoreboardteambase = entity.getTeam();
|
|
|
|
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteambase == null ? Team.CollisionRule.ALWAYS : scoreboardteambase.getCollisionRule();
|
|
|
|
|
|
|
|
return (Predicate) (scoreboardteambase_enumteampush == Team.CollisionRule.NEVER ? Predicates.alwaysFalse() : EntitySelector.NO_SPECTATORS.and((entity1) -> {
|
2021-06-14 18:58:00 +02:00
|
|
|
- if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
|
|
|
|
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
|
2021-06-11 14:02:28 +02:00
|
|
|
return false;
|
|
|
|
} else if (entity.level.isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
|
|
|
|
return false;
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2022-02-18 19:16:41 +01:00
|
|
|
index 371ae3291afa84a41821edc37cdcabe7723a45d0..efc4ebcd1bb024ee7549047147bfe4da2b3fa3f8 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2022-02-18 19:16:41 +01:00
|
|
|
@@ -3297,7 +3297,7 @@ public abstract class LivingEntity extends Entity {
|
2021-06-11 14:02:28 +02:00
|
|
|
return;
|
|
|
|
}
|
2021-06-14 18:58:00 +02:00
|
|
|
// Paper end - don't run getEntities if we're not going to use its result
|
2021-11-24 17:39:04 +01:00
|
|
|
- List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
|
|
|
+ List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
// Paper - move up
|
2022-02-18 19:16:41 +01:00
|
|
|
@@ -3468,9 +3468,16 @@ public abstract class LivingEntity extends Entity {
|
2021-06-14 18:58:00 +02:00
|
|
|
return !this.isRemoved() && this.collides; // CraftBukkit
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
@Override
|
|
|
|
public boolean isPushable() {
|
|
|
|
- return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
|
|
|
|
+ return this.isCollidable(level.paperConfig.fixClimbingBypassingCrammingRule);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) {
|
|
|
|
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.onClimbable()) && this.collides; // CraftBukkit
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
|
|
|
// CraftBukkit start - collidable API
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index 3b34f1e7ae8aa33d957a9ff7ebe4a8e7fed73f3c..29dfbcecfbb2560e6ecde997abd5224a16c08c94 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
2021-06-14 18:58:00 +02:00
|
|
|
@@ -83,7 +83,7 @@ public class Bat extends AmbientCreature {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index daec622f4b47c5ccd474ae7f56042fa6434091e1..dd80d9e0614445ba088c295784dc30584dedaa2b 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
2021-11-24 17:39:04 +01:00
|
|
|
@@ -383,8 +383,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
- return super.isPushable(); // CraftBukkit - collidable API
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index e63f55df91d301b18c63ba94dc19966155916b65..cd278a859c87fc89c421378ffab1bd36a45bd65d 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
2021-11-24 17:39:04 +01:00
|
|
|
@@ -241,7 +241,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return !this.isVehicle();
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index 0d468631b9c260091e732925da43c177ebda892f..e5ef24d92de21c4c0e6a98e06985e52d47bfdce0 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
2021-11-24 17:39:04 +01:00
|
|
|
@@ -344,7 +344,7 @@ public class ArmorStand extends LivingEntity {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index 6f9cbba0c063b272afd6aacc3eab02df405b3061..75cff07051d3b81d37926fb1da50af5ba27c34dc 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
2021-11-24 17:39:04 +01:00
|
|
|
@@ -148,7 +148,7 @@ public abstract class AbstractMinecart extends Entity {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
2021-11-24 17:39:04 +01:00
|
|
|
index 11632004d16fe254e7b20cf6db25d4fc24887867..b4516094996c80886b8d7af599ba7c3d4229ba9d 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
2021-06-14 18:58:00 +02:00
|
|
|
@@ -158,7 +158,7 @@ public class Boat extends Entity {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|