2020-07-05 09:00:09 +02: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
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 13:29:53 +02:00
|
|
|
index d903460c32213fa2d5362671efc9e96b142daf9a..3e6ccdd5b54dbe51d4ee9ec979cbc2d0f335be70 100644
|
2020-07-05 09:00:09 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 13:29:53 +02:00
|
|
|
@@ -1074,12 +1074,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-07-05 09:00:09 +02:00
|
|
|
return this.inWater;
|
|
|
|
}
|
|
|
|
|
|
|
|
- private boolean isInRain() {
|
|
|
|
+ public boolean isInRain() { // Paper - private -> public
|
|
|
|
BlockPosition blockposition = this.getChunkCoordinates();
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
return this.world.isRainingAt(blockposition) || this.world.isRainingAt(new BlockPosition((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ()));
|
2020-07-05 09:00:09 +02:00
|
|
|
}
|
|
|
|
|
2020-08-02 07:39:36 +02:00
|
|
|
+ public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
|
2020-07-05 09:00:09 +02:00
|
|
|
private boolean k() {
|
|
|
|
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
|
|
|
|
}
|
2020-09-19 13:29:53 +02:00
|
|
|
@@ -1093,6 +1094,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-07-05 09:00:09 +02:00
|
|
|
return this.isInWater() || this.isInRain() || this.k();
|
|
|
|
}
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
+ public final boolean isInWaterOrBubbleColumn() { return aG(); } // Paper - OBFHELPER
|
|
|
|
public boolean aG() {
|
2020-07-05 09:00:09 +02:00
|
|
|
return this.isInWater() || this.k();
|
|
|
|
}
|
2020-09-19 13:29:53 +02:00
|
|
|
@@ -1235,6 +1237,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-08-25 04:22:08 +02:00
|
|
|
return this.O == tag;
|
2020-07-05 09:00:09 +02:00
|
|
|
}
|
|
|
|
|
2020-08-25 04:22:08 +02:00
|
|
|
+ public final boolean isInLava() { return aP(); } // Paper - OBFHELPER
|
|
|
|
public boolean aP() {
|
|
|
|
return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D;
|
2020-07-05 09:00:09 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2020-10-17 12:39:45 +02:00
|
|
|
index fb6fa1d15dc7d189a38e2cc78d9c7d24cf0af752..e3026d54cb6b6e8fe9164a1bc7d5500c62ba7211 100644
|
2020-07-05 09:00:09 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2020-10-17 12:39:45 +02:00
|
|
|
@@ -1103,5 +1103,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2020-07-05 09:00:09 +02:00
|
|
|
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() {
|
|
|
|
return getHandle().spawnReason;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean isInWater() {
|
|
|
|
+ return getHandle().isInWater();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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
|
|
|
|
}
|