generated from LabyMod/addon-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from RappyLabyAddons/feat/update
Add `1.20.3` support
Showing
3 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
game-runner/src/v1_20_3/java/com/rappytv/deathfinder/v1_20_3/mixins/DeathScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.rappytv.deathfinder.v1_20_3.mixins; | ||
|
||
import com.rappytv.deathfinder.DeathFinderAddon; | ||
import com.rappytv.deathfinder.events.DeathEvent; | ||
import com.rappytv.deathfinder.util.Location; | ||
import net.labymod.api.Laby; | ||
import net.minecraft.client.gui.screens.DeathScreen; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import net.minecraft.client.player.LocalPlayer; | ||
import net.minecraft.network.chat.Component; | ||
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.CallbackInfo; | ||
|
||
@Mixin(DeathScreen.class) | ||
public class DeathScreenMixin extends Screen { | ||
|
||
protected DeathScreenMixin(Component title) { | ||
super(title); | ||
} | ||
|
||
@Inject(method = "init", at = @At("TAIL")) | ||
public void onDeathScreen(CallbackInfo ci) { | ||
if(this.minecraft == null || this.minecraft.player == null) return; | ||
|
||
LocalPlayer player = this.minecraft.player; | ||
Location deathLocation = new Location(player.getX(), player.getY(), player.getZ()); | ||
|
||
if(DeathFinderAddon.get().configuration().saveRotation().get()) { | ||
deathLocation.setYaw(player.getYRot()); | ||
deathLocation.setPitch(player.getXRot()); | ||
} | ||
if(deathLocation.equals(DeathFinderAddon.getDeathLocation())) return; | ||
|
||
Laby.fireEvent(new DeathEvent(deathLocation)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters