mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 12:11:47 +01:00
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
75 lines
3 KiB
Diff
75 lines
3 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 ad5139428e8cc10ed702dce3fa9c091c22eafa15..83a469447e39b801442769fcb5979e987e2adae9 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 017410819a628c1b373f45ac5a0e9f00dd56639e..dc42bd1b2b89881789481d736a57011936857abf 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1134,5 +1134,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
|
|
}
|