Paper/Spigot-Server-Patches/0533-Add-entity-liquid-API.patch
Aikar 9788250b10
Clean up a lot of obfuscation helpers and impls
This fixes a bug with obfuscation helpers for attack cooldown
But every other change should stay the same.

Cleaning up a lot of helpers that pointed to already unobfuscated items.
Also adds final to many of the obfhelpers to assist with inlining.

This is pretty much a patch maintenance
2020-08-02 01:39:36 -04:00

80 Zeilen
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 9b5cad1f1137cb6c73f423dada1ae027218086ca..5a8bcd91dc5d030be531124106005ddf513e627f 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 final 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 final 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 final 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 a525a9e29f46c889a10d8c9fb70d8389fc204226..d1df4e5799de4bf0a1fcc6940e2498374cd3db9d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1087,5 +1087,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
}