diff --git a/changelog.md b/changelog.md index 590d6e93..2d0034e1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## Upcoming +* Ender Dragon now will now land on the exact center of the podium, to prevent begin too low and hitting players *in* the podium +* Fixed larvae dropping ancient debris and nether star shard + ## 3.5.10 * Ender Dragon difficulty now applies in any dimension (fixes incompatiblity with https://www.planetminecraft.com/data-pack/nullscape/) * Fixed crash when player kills another player diff --git a/command_utils.md b/command_utils.md index 47e94fd1..58a4bec3 100644 --- a/command_utils.md +++ b/command_utils.md @@ -3,4 +3,6 @@ /data modify entity @e[type=minecraft:wither,limit=1] ForgeData.progressivebosses:charge_attack set value 90 /data modify entity @e[type=wither,limit=1] ForgeData.progressivebosses:barrage_attack set value 100 -/summon progressivebosses:larva ~ ~ ~ {ForgeData:{"progressivebosses:difficulty":8}} \ No newline at end of file +/summon progressivebosses:larva ~ ~ ~ {ForgeData:{"progressivebosses:difficulty":8}} + +/data merge entity @e[type=ender_dragon,limit=1] {DragonPhase:3b} \ No newline at end of file diff --git a/src/main/java/insane96mcp/progressivebosses/mixin/DragonLandingPhaseMixin.java b/src/main/java/insane96mcp/progressivebosses/mixin/DragonLandingPhaseMixin.java new file mode 100644 index 00000000..0ddefb5a --- /dev/null +++ b/src/main/java/insane96mcp/progressivebosses/mixin/DragonLandingPhaseMixin.java @@ -0,0 +1,51 @@ +package insane96mcp.progressivebosses.mixin; + +import insane96mcp.progressivebosses.module.Modules; +import net.minecraft.world.entity.boss.enderdragon.EnderDragon; +import net.minecraft.world.entity.boss.enderdragon.phases.AbstractDragonPhaseInstance; +import net.minecraft.world.entity.boss.enderdragon.phases.DragonLandingPhase; +import net.minecraft.world.entity.boss.enderdragon.phases.DragonPhaseInstance; +import net.minecraft.world.entity.boss.enderdragon.phases.EnderDragonPhase; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import javax.annotation.Nullable; + +@Mixin(DragonLandingPhase.class) +public class DragonLandingPhaseMixin extends AbstractDragonPhaseInstance { + + @Shadow @Nullable private Vec3 targetLocation; + + public DragonLandingPhaseMixin(EnderDragon dragon) { + super(dragon); + } + + @Inject(at = @At("HEAD"), method = "getFlySpeed()F", cancellable = true) + private void getFlySpeed(CallbackInfoReturnable callback) { + if (Modules.dragon.attack.increaseMaxRiseAndFall) + callback.setReturnValue(12f); + } + + @Inject(at = @At("HEAD"), method = "getTurnSpeed()F", cancellable = true) + private void getTurnSpeed(CallbackInfoReturnable callback) { + float f = (float)this.dragon.getDeltaMovement().horizontalDistance() + 1.0F; + float f1 = Math.min(f, 40.0F); + callback.setReturnValue(0.925f / f1 / f); + } + + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhaseManager;setPhase(Lnet/minecraft/world/entity/boss/enderdragon/phases/EnderDragonPhase;)V", shift = At.Shift.AFTER), method = "doServerTick") + private void setCorrectSittingPosition(CallbackInfo ci) { + //noinspection ConstantConditions since I call it after the dragon reaches the center podium it shouldn't be null + this.dragon.setPos(this.targetLocation); + } + + @Override + public EnderDragonPhase getPhase() { + return EnderDragonPhase.LANDING; + } +} diff --git a/src/main/java/insane96mcp/progressivebosses/mixin/LandingPhaseMixin.java b/src/main/java/insane96mcp/progressivebosses/mixin/LandingPhaseMixin.java deleted file mode 100644 index ec21aed8..00000000 --- a/src/main/java/insane96mcp/progressivebosses/mixin/LandingPhaseMixin.java +++ /dev/null @@ -1,18 +0,0 @@ -package insane96mcp.progressivebosses.mixin; - -import insane96mcp.progressivebosses.module.Modules; -import net.minecraft.world.entity.boss.enderdragon.phases.DragonLandingPhase; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(DragonLandingPhase.class) -public class LandingPhaseMixin { - - @Inject(at = @At("HEAD"), method = "getFlySpeed()F", cancellable = true) - private void getFlySpeed(CallbackInfoReturnable callback) { - if (Modules.dragon.attack.increaseMaxRiseAndFall) - callback.setReturnValue(12f); - } -}