3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0608-Climbing-should-not-bypass-cramming-gamerule.patch
Shane Freeder abca14ff96 Updated Upstream (Bukkit/CraftBukkit)
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:
6f9fe1d9 #562: Add API to set equipment silently
bcddb754 SPIGOT-6256: Add method to check if the entity is in water

CraftBukkit Changes:
878b4375 #772: Add API to set equipment silently
22d7fcc9 SPIGOT-6256: Add method to check if the entity is in water
2020-12-21 07:56:22 +00:00

180 Zeilen
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 80b0c08cef9a5326492b1faec020929fca59ff77..5596d9f42523dbcbad47d21a4b2fdba39e3c5590 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -699,4 +699,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 959848eba4900ece787373a3af201be8c6323ca2..091d55c04c663df07c69f637515f53990c3c2d46 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 0fd3a7ebddfd22d6640307452f525d1c2aaf4439..d6de166babe2e25a88f9e6dae462907e26b6fb6f 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 38ce3563106b02bfefb54a637713f27262ff258f..0a59e02d762a096cb3de62e0f8105cc5a5fab8d4 100644
--- a/src/main/java/net/minecraft/server/EntityBat.java
+++ b/src/main/java/net/minecraft/server/EntityBat.java
@@ -50,7 +50,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 8af1fe5d820f3bcb5e02dd2300e8e9cbd7e4e201..fcb31147622b4b81934be05ffc8de5e821ce69b7 100644
--- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java
@@ -165,7 +165,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 df66083880e8416d2ddb3ec5ef0290a489929942..53d193fab101192ee0e0a5519b78c354122db353 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 {
@@ -2853,7 +2852,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
@@ -2991,9 +2990,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;