- 3
- 0
Здравствуйте у меня появилась одна проблема я не могу добавить модель Стива в GUI, как в инвентаре!
Смотрел разные туториалы, но у меня появлялась ошибка, проблему не пойму, кто выручит
Смотрел разные туториалы, но у меня появлялась ошибка, проблему не пойму, кто выручит
Java:
public class BookGui extends GuiScreen {
EntityPlayer player;
private int xSize = 255;
private int ySize = 195;
private static final ResourceLocation texture = new ResourceLocation("magicmod", "textures/gui/bookgui.png");
public BookGui(EntityPlayer player) {
this.player = player;
}
@Override
public void keyTyped(char character, int key) {
if (key == mc.gameSettings.keyBindInventory.getKeyCode()) {//E
mc.displayGuiScreen((GuiScreen)null);
mc.setIngameFocus();
} else {
super.keyTyped(character, key);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float parTick) {
drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int posX = (width - xSize) / 2;
int posY = (height - ySize) / 2;
drawTexturedModalRect(posX, posY, 0, 0, xSize, ySize);
super.drawScreen(mouseX, mouseY, parTick);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere")), (205), (70), 0xFFFFFF);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere2")), (142), (175), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere3")), (142), (185), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere4")), (142), (195), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere10")), (265), (90), 0x0080FF);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere5")), (265), (100), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere6")), (265), (110), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere7")), (265), (120), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere8")), (265), (130), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere9")), (265), (140), 0x000000);
this.fontRendererObj.drawString((I18n.format("tooltip.sphere1")) + player.getCommandSenderName(), (142), (165), 0x000000);
}
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent)
{
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)posX, (float)posY, 50.0F);
GL11.glScalef((float)(-scale), (float)scale, (float)scale);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
float f2 = ent.renderYawOffset;
float f3 = ent.rotationYaw;
float f4 = ent.rotationPitch;
float f5 = ent.prevRotationYawHead;
float f6 = ent.rotationYawHead;
GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
ent.rotationYawHead = ent.rotationYaw;
ent.prevRotationYawHead = ent.rotationYaw;
GL11.glTranslatef(0.0F, ent.yOffset, 0.0F);
RenderManager.instance.playerViewY = 180.0F;
RenderManager.instance.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
ent.renderYawOffset = f2;
ent.rotationYaw = f3;
ent.rotationPitch = f4;
ent.prevRotationYawHead = f5;
ent.rotationYawHead = f6;
GL11.glPopMatrix();
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}