Make sure we're looking at a block before doing blocky things (#1227)

This commit is contained in:
Nicholas Ignoffo 2018-02-17 09:26:35 -08:00
parent 0e986a0bdf
commit f49e661eb6

View file

@ -11,6 +11,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import org.apache.commons.lang3.tuple.Pair;
@ -79,6 +80,10 @@ public abstract class HUDElementCornerTile<T extends TileEntity> extends HUDElem
}
}
RayTraceResult trace = Minecraft.getMinecraft().objectMouseOver;
if (trace.typeOfHit != RayTraceResult.Type.BLOCK)
return false;
TileEntity tile = Minecraft.getMinecraft().world.getTileEntity(Minecraft.getMinecraft().objectMouseOver.getBlockPos());
if (!(tile instanceof TileAltar))
flag = false;