mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 09:23:42 +01:00
b31089a929
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: d264e972 #591: Add option for a consumer before spawning an item 1c537fce #590: Add spawn and transform reasons for piglin zombification. CraftBukkit Changes: ee5006d1 #810: Add option for a consumer before spawning an item f6a39d3c #809: Add spawn and transform reasons for piglin zombification. 0c24068a Organise imports Spigot Changes: bff52619 Organise imports
179 lines
8.7 KiB
Diff
179 lines
8.7 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index b4d76494851601d61a69e2f060727a68f4461267..6262246c4018c660705fbad028f297fc44e7197f 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -710,4 +710,9 @@ public class PaperWorldConfig {
|
|
wanderingTraderSpawnChanceMin = getInt("wandering-trader.spawn-chance-min", wanderingTraderSpawnChanceMin);
|
|
wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax);
|
|
}
|
|
+
|
|
+ public boolean fixClimbingBypassingCrammingRule = false;
|
|
+ private void fixClimbingBypassingCrammingRule() {
|
|
+ fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
|
index aa1807502131893f29be5918b533aabe83f87514..8e71f7a8b62d89f2d770b03b4730d3d030717bfd 100644
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
|
@@ -1483,6 +1483,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
|
}
|
|
|
|
public boolean isCollidable() {
|
|
+ // Paper start
|
|
+ return isCollidable(false);
|
|
+ }
|
|
+
|
|
+ public boolean isCollidable(boolean ignoreClimbing) {
|
|
+ // Paper end
|
|
return false;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
index 97425f38ac05c24433dc27c5cda74c36871d61a9..0ef9516fbe9283cb1aca71eb9dbdbec0d98c8fa4 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
|
@@ -327,7 +327,7 @@ public class EntityArmorStand extends EntityLiving {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return false;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
|
|
index c1af257c1155d79ceff7211e1c37b4ddb9e1a19a..451ffcfd1fc9fa3091dc2bd697e5d829dcf6443f 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityBat.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityBat.java
|
|
@@ -51,7 +51,7 @@ public class EntityBat extends EntityAmbient {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return false;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
|
|
index 45fea38933d57e52dea19317c65682d57114a077..fdfdf83c28c3065fa89fba9e44b3da99f9791e0e 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityBoat.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
|
|
@@ -106,7 +106,7 @@ public class EntityBoat extends Entity {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return true;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
index 9ecad93e6464644fb147f3e2a770f29c0fe762c7..410578d7baf08db330b708a6c5517c4986258f97 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
|
|
@@ -166,7 +166,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return !this.isVehicle();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index cac3138b98ad2df4b63c77edb16c6c0c3951487c..ac800f307dbf18d2fa074a95f1d32bab84cb6cbd 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -43,7 +43,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
// CraftBukkit end
|
|
|
|
-import co.aikar.timings.MinecraftTimings; // Paper
|
|
|
|
public abstract class EntityLiving extends Entity {
|
|
|
|
@@ -2865,7 +2864,7 @@ public abstract class EntityLiving extends Entity {
|
|
return;
|
|
}
|
|
// Paper - end don't run getEntities if we're not going to use its result
|
|
- List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this));
|
|
+ List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.pushable(this, world.paperConfig.fixClimbingBypassingCrammingRule)); // Paper - fix climbing bypassing cramming rule
|
|
|
|
if (!list.isEmpty()) {
|
|
// Paper - move up
|
|
@@ -3003,9 +3002,16 @@ public abstract class EntityLiving extends Entity {
|
|
return !this.dead && this.collides; // CraftBukkit
|
|
}
|
|
|
|
+ // Paper start
|
|
@Override
|
|
public boolean isCollidable() {
|
|
- return this.isAlive() && !this.isSpectator() && !this.isClimbing() && this.collides; // CraftBukkit
|
|
+ return this.isCollidable(world.paperConfig.fixClimbingBypassingCrammingRule);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCollidable(boolean ignoreClimbing) {
|
|
+ return this.isAlive() && !this.isSpectator() && (ignoreClimbing || !this.isClimbing()) && this.collides; // CraftBukkit
|
|
+ // Paper end
|
|
}
|
|
|
|
// CraftBukkit start - collidable API
|
|
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
index 9af2bb392881900d74803cccd093d96b08673a25..efe5c0cecaf12ef921f6d32ff6670eff051bf323 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
|
@@ -107,7 +107,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
+ public boolean isCollidable(boolean ignoreClimbing) { // Paper
|
|
return true;
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityParrot.java b/src/main/java/net/minecraft/server/EntityParrot.java
|
|
index 1c682a62b8fd871848ebe8ff0dc576da6bb28810..0af6c9395b5d98e6bfa162f651d0e8cb89035afd 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityParrot.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityParrot.java
|
|
@@ -314,8 +314,8 @@ public class EntityParrot extends EntityPerchable implements EntityBird {
|
|
}
|
|
|
|
@Override
|
|
- public boolean isCollidable() {
|
|
- return super.isCollidable(); // 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/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
index 56fc1777401ab0fbebbbaf21f33f63c078dc9505..b5e1a860a2569d7668330827614d221b60f3fc78 100644
|
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
|
@@ -43,11 +43,17 @@ public final class IEntitySelector {
|
|
}
|
|
|
|
public static Predicate<Entity> a(Entity entity) {
|
|
+ // Paper start - ignoreClimbing param
|
|
+ return pushable(entity, false);
|
|
+ }
|
|
+
|
|
+ public static Predicate<Entity> pushable(Entity entity, boolean ignoreClimbing) {
|
|
+ // Paper end
|
|
ScoreboardTeamBase scoreboardteambase = entity.getScoreboardTeam();
|
|
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteambase == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteambase.getCollisionRule();
|
|
|
|
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.g.and((entity1) -> {
|
|
- if (!entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API
|
|
+ if (!entity1.isCollidable(ignoreClimbing) || !entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API // Paper - isCollidable
|
|
return false;
|
|
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) {
|
|
return false;
|