Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the Ender Dragon spamming screen shakes #252

Open
wants to merge 3 commits into
base: 1.20-quilt
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.entity.boss.dragon.phase.SittingAttackingPhase;
import org.ladysnake.effective.EffectiveConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand All @@ -15,15 +16,27 @@

@Mixin(SittingAttackingPhase.class)
public abstract class EnderDragonRoarScreenshakeAdder extends AbstractSittingPhase {
@Unique
private boolean screenShaked = false;
EnnuiL marked this conversation as resolved.
Show resolved Hide resolved

public EnderDragonRoarScreenshakeAdder(EnderDragonEntity enderDragonEntity) {
super(enderDragonEntity);
}

@Inject(method = "clientTick", at = @At("HEAD"))
public void clientTick(CallbackInfo ci) {
if (EffectiveConfig.dragonScreenShake) {
ScreenshakeInstance roarScreenShake = new PositionedScreenshakeInstance(60, this.dragon.getPos(), 20f, 0f, 25f, Easing.CIRC_IN_OUT).setIntensity(0.0f, EffectiveConfig.screenShakeIntensity, 0.0f);
ScreenshakeHandler.addScreenshake(roarScreenShake);
if (!this.screenShaked) {
if (EffectiveConfig.dragonScreenShake) {
ScreenshakeInstance roarScreenShake = new PositionedScreenshakeInstance(80, this.dragon.getPos(), 30f, 0f, 35f, Easing.CIRC_IN_OUT).setIntensity(0.0f, EffectiveConfig.screenShakeIntensity, 0.0f);
ScreenshakeHandler.addScreenshake(roarScreenShake);
}

this.screenShaked = true;
}
}

@Inject(method = "beginPhase", at = @At("HEAD"))
private void resetScreenShaked(CallbackInfo ci) {
this.screenShaked = false;
}
}
Loading