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
2024-08-31 20:29:50 +02:00
index 6ab665efcac4c2543bab9d95472026e0ec8580c5..dae7643897b47dba304cbea56112445df2736cff 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
2024-07-29 00:28:28 +02:00
@@ -2079,6 +2079,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2021-06-11 14:02:28 +02:00
}
public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ // Paper start - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
+ return isCollidable(false);
+ }
+
+ public boolean isCollidable(boolean ignoreClimbing) {
2024-01-20 12:50:16 +01:00
+ // Paper end - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
return false;
}
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
2024-09-15 22:26:23 +02:00
index eb425fac573881f3aad09ae75a32184fb0e325a6..302decdccd37c5579473c8fc33adda3956be7603 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
2023-12-06 04:00:14 +01:00
@@ -46,11 +46,16 @@ public final class EntitySelector {
2021-06-11 14:02:28 +02:00
}
public static Predicate<Entity> pushableBy(Entity entity) {
2024-01-20 12:50:16 +01:00
+ // Paper start - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
+ return pushable(entity, false);
+ }
+ public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
2024-01-20 12:50:16 +01:00
+ // Paper end - Climbing should not bypass cramming gamerule
2023-12-06 04:00:14 +01:00
PlayerTeam scoreboardteam = entity.getTeam();
Team.CollisionRule scoreboardteambase_enumteampush = scoreboardteam == null ? Team.CollisionRule.ALWAYS : scoreboardteam.getCollisionRule();
2021-06-11 14:02:28 +02:00
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
2024-01-20 12:50:16 +01:00
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
return false;
2024-09-15 22:26:23 +02:00
} else if (entity1 instanceof Player && entity instanceof Player && !io.papermc.paper.configuration.GlobalConfiguration.get().collisions.enablePlayerCollisions) { // Paper - Configurable player collision
2021-06-11 14:02:28 +02:00
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2024-09-19 16:36:07 +02:00
index 906e8589483b93bcdb55677f7f942f6c7a89caf8..d94c3e86885c5a8ba636988d29f98b496e13b627 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
2024-07-06 21:19:14 +02:00
@@ -3573,7 +3573,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
2023-06-08 01:56:33 +02:00
- List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
2024-01-20 12:50:16 +01:00
+ List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
2022-12-07 21:16:54 +01:00
if (!list.isEmpty()) {
2024-01-21 12:11:43 +01:00
// Paper - don't run getEntities if we're not going to use its result; moved up
2024-07-06 21:19:14 +02:00
@@ -3765,9 +3765,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
}
2024-01-20 12:50:16 +01:00
+ // Paper start - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
@Override
public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
2023-06-08 01:56:33 +02:00
+ return this.isCollidable(this.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
2024-01-20 12:50:16 +01:00
+ // Paper end - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
}
// 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
2024-04-24 15:46:45 +02:00
index 934fa26b8f347b8b2d90f79370b62165c0cdc312..dc27ddf5131e7398a5390a5187261d4c7fb6ccaa 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
2024-04-24 15:46:45 +02:00
@@ -88,7 +88,7 @@ public class Bat extends AmbientCreature {
2021-06-11 14:02:28 +02:00
}
@Override
- public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
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
2024-06-13 22:57:13 +02:00
index 12b2267cba476547d510d9161b25a28f4f5c798e..97931bfd360725945ab9606ff698b518ae101076 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
2024-06-13 22:57:13 +02:00
@@ -362,8 +362,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
2024-01-20 12:50:16 +01:00
+ 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
2021-06-11 14:02:28 +02:00
}
@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
2024-06-13 22:57:13 +02:00
index 45ba002e23258ef734012ae81b2c4c9e92d863fb..affa2e133611b7a045a99bac801398263d114ba7 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
2024-06-13 22:57:13 +02:00
@@ -356,7 +356,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
2021-06-11 14:02:28 +02:00
}
@Override
- public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
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
2024-06-13 22:57:13 +02:00
index cc1189c2d7dc57ba8f29aad4ba5d2a07362bcd5b..5bcb9a53ebebeef4bd6ec2458df4b63002ebd804 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
2024-06-13 22:57:13 +02:00
@@ -349,7 +349,7 @@ public class ArmorStand extends LivingEntity {
2021-06-11 14:02:28 +02:00
}
@Override
- public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
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
2024-09-19 16:36:07 +02:00
index 351e581c55d38e652fc3397f95a0837a6ee3656c..4d8c14d3a42f3e4b963cf5f8fa764df79813912b 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
2024-04-24 15:46:45 +02:00
@@ -169,7 +169,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
2021-06-11 14:02:28 +02:00
}
@Override
- public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
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
2024-06-13 22:57:13 +02:00
index 26dd7c9f48f15f66a326901259ee89f4ab911526..2cb535639bff0e867c1b1e845fee6e34bb237044 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
2024-06-13 22:57:13 +02:00
@@ -154,7 +154,7 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
2021-06-11 14:02:28 +02:00
}
@Override
- public boolean isPushable() {
2024-01-20 12:50:16 +01:00
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - Climbing should not bypass cramming gamerule
2021-06-11 14:02:28 +02:00
return true;
}