Résolu La texture du livre au-dessus de la table de craft
-
Salut,
J’ai créé un block se basant sur la table d’enchantement, et j’aimerai savoir si je peux changer la texture du livre au-dessus.
Dans GuiEnchantment on a ça :protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); int i = (this.width - this.xSize) / 2; int j = (this.height - this.ySize) / 2; this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize); GlStateManager.pushMatrix(); GlStateManager.matrixMode(5889); GlStateManager.pushMatrix(); GlStateManager.loadIdentity(); ScaledResolution scaledresolution = new ScaledResolution(this.mc); GlStateManager.viewport((scaledresolution.getScaledWidth() - 320) / 2 * scaledresolution.getScaleFactor(), (scaledresolution.getScaledHeight() - 240) / 2 * scaledresolution.getScaleFactor(), 320 * scaledresolution.getScaleFactor(), 240 * scaledresolution.getScaleFactor()); GlStateManager.translate(-0.34F, 0.23F, 0.0F); Project.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F); float f = 1.0F; GlStateManager.matrixMode(5888); GlStateManager.loadIdentity(); RenderHelper.enableStandardItemLighting(); GlStateManager.translate(0.0F, 3.3F, -16.0F); GlStateManager.scale(f, f, f); float f1 = 5.0F; GlStateManager.scale(f1, f1, f1); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_BOOK_TEXTURE); GlStateManager.rotate(20.0F, 1.0F, 0.0F, 0.0F); float f2 = this.field_147076_A + (this.field_147080_z - this.field_147076_A) * partialTicks; GlStateManager.translate((1.0F - f2) * 0.2F, (1.0F - f2) * 0.1F, (1.0F - f2) * 0.25F); GlStateManager.rotate(-(1.0F - f2) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); float f3 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.25F; float f4 = this.field_147069_w + (this.field_147071_v - this.field_147069_w) * partialTicks + 0.75F; f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F; f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F; if (f3 < 0.0F) { f3 = 0.0F; } if (f4 < 0.0F) { f4 = 0.0F; } if (f3 > 1.0F) { f3 = 1.0F; } if (f4 > 1.0F) { f4 = 1.0F; } GlStateManager.enableRescaleNormal(); MODEL_BOOK.render((Entity)null, 0.0F, f3, f4, f2, 0.0F, 0.0625F); GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.matrixMode(5889); GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); EnchantmentNameParts.getInstance().reseedRandomGenerator((long)this.container.xpSeed); int k = this.container.getLapisAmount(); for (int l = 0; l < 3; ++l) { int i1 = i + 60; int j1 = i1 + 20; int k1 = 86; String s = EnchantmentNameParts.getInstance().generateNewRandomName(); this.zLevel = 0.0F; this.mc.getTextureManager().bindTexture(ENCHANTMENT_TABLE_GUI_TEXTURE); int l1 = this.container.enchantLevels[l]; GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); if (l1 == 0) { this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 185, 108, 19); } else { String s1 = "" + l1; FontRenderer fontrenderer = this.mc.standardGalacticFontRenderer; int i2 = 6839882; if ((k < l + 1 || this.mc.thePlayer.experienceLevel < l1) && !this.mc.thePlayer.capabilities.isCreativeMode) { this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 185, 108, 19); this.drawTexturedModalRect(i1 + 1, j + 15 + 19 * l, 16 * l, 239, 16, 16); fontrenderer.drawSplitString(s, j1, j + 16 + 19 * l, k1, (i2 & 16711422) >> 1); i2 = 4226832; } else { int j2 = mouseX - (i + 60); int k2 = mouseY - (j + 14 + 19 * l); if (j2 >= 0 && k2 >= 0 && j2 < 108 && k2 < 19) { this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 204, 108, 19); i2 = 16777088; } else { this.drawTexturedModalRect(i1, j + 14 + 19 * l, 0, 166, 108, 19); } this.drawTexturedModalRect(i1 + 1, j + 15 + 19 * l, 16 * l, 223, 16, 16); fontrenderer.drawSplitString(s, j1, j + 16 + 19 * l, k1, i2); i2 = 8453920; } fontrenderer = this.mc.fontRendererObj; fontrenderer.drawStringWithShadow(s1, (float)(j1 + 86 - fontrenderer.getStringWidth(s1)), (float)(j + 16 + 19 * l + 7), i2); } } }
Cependant changer ENCHANTMENT_TABLE_BOOK_TEXTURE ne change que le livre dans la gui de la table, et pas le livre en dehors. Je n’ai trouvé aucune trace de cette texture autre part et je pensais la trouver ici car c’est dans cette fonction que le model du livre est créé
-
Regarde dans Minecraft.client.render et cherche dans les sous packages si y’a pas un truc en rapport, c’est là que y’a tous les rendus spéciaux
-
Merci ! C’est ce que je cherchais !