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/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2023-03-14 21:25:13 +01:00
|
|
|
index f4cca3313b0a5ac69f5b47da727d9ea3e2b7ffc5..25e8dcca51dbefc027d985ba09b973fac17702f7 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
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -1929,6 +1929,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
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
|
2022-11-19 22:14:19 +01:00
|
|
|
index 302676ef78ed5b3b7fc1b04851447ca72eed10c0..a00c3d96f2fc7131d1f4afa7af4e41ace3cfce89 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
|
2023-03-14 21:25:13 +01:00
|
|
|
index 164c22a70f4b916615da36819cae09d94cd88d39..c7209675ad3eeca881da75bfc0c3212204da898e 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
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -3356,7 +3356,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2022-12-07 21:16:54 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Paper end - don't run getEntities if we're not going to use its result
|
|
|
|
- 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().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
// Paper - moved up
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -3516,9 +3516,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
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
|
2022-06-09 10:51:45 +02:00
|
|
|
+ return this.isCollidable(level.paperConfig().collisions.fixClimbingBypassingCrammingRule);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @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
|
2023-03-14 21:25:13 +01:00
|
|
|
index eb53029868ceebe08281ae1012e5ae95d555fc93..f5efdf59617d43de18a2267351fa784c0be3ae83 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
|
2022-12-07 21:16:54 +01:00
|
|
|
@@ -85,7 +85,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
|
2023-03-14 21:25:13 +01:00
|
|
|
index 047f8cc00eb361eecc2cb93980b56d61d09a014c..e6e40770acf71b9079e8f6ac07025319dd8e2e4e 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
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -381,8 +381,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
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
|
2023-03-14 21:25:13 +01:00
|
|
|
index 0a1d441837a74184cdb4fd234981fc0547375dda..68788aa7a1db1468aecf0a2acb1ac03d92c9f5b9 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
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -285,7 +285,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
|
2023-03-14 21:25:13 +01:00
|
|
|
index 3be5ea477cb3dd3ce75f3feced8daf7cce7075cd..3677dd991ae73428984e62e4d6fb757317987887 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
|
2023-03-14 21:25:13 +01:00
|
|
|
@@ -343,7 +343,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
|
2023-03-14 21:25:13 +01:00
|
|
|
index 1e39bdb3146bcc577abc77021d7b9c9dcce51f4c..aa474c7bc8bb8f1ecfefc49da987011da298fa67 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
|
2022-12-07 21:16:54 +01:00
|
|
|
@@ -146,7 +146,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
|
2023-03-14 21:25:13 +01:00
|
|
|
index f2a3e239ec812f717d0bb209b7894a6b5b9b950a..e8c201d45497e212cfeba125a9261d75198cadf7 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
|
2022-12-07 21:16:54 +01:00
|
|
|
@@ -159,7 +159,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
- public boolean isPushable() {
|
|
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|