Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
76 Zeilen
3.0 KiB
Diff
76 Zeilen
3.0 KiB
Diff
|
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/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||
|
index 1f330d852eb9b3a36570542e10a88ae065798714..fd91c80cd6337b5fa41d6060ecdb44b8fa68a16a 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
|
||
|
@@ -80,6 +80,11 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||
|
return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable();
|
||
|
};
|
||
|
private static final TargetingConditions TARGETING_CONDITIONS = (new TargetingConditions()).range(20.0D).selector(WitherBoss.LIVING_ENTITY_SELECTOR);
|
||
|
+ // Paper start
|
||
|
+ private boolean canPortal = false;
|
||
|
+
|
||
|
+ public void setCanTravelThroughPortals(boolean canPortal) { this.canPortal = canPortal; }
|
||
|
+ // Paper end
|
||
|
|
||
|
public WitherBoss(EntityType<? extends WitherBoss> type, Level world) {
|
||
|
super(type, world);
|
||
|
@@ -578,6 +583,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||
|
this.entityData.set((EntityDataAccessor) WitherBoss.DATA_TARGETS.get(headIndex), id);
|
||
|
}
|
||
|
|
||
|
+ public final boolean isPowered() { return this.isPowered(); } // Paper - OBFHELPER
|
||
|
public boolean isPowered() {
|
||
|
return this.getHealth() <= this.getMaxHealth() / 2.0F;
|
||
|
}
|
||
|
@@ -594,7 +600,7 @@ public class WitherBoss extends Monster implements RangedAttackMob {
|
||
|
|
||
|
@Override
|
||
|
public boolean canChangeDimensions() {
|
||
|
- return false;
|
||
|
+ return super.canChangeDimensions() && 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 fdcd680b972da54f9cdb41dff5563e42bd12d8e3..a09f46c586416b77dda40067fe1639a9250af3f0 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().getInvulnerableTicks();
|
||
|
+ }
|
||
|
+
|
||
|
+ @Override
|
||
|
+ public void setInvulnerableTicks(int ticks) {
|
||
|
+ getHandle().setInvulnerableTicks(ticks);
|
||
|
+ }
|
||
|
+
|
||
|
+ @Override
|
||
|
+ public boolean canTravelThroughPortals() {
|
||
|
+ return getHandle().canChangeDimensions();
|
||
|
+ }
|
||
|
+
|
||
|
+ @Override
|
||
|
+ public void setCanTravelThroughPortals(boolean value) {
|
||
|
+ getHandle().setCanTravelThroughPortals(value);
|
||
|
+ }
|
||
|
+ // Paper end
|
||
|
}
|