mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
parent
e0cae289c4
commit
5a17ba07bb
2 changed files with 130 additions and 0 deletions
51
Spigot-API-Patches/0215-Add-entity-liquid-API.patch
Normal file
51
Spigot-API-Patches/0215-Add-entity-liquid-API.patch
Normal file
|
@ -0,0 +1,51 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Thu, 2 Jul 2020 18:11:33 -0500
|
||||
Subject: [PATCH] Add entity liquid API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index d4c776f32caf0491670175a79584c73dd2c7fcca..7808ade92ccd3553056c57cdf77464fb8bdf9312 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -659,5 +659,40 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull
|
||||
org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water
|
||||
+ */
|
||||
+ public boolean isInWater();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in rain
|
||||
+ */
|
||||
+ public boolean isInRain();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in bubble column
|
||||
+ */
|
||||
+ public boolean isInBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or rain
|
||||
+ */
|
||||
+ public boolean isInWaterOrRain();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or bubble column
|
||||
+ */
|
||||
+ public boolean isInWaterOrBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in water or rain or bubble column
|
||||
+ */
|
||||
+ public boolean isInWaterOrRainOrBubbleColumn();
|
||||
+
|
||||
+ /**
|
||||
+ * Check if entity is in lava
|
||||
+ */
|
||||
+ public boolean isInLava();
|
||||
// Paper end
|
||||
}
|
79
Spigot-Server-Patches/0532-Add-entity-liquid-API.patch
Normal file
79
Spigot-Server-Patches/0532-Add-entity-liquid-API.patch
Normal file
|
@ -0,0 +1,79 @@
|
|||
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
|
||||
}
|
Loading…
Reference in a new issue