use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class LogisticsNewSolidBlockWorldRenderer method renderWorldBlock.
public void renderWorldBlock(IBlockAccess world, LogisticsSolidTileEntity blockTile, RenderBlocks renderer, int x, int y, int z) {
Tessellator tess = Tessellator.instance;
SimpleServiceLocator.cclProxy.getRenderState().reset();
SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
BlockRotation rotation = BlockRotation.ZERO;
int brightness = 0;
IIconTransformation icon;
if (blockTile != null) {
BlockRotation.getRotation(blockTile.getRotation());
brightness = new DoubleCoordinates(blockTile).getBlock(world).getMixedBrightnessForBlock(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord);
icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord));
} else {
brightness = LogisticsPipes.LogisticsSolidBlock.getMixedBrightnessForBlock(world, x, y, z);
icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, x, y, z));
}
tess.setColorOpaque_F(1F, 1F, 1F);
tess.setBrightness(brightness);
//Draw
LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(new LPTranslation(x, y, z), icon);
if (blockTile != null) {
DoubleCoordinates pos = new DoubleCoordinates(blockTile);
for (CoverSides side : CoverSides.values()) {
boolean render = true;
DoubleCoordinates newPos = CoordinateUtils.sum(pos, side.getDir(rotation));
TileEntity sideTile = newPos.getTileEntity(blockTile.getWorldObj());
if (sideTile instanceof LogisticsTileGenericPipe) {
LogisticsTileGenericPipe tilePipe = (LogisticsTileGenericPipe) sideTile;
if (tilePipe.renderState.pipeConnectionMatrix.isConnected(side.getDir(rotation).getOpposite())) {
render = false;
}
}
if (render) {
LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
}
}
}
}
use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class LogisticsPipeItemRenderer method renderPipeItem.
private void renderPipeItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
//don't break other mods' guis when holding a pipe
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
//force transparency
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
// GL11.glBindTexture(GL11.GL_TEXTURE_2D, 10);
Tessellator tessellator = Tessellator.instance;
Block block = LogisticsPipes.LogisticsPipeBlock;
IIcon icon = item.getItem().getIconFromDamage(0);
if (icon == null) {
icon = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture)).getAtlasSprite("missingno");
}
block.setBlockBounds(LogisticsPipeItemRenderer.PIPE_MIN_POS, 0.0F, LogisticsPipeItemRenderer.PIPE_MIN_POS, LogisticsPipeItemRenderer.PIPE_MAX_POS, 1.0F, LogisticsPipeItemRenderer.PIPE_MAX_POS);
//block.setBlockBounds(PIPE_MIN_POS, PIPE_MIN_POS, PIPE_MIN_POS, PIPE_MAX_POS, PIPE_MAX_POS, PIPE_MAX_POS);
block.setBlockBoundsForItemRender();
render.setRenderBoundsFromBlock(block);
GL11.glTranslatef(translateX, translateY, translateZ);
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, -1F, 0.0F);
render.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
render.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, -1F);
render.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 0.0F, 1.0F);
render.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0.0F, 0.0F);
render.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(1.0F, 0.0F, 0.0F);
render.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, icon);
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
// nicely leave the rendering how it was
GL11.glPopAttrib();
}
use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class LogisticsNewPipeItemRenderer method renderPipeItem.
private void renderPipeItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
GL11.glPushMatrix();
// don't break other mods' guis when holding a pipe
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
// force transparency
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
// GL11.glBindTexture(GL11.GL_TEXTURE_2D, 10);
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(translateX, translateY, translateZ);
Block block = LogisticsPipes.LogisticsPipeBlock;
if (item.getItem() instanceof ItemLogisticsPipe) {
ItemLogisticsPipe lItem = (ItemLogisticsPipe) item.getItem();
int renderList = lItem.getNewPipeRenderList();
if (renderList == -1) {
lItem.setNewPipeRenderList(GL11.glGenLists(1));
renderList = lItem.getNewPipeRenderList();
GL11.glNewList(renderList, GL11.GL_COMPILE);
tessellator.startDrawingQuads();
generatePipeRenderList(lItem.getNewPipeIconIndex());
tessellator.draw();
GL11.glEndList();
}
GL11.glCallList(renderList);
}
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class LogisticsNewPipeItemRenderer method renderBlockItem.
private void renderBlockItem(RenderBlocks render, ItemStack item, float translateX, float translateY, float translateZ) {
//don't break other mods' guis when holding a pipe
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
//force transparency
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glTranslatef(translateX, translateY, translateZ);
Block block = LogisticsPipes.LogisticsPipeBlock;
Tessellator tess = Tessellator.instance;
BlockRotation rotation = BlockRotation.ZERO;
tess.startDrawingQuads();
IIconTransformation icon = SimpleServiceLocator.cclProxy.createIconTransformer(Textures.LOGISTICS_REQUEST_TABLE_NEW);
//Draw
LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(new I3DOperation[] { icon });
for (CoverSides side : CoverSides.values()) {
LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(new I3DOperation[] { icon });
}
tess.draw();
block.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
// nicely leave the rendering how it was
GL11.glPopAttrib();
}
use of net.minecraft.client.renderer.Tessellator in project LogisticsPipes by RS485.
the class GuiCheckBox method drawButton.
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft minecraft, int par2, int par3) {
if (visible) {
boolean var5 = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int var6 = getHoverState(var5);
//GL11.glBindTexture(GL11.GL_TEXTURE_2D, minecraft.renderEngine.getTexture("/logisticspipes/gui/checkbox-" + (state?"on":"out") + "" + (var6 == 2?"-mouse":"") + ".png"));
minecraft.renderEngine.bindTexture(new ResourceLocation("logisticspipes", "textures/gui/checkbox-" + (state ? "on" : "out") + "" + (var6 == 2 ? "-mouse" : "") + ".png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.addVertexWithUV(xPosition, yPosition + height, zLevel, 0, 1);
var9.addVertexWithUV(xPosition + width, yPosition + height, zLevel, 1, 1);
var9.addVertexWithUV(xPosition + width, yPosition, zLevel, 1, 0);
var9.addVertexWithUV(xPosition, yPosition, zLevel, 0, 0);
var9.draw();
/*
drawTexturedModalRect(xPosition , yPosition , 0 , 0 ,0);
drawTexturedModalRect(xPosition + width / 2 , yPosition , 0 , 1, 0);
drawTexturedModalRect(xPosition , yPosition + height / 2, 0 , 0 ,1);
drawTexturedModalRect(xPosition + width / 2 , yPosition + height / 2, 0 , 1, 1);
*/
mouseDragged(minecraft, par2, par3);
}
}
Aggregations