Skip to content

Instantly share code, notes, and snippets.

@shadowfacts
Created June 16, 2016 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadowfacts/aa52bfc659ba5527d4b7f81bcc652054 to your computer and use it in GitHub Desktop.
Save shadowfacts/aa52bfc659ba5527d4b7f81bcc652054 to your computer and use it in GitHub Desktop.
public class TESRCharger extends TileEntitySpecialRenderer<TileEntityCharger> {
@Override
public void renderTileEntityAt(TileEntityCharger te, double x, double y, double z, float partialTicks, int destroyStage) {
ItemStack stack = te.getStackInSlot(0);
if (stack != null) {
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(516, 0.1f);
GlStateManager.enableBlend();
RenderHelper.enableStandardItemLighting();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5d, y + 0.5d + (Math.sin(Math.toRadians(te.ticks)) * 0.2), z + 0.5d);
GL11.glRotated(te.ticks % 360 * 2, 0, 1, 0);
IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, te.getWorld(), null);
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.GROUND, false);
Minecraft.getMinecraft().getRenderItem().renderItem(stack, model);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment