PaperMC/Spigot-Server-Patches/added-Wither-API.patch

76 lines
2.8 KiB
Diff
Raw Normal View History

2020-07-06 00:41:43 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 5 Jul 2020 15:39:19 -0700
Subject: [PATCH] added Wither API
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
return entityliving.getMonsterType() != EnumMonsterType.UNDEAD && entityliving.ei();
};
private static final PathfinderTargetCondition bz = (new PathfinderTargetCondition()).a(20.0D).a(EntityWither.by);
+ // Paper start
+ private boolean canPortal = false;
+
+ public void setCanTravelThroughPortals(boolean canPortal) { this.canPortal = canPortal; }
+ // Paper end
public EntityWither(EntityTypes<? extends EntityWither> entitytypes, World world) {
super(entitytypes, world);
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.datawatcher.set((DataWatcherObject) EntityWither.bo.get(i), j);
}
+ public final boolean isPowered() { return this.S_(); } // Paper - OBFHELPER
public boolean S_() {
return this.getHealth() <= this.getMaxHealth() / 2.0F;
}
@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@Override
public boolean canPortal() {
- return false;
+ return canPortal; // Paper
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -0,0 +0,0 @@ public class CraftWither extends CraftMonster implements Wither, CraftRangedEnti
public BossBar getBossBar() {
return bossBar;
}
+
+ // Paper start
+ @Override
+ public boolean isCharged() {
+ return getHandle().isPowered();
+ }
+
+ @Override
+ public int getInvulnerableTicks() {
+ return getHandle().getInvul();
+ }
+
+ @Override
+ public void setInvulnerableTicks(int ticks) {
+ getHandle().setInvul(ticks);
+ }
+
+ @Override
+ public boolean canTravelThroughPortals() {
+ return getHandle().canPortal();
+ }
+
+ @Override
+ public void setCanTravelThroughPortals(boolean value) {
+ getHandle().setCanTravelThroughPortals(value);
+ }
+ // Paper end
}