Paper/Spigot-Server-Patches/0533-Add-entity-liquid-API.patch
Aikar 166e52b574
[CI-SKIP] [Auto] Rebuild Patches
A recent commit has been made that caused patches to be out of order, rebuilding
2020-07-05 03:07:02 -04:00

80 lines
3.0 KiB
Diff

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
index fcb3d3adae52fd70e856344a727a344cf78cfce3..9c4b02d776f8b99c6703c8dfc5d9fac0702bbe80 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1117,12 +1117,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.inWater;
}
- private boolean isInRain() {
+ public boolean isInRain() { // Paper - private -> public
BlockPosition blockposition = this.getChunkCoordinates();
return this.world.isRainingAt(blockposition) || this.world.isRainingAt(blockposition.a(0.0D, (double) this.size.height, 0.0D));
}
+ public boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
private boolean k() {
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
}
@@ -1136,6 +1137,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.isInWater() || this.isInRain() || this.k();
}
+ public boolean isInWaterOrBubbleColumn() { return aD(); } // Paper - OBFHELPER
public boolean aD() {
return this.isInWater() || this.k();
}
@@ -1286,6 +1288,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
this.inLava = true;
}
+ public boolean isInLava() { return aN(); } // Paper - OBFHELPER
public boolean aN() {
return this.inLava;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 821417610fdb23791bd83e263977026b9d09e31a..8002a38bcc806a5d79531fe1a9c12b2c5ac6c37b 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1065,5 +1065,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
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
}