mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-09 21:48:11 +02:00
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 37262de8 PR-812: Add Registry#match(String) d6b40162 SPIGOT-4569: Add more BlockData API f9691891 PR-809: Throw a more clear error for BlockIterators with zero direction, add Vector#isZero() 91e79e19 PR-804: Added methods to get translation keys for materials, itemstacks and more 426b00d3 PR-795: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 0e91ea52 SPIGOT-7224: Add events for brewing stands and campfires starting their actions CraftBukkit Changes: a50301aa5 Fix issues with fluid tag conversion and fluid #isTagged 6aeb5e4c3 SPIGOT-4569: Implement more BlockData API 7dbf862c2 PR-1131: Added methods to get translation keys for materials, itemstacks and more 7167588b1 PR-1117: Add new BiomeParameterPoint passed to BiomeProvider#getBiome 7c44152eb SPIGOT-7224: Add events for brewing stands and campfires starting their actions
152 lines
10 KiB
Diff
152 lines
10 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Doc <nachito94@msn.com>
|
|
Date: Sun, 3 Apr 2022 11:31:42 -0400
|
|
Subject: [PATCH] Allow to change the podium for the EnderDragon
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
index c9051e80d329f1b10fa04d21f8891e85c44b5200..c7caaebfb4b9f28cbe700d88fdcf232a500e8ca7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
@@ -99,6 +99,10 @@ public class EnderDragon extends Mob implements Enemy {
|
|
private final int[] nodeAdjacency = new int[24];
|
|
private final BinaryHeap openSet = new BinaryHeap();
|
|
private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.BlockInteraction.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
|
+ // Paper start - add var for save custom podium
|
|
+ @Nullable
|
|
+ private BlockPos podium;
|
|
+ // Paper end
|
|
|
|
public EnderDragon(EntityType<? extends EnderDragon> entitytypes, Level world) {
|
|
super(EntityType.ENDER_DRAGON, world);
|
|
@@ -119,6 +123,19 @@ public class EnderDragon extends Mob implements Enemy {
|
|
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 200.0D);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public BlockPos getPodium() {
|
|
+ if (this.podium == null) {
|
|
+ return EndPodiumFeature.END_PODIUM_LOCATION;
|
|
+ }
|
|
+ return this.podium;
|
|
+ }
|
|
+
|
|
+ public void setPodium(@Nullable BlockPos blockPos) {
|
|
+ this.podium = blockPos;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public boolean isFlapping() {
|
|
float f = Mth.cos(this.flapTime * 6.2831855F);
|
|
@@ -969,7 +986,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
d0 = segment2[1] - segment1[1];
|
|
}
|
|
} else {
|
|
- BlockPos blockposition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.END_PODIUM_LOCATION);
|
|
+ BlockPos blockposition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.getPodium()); // Paper - use custom podium
|
|
double d1 = Math.max(Math.sqrt(blockposition.distToCenterSqr(this.position())) / 4.0D, 1.0D);
|
|
|
|
d0 = (double) segmentOffset / d1;
|
|
@@ -996,7 +1013,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
vec3d = this.getViewVector(tickDelta);
|
|
}
|
|
} else {
|
|
- BlockPos blockposition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.END_PODIUM_LOCATION);
|
|
+ BlockPos blockposition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.getPodium()); // Paper - use custom podium
|
|
|
|
f1 = Math.max((float) Math.sqrt(blockposition.distToCenterSqr(this.position())) / 4.0F, 1.0F);
|
|
float f3 = 6.0F / f1;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java
|
|
index a64ee433e34538ce2b52207b6183999ae611e5dd..0f78e1ab090bb1df7b863c90b3c7465a3ce28c8c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java
|
|
@@ -32,7 +32,7 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance {
|
|
public void doServerTick() {
|
|
++this.time;
|
|
if (this.targetLocation == null) {
|
|
- BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
|
|
+ BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - use custom podium
|
|
this.targetLocation = Vec3.atBottomCenterOf(blockPos);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java
|
|
index adec9aec93d545941a3d592b54c5fe064cdb1437..77206aba171d063691b8f32afcebd570784d7da2 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java
|
|
@@ -54,7 +54,7 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance {
|
|
|
|
private void findNewTarget() {
|
|
if (this.currentPath != null && this.currentPath.isDone()) {
|
|
- BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.END_PODIUM_LOCATION));
|
|
+ BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - use custom podium
|
|
int i = this.dragon.getDragonFight() == null ? 0 : this.dragon.getDragonFight().getCrystalsAlive();
|
|
if (this.dragon.getRandom().nextInt(i + 3) == 0) {
|
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.LANDING_APPROACH);
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java
|
|
index fdfdd42a30d752b11d18f2cefe84c1e9ddec41a2..5fca7c4e1d1d9da6f29ad70f1b5703c7f092d851 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java
|
|
@@ -52,7 +52,7 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance {
|
|
private void findNewTarget() {
|
|
if (this.currentPath == null || this.currentPath.isDone()) {
|
|
int i = this.dragon.findClosestNode();
|
|
- BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.END_PODIUM_LOCATION);
|
|
+ BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - use custom podium
|
|
Player player = this.dragon.level.getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ());
|
|
int j;
|
|
if (player != null) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java
|
|
index ed29ba6c5c4f1380847564f07b5523cce77ab865..2948d58f9f90b353b86eb43f932ab0574b3415f7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java
|
|
@@ -39,7 +39,7 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance {
|
|
@Override
|
|
public void doServerTick() {
|
|
if (this.targetLocation == null) {
|
|
- this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.END_PODIUM_LOCATION));
|
|
+ this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium())); // Paper - use custom podium
|
|
}
|
|
|
|
if (this.targetLocation.distanceToSqr(this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()) < 1.0D) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java
|
|
index 0ae65d0fa03d12486f48b0274b6e2d4eea169caf..ffe89d8c1f22f672d145fedb3bb102589dc31656 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java
|
|
@@ -24,7 +24,7 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance {
|
|
@Override
|
|
public void doServerTick() {
|
|
if (!this.firstTick && this.currentPath != null) {
|
|
- BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.END_PODIUM_LOCATION);
|
|
+ BlockPos blockPos = this.dragon.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - use custom podium
|
|
if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0D)) {
|
|
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
|
|
index acdd2e6efa42476dd627a54da66576ea75bc02d4..4326dae90e70d0f2029c43b878d19c3a1ba90d8a 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java
|
|
@@ -79,4 +79,22 @@ public class CraftEnderDragon extends CraftMob implements EnderDragon, CraftEnem
|
|
public int getDeathAnimationTicks() {
|
|
return this.getHandle().dragonDeathTime;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public org.bukkit.Location getPodium() {
|
|
+ net.minecraft.core.BlockPos blockPosOrigin = this.getHandle().getPodium();
|
|
+ return new org.bukkit.Location(getWorld(), blockPosOrigin.getX(), blockPosOrigin.getY(), blockPosOrigin.getZ());
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setPodium(org.bukkit.Location location) {
|
|
+ if (location == null) {
|
|
+ this.getHandle().setPodium(null);
|
|
+ } else {
|
|
+ org.apache.commons.lang.Validate.isTrue(location.getWorld() == null || location.getWorld().equals(getWorld()), "You cannot set a podium in a different world to where the dragon is");
|
|
+ this.getHandle().setPodium(new net.minecraft.core.BlockPos(location.getX(), location.getY(), location.getZ()));
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|