Paper/Spigot-Server-Patches/0521-Add-entity-liquid-API.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

76 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 ded88464d102679423ac69d8a6c3cf4ba6fc516f..bf0ef3998ff5dd71d3d6489184ece7fdce8afdd5 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1075,12 +1075,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(new BlockPosition((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ()));
}
+ public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER
private boolean k() {
return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN);
}
@@ -1094,6 +1095,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.isInWater() || this.isInRain() || this.k();
}
+ public final boolean isInWaterOrBubbleColumn() { return aH(); } // Paper - OBFHELPER
public boolean aH() {
return this.isInWater() || this.k();
}
@@ -1236,6 +1238,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
return this.O == tag;
}
+ public final boolean isInLava() { return aQ(); } // Paper - OBFHELPER
public boolean aQ() {
return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 666876943675a8c299b414f6b5ea359aac186961..c7636ffc952c436d7148e6e5926b0108cc628821 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1120,5 +1120,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
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
}