use of com.builtbroken.mc.api.tile.client.ITagRender in project Engine by VoltzEngine-Project.
the class RenderTaggedTile method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f) {
if (t != null) {
if (t instanceof ITagRender && this.getPlayer().getDistance(t.xCoord, t.yCoord, t.zCoord) <= RendererLivingEntity.NAME_TAG_RANGE) {
HashMap<String, Integer> tags = new HashMap<>();
float height = ((ITagRender) t).addInformation(tags, this.getPlayer());
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player.ridingEntity == null) {
MovingObjectPosition objectPosition = player.rayTrace(8, 1);
if (objectPosition != null) {
boolean isLooking = false;
for (int h = 0; h < height; h++) {
if (objectPosition.blockX == t.xCoord && objectPosition.blockY == t.yCoord + h && objectPosition.blockZ == t.zCoord) {
isLooking = true;
}
}
if (isLooking) {
Iterator<Entry<String, Integer>> it = tags.entrySet().iterator();
int i = 0;
while (it.hasNext()) {
Entry<String, Integer> entry = it.next();
if (entry.getKey() != null) {
RenderUtility.renderFloatingText(entry.getKey(), new Pos(x, y, z).add(new Pos(0.5, i * 0.25f + height, 0.5f)), entry.getValue());
}
i++;
}
}
}
}
}
}
}
Aggregations