Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ladders should not bypass cramming gamerule
- Loading branch information
1 parent
6bdc067
commit 96e0202
Showing
1 changed file
with
81 additions
and
0 deletions.
There are no files selected for viewing
81 changes: 81 additions & 0 deletions
81
patches/server/0057-Ladders-should-not-bypass-cramming-gamerule.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
From ac28dfadae1f57e33186f99b14d3f77fdb498f68 Mon Sep 17 00:00:00 2001 | ||
From: William Blake Galbreath <blake.galbreath@gmail.com> | ||
Date: Sun, 21 Jul 2019 18:06:20 -0500 | ||
Subject: [PATCH] Ladders should not bypass cramming gamerule | ||
|
||
--- | ||
src/main/java/net/minecraft/server/Entity.java | 5 +++++ | ||
src/main/java/net/minecraft/server/EntityLiving.java | 11 +++++++++-- | ||
.../java/net/minecraft/server/IEntitySelector.java | 7 ++++++- | ||
3 files changed, 20 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java | ||
index cfe21c2e70..1857cfb877 100644 | ||
--- a/src/main/java/net/minecraft/server/Entity.java | ||
+++ b/src/main/java/net/minecraft/server/Entity.java | ||
@@ -1523,6 +1523,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke | ||
} | ||
|
||
public boolean isCollidable() { | ||
+ // Purpur start | ||
+ return isCollidable(false); | ||
+ } | ||
+ public boolean isCollidable(boolean ignoreClimbing) { | ||
+ // Purpur end | ||
return false; | ||
} | ||
|
||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java | ||
index a14553a799..1fb6e8e052 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityLiving.java | ||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java | ||
@@ -2609,7 +2609,7 @@ public abstract class EntityLiving extends Entity { | ||
protected void doTick() {} | ||
|
||
protected void collideNearby() { | ||
- List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this)); | ||
+ List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), IEntitySelector.a(this, true)); // Purpur | ||
|
||
if (!list.isEmpty()) { | ||
int i = this.world.getGameRules().getInt(GameRules.MAX_ENTITY_CRAMMING); | ||
@@ -2748,7 +2748,14 @@ public abstract class EntityLiving extends Entity { | ||
|
||
@Override | ||
public boolean isCollidable() { | ||
- return this.isAlive() && !this.isClimbing() && this.collides; // CraftBukkit | ||
+ // Purpur start | ||
+ return isCollidable(false); | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean isCollidable(boolean ignoreClimbing) { | ||
+ return this.isAlive() && (ignoreClimbing || !isClimbing()) && this.collides; // CraftBukkit | ||
+ // Purpur end | ||
} | ||
|
||
@Override | ||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java | ||
index 56488b78dd..7ef7fe228b 100644 | ||
--- a/src/main/java/net/minecraft/server/IEntitySelector.java | ||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java | ||
@@ -32,11 +32,16 @@ public final class IEntitySelector { | ||
} | ||
|
||
public static Predicate<Entity> a(Entity entity) { | ||
+ // Purpur start | ||
+ return a(entity, false); | ||
+ } | ||
+ public static Predicate<Entity> a(Entity entity, boolean ignoreClimbing) { | ||
+ // Purpur 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.f.and((entity1) -> { | ||
- if (!entity1.isCollidable()) { | ||
+ if (!entity1.isCollidable(ignoreClimbing)) { // Purpur | ||
return false; | ||
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).dG())) { | ||
return false; | ||
-- | ||
2.20.1 | ||
|