use of net.minecraft.util.IIcon in project NyaSamaRailway by NSDN.
the class PlatformRenderer method renderWorldBlock.
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
this.blockMetadata = world.getBlockMetadata(x, y, z);
this.topIcon = world.getBlock(x, y, z).getIcon(1, 0);
if ((this.blockMetadata & 0x3) == 2) {
this.xOffset = -1;
} else if ((this.blockMetadata & 0x3) == 0) {
this.xOffset = 1;
} else {
this.xOffset = 0;
}
if ((this.blockMetadata & 0x3) == 3) {
this.zOffset = -1;
} else if ((this.blockMetadata & 0x3) == 1) {
this.zOffset = 1;
} else {
this.zOffset = 0;
}
if (Minecraft.getMinecraft().theWorld.getBlock(x, y - 1, z).equals(block)) {
this.yOffset = -1;
} else {
this.yOffset = 0;
}
this.attachedBlock = world.getBlock(x + this.xOffset, y + this.yOffset, z + this.zOffset);
this.attachedBlockMetadata = world.getBlockMetadata(x + this.xOffset, y + this.yOffset, z + this.zOffset);
if (this.attachedBlock.equals(Blocks.air)) {
this.attachedBlock = block;
}
this.sidesIcon = this.attachedBlock.getIcon(2, this.attachedBlockMetadata);
Tessellator.instance.addTranslation(x + 0.5F, y - (this.blockMetadata & 0x4) / 8.0F, z + 0.5F);
Tessellator.instance.setColorOpaque(255, 255, 255);
Tessellator.instance.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
RendererHelper.renderWithIconAndRotation(topModel, (this.blockMetadata & 0x3) * 90.0F, this.topIcon, Tessellator.instance);
if (world.getTileEntity(x, y + 1, z) instanceof TileEntityGlassShieldBase) {
IIcon pimpTexture = Blocks.wool.getIcon(0, 15);
RendererHelper.renderWithIconAndRotation(pimpModel, (this.blockMetadata & 0x3) * 90.0F, pimpTexture, Tessellator.instance);
}
if ((this.blockMetadata & 0xC) == 0) {
RendererHelper.renderWithIconAndRotation(tallSidesModel, (this.blockMetadata & 0x3) * 90.0F, this.sidesIcon, Tessellator.instance);
} else {
RendererHelper.renderWithIconAndRotation(sidesModel, (this.blockMetadata & 0x3) * 90.0F, this.sidesIcon, Tessellator.instance);
}
Tessellator.instance.addTranslation(-x - 0.5F, -y + (this.blockMetadata & 0x4) / 8.0F, -z - 0.5F);
return true;
}
use of net.minecraft.util.IIcon in project LogisticsPipes by RS485.
the class GuiApiaristSink method renderForestryBeeAt.
public void renderForestryBeeAt(Minecraft mc, int x, int y, float zLevel, String id) {
GL11.glDisable(GL11.GL_LIGHTING);
mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);
for (int i = 0; i < SimpleServiceLocator.forestryProxy.getRenderPassesForAlleleId(id); i++) {
IIcon icon = SimpleServiceLocator.forestryProxy.getIconIndexForAlleleId(id, i);
if (icon == null) {
continue;
}
int color = SimpleServiceLocator.forestryProxy.getColorForAlleleId(id, i);
float colorR = (color >> 16 & 0xFF) / 255.0F;
float colorG = (color >> 8 & 0xFF) / 255.0F;
float colorB = (color & 0xFF) / 255.0F;
GL11.glColor4f(colorR, colorG, colorB, 1.0F);
// Render icon
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.addVertexWithUV(x, y + 16, zLevel, icon.getMinU(), icon.getMaxV());
var9.addVertexWithUV(x + 16, y + 16, zLevel, icon.getMaxU(), icon.getMaxV());
var9.addVertexWithUV(x + 16, y, zLevel, icon.getMaxU(), icon.getMinV());
var9.addVertexWithUV(x, y, zLevel, icon.getMinU(), icon.getMinV());
var9.draw();
}
GL11.glEnable(GL11.GL_LIGHTING);
}
use of net.minecraft.util.IIcon in project Engine by VoltzEngine-Project.
the class BlockBase method getIcon.
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
final int meta = world.getBlockMetadata(x, y, z);
ListenerIterator it = new ListenerIterator(world, x, y, z, this, "icon");
while (it.hasNext()) {
ITileEventListener next = it.next();
if (next instanceof IIconListener) {
IIcon icon = ((IIconListener) next).getTileIcon(side, meta);
if (icon != null) {
return icon;
}
}
}
return getIcon(side, meta);
}
use of net.minecraft.util.IIcon in project BluePower by Qmunity.
the class RenderCircuitTile method renderItem.
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
boolean blend = GL11.glGetBoolean(GL11.GL_BLEND);
boolean alpha = GL11.glGetBoolean(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
{
switch(type) {
case ENTITY:
GL11.glTranslated(-0.5, 0, -0.5);
break;
case EQUIPPED:
GL11.glTranslated(-0.375, 0.5, -0.125);
GL11.glScaled(1.5, 1.5, 1.5);
break;
case EQUIPPED_FIRST_PERSON:
GL11.glTranslated(-0.375, 0.75, -0.125);
GL11.glScaled(1.5, 1.5, 1.5);
break;
case INVENTORY:
GL11.glTranslated(0, 0.4, 0);
GL11.glScaled(1.75, 1.75, 1.75);
break;
default:
break;
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Tessellator.instance.startDrawingQuads();
RenderHelper rh = RenderHelper.instance;
rh.renderBox(new Vec3dCube(4 / 16D, 0, 4 / 16D, 12 / 16D, 2 / 16D, 12 / 16D), Blocks.stone_slab.getIcon(0, 0));
rh.reset();
Tessellator.instance.draw();
double wireHeight = 1 / 32D;
double wireWidth = 1.5 / 16D;
double bundledHeight = 4 / 32D;
double bundledWidth = 6 / 16D;
IIcon wireTexture = IconSupplier.wire;
// Bluestone tiles
rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.BLUESTONE, (byte) (255 / 2)));
if (item.getItem() == BPItems.bluestone_cathode_tile) {
com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_pointer_tile) {
com.bluepowermod.client.render.RenderHelper.renderDigitalRedstoneTorch(0, 0, 0, 13 / 16D, true);
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.875, 1, 0.875);
GL11.glTranslated(-0.5, 0, -0.5);
com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
GL11.glPopMatrix();
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_anode_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.bluestone_wire_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
Tessellator.instance.draw();
}
// Redstone tiles
rh.setColor(WireHelper.getColorForPowerLevel(RedwireType.RED_ALLOY, (byte) (255 / 2)));
if (item.getItem() == BPItems.redstone_cathode_tile) {
com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_pointer_tile) {
com.bluepowermod.client.render.RenderHelper.renderAnalogRedstoneTorch(0, 0, 0, 13 / 16D, true);
GL11.glPushMatrix();
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.875, 1, 0.875);
GL11.glTranslated(-0.5, 0, -0.5);
com.bluepowermod.client.render.RenderHelper.renderPointer(0, 3 / 16D, 0, 0.25);
GL11.glPopMatrix();
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7 / 16D), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_anode_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 7.5 / 16D), wireTexture);
rh.renderBox(new Vec3dCube(4 / 16D, 2 / 16D, 0.5 - (wireWidth / 2), 12 / 16D, 2 / 16D + wireHeight, 0.5 + (wireWidth / 2)), wireTexture);
Tessellator.instance.draw();
}
if (item.getItem() == BPItems.redstone_wire_tile) {
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (wireWidth / 2), 2 / 16D, 4 / 16D, 0.5 + (wireWidth / 2), 2 / 16D + wireHeight, 12 / 16D), wireTexture);
Tessellator.instance.draw();
}
rh.setColor(0xFFFFFF);
if (item.getItem() == BPItems.stone_bundle) {
GL11.glPushMatrix();
{
GL11.glTranslated(0.5, 0, 0.5);
GL11.glScaled(0.5, 0.5, 0.5);
GL11.glTranslated(-0.5, 0.125, -0.5);
Tessellator.instance.startDrawingQuads();
rh.renderBox(new Vec3dCube(0.5 - (bundledWidth / 2), 2 / 16D, 0, 0.5 + (bundledWidth / 2), 2 / 16D + bundledHeight, 1), null, IconSupplier.wireBundledStraight1, IconSupplier.wireBundledSide1, IconSupplier.wireBundledSide2, IconSupplier.wireBundledConnection, IconSupplier.wireBundledConnection);
Tessellator.instance.draw();
}
GL11.glPopMatrix();
}
// Misc renderers
rh.setColor(0xFFFFFF);
rh.addTransformation(new Translation(0.375, 0, 0.375));
Tessellator.instance.startDrawingQuads();
if (item.getItem() == BPItems.quartz_resonator_tile) {
new GateComponentQuartzResonator(null, -1).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
if (item.getItem() == BPItems.silicon_chip_tile) {
new GateComponentSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
if (item.getItem() == BPItems.tainted_silicon_chip_tile) {
new GateComponentTaintedSiliconChip(null, -1).setState(true).renderStatic(new Vec3i(0, 0, 0), rh, 0);
}
Tessellator.instance.draw();
rh.reset();
}
GL11.glPopMatrix();
if (!blend)
GL11.glDisable(GL11.GL_BLEND);
if (!alpha)
GL11.glDisable(GL11.GL_ALPHA_TEST);
}
use of net.minecraft.util.IIcon in project BluePower by Qmunity.
the class PartFixture method renderLamp.
/**
* @author Koen Beckers (K4Unl), Amadornes
*/
@Override
@SideOnly(Side.CLIENT)
public void renderLamp(RenderHelper renderer) {
Vec3dCube vector = new Vec3dCube(2 / 16D, 0.0, 2 / 16D, 1.0 - (2 / 16D), 2 / 16D, 1.0 - 2 / 16D);
IIcon topIcon = IconSupplier.fixtureFootTop;
IIcon sideIcon = IconSupplier.fixtureFootSide;
renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
vector = new Vec3dCube(3 / 16D, 2 / 16D, 3 / 16D, 1.0 - (3 / 16D), 8 / 16D, 13 / 16D);
if (inverted ? (power & 0xFF) == 255 : power == 0) {
sideIcon = IconSupplier.fixtureLampSideOff;
topIcon = IconSupplier.fixtureLampTopOff;
} else {
sideIcon = IconSupplier.fixtureLampSideOn;
topIcon = IconSupplier.fixtureLampTopOn;
}
renderer.setColor(color.getHex());
renderer.renderBox(vector, topIcon, topIcon, sideIcon, sideIcon, sideIcon, sideIcon);
renderer.setColor(0xFFFFFF);
}
Aggregations