use of uk.co.qmunity.lib.vec.Vec3i 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 uk.co.qmunity.lib.vec.Vec3i in project BluePower by Qmunity.
the class GateBase method renderItem.
@Override
@SideOnly(Side.CLIENT)
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if (this instanceof ISilkyRemovable) {
if (this instanceof IAdvancedSilkyRemovable) {
((IAdvancedSilkyRemovable) this).readSilkyData(null, 0, 0, 0, item.hasTagCompound() ? item.getTagCompound().getCompoundTag("tileData") : new NBTTagCompound());
} else {
readFromNBT(item.hasTagCompound() ? item.getTagCompound().getCompoundTag("tileData") : new NBTTagCompound());
}
}
GL11.glPushMatrix();
{
RenderHelper rh = RenderHelper.instance;
rh.reset();
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslated(-0.25, 0.75, 0.25);
}
if (type == ItemRenderType.ENTITY && item.getItemFrame() != null) {
GL11.glTranslated(19 / 32D, 8 / 16D, 1);
GL11.glRotated(-90, 0, 0, 1);
GL11.glRotated(90, 0, 1, 0);
}
if (type == ItemRenderType.INVENTORY && BluePower.proxy.isSneakingInGui()) {
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if (gui != null && gui instanceof GuiContainer) {
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-45F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-210F, 1.0F, 0.0F, 0.0F);
GL11.glScaled(1.5, 1.5, 1.5);
GL11.glTranslated(-0.5, 0, 0);
GL11.glTranslated(0, -0.5, 0);
GL11.glRotated(-90, 1, 0, 0);
GL11.glTranslated(0, 0.5, 0);
}
}
Tessellator.instance.startDrawingQuads();
if (shouldRenderOnPass(0))
renderStatic(new Vec3i(0, 0, 0), rh, RenderBlocks.getInstance(), 0);
rh.reset();
if (shouldRenderOnPass(1))
renderStatic(new Vec3i(0, 0, 0), rh, RenderBlocks.getInstance(), 1);
rh.reset();
Tessellator.instance.draw();
if (shouldRenderOnPass(0))
renderDynamic(new Vec3d(0, 0, 0), 0, 0);
if (shouldRenderOnPass(1))
renderDynamic(new Vec3d(0, 0, 0), 0, 1);
}
GL11.glPopMatrix();
}
use of uk.co.qmunity.lib.vec.Vec3i in project BluePower by Qmunity.
the class PartLamp method renderItem.
/**
* @author Koen Beckers (K4Unl)
*/
@Override
@SideOnly(Side.CLIENT)
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
power = (byte) 0;
RenderHelper rh = RenderHelper.instance;
rh.setRenderCoords(null, 0, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Tessellator.instance.startDrawingQuads();
renderStatic(new Vec3i(0, 0, 0), rh, RenderBlocks.getInstance(), 0);
Tessellator.instance.draw();
rh.reset();
GL11.glPushMatrix();
renderGlow(1);
GL11.glPopMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
}
use of uk.co.qmunity.lib.vec.Vec3i in project BluePower by Qmunity.
the class ConnectionLogicHelper method getNeighbor.
public C getNeighbor(T device, ForgeDirection side) {
ForgeDirection face = ForgeDirection.UNKNOWN;
if (device instanceof IFace)
face = ((IFace) device).getFace();
// In same block
do {
Vec3i loc = new Vec3i(device);
T dev = provider.getConnectableAt(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), side == face.getOpposite() ? ForgeDirection.UNKNOWN : side, face == ForgeDirection.UNKNOWN ? side.getOpposite() : face);
if (dev == null || dev == device || !provider.isValidClosedCorner(dev))
break;
ConnectionType type = (device instanceof IFace || dev instanceof IFace) && !(device instanceof IFace == dev instanceof IFace) ? ConnectionType.STRAIGHT : ConnectionType.CLOSED_CORNER;
if (provider.canConnect(device, dev, side, type) && provider.canConnect(dev, device, face, type))
return provider.createConnection(device, dev, side, face, type);
} while (false);
// On same block
if (face != ForgeDirection.UNKNOWN) {
do {
Vec3i loc = new Vec3i(device).add(face).add(side);
T dev = provider.getConnectableAt(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), side.getOpposite(), face.getOpposite());
if (dev == null || dev == device || !provider.isValidOpenCorner(dev))
break;
Vec3i block = new Vec3i(device).add(side);
Block b = block.getBlock();
// Full block check
if (b.isNormalCube() || b == Blocks.redstone_block)
break;
// Microblock check
if (!OcclusionHelper.microblockOcclusionTest(block, MicroblockShape.EDGE, 2, face, side.getOpposite()))
break;
if (provider.canConnect(device, dev, side, ConnectionType.OPEN_CORNER) && provider.canConnect(dev, device, face.getOpposite(), ConnectionType.OPEN_CORNER))
return provider.createConnection(device, dev, side, face.getOpposite(), ConnectionType.OPEN_CORNER);
} while (false);
}
// Straight connection
do {
Vec3i loc = new Vec3i(device).add(side);
T dev = provider.getConnectableAt(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), face, side.getOpposite());
if (dev == null) {
dev = provider.getConnectableAt(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), side.getOpposite(), side.getOpposite());
if (dev == null && face == ForgeDirection.UNKNOWN && provider.isNormalFace(device, side)) {
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (d != side && d != side.getOpposite()) {
dev = provider.getConnectableAt(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), d, side.getOpposite());
if (dev != null)
break;
}
}
}
}
if (dev == null || dev == device || !provider.isValidStraight(dev))
break;
if (provider.canConnect(device, dev, side, ConnectionType.STRAIGHT) && provider.canConnect(dev, device, side.getOpposite(), ConnectionType.STRAIGHT))
return provider.createConnection(device, dev, side, side.getOpposite(), ConnectionType.STRAIGHT);
} while (false);
return null;
}
use of uk.co.qmunity.lib.vec.Vec3i in project BluePower by Qmunity.
the class PneumaticTube method renderItem.
@Override
@SideOnly(Side.CLIENT)
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
GL11.glTranslated(0, -0.125D, 0);
Tessellator t = Tessellator.instance;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
t.startDrawingQuads();
connections[ForgeDirection.DOWN.ordinal()] = true;
connections[ForgeDirection.UP.ordinal()] = true;
RenderHelper renderer = RenderHelper.instance;
renderer.fullReset();
RenderBlocks rb = new RenderBlocks();
renderStatic(new Vec3i(0, 0, 0), renderer, rb, 0);
renderStatic(new Vec3i(0, 0, 0), renderer, rb, 1);
t.draw();
renderSide();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
GL11.glPopMatrix();
}
Aggregations