Paper/Spigot-Server-Patches/0224-Enderman.teleportRandomly.patch
2019-04-28 20:14:31 -07:00

35 lines
1.7 KiB
Diff

From c80235802b0eb5c67f0682ef37f8bb4f257671d4 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 30 Apr 2018 13:29:44 -0400
Subject: [PATCH] Enderman.teleportRandomly()
Ability to trigger the vanilla "teleport randomly" mechanic of an enderman.
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 2b484c819..e441fa234 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -190,6 +190,7 @@ public class EntityEnderman extends EntityMonster {
super.mobTick();
}
+ public final boolean teleportRandomly() { return this.dW(); } // Paper - OBFHELPER
protected boolean dW() {
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
index da8a70d6a..e56da9085 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
@@ -16,6 +16,7 @@ public class CraftEnderman extends CraftMonster implements Enderman {
super(server, entity);
}
+ @Override public boolean teleportRandomly() { return getHandle().teleportRandomly(); } // Paper
public MaterialData getCarriedMaterial() {
IBlockData blockData = getHandle().getCarried();
return (blockData == null) ? Material.AIR.getNewData((byte) 0) : CraftMagicNumbers.getMaterial(blockData);
--
2.21.0