Skip to content

Commit

Permalink
Ender Dragon now will be put on the exact center of the podium
Browse files Browse the repository at this point in the history
  • Loading branch information
Insane96 committed May 9, 2022
1 parent 10a310d commit 1e5eb47
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 19 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion command_utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
/summon progressivebosses:larva ~ ~ ~ {ForgeData:{"progressivebosses:difficulty":8}}

/data merge entity @e[type=ender_dragon,limit=1] {DragonPhase:3b}
Original file line number Diff line number Diff line change
@@ -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<Float> callback) {
if (Modules.dragon.attack.increaseMaxRiseAndFall)
callback.setReturnValue(12f);
}

@Inject(at = @At("HEAD"), method = "getTurnSpeed()F", cancellable = true)
private void getTurnSpeed(CallbackInfoReturnable<Float> 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<? extends DragonPhaseInstance> getPhase() {
return EnderDragonPhase.LANDING;
}
}

This file was deleted.

0 comments on commit 1e5eb47

Please sign in to comment.