diff options
author | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:15:21 -0400 |
---|---|---|
committer | TymanWasTaken <tyman@tyman.tech> | 2021-07-06 17:17:22 -0400 |
commit | a8e475fa0a7977f64f072548459d592274169d66 (patch) | |
tree | 2f6e3c2fc4aa55c52b848adc493a9ecc842e53f8 /src/main/java/com/thatgravyboat/skyblockhud/mixins | |
parent | bb75fd7b83b238f1f922ffc64b2a0a535c5524b7 (diff) | |
download | SkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.tar.gz SkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.tar.bz2 SkyblockHud-Death-Defied-a8e475fa0a7977f64f072548459d592274169d66.zip |
Format v2
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/mixins')
4 files changed, 181 insertions, 178 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java index 07853d3..d29b6f5 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java @@ -14,29 +14,29 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(RenderEnderman.class) public class MixinEndermanRenderer { - @Inject( - method = "doRender(Lnet/minecraft/entity/monster/EntityEnderman;DDDFF)V", - at = @At("HEAD") - ) - public void onRender( - EntityEnderman entity, - double x, - double y, - double z, - float entityYaw, - float partialTicks, - CallbackInfo ci - ) { - if (EntityTypeHelper.isZealot(entity)) { - Color color = new Color( - SpecialColour.specialToChromaRGB("255:255:0:48:255") - ); - GlStateManager.color( - color.getRed() / 255f, - color.getGreen() / 255f, - color.getBlue() / 255f, - 255f - ); + @Inject( + method = "doRender(Lnet/minecraft/entity/monster/EntityEnderman;DDDFF)V", + at = @At("HEAD") + ) + public void onRender( + EntityEnderman entity, + double x, + double y, + double z, + float entityYaw, + float partialTicks, + CallbackInfo ci + ) { + if (EntityTypeHelper.isZealot(entity)) { + Color color = new Color( + SpecialColour.specialToChromaRGB("255:255:0:48:255") + ); + GlStateManager.color( + color.getRed() / 255f, + color.getGreen() / 255f, + color.getBlue() / 255f, + 255f + ); + } } - } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java index 57ea2dc..3641876 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java @@ -13,21 +13,23 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable; @Mixin(EntityArrow.class) public class MixinEntityArrow { - //Disabled as kill tracker stuff not fully added yet. - @Shadow - public Entity shootingEntity; + //Disabled as kill tracker stuff not fully added yet. + @Shadow + public Entity shootingEntity; - @ModifyVariable(method = "onUpdate", at = @At(value = "STORE", ordinal = 1)) - public MovingObjectPosition onUpdate(MovingObjectPosition position) { - if ( - position != null && - position.entityHit != null && - this.shootingEntity != null && - this.shootingEntity.getUniqueID() - .equals(Minecraft.getMinecraft().thePlayer.getUniqueID()) - ) { - KillTrackerHandler.attackedEntities.add(position.entityHit.getUniqueID()); + @ModifyVariable(method = "onUpdate", at = @At(value = "STORE", ordinal = 1)) + public MovingObjectPosition onUpdate(MovingObjectPosition position) { + if ( + position != null && + position.entityHit != null && + this.shootingEntity != null && + this.shootingEntity.getUniqueID() + .equals(Minecraft.getMinecraft().thePlayer.getUniqueID()) + ) { + KillTrackerHandler.attackedEntities.add( + position.entityHit.getUniqueID() + ); + } + return position; } - return position; - } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java index 1d20f02..d6e0ac6 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java @@ -15,136 +15,137 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(GuiIngameForge.class) public class MixinGuiIngameForge { - @Shadow(remap = false) - private RenderGameOverlayEvent eventParent; + @Shadow(remap = false) + private RenderGameOverlayEvent eventParent; - @Inject( - method = "renderArmor", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderArmor(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideArmor && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(ARMOR)) return; - post(ARMOR); + @Inject( + method = "renderArmor", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderArmor(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideArmor && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(ARMOR)) return; + post(ARMOR); + } } - } - @Inject( - method = "renderHealth", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderHealth(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideHearts && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(HEALTH)) return; - post(HEALTH); + @Inject( + method = "renderHealth", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderHealth(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideHearts && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(HEALTH)) return; + post(HEALTH); + } } - } - @Inject( - method = "renderAir", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderAir(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideAir && SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(AIR)) return; - post(AIR); + @Inject( + method = "renderAir", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderAir(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideAir && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(AIR)) return; + post(AIR); + } } - } - @Inject( - method = "renderHealthMount", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderHealthMount(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideAnimalHearts && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(HEALTHMOUNT)) return; - post(HEALTHMOUNT); + @Inject( + method = "renderHealthMount", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderHealthMount(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideAnimalHearts && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(HEALTHMOUNT)) return; + post(HEALTHMOUNT); + } } - } - @Inject( - method = "renderExperience", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderExperience(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideXpBar && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(EXPERIENCE)) return; - post(EXPERIENCE); + @Inject( + method = "renderExperience", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderExperience(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideXpBar && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(EXPERIENCE)) return; + post(EXPERIENCE); + } } - } - @Inject( - method = "renderJumpBar", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderJumpBar(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideXpBar && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(JUMPBAR)) return; - post(JUMPBAR); + @Inject( + method = "renderJumpBar", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderJumpBar(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideXpBar && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(JUMPBAR)) return; + post(JUMPBAR); + } } - } - @Inject( - method = "renderFood", - at = @At("HEAD"), - cancellable = true, - remap = false - ) - public void onRenderFood(int width, int height, CallbackInfo ci) { - if ( - SkyblockHud.config.renderer.hideFood && - SkyblockHud.hasSkyblockScoreboard() - ) { - ci.cancel(); - if (pre(FOOD)) return; - post(FOOD); + @Inject( + method = "renderFood", + at = @At("HEAD"), + cancellable = true, + remap = false + ) + public void onRenderFood(int width, int height, CallbackInfo ci) { + if ( + SkyblockHud.config.renderer.hideFood && + SkyblockHud.hasSkyblockScoreboard() + ) { + ci.cancel(); + if (pre(FOOD)) return; + post(FOOD); + } } - } - private boolean pre(RenderGameOverlayEvent.ElementType type) { - return MinecraftForge.EVENT_BUS.post( - new RenderGameOverlayEvent.Pre(eventParent, type) - ); - } + private boolean pre(RenderGameOverlayEvent.ElementType type) { + return MinecraftForge.EVENT_BUS.post( + new RenderGameOverlayEvent.Pre(eventParent, type) + ); + } - private void post(RenderGameOverlayEvent.ElementType type) { - MinecraftForge.EVENT_BUS.post( - new RenderGameOverlayEvent.Post(eventParent, type) - ); - } + private void post(RenderGameOverlayEvent.ElementType type) { + MinecraftForge.EVENT_BUS.post( + new RenderGameOverlayEvent.Post(eventParent, type) + ); + } } diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java index 759089b..5cb4036 100644 --- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java @@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(NetHandlerPlayClient.class) public class MixinNetHandlerPlayClient { - /* DISABLE UNTIL NEW SYSTEM + /* DISABLE UNTIL NEW SYSTEM @Inject(method = "handleSetSlot", at = @At("HEAD")) public void onHandleSetSlot(S2FPacketSetSlot packetIn, CallbackInfo ci){ if (SkyblockHud.hasSkyblockScoreboard()) { @@ -44,26 +44,26 @@ public class MixinNetHandlerPlayClient { } */ - @Inject( - method = "handleTeams", - locals = LocalCapture.CAPTURE_FAILHARD, - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", - ordinal = 0, - shift = At.Shift.BEFORE - ), - cancellable = true - ) - public void handleTeams( - S3EPacketTeams packetIn, - CallbackInfo ci, - Scoreboard scoreboard - ) { - //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. - if ( - scoreboard.getTeam(packetIn.getName()) != null && - packetIn.getAction() == 0 - ) ci.cancel(); - } + @Inject( + method = "handleTeams", + locals = LocalCapture.CAPTURE_FAILHARD, + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/network/play/server/S3EPacketTeams;getAction()I", + ordinal = 0, + shift = At.Shift.BEFORE + ), + cancellable = true + ) + public void handleTeams( + S3EPacketTeams packetIn, + CallbackInfo ci, + Scoreboard scoreboard + ) { + //This stops Hypixel from being stupid and spamming our logs because they dont have different ids for things. + if ( + scoreboard.getTeam(packetIn.getName()) != null && + packetIn.getAction() == 0 + ) ci.cancel(); + } } |