Java Code Examples for net.minecraft.client.renderer.GlStateManager#enableColorMaterial()
The following examples show how to use
net.minecraft.client.renderer.GlStateManager#enableColorMaterial() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Camera.java From seppuku with GNU General Public License v3.0 | 6 votes |
public void render(float x, float y, float w, float h) { if (OpenGlHelper.isFramebufferEnabled()) { GlStateManager.pushMatrix(); GlStateManager.enableTexture2D(); GlStateManager.disableLighting(); GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.enableColorMaterial(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); frameBuffer.bindFramebufferTexture(); final Tessellator tessellator = Tessellator.getInstance(); final BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(x, h, 0).tex(0, 0).endVertex(); bufferbuilder.pos(w, h, 0).tex(1, 0).endVertex(); bufferbuilder.pos(w, y, 0).tex(1, 1).endVertex(); bufferbuilder.pos(x, y, 0).tex(0, 1).endVertex(); tessellator.draw(); frameBuffer.unbindFramebufferTexture(); GlStateManager.popMatrix(); } }
Example 2
Source File: SurfaceHelper.java From ForgeHax with MIT License | 6 votes |
public static void drawItemWithOverlay(ItemStack item, double x, double y, double scale) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); MC.getRenderItem().zLevel = 100.f; renderItemAndEffectIntoGUI(getLocalPlayer(), item, x, y, 16.D); renderItemOverlayIntoGUI(MC.fontRenderer, item, x, y, null, scale); MC.getRenderItem().zLevel = 0.f; GlStateManager.popMatrix(); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); }
Example 3
Source File: SurfaceHelper.java From ForgeHax with MIT License | 6 votes |
public static void drawPotionEffect(PotionEffect potion, int x, int y) { int index = potion.getPotion().getStatusIconIndex(); GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); GlStateManager.enableTexture2D(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); MC.getTextureManager().bindTexture(GuiContainer.INVENTORY_BACKGROUND); drawTexturedRect(x, y, index % 8 * 18, 198 + index / 8 * 18, 18, 18, 100); potion.getPotion().renderHUDEffect(x, y, potion, MC, 255); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); GlStateManager.popMatrix(); }
Example 4
Source File: PhasedBlockRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
public static BufferBuilder beginRender() { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.enableCull(); GlStateManager.cullFace(GlStateManager.CullFace.BACK); GlStateManager.depthMask(false); GlStateManager.enablePolygonOffset(); GlStateManager.doPolygonOffset(-0.1f, -1000f); GlStateManager.enableColorMaterial(); GlStateManager.color(1, 1, 1, 1); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); GL14.glBlendEquation(GL14.GL_FUNC_SUBTRACT); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); buffer.setTranslation(-TileEntityRendererDispatcher.staticPlayerX, -TileEntityRendererDispatcher.staticPlayerY, -TileEntityRendererDispatcher.staticPlayerZ); return buffer; }
Example 5
Source File: GuiSurgery.java From Cyberware with MIT License | 6 votes |
public void renderEntity(Entity entity, float x, float y, float scale, float rotation) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 50.0F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().doRenderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.enableTexture2D(); }
Example 6
Source File: GuiSurgery.java From Cyberware with MIT License | 6 votes |
public void renderModel(ModelBase model, float x, float y, float scale, float rotation) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(x, y, 120F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(10.0F, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(rotation, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); float f1 = 0.7F; GlStateManager.glLightModel(2899, RenderHelper.setColorBuffer(f1, f1, f1, 1.0F)); model.render(null, 0, 0, 0, 0, 0, .0625f); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.enableTexture2D(); }
Example 7
Source File: RenderEntityThrownItem.java From Production-Line with MIT License | 5 votes |
/** * Renders the desired {@code T} type Entity. */ @Override public void doRender(T entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate((float) (this.renderManager.options.thirdPersonView == 2 ? -1 : 1) * this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } this.itemRenderer.renderItem(this.getStackToRender(entity), ItemCameraTransforms.TransformType.GROUND); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 8
Source File: SurfaceBuilder.java From ForgeHax with MIT License | 5 votes |
public static void enableItemRendering() { RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); }
Example 9
Source File: SurfaceHelper.java From ForgeHax with MIT License | 5 votes |
public static void drawItem(ItemStack item, double x, double y) { GlStateManager.pushMatrix(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); MC.getRenderItem().zLevel = 100.f; renderItemAndEffectIntoGUI(getLocalPlayer(), item, x, y, 16.D); MC.getRenderItem().zLevel = 0.f; GlStateManager.popMatrix(); GlStateManager.disableLighting(); GlStateManager.enableDepth(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); }
Example 10
Source File: RenderFallTofu.java From TofuCraftReload with MIT License | 5 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFallTofu entity, double x, double y, double z, float entityYaw, float partialTicks) { IBlockState iblockstate = BlockLoader.tofuTerrain.getDefaultState(); if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) { World world = entity.getWorldObj(); if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } bufferbuilder.begin(7, DefaultVertexFormats.BLOCK); BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ); GlStateManager.translate((float) (x - (double) blockpos.getX() - 0.5D), (float) (y - (double) blockpos.getY()), (float) (z - (double) blockpos.getZ() - 0.5D)); BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, blockpos, bufferbuilder, false); tessellator.draw(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } } }
Example 11
Source File: GuiInventoryExpandedCrafting.java From Cyberware with MIT License | 5 votes |
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent) { GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate((float)posX, (float)posY, 50.0F); GlStateManager.scale((float)(-scale), (float)scale, (float)scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); float f = ent.renderYawOffset; float f1 = ent.rotationYaw; float f2 = ent.rotationPitch; float f3 = ent.prevRotationYawHead; float f4 = ent.rotationYawHead; GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F; ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F; ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F; ent.rotationYawHead = ent.rotationYaw; ent.prevRotationYawHead = ent.rotationYaw; GlStateManager.translate(0.0F, 0.0F, 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); ent.renderYawOffset = f; ent.rotationYaw = f1; ent.rotationPitch = f2; ent.prevRotationYawHead = f3; ent.rotationYawHead = f4; GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); }
Example 12
Source File: RenderHand.java From pycode-minecraft with MIT License | 5 votes |
public void doRender(@Nonnull HandEntity entity, double x, double y, double z, float entityYaw, float partialTicks) { GlStateManager.pushMatrix(); this.bindEntityTexture(entity); float f3 = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; GlStateManager.translate((float)x, (float)y + 0.7F, (float)z); GlStateManager.rotate(180.0F - entityYaw, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(-f3, 0.0F, 0.0F, 1.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.scale(-1.0F, -1.0F, 1.0F); model.render(entity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GlStateManager.popMatrix(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } else { this.renderName(entity, x, y, z); } super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 13
Source File: UnicornTrailRenderer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
@SubscribeEvent @SideOnly(Side.CLIENT) public static void render(RenderWorldLastEvent event) { World world = Minecraft.getMinecraft().world; EntityPlayer player = Minecraft.getMinecraft().player; if (player == null || world == null) return; GlStateManager.pushMatrix(); double interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks(); double interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks(); double interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks(); GlStateManager.translate(-interpPosX, -interpPosY + 0.1, -interpPosZ); GlStateManager.disableCull(); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.disableTexture2D(); GlStateManager.shadeModel(GL11.GL_SMOOTH); GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE); GlStateManager.enableColorMaterial(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder vb = tessellator.getBuffer(); Set<EntityUnicorn> corns = new HashSet<>(positions.keySet()); for (EntityUnicorn corn : corns) { if (corn.world.provider.getDimension() != world.provider.getDimension()) continue; List<Point> points = new ArrayList<>(positions.getOrDefault(corn, new ArrayList<>())); boolean q = false; vb.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_COLOR); for (Point pos : points) { if (pos == null) continue; float sub = (world.getTotalWorldTime() - pos.time); Color color = Color.getHSBColor(sub % 360.0f / 360.0f, 1f, 1f); int alpha; if (sub < 500) { alpha = (int) (MathHelper.clamp(Math.log(sub + 1) / 2.0, 0, 1) * 80.0); } else { alpha = (int) (MathHelper.clamp(1 - (Math.log(sub) / 2.0), 0, 1) * 80.0); } pos(vb, pos.origin.subtract(pos.normal.scale(1.5))).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex(); pos(vb, pos.origin.add(pos.normal.scale(1.5))).color(color.getRed(), color.getGreen(), color.getBlue(), alpha).endVertex(); q = !q; } tessellator.draw(); } GlStateManager.enableCull(); GlStateManager.depthMask(true); GlStateManager.disableBlend(); GlStateManager.enableTexture2D(); GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.popMatrix(); }
Example 14
Source File: EntityWikiTab.java From IGW-mod with GNU General Public License v2.0 | 4 votes |
public static void drawEntity(Entity entity, int x, int y, float size, float partialTicks){ //GL11.glEnable(GL11.GL_LIGHTING); //x, y, scale, yaw, pitch GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); float maxHitboxComponent = Math.max(1, Math.max(entity.width, entity.height)); int scale = (int)(40 * size / maxHitboxComponent); GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GL11.glTranslatef(x, y, 50.0F); GL11.glScalef(-scale, scale, scale); GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(30, 1, 0, 0); GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-TickHandler.ticksExisted, 0, 1, 0); /* GL11.glRotatef(-((float)Math.atan((double)(par4 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F); entity.renderYawOffset = (float)Math.atan((double)(par3 / 40.0F)) * 20.0F; entity.rotationYaw = (float)Math.atan((double)(par3 / 40.0F)) * 40.0F; entity.rotationPitch = -((float)Math.atan((double)(par4 / 40.0F))) * 20.0F; entity.rotationYawHead = entity.rotationYaw; entity.prevRotationYawHead = entity.rotationYaw;*/ GL11.glTranslatef(0.0F, (float)entity.getYOffset(), 0.0F); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setRenderShadow(false); Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F; Minecraft.getMinecraft().getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); /* entity.renderYawOffset = f2; entity.rotationYaw = f3; entity.rotationPitch = f4; entity.prevRotationYawHead = f5; entity.rotationYawHead = f6;*/ GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); // GL11.glDisable(GL11.GL_LIGHTING); }
Example 15
Source File: GuiEntityRender.java From WearableBackpacks with MIT License | 4 votes |
@Override public void draw(int mouseX, int mouseY, float partialTicks) { int w = getWidth(); int h = getHeight(); enableBlendAlphaStuffs(); setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2); setRenderColorARGB(_colorBorder); drawOutline(0, 0, w, h); disableBlendAlphaStuffs(); Entity entity = getEntity(); if (entity == null) return; AxisAlignedBB bbox = entity.getRenderBoundingBox(); float entityWidth = (float)(bbox.maxX - bbox.minX); float entityHeight = (float)(bbox.maxY - bbox.minY); float scale = Math.min((w - RESERVED_SPACE) / entityWidth, (h - RESERVED_SPACE) / entityHeight) * _zoom; float yaw = _yawDefault + _yaw; float pitch = _pitchDefault + _pitch; getContext().pushScissor(this, 1, 1, w - 2, h - 2); if (entity.getEntityWorld() == null) entity.setWorld(DummyWorld.INSTANCE); if (getMC().player == null) { World world = entity.getEntityWorld(); if (!(world instanceof DummyWorld)) return; getMC().player = ((DummyWorld)world).player; getMC().player.setWorld(world); } setRenderColorARGB(Color.WHITE); GlStateManager.enableDepth(); // From GuiInventory.drawEntityOnScreen GlStateManager.enableColorMaterial(); GlStateManager.pushMatrix(); GlStateManager.translate(w * _centerX, h * _centerY, 100.0F); GlStateManager.scale(-scale, scale, scale); GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F); GlStateManager.rotate(pitch, 1.0F, 0.0F, 0.0F); GlStateManager.translate(0.0F, -(entityHeight / 2), 0.0F); GlStateManager.rotate(yaw, 0.0F, 1.0F, 0.0F); RenderHelper.enableStandardItemLighting(); RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); rendermanager.setPlayerViewY(180.0F); rendermanager.setRenderShadow(false); rendermanager.renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false); rendermanager.setRenderShadow(true); GlStateManager.popMatrix(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); GlStateManager.disableTexture2D(); GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); GlStateManager.disableDepth(); if (getMC().player instanceof DummyPlayerSP) getMC().player = null; getContext().popScissor(); }
Example 16
Source File: RenderFallingBlockEU.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
public void doRender(EntityFallingBlockEU entity, double x, double y, double z, float entityYaw, float partialTicks) { IBlockState state = entity.getBlockState(); if (state != null && state.getRenderType() == EnumBlockRenderType.MODEL) { World world = entity.getEntityWorld(); if (state != world.getBlockState(new BlockPos(entity)) && state.getRenderType() != EnumBlockRenderType.INVISIBLE) { this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buffer = tessellator.getBuffer(); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } buffer.begin(7, DefaultVertexFormats.BLOCK); BlockPos pos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ); GlStateManager.translate((float)(x - pos.getX() - 0.5D), (float)(y - pos.getY()), (float)(z - pos.getZ() - 0.5D)); BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); dispatcher.getBlockModelRenderer().renderModel( world, dispatcher.getModelForState(state), state, pos, buffer, false, MathHelper.getPositionRandom(entity.getOrigin())); tessellator.draw(); if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } } }
Example 17
Source File: ShulkerViewer.java From ForgeHax with MIT License | 4 votes |
@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { final int DEPTH = 500; int x = posX; int y = posY; GlStateManager.enableTexture2D(); GlStateManager.disableLighting(); GlStateManager.color( 1.f, 1.f, 1.f, !isLocked() ? (tooltip_opacity.getAsFloat() / 255.f) : (locked_opacity.getAsFloat() / 255.f)); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); MC.getTextureManager().bindTexture(SHULKER_GUI_TEXTURE); // width 176 = width of container // height 16 = top of the gui // height 54 = gui item boxes // height 6 = bottom of the gui SurfaceHelper.drawTexturedRect(x, y, 0, 0, 176, 16, DEPTH); SurfaceHelper.drawTexturedRect(x, y + 16, 0, 16, 176, 54, DEPTH); SurfaceHelper.drawTexturedRect(x, y + 16 + 54, 0, 160, 176, 6, DEPTH); GlStateManager.disableDepth(); SurfaceHelper.drawText(parentShulker.getDisplayName(), x + 8, y + 6, Colors.BLACK.toBuffer()); GlStateManager.enableDepth(); RenderHelper.enableGUIStandardItemLighting(); GlStateManager.enableRescaleNormal(); GlStateManager.enableColorMaterial(); GlStateManager.enableLighting(); Slot hoveringOver = null; int rx = x + 8; int ry = y - 1; for (Slot slot : inventorySlots.inventorySlots) { if (slot.getHasStack()) { int px = rx + slot.xPos; int py = ry + slot.yPos; MC.getRenderItem().zLevel = DEPTH + 1; SurfaceHelper.drawItem(slot.getStack(), px, py); SurfaceHelper.drawItemOverlay(slot.getStack(), px, py); MC.getRenderItem().zLevel = 0.f; if (isPointInRegion(px, py, 16, 16, mouseX, mouseY)) { hoveringOver = slot; } } } GlStateManager.disableLighting(); if (hoveringOver != null) { // background of the gui GlStateManager.disableLighting(); GlStateManager.disableDepth(); GlStateManager.colorMask(true, true, true, false); this.drawGradientRect( rx + hoveringOver.xPos, ry + hoveringOver.yPos, rx + hoveringOver.xPos + 16, ry + hoveringOver.yPos + 16, -2130706433, -2130706433); GlStateManager.colorMask(true, true, true, true); // tool tip GlStateManager.color(1.f, 1.f, 1.f, 1.0f); GlStateManager.pushMatrix(); isModGeneratedToolTip = true; renderToolTip(hoveringOver.getStack(), mouseX + 8, mouseY + 8); isModGeneratedToolTip = false; GlStateManager.popMatrix(); GlStateManager.enableDepth(); } if (isPointInRegion(this.posX, this.posY, getWidth(), getHeight(), mouseX, mouseY)) { isMouseInShulkerGui = true; } GlStateManager.disableBlend(); GlStateManager.color(1.f, 1.f, 1.f, 1.0f); }
Example 18
Source File: WrapperGlStateManager.java From ClientBase with MIT License | 4 votes |
public static void enableColorMaterial() { GlStateManager.enableColorMaterial(); }
Example 19
Source File: RenderBeam.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityBeam entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float) x, (float) y, (float) z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.enableBlend(); GlStateManager.disableAlpha(); GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); GlStateManager.depthMask(true); GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableBlend(); GlStateManager.enableAlpha(); GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
Example 20
Source File: RenderFukumame.java From TofuCraftReload with MIT License | 4 votes |
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityFukumame entity, double x, double y, double z, float entityYaw, float partialTicks) { this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.disableLighting(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(0.05625F, 0.05625F, 0.05625F); GlStateManager.translate(-4.0F, 0.0F, 0.0F); if (this.renderOutlines) { GlStateManager.enableColorMaterial(); GlStateManager.enableOutlineMode(this.getTeamColor(entity)); } GlStateManager.glNormal3f(0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); GlStateManager.glNormal3f(-0.05625F, 0.0F, 0.0F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-7.0D, 2.0D, -2.0D).tex(0.0D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, 2.0D, 2.0D).tex(0.15625D, 0.15625D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, 2.0D).tex(0.15625D, 0.3125D).endVertex(); bufferbuilder.pos(-7.0D, -2.0D, -2.0D).tex(0.0D, 0.3125D).endVertex(); tessellator.draw(); for (int j = 0; j < 4; ++j) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GlStateManager.glNormal3f(0.0F, 0.0F, 0.05625F); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(-8.0D, -2.0D, 0.0D).tex(0.0D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, -2.0D, 0.0D).tex(0.5D, 0.0D).endVertex(); bufferbuilder.pos(8.0D, 2.0D, 0.0D).tex(0.5D, 0.15625D).endVertex(); bufferbuilder.pos(-8.0D, 2.0D, 0.0D).tex(0.0D, 0.15625D).endVertex(); tessellator.draw(); } if (this.renderOutlines) { GlStateManager.disableOutlineMode(); GlStateManager.disableColorMaterial(); } GlStateManager.disableRescaleNormal(); GlStateManager.enableLighting(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }