mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 23:13:09 +00:00
Full GLStatemanager substitution
This commit is contained in:
1 parent
9cd7a4a0d5
commit
2dae52a9ff
135 files changed
+1629
-1596
No files matched your search
@@ -45,69 +45,69 @@ public class RenderTileAvatar extends TileEntitySpecialRenderer {
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks, int digProgress) {
|
||||
TileAvatar avatar = (TileAvatar) tileentity;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
GlStateManager.translate(d0, d1, d2);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
int meta = avatar.getWorld() != null ? avatar.getBlockMetadata() : 0;
|
||||
|
||||
GL11.glTranslatef(0.5F, 1.6F, 0.5F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glRotatef(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0F, 1F, 0F);
|
||||
GlStateManager.translate(0.5F, 1.6F, 0.5F);
|
||||
GlStateManager.scale(1F, -1F, -1F);
|
||||
GlStateManager.rotate(ROTATIONS[Math.max(Math.min(ROTATIONS.length - 1, meta - 2), 0)], 0F, 1F, 0F);
|
||||
model.render();
|
||||
|
||||
ItemStack stack = avatar.getStackInSlot(0);
|
||||
if(stack != null) {
|
||||
GL11.glPushMatrix();
|
||||
GlStateManager.pushMatrix();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
float s = 0.4F;
|
||||
GL11.glScalef(s, s, s);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslated(-1.2F, -3.5F, -0.65F);
|
||||
GL11.glRotatef(20F, 0F, 0F, 1F);
|
||||
GlStateManager.scale(s, s, s);
|
||||
GlStateManager.rotate(90F, 0F, 1F, 0F);
|
||||
GlStateManager.rotate(180F, 0F, 0F, 1F);
|
||||
GlStateManager.translate(-1.2F, -3.5F, -0.65F);
|
||||
GlStateManager.rotate(20F, 0F, 0F, 1F);
|
||||
|
||||
int renderPass = 0;
|
||||
do {
|
||||
IIcon icon = stack.getItem().getIcon(stack, renderPass);
|
||||
if(icon != null) {
|
||||
Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
|
||||
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
GlStateManager.color((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
ItemRenderer.renderItemIn2D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
}
|
||||
renderPass++;
|
||||
} while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
IAvatarWieldable wieldable = (IAvatarWieldable) stack.getItem();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(wieldable.getOverlayResource(avatar, stack));
|
||||
s = 1.01F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glScalef(s, s, s);
|
||||
GL11.glTranslatef(0F, -0.01F, 0F);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.scale(s, s, s);
|
||||
GlStateManager.translate(0F, -0.01F, 0F);
|
||||
int light = 15728880;
|
||||
int lightmapX = light % 65536;
|
||||
int lightmapY = light / 65536;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
|
||||
float alpha = (float) Math.sin(ClientTickHandler.ticksInGame / 20D) / 2F + 0.5F;
|
||||
GL11.glColor4f(1F, 1F, 1F, alpha + 0.183F);
|
||||
GlStateManager.color(1F, 1F, 1F, alpha + 0.183F);
|
||||
model.render();
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
GlStateManager.color(1F, 1F, 1F);
|
||||
GlStateManager.scale(1F, -1F, -1F);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user