use of net.minecraft.client.renderer.Tessellator in project SecurityCraft by Geforce132.
the class ItemCameraMonitorRenderer method renderItem.
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if (type == ItemRenderType.FIRST_PERSON_MAP) {
// Draw the base monitor texture.
((TextureManager) data[1]).bindTexture(new ResourceLocation("securitycraft:textures/gui/camera/cameraBackground.png"));
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0 - 7, 128 + 7, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV(128 + 7, 128 + 7, 0.0D, 1.0D, 1.0D);
tessellator.addVertexWithUV(128 + 7, 0 - 7, 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV(0 - 7, 0 - 7, 0.0D, 0.0D, 0.0D);
tessellator.draw();
if (item != null && item.getItem() instanceof ItemCameraMonitor && ((ItemCameraMonitor) item.getItem()).hasCameraAdded(item.getTagCompound())) {
CameraView view = ((ItemCameraMonitor) item.getItem()).getCameraView(item.getTagCompound());
if (SecurityCraft.instance.hasViewForCoords(view.toNBTString())) {
IWorldView worldView = SecurityCraft.instance.getViewFromCoords(view.toNBTString()).getView();
if (worldView.isReady() && worldView.getTexture() != 0) {
// Bind the IWorldView texture then draw it.
GL11.glDisable(3008);
GL11.glDisable(2896);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, worldView.getTexture());
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(128 + 7, 0 - 7, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV(0 - 7, 0 - 7, 0.0D, -1.0D, 1.0D);
tessellator.addVertexWithUV(0 - 7, 128 + 7, 0.0D, -1.0D, 0.0D);
tessellator.addVertexWithUV(128 + 7, 128 + 7, 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
GL11.glEnable(3008);
GL11.glEnable(2896);
//
}
// Update the camera.
worldView.markDirty();
}
}
}
}
use of net.minecraft.client.renderer.Tessellator in project SecurityCraft by Geforce132.
the class TileEntityAlarmRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double x, double y, double z, float par5) {
int meta = par1TileEntity.hasWorldObj() ? par1TileEntity.getBlockMetadata() : par1TileEntity.blockMetadata;
float rotationX = 0F;
float rotationY = 0F;
float rotationZ = 1F;
if (par1TileEntity.hasWorldObj()) {
Tessellator tessellator = Tessellator.instance;
float f = par1TileEntity.getWorld().getLightBrightness(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord);
int l = par1TileEntity.getWorld().getLightBrightnessForSkyBlocks(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glPushMatrix();
if (meta == 0) {
rotationX = -1F;
rotationY = -10000F;
GL11.glTranslatef(0F, -2F, 0F);
} else if (meta == 1) {
rotationX = -1F;
rotationY = 1F;
rotationZ = 0F;
GL11.glTranslatef(1F, -1F, 0F);
} else if (meta == 2) {
rotationX = -1F;
rotationY = -1F;
rotationZ = 0F;
GL11.glTranslatef(-1F, -1F, 0F);
} else if (meta == 3) {
rotationX = 0F;
rotationY = -1F;
rotationZ = 1F;
GL11.glTranslatef(0F, -1F, 1F);
} else if (meta == 4) {
rotationX = 0F;
rotationY = 1F;
rotationZ = 1F;
GL11.glTranslatef(0F, -1F, -1F);
} else if (meta == 5)
rotationX = 0F;
GL11.glRotatef(180F, rotationX, rotationY, rotationZ);
alarmModel.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project SecurityCraft by Geforce132.
the class TileEntityClaymoreRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double x, double y, double z, float par5) {
claymoreModel.setActive(par1TileEntity.hasWorldObj() && par1TileEntity.blockType != null && par1TileEntity.blockType == SCContent.claymoreActive);
int meta = par1TileEntity.hasWorldObj() ? par1TileEntity.getBlockMetadata() : par1TileEntity.blockMetadata;
float rotation = 0F;
if (par1TileEntity.hasWorldObj()) {
Tessellator tessellator = Tessellator.instance;
float f = par1TileEntity.getWorld().getLightBrightness(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord);
int l = par1TileEntity.getWorld().getLightBrightnessForSkyBlocks(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glPushMatrix();
if (meta == 1)
rotation = 0F;
else if (meta == 2)
rotation = 1F;
else if (meta == 3)
rotation = -10000F;
else if (meta == 4)
rotation = -1F;
GL11.glRotatef(180F, rotation, 0.0F, 1.0F);
claymoreModel.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project SecurityCraft by Geforce132.
the class TileEntityFrameRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double x, double y, double z, float par5) {
int meta = par1TileEntity.hasWorldObj() ? par1TileEntity.getBlockMetadata() : par1TileEntity.blockMetadata;
IWorldView lgView = null;
float rotation = 0F;
Tessellator tessellator = Tessellator.instance;
if (par1TileEntity.hasWorldObj()) {
float f = par1TileEntity.getWorld().getLightBrightness(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord);
int l = par1TileEntity.getWorld().getLightBrightnessForSkyBlocks(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
}
if (par1TileEntity.hasWorldObj() && lgView == null && ((TileEntityFrame) par1TileEntity).hasCameraLocation() && SecurityCraft.instance.hasViewForCoords(((TileEntityFrame) par1TileEntity).getCameraView().toNBTString()) && ((TileEntityFrame) par1TileEntity).shouldShowView())
lgView = SecurityCraft.instance.getViewFromCoords(((TileEntityFrame) par1TileEntity).getCameraView().toNBTString()).getView();
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(frameTexture);
GL11.glPushMatrix();
if (par1TileEntity.hasWorldObj()) {
if (meta == 2)
rotation = 0F;
else if (meta == 4)
rotation = 1F;
else if (meta == 3)
rotation = -10000F;
else if (meta == 5)
rotation = -1F;
} else
rotation = -1F;
GL11.glRotatef(180F, rotation, 0.0F, 1.0F);
frameModel.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
if (lgView != null) {
if (lgView.getTexture() != 0) {
GL11.glTranslatef(0.625F, 0.375F, -0.475F);
GL11.glRotated(180D, 0D, 1D, 0D);
GL11.glDisable(3008);
GL11.glDisable(2896);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, lgView.getTexture());
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0.25, 1, 0, 1, 0);
tessellator.addVertexWithUV(0.25, 0.25, 0, 1, 1);
tessellator.addVertexWithUV(1, 0.25, 0, 0, 1);
tessellator.addVertexWithUV(1, 1, 0, 0, 0);
tessellator.draw();
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
GL11.glEnable(3008);
GL11.glEnable(2896);
}
lgView.markDirty();
}
GL11.glPopMatrix();
GL11.glPopMatrix();
}
use of net.minecraft.client.renderer.Tessellator in project SecurityCraft by Geforce132.
the class TileEntityIMSRenderer method renderTileEntityAt.
@Override
public void renderTileEntityAt(TileEntity par1TileEntity, double x, double y, double z, float par5) {
int bombsRemaining = (par1TileEntity != null && par1TileEntity.hasWorldObj()) ? ((TileEntityIMS) par1TileEntity).getBombsRemaining() : 4;
float rotationX = 0F;
float rotationY = 0F;
float rotationZ = 1F;
if (par1TileEntity.hasWorldObj()) {
Tessellator tessellator = Tessellator.instance;
float f = par1TileEntity.getWorld().getLightBrightness(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord);
int l = par1TileEntity.getWorld().getLightBrightnessForSkyBlocks(par1TileEntity.xCoord, par1TileEntity.yCoord, par1TileEntity.zCoord, 0);
int l1 = l % 65536;
int l2 = l / 65536;
tessellator.setColorOpaque_F(f, f, f);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, l1, l2);
}
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glPushMatrix();
GL11.glRotatef(180F, rotationX, rotationY, rotationZ);
imsModel.render((Entity) null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F, bombsRemaining);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
Aggregations