- 9
- 1
При добавление полоски на экран исчезает бар голода игрока. Также не рисуется мой бар жизни ( только розовая полоска).
Основной код
Сурцы
Основной код
Java:
public class EventsForge extends Gui{
private final ResourceLocation bar = new ResourceLocation(HudMod.MODID, "textures/hpbar.png");
private final int tex_width = 102, tex_height = 8, bar_width = 100, bar_height = 6;
@SubscribeEvent
public void onRenderGameOverlayEventPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
mc.renderEngine.bindTexture(bar);
float oneUnit = (float)bar_width / mc.thePlayer.getMaxHealth();
int currentWidth = (int)(oneUnit * mc.thePlayer.getHealth());
System.out.println((int)mc.thePlayer.getHealth());
drawTexturedModalRect(0, 0, 0, 0, tex_width, tex_height);
drawTexturedModalRect(1, 0, 1, tex_height, currentWidth, tex_height);
}
}
Последнее редактирование: