geforkt von Mirrors/Paper
72e87abc2d
Co-authored-by: Paul Sauve <paul@technove.co>
158 Zeilen
8.0 KiB
Diff
158 Zeilen
8.0 KiB
Diff
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
|
|
index 73a2ddf2806ea1e1826d553b7d13cf4d58be43fc..01c5a986d7d5c87cb7bf574a2f59e57dd5b347e2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2049,6 +2049,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
}
|
|
|
|
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
|
|
index d15e62da0307728a7c2be191a27f87da1bb29f49..de06ae3e8757c923a6f3f475a34885d2f15af46e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
|
@@ -45,11 +45,17 @@ public final class EntitySelector {
|
|
}
|
|
|
|
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) -> {
|
|
- 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
|
|
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
|
|
index 7b0e6f975ee00be6fc36c22ef586d4f0d4ce06ee..e4fd0bc35064e7962c7e43f9d0ee502463a6085f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -3398,7 +3398,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
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, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
|
|
|
if (!list.isEmpty()) {
|
|
// Paper - moved up
|
|
@@ -3558,9 +3558,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
return !this.isRemoved() && this.collides; // CraftBukkit
|
|
}
|
|
|
|
+ // Paper start
|
|
@Override
|
|
public boolean isPushable() {
|
|
- return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
|
|
+ return this.isCollidable(this.level().paperConfig().collisions.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
|
|
index 867717f130b6fcd48f39d40b10b3f514dbb8798c..5beaa849a250ea005733250ad3edfa8382224667 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
@@ -87,7 +87,7 @@ public class Bat extends AmbientCreature {
|
|
}
|
|
|
|
@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
|
|
index 2f5056b00e4475906ffb1f1938cacb191169809d..e1874aaa0065a6e8e6ae043713c22f08b58b5e21 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
|
|
@@ -381,8 +381,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
|
|
}
|
|
|
|
@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
|
|
index 9c58a60adad7e72ca6bbc5093836d7ebc584add4..07116849e39ef891182fe603d34d7fd8aee6c046 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
|
@@ -284,7 +284,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
|
}
|
|
|
|
@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
|
|
index 498c6664fcfb028111031691348bfa2eb21d605b..5c6e060a54ffb13c37ff5711992e964bdd59643d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
|
@@ -343,7 +343,7 @@ public class ArmorStand extends LivingEntity {
|
|
}
|
|
|
|
@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
|
|
index c2a18a8e52f897bc96227854646e53e4dc189362..1f909082eb123bfe37e1078962ee7d71c78a8194 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
|
|
@@ -148,7 +148,7 @@ public abstract class AbstractMinecart extends Entity {
|
|
}
|
|
|
|
@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
|
|
index a42f47ba5fd6c075d915c6d9d076aa4d154aeac6..415c6fd01dd871729c054f916702f9f3062c346c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
|
|
@@ -160,7 +160,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isPushable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return true;
|
|
}
|
|
|