Add raytrace logic to the GuiOverlayDebugForge, so that the debug overlay can show the currently targetted block and liquid. (#5278)

This commit is contained in:
David Quintana 2018-12-16 21:47:16 +01:00 committed by LexManos
parent e47a4ea514
commit 152836c907
2 changed files with 10 additions and 0 deletions

View file

@ -52,6 +52,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StringUtils;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceFluidMode;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.GameType;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
@ -617,6 +618,7 @@ public class GuiIngameForge extends GuiIngame
if (this.mc.gameSettings.showDebugInfo && !pre(DEBUG))
{
debugOverlay.update();
listL.addAll(debugOverlay.getLeft());
listR.addAll(debugOverlay.getRight());
post(DEBUG);
@ -832,6 +834,12 @@ public class GuiIngameForge extends GuiIngame
super(mc);
this.mc = mc;
}
public void update()
{
Entity entity = this.mc.getRenderViewEntity();
this.rayTraceBlock = entity.rayTrace(20.0D, 0.0F, RayTraceFluidMode.NEVER);
this.rayTraceFluid = entity.rayTrace(20.0D, 0.0F, RayTraceFluidMode.ALWAYS);
}
@Override protected void renderDebugInfoLeft(){}
@Override protected void renderDebugInfoRight(){}
private List<String> getLeft()

View file

@ -303,6 +303,8 @@ public net.minecraft.nbt.NBTPrimitive
#GuiOverlayDebug
public net.minecraft.client.gui.GuiOverlayDebug func_181554_e()V # renderLagometer
protected net.minecraft.client.gui.GuiOverlayDebug field_211537_g # rayTraceBlock
protected net.minecraft.client.gui.GuiOverlayDebug field_211538_h # rayTraceFluid
# Expose vanilla brewing recipe system
public net.minecraft.potion.PotionHelper$MixPredicate