aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0607-added-Wither-API.patch
blob: 1995967f84320795293f9affb41fe92d727b49f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 9a89e6ff72d285a941be986300ff5c2a723a80e0..c4b075fffae1e535b887740d48bd26da223d6798 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
@@ -83,6 +83,11 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
         return entityliving.getMobType() != MobType.UNDEAD && entityliving.attackable();
     };
     private static final TargetingConditions TARGETING_CONDITIONS = TargetingConditions.forCombat().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);
@@ -591,7 +596,7 @@ public class WitherBoss extends Monster implements PowerableMob, 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 640b0860fbe3412da32d03187e6f355ba8f099ea..299d5e47489cfe489ac130a33a08cdb29ba76d72 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 this.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
 }