use of net.minecraft.client.model.ModelChest in project SecurityCraft by Geforce132.
the class TileEntityKeypadChestRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntityKeypadChest p_180538_1_, double p_180538_2_, double p_180538_4_, double p_180538_6_, float p_180538_8_, int p_180538_9_) {
int j;
if (!p_180538_1_.hasWorldObj())
j = 0;
else {
Block block = p_180538_1_.getBlockType();
j = p_180538_1_.getBlockMetadata();
if (block instanceof BlockChest && j == 0) {
((BlockChest) block).checkForSurroundingChests(p_180538_1_.getWorld(), p_180538_1_.getPos(), p_180538_1_.getWorld().getBlockState(p_180538_1_.getPos()));
j = p_180538_1_.getBlockMetadata();
}
p_180538_1_.checkForAdjacentChests();
}
if (p_180538_1_.adjacentChestZNeg == null && p_180538_1_.adjacentChestXNeg == null) {
ModelChest modelchest;
if (p_180538_1_.adjacentChestXPos == null && p_180538_1_.adjacentChestZPos == null) {
modelchest = field_147510_h;
if (p_180538_9_ >= 0) {
bindTexture(DESTROY_STAGES[p_180538_9_]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasNormal);
else if (p_180538_1_.lidAngle >= 0.9)
bindTexture(normalSingleActive);
else
bindTexture(normalSingleUnactive);
} else {
modelchest = field_147511_i;
if (p_180538_9_ >= 0) {
bindTexture(DESTROY_STAGES[p_180538_9_]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasDouble);
else if (p_180538_1_.lidAngle >= 0.9)
bindTexture(normalDoubleActive);
else
bindTexture(normalDoubleUnactive);
}
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
if (p_180538_9_ < 0)
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translate((float) p_180538_2_, (float) p_180538_4_ + 1.0F, (float) p_180538_6_ + 1.0F);
GlStateManager.scale(1.0F, -1.0F, -1.0F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
short short1 = 0;
if (j == 2)
short1 = 180;
if (j == 3)
short1 = 0;
if (j == 4)
short1 = 90;
if (j == 5)
short1 = -90;
if (j == 2 && p_180538_1_.adjacentChestXPos != null)
GlStateManager.translate(1.0F, 0.0F, 0.0F);
if (j == 5 && p_180538_1_.adjacentChestZPos != null)
GlStateManager.translate(0.0F, 0.0F, -1.0F);
GlStateManager.rotate(short1, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
float f1 = p_180538_1_.prevLidAngle + (p_180538_1_.lidAngle - p_180538_1_.prevLidAngle) * p_180538_8_;
float f2;
if (p_180538_1_.adjacentChestZNeg != null) {
f2 = p_180538_1_.adjacentChestZNeg.prevLidAngle + (p_180538_1_.adjacentChestZNeg.lidAngle - p_180538_1_.adjacentChestZNeg.prevLidAngle) * p_180538_8_;
if (f2 > f1)
f1 = f2;
}
if (p_180538_1_.adjacentChestXNeg != null) {
f2 = p_180538_1_.adjacentChestXNeg.prevLidAngle + (p_180538_1_.adjacentChestXNeg.lidAngle - p_180538_1_.adjacentChestXNeg.prevLidAngle) * p_180538_8_;
if (f2 > f1)
f1 = f2;
}
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
modelchest.renderAll();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (p_180538_9_ >= 0) {
GlStateManager.matrixMode(5890);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
}
}
}
use of net.minecraft.client.model.ModelChest in project SecurityCraft by Geforce132.
the class TileEntityKeypadChestRenderer method render.
@Override
public void render(TileEntityKeypadChest te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
int j;
if (!te.hasWorld())
j = 0;
else {
Block block = te.getBlockType();
j = te.getBlockMetadata();
if (block instanceof BlockChest && j == 0) {
((BlockChest) block).checkForSurroundingChests(te.getWorld(), te.getPos(), te.getWorld().getBlockState(te.getPos()));
j = te.getBlockMetadata();
}
te.checkForAdjacentChests();
}
if (te.adjacentChestZNeg == null && te.adjacentChestXNeg == null) {
ModelChest modelchest;
if (te.adjacentChestXPos == null && te.adjacentChestZPos == null) {
modelchest = field_147510_h;
if (destroyStage >= 0) {
bindTexture(DESTROY_STAGES[destroyStage]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasNormal);
else if (te.lidAngle >= 0.9)
bindTexture(normalSingleActive);
else
bindTexture(normalSingleUnactive);
} else {
modelchest = field_147511_i;
if (destroyStage >= 0) {
bindTexture(DESTROY_STAGES[destroyStage]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasDouble);
else if (te.lidAngle >= 0.9)
bindTexture(normalDoubleActive);
else
bindTexture(normalDoubleUnactive);
}
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
if (destroyStage < 0)
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
GlStateManager.scale(1.0F, -1.0F, -1.0F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
short short1 = 0;
if (j == 2)
short1 = 180;
if (j == 3)
short1 = 0;
if (j == 4)
short1 = 90;
if (j == 5)
short1 = -90;
if (j == 2 && te.adjacentChestXPos != null)
GlStateManager.translate(1.0F, 0.0F, 0.0F);
if (j == 5 && te.adjacentChestZPos != null)
GlStateManager.translate(0.0F, 0.0F, -1.0F);
GlStateManager.rotate(short1, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
float f1 = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;
float f2;
if (te.adjacentChestZNeg != null) {
f2 = te.adjacentChestZNeg.prevLidAngle + (te.adjacentChestZNeg.lidAngle - te.adjacentChestZNeg.prevLidAngle) * partialTicks;
if (f2 > f1)
f1 = f2;
}
if (te.adjacentChestXNeg != null) {
f2 = te.adjacentChestXNeg.prevLidAngle + (te.adjacentChestXNeg.lidAngle - te.adjacentChestXNeg.prevLidAngle) * partialTicks;
if (f2 > f1)
f1 = f2;
}
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
modelchest.renderAll();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (destroyStage >= 0) {
GlStateManager.matrixMode(5890);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
}
}
}
use of net.minecraft.client.model.ModelChest in project SecurityCraft by Geforce132.
the class TileEntityKeypadChestRenderer method func_180538_a.
public void func_180538_a(TileEntityChest p_180538_1_, double p_180538_2_, double p_180538_4_, double p_180538_6_, float p_180538_8_, int p_180538_9_) {
int j;
if (!p_180538_1_.hasWorldObj())
j = 0;
else {
Block block = p_180538_1_.getBlockType();
j = p_180538_1_.getBlockMetadata();
if (block instanceof BlockChest && j == 0) {
((BlockChest) block).checkForSurroundingChests(p_180538_1_.getWorld(), p_180538_1_.getPos(), p_180538_1_.getWorld().getBlockState(p_180538_1_.getPos()));
j = p_180538_1_.getBlockMetadata();
}
p_180538_1_.checkForAdjacentChests();
}
if (p_180538_1_.adjacentChestZNeg == null && p_180538_1_.adjacentChestXNeg == null) {
ModelChest modelchest;
if (p_180538_1_.adjacentChestXPos == null && p_180538_1_.adjacentChestZPos == null) {
modelchest = field_147510_h;
if (p_180538_9_ >= 0) {
bindTexture(DESTROY_STAGES[p_180538_9_]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasNormal);
else if (p_180538_1_.lidAngle >= 0.9)
bindTexture(normalSingleActive);
else
bindTexture(normalSingleUnactive);
} else {
modelchest = field_147511_i;
if (p_180538_9_ >= 0) {
bindTexture(DESTROY_STAGES[p_180538_9_]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (field_147509_j)
bindTexture(christmasDouble);
else if (p_180538_1_.lidAngle >= 0.9)
bindTexture(normalDoubleActive);
else
bindTexture(normalDoubleUnactive);
}
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
if (p_180538_9_ < 0)
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.translate((float) p_180538_2_, (float) p_180538_4_ + 1.0F, (float) p_180538_6_ + 1.0F);
GlStateManager.scale(1.0F, -1.0F, -1.0F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
short short1 = 0;
if (j == 2)
short1 = 180;
if (j == 3)
short1 = 0;
if (j == 4)
short1 = 90;
if (j == 5)
short1 = -90;
if (j == 2 && p_180538_1_.adjacentChestXPos != null)
GlStateManager.translate(1.0F, 0.0F, 0.0F);
if (j == 5 && p_180538_1_.adjacentChestZPos != null)
GlStateManager.translate(0.0F, 0.0F, -1.0F);
GlStateManager.rotate(short1, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
float f1 = p_180538_1_.prevLidAngle + (p_180538_1_.lidAngle - p_180538_1_.prevLidAngle) * p_180538_8_;
float f2;
if (p_180538_1_.adjacentChestZNeg != null) {
f2 = p_180538_1_.adjacentChestZNeg.prevLidAngle + (p_180538_1_.adjacentChestZNeg.lidAngle - p_180538_1_.adjacentChestZNeg.prevLidAngle) * p_180538_8_;
if (f2 > f1)
f1 = f2;
}
if (p_180538_1_.adjacentChestXNeg != null) {
f2 = p_180538_1_.adjacentChestXNeg.prevLidAngle + (p_180538_1_.adjacentChestXNeg.lidAngle - p_180538_1_.adjacentChestXNeg.prevLidAngle) * p_180538_8_;
if (f2 > f1)
f1 = f2;
}
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
modelchest.renderAll();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (p_180538_9_ >= 0) {
GlStateManager.matrixMode(5890);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
}
}
}
use of net.minecraft.client.model.ModelChest in project MorePlanets by SteveKunG.
the class TileEntityAncientChestRendererMP method render.
@Override
public void render(TileEntityAncientChestMP tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
int meta;
if (!tile.hasWorld()) {
meta = 0;
} else {
Block block = tile.getBlockType();
meta = tile.getBlockMetadata();
if (block instanceof BlockAncientChestMP && meta == 0) {
((BlockAncientChestMP) block).checkForSurroundingChests(tile.getWorld(), tile.getPos(), tile.getWorld().getBlockState(tile.getPos()));
meta = tile.getBlockMetadata();
}
tile.checkForAdjacentChests();
}
if (tile.adjacentChestZNeg == null && tile.adjacentChestXNeg == null) {
ModelChest modelchest;
if (tile.adjacentChestXPos == null && tile.adjacentChestZPos == null) {
modelchest = this.simpleChest;
if (destroyStage >= 0) {
this.bindTexture(DESTROY_STAGES[destroyStage]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(4.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (CalendarHelper.isChristmasDay()) {
this.bindTexture(this.textureChristmas);
} else if (CalendarHelper.isMorePlanetsBirthDay()) {
this.bindTexture(this.morePlanetsChestNormal);
} else {
this.bindTexture(this.textureNormal);
}
} else {
modelchest = this.largeChest;
if (destroyStage >= 0) {
this.bindTexture(DESTROY_STAGES[destroyStage]);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0F, 4.0F, 1.0F);
GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
GlStateManager.matrixMode(5888);
} else if (CalendarHelper.isChristmasDay()) {
this.bindTexture(this.textureChristmasDouble);
} else if (CalendarHelper.isMorePlanetsBirthDay()) {
this.bindTexture(this.morePlanetsLargeChestNormal);
} else {
this.bindTexture(this.textureNormalDouble);
}
}
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
if (destroyStage < 0) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}
GlStateManager.translate((float) x, (float) y + 1.0F, (float) z + 1.0F);
GlStateManager.scale(1.0F, -1.0F, -1.0F);
GlStateManager.translate(0.5F, 0.5F, 0.5F);
short short1 = 0;
if (meta == 2) {
short1 = 180;
}
if (meta == 3) {
short1 = 0;
}
if (meta == 4) {
short1 = 90;
}
if (meta == 5) {
short1 = -90;
}
if (meta == 2 && tile.adjacentChestXPos != null) {
GlStateManager.translate(1.0F, 0.0F, 0.0F);
}
if (meta == 5 && tile.adjacentChestZPos != null) {
GlStateManager.translate(0.0F, 0.0F, -1.0F);
}
GlStateManager.rotate(short1, 0.0F, 1.0F, 0.0F);
GlStateManager.translate(-0.5F, -0.5F, -0.5F);
float f1 = tile.prevLidAngle + (tile.lidAngle - tile.prevLidAngle) * partialTicks;
float f2;
if (tile.adjacentChestZNeg != null) {
f2 = tile.adjacentChestZNeg.prevLidAngle + (tile.adjacentChestZNeg.lidAngle - tile.adjacentChestZNeg.prevLidAngle) * partialTicks;
if (f2 > f1) {
f1 = f2;
}
}
if (tile.adjacentChestXNeg != null) {
f2 = tile.adjacentChestXNeg.prevLidAngle + (tile.adjacentChestXNeg.lidAngle - tile.adjacentChestXNeg.prevLidAngle) * partialTicks;
if (f2 > f1) {
f1 = f2;
}
}
f1 = 1.0F - f1;
f1 = 1.0F - f1 * f1 * f1;
modelchest.chestLid.rotateAngleX = -(f1 * (float) Math.PI / 2.0F);
modelchest.renderAll();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (destroyStage >= 0) {
GlStateManager.matrixMode(5890);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
}
}
}
Aggregations