3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-22 14:28:09 +01:00
Paper/patches/server-unmapped/0655-added-Wither-API.patch

76 Zeilen
2.9 KiB
Diff

2021-06-11 14:02:28 +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/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
index 30290c0208a4725b2eb0e7764465c354e592e4ee..170b085c76e092f6d7b14095c66c84fa9a96a1fc 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -82,6 +82,11 @@ 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);
@@ -580,6 +585,7 @@ 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;
}
@@ -596,7 +602,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
@Override
public boolean canPortal() {
- return false;
+ return super.canPortal() && 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 1d94aeec37dcb9758d88ef25a5cad1333bbfbf6c..adf4ce8afa3a42ea8a184905969e03b6b756830f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java
@@ -38,4 +38,31 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok
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
}