From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Thu, 2 Jul 2020 18:11:43 -0500 Subject: [PATCH] Add entity liquid API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 96da70f1077f70c4bd5ba1196292a856deb25286..8531f1deea95aa8e73e75b714426c915a52a74af 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1305,12 +1305,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.wasTouchingWater; } - private boolean isInRain() { + public boolean isInRain() { // Paper - private -> public BlockPos blockposition = this.blockPosition(); return this.level.isRainingAt(blockposition) || this.level.isRainingAt(new BlockPos((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ())); } + public final boolean isInBubbleColumn() { return isInBubbleColumn(); } // Paper - OBFHELPER private boolean isInBubbleColumn() { return this.level.getBlockState(this.blockPosition()).is(Blocks.BUBBLE_COLUMN); } @@ -1324,6 +1325,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.isInWater() || this.isInRain() || this.isInBubbleColumn(); } + public final boolean isInWaterOrBubbleColumn() { return isInWaterOrBubble(); } // Paper - OBFHELPER public boolean isInWaterOrBubble() { return this.isInWater() || this.isInBubbleColumn(); } @@ -1463,6 +1465,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return this.fluidOnEyes == fluidTag; } + public final boolean isInLava() { return isInLava(); } // Paper - OBFHELPER public boolean isInLava() { return !this.firstTick && this.fluidHeight.getDouble(FluidTags.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 98d3818d38f487fc7e1302ee4af9e4898efec809..26bfbab1e8332f91c4d2814cd0056ca2ea7ddab7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1169,5 +1169,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 }