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
|
2021-08-25 09:59:26 +02:00
|
|
|
index 79229cb327e931443d23255720cb4d0716831c69..eb8d3d911f3fc5b6fc6ac892a95ae12e58d0540d 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-06-15 15:20:52 +02:00
|
|
|
@@ -74,6 +74,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
|
2021-08-26 04:16:27 +02:00
|
|
|
index ae2937e6b6b0ac150f6f608459d2b75a05e16c36..3e52bdd450c5af9a455b627dc8997cbcc7dd1f59 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
|
2021-08-25 09:59:26 +02:00
|
|
|
@@ -1726,6 +1726,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
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-06-14 18:58:00 +02:00
|
|
|
index 8fb89326395a7e70982c0d757b506565e98b12a4..a060cca08631fb42041e3a79a9abc422fe7757af 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-06-14 18:58:00 +02:00
|
|
|
@@ -44,11 +44,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
|
2021-08-14 12:01:07 +02:00
|
|
|
index 0c7ed53964675c81185644549898369cdda80377..3227ce58391b93c12dd01e2b73a3a6c5d6062827 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
|
2021-07-07 12:04:34 +02:00
|
|
|
@@ -3277,7 +3277,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-06-11 14:02:28 +02:00
|
|
|
- List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushableBy(this));
|
|
|
|
+ List<Entity> list = this.level.getEntities(this, this.getBoundingBox(), EntitySelector.pushable(this, level.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
// Paper - move up
|
2021-07-07 12:04:34 +02:00
|
|
|
@@ -3444,9 +3444,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-06-16 00:24:12 +02:00
|
|
|
index 9cd91a73ae1a6ad550b9482db1fb7d72d7247c6e..153194d937d210e2e4fd8864e4a3c000f85d7e2e 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-06-14 18:58:00 +02:00
|
|
|
index 23f87848b42d180c94b5659b184a768a756deed8..345fe87d5d6c3883c28d2c1b34d1020e18864d97 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-06-14 18:58:00 +02:00
|
|
|
@@ -380,8 +380,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-07-07 08:52:40 +02:00
|
|
|
index e9cfe18bc6be3bc6f2d18c25b6b69e67d62ee946..5c104bf219e5e4acb8acfb160bd92f0a0621d864 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-07-07 08:52:40 +02:00
|
|
|
@@ -239,7 +239,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-06-16 00:24:12 +02:00
|
|
|
index 069cdfce085909991a69ebec3004d407526d469d..5fc66d7096afcfe63eba774e1dc330ac3263e4b0 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-06-14 18:58:00 +02:00
|
|
|
@@ -345,7 +345,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-06-14 18:58:00 +02:00
|
|
|
index fa889f93a5c6782957bdbf803915cb5e80e05f3e..9653b142c199c068e4d6175bcd3cbecb6465853f 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-06-14 18:58:00 +02:00
|
|
|
@@ -149,7 +149,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-06-14 18:58:00 +02:00
|
|
|
index 3f1059569da23bd02c00279050bf7bce7a160462..a1b93f2878e22fa1d0cad639416d2dc5b8339c73 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;
|
|
|
|
}
|
|
|
|
|