aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/thatgravyboat/skyblockhud/mixins
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/thatgravyboat/skyblockhud/mixins')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java33
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java24
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java180
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java30
4 files changed, 183 insertions, 84 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java
index 3cdbae5..07853d3 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEndermanRenderer.java
@@ -2,6 +2,7 @@ package com.thatgravyboat.skyblockhud.mixins;
import com.thatgravyboat.skyblockhud.SpecialColour;
import com.thatgravyboat.skyblockhud.handlers.sbentities.EntityTypeHelper;
+import java.awt.*;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderEnderman;
import net.minecraft.entity.monster.EntityEnderman;
@@ -10,16 +11,32 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import java.awt.*;
-
@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 93537ea..57ea2dc 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinEntityArrow.java
@@ -12,14 +12,22 @@ 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;
- @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;
+ //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());
}
+ 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 ce7c228..1d20f02 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinGuiIngameForge.java
@@ -1,5 +1,7 @@
package com.thatgravyboat.skyblockhud.mixins;
+import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*;
+
import com.thatgravyboat.skyblockhud.SkyblockHud;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
@@ -10,83 +12,139 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.*;
-
@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 void post(RenderGameOverlayEvent.ElementType type)
- {
- MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(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)
+ );
+ }
}
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java b/src/main/java/com/thatgravyboat/skyblockhud/mixins/MixinNetHandlerPlayClient.java
index 679da20..759089b 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,10 +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();
+ }
}