2020-07-05 07:00:09 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Thu, 2 Jul 2020 18:11:43 -0500
|
|
|
|
Subject: [PATCH] Add entity liquid API
|
|
|
|
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
index 4a8f6c9a08c4e5012fd17978bf3b8e87a71f607b..1aa2f0f5c021345643c13fd9b6ef0a070c34c43c 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
@@ -1160,12 +1160,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-07-05 07:00:09 +00:00
|
|
|
return this.inWater;
|
|
|
|
}
|
|
|
|
|
|
|
|
- private boolean isInRain() {
|
|
|
|
+ public boolean isInRain() { // Paper - private -> public
|
|
|
|
BlockPosition blockposition = this.getChunkCoordinates();
|
|
|
|
|
2020-08-25 02:22:08 +00:00
|
|
|
return this.world.isRainingAt(blockposition) || this.world.isRainingAt(new BlockPosition((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ()));
|
2020-07-05 07:00:09 +00:00
|
|
|
}
|
|
|
|
|
2020-08-02 05:39:36 +00:00
|
|
|
+ public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
|
2020-07-05 07:00:09 +00:00
|
|
|
private boolean k() {
|
|
|
|
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
|
|
|
|
}
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -1179,6 +1180,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-07-05 07:00:09 +00:00
|
|
|
return this.isInWater() || this.isInRain() || this.k();
|
|
|
|
}
|
|
|
|
|
2020-11-03 02:22:15 +00:00
|
|
|
+ public final boolean isInWaterOrBubbleColumn() { return aH(); } // Paper - OBFHELPER
|
|
|
|
public boolean aH() {
|
2020-07-05 07:00:09 +00:00
|
|
|
return this.isInWater() || this.k();
|
|
|
|
}
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -1321,6 +1323,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-08-25 02:22:08 +00:00
|
|
|
return this.O == tag;
|
2020-07-05 07:00:09 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 02:22:15 +00:00
|
|
|
+ public final boolean isInLava() { return aQ(); } // Paper - OBFHELPER
|
|
|
|
public boolean aQ() {
|
2020-08-25 02:22:08 +00:00
|
|
|
return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D;
|
2020-07-05 07:00:09 +00:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2021-03-16 07:19:45 +00:00
|
|
|
index 27b90388cc21ffdccaabc8072ead1bd29f3e88c6..d76800778ccf05913ff887a566b3a2f11ec2d40b 100644
|
2020-07-05 07:00:09 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2021-03-16 07:19:45 +00:00
|
|
|
@@ -1133,5 +1133,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2020-07-05 07:00:09 +00:00
|
|
|
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
|
|
|
return getHandle().spawnReason;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean isInRain() {
|
|
|
|
+ return getHandle().isInRain();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isInBubbleColumn() {
|
|
|
|
+ return getHandle().isInBubbleColumn();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isInWaterOrRain() {
|
|
|
|
+ return getHandle().isInWaterOrRain();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isInWaterOrBubbleColumn() {
|
|
|
|
+ return getHandle().isInWaterOrBubbleColumn();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isInWaterOrRainOrBubbleColumn() {
|
|
|
|
+ return getHandle().isInWaterOrRainOrBubble();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isInLava() {
|
|
|
|
+ return getHandle().isInLava();
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|