testserver/Spigot-Server-Patches/0253-SkeletonHorse-Addition...

76 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 27 Jul 2018 22:36:31 -0500
Subject: [PATCH] SkeletonHorse Additions
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
index 187c21efe4899f84666af4007f34b488e3e7f7d4..abbc12c8e0767cf70ae5558979f1e49e8e52dd5c 100644
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
@@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
private final PathfinderGoalHorseTrap bw = new PathfinderGoalHorseTrap(this);
private boolean bx;
- private int by;
+ private int by; public int getTrapTime() { return this.by; } // Paper - OBFHELPER
public EntityHorseSkeleton(EntityTypes<? extends EntityHorseSkeleton> entitytypes, World world) {
super(entitytypes, world);
@@ -125,10 +125,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
return 0.96F;
}
+ public boolean isTrap() { return this.eM(); } // Paper - OBFHELPER
public boolean eM() {
return this.bx;
}
+ public void setTrap(boolean trap) { this.t(trap); } // Paper - OBFHELPER
public void t(boolean flag) {
if (flag != this.bx) {
this.bx = flag;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
index 8433a1a9a7de6a705a7fbecb593742ffa2e544f0..6a9af67d03737041a8f78c85a166c79a841ec8e5 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
@@ -16,6 +16,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
@Override
public void e() {
WorldServer worldserver = (WorldServer) this.a.world;
+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper
DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates());
this.a.t(false);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
index e822c2200d6270ca538eadd9637b748fc3602cb6..2a7d1d4ec2c1ff16840614165c6f0c37dc534d87 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
@@ -26,4 +26,26 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo
public Variant getVariant() {
return Variant.SKELETON_HORSE;
}
+
+ // Paper start
+ @Override
+ public EntityHorseSkeleton getHandle() {
+ return (EntityHorseSkeleton) super.getHandle();
+ }
+
+ @Override
+ public int getTrapTime() {
+ return getHandle().getTrapTime();
+ }
+
+ @Override
+ public boolean isTrap() {
+ return getHandle().isTrap();
+ }
+
+ @Override
+ public void setTrap(boolean trap) {
+ getHandle().setTrap(trap);
+ }
+ // Paper end
}