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-06-08 01:56:33 +02:00
|
|
|
index a4926cdfeac99b78ca2551a8d0e6f1fab9ca985b..f359cf2f9e3a866a569ca3a97f8373758e0140e2 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-06-08 01:56:33 +02:00
|
|
|
@@ -1964,6 +1964,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
|
2023-06-08 01:56:33 +02:00
|
|
|
index 9edea92834306b39abda36ba9be4e8796f113cc4..f6e5406f84410ab9c177213157106739a2074cf8 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;
|
2023-06-08 01:56:33 +02:00
|
|
|
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
|
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
|
2023-06-08 01:56:33 +02:00
|
|
|
index 84f56d1eb0075f1f3d3d52d1b893732c3804c276..922e953234998f1322cb9fb72b02321b7975a674 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-06-08 01:56:33 +02:00
|
|
|
@@ -3405,7 +3405,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));
|
|
|
|
+ List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
2022-12-07 21:16:54 +01:00
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
// Paper - moved up
|
2023-06-08 01:56:33 +02:00
|
|
|
@@ -3565,9 +3565,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
|
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
|
|
|
|
+ // 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-06-08 01:56:33 +02:00
|
|
|
index 8aae860fae71570d88453d0d56d40a519f889326..940cd932e74bc2e6754186731d7aa6f10d56eb68 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-06-08 01:56:33 +02:00
|
|
|
index a32845854d9575ae950c47179ceff4ac149ebc01..3cc7af656433117991547476c118b58cff95e8e2 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-06-08 01:56:33 +02:00
|
|
|
index d4c874f4ba924f9f2067e22846a41699ad190a60..bb2a75f25a2959c8d387836f806b544b73e2e7c7 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-06-08 01:56:33 +02:00
|
|
|
@@ -281,7 +281,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-06-08 01:56:33 +02:00
|
|
|
index 101e3a1f0f52b67b55c99c2619cc43298d92a3f2..8a8b9e8983be1acad66ad875c901be5bbdeabb1f 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-06-08 01:56:33 +02:00
|
|
|
index c2a18a8e52f897bc96227854646e53e4dc189362..1f909082eb123bfe37e1078962ee7d71c78a8194 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
|
2023-06-08 01:56:33 +02: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
|
2023-06-08 01:56:33 +02:00
|
|
|
index d204de1793b4e37b18dd7ac705858cdf8bbc6aa0..b978d5fb28ef1472bd890df0229cf7535ead6b00 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
|
2023-05-12 13:10:08 +02:00
|
|
|
@@ -160,7 +160,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;
|
|
|
|
}
|
|
|
|
|