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

Add show food on rideable mobs #331

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
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