Skip to content

Commit

Permalink
Add show food on rideable mobs (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
ToxicAven authored Jun 13, 2022
1 parent bb12f41 commit 330f587
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/com/lambda/mixin/gui/MixinGuiIngameForge.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
package com.lambda.mixin.gui;

import com.lambda.client.module.modules.player.Freecam;
import com.lambda.client.module.modules.render.HungerOverlay;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.client.GuiIngameForge;
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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(value = GuiIngameForge.class, remap = false)
public class MixinGuiIngameForge {
public abstract class MixinGuiIngameForge {

@Shadow
public abstract void renderFood(int width, int height);

@ModifyVariable(method = "renderAir", at = @At(value = "STORE", ordinal = 0))
private EntityPlayer renderAir$getRenderViewEntity(EntityPlayer renderViewEntity) {
return Freecam.getRenderViewEntity(renderViewEntity);
Expand All @@ -28,4 +36,11 @@ public class MixinGuiIngameForge {
private EntityPlayer renderHealthMount$getRenderViewEntity(EntityPlayer renderViewEntity) {
return Freecam.getRenderViewEntity(renderViewEntity);
}

@Inject(method = "renderHealthMount", at = @At("HEAD"))
private void renderHealthMount(int width, int height, CallbackInfo ci) {
if (HungerOverlay.INSTANCE.getRenderFoodOnRideable()) {
this.renderFood(width, height);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object HungerOverlay : Module(
private val saturationOverlay by setting("Saturation Overlay", true)
private val foodHungerOverlay by setting("Food Hunger Overlay", true)
private val foodSaturationOverlay by setting("Food Saturation Overlay", true)
val renderFoodOnRideable by setting("Render Food On Rideables", true)

private val icons = ResourceLocation("lambda/textures/hungeroverlay.png")

Expand Down

0 comments on commit 330f587

Please sign in to comment.