Advertisement
Creepinson

tesr

Jun 19th, 2017
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. package me.creepinson.tileentity.render;
  2.  
  3. import me.creepinson.block.model.ModelCreepinoSkull;
  4. import me.creepinson.tileentity.TEBulb;
  5. import net.minecraft.client.renderer.GlStateManager;
  6. import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
  7. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  8. import net.minecraft.util.EnumFacing;
  9. import net.minecraftforge.fml.relauncher.Side;
  10. import net.minecraftforge.fml.relauncher.SideOnly;
  11.  
  12. @SideOnly(Side.CLIENT)
  13. public class TESRBulb extends TileEntitySpecialRenderer<TEBulb> {
  14. public static TESRBulb instance;
  15.  
  16.  
  17. public void renderTileEntityAt(TEBulb te, double x, double y, double z, float partialTicks,
  18. int destroyStage) {
  19. EnumFacing enumfacing = EnumFacing.getFront(te.getBlockMetadata() & 7);
  20.  
  21. this.renderSkull((float) x, (float) y, (float) z, EnumFacing.NORTH, (float) (te.getSkullRotation() * 360) / 16.0F, destroyStage);
  22. this.renderSkull((float) x, (float) y, (float) z, EnumFacing.EAST, (float) (te.getSkullRotation() * 360) / 16.0F, destroyStage);
  23. this.renderSkull((float) x, (float) y, (float) z, EnumFacing.SOUTH, (float) (te.getSkullRotation() * 360) / 16.0F, destroyStage);
  24. this.renderSkull((float) x, (float) y, (float) z, EnumFacing.WEST, (float) (te.getSkullRotation() * 360) / 16.0F, destroyStage);
  25. this.renderSkull((float) x, (float) y, (float) z, EnumFacing.UP, (float) (te.getSkullRotation() * 360) / 16.0F, destroyStage);
  26.  
  27.  
  28.  
  29.  
  30. }
  31.  
  32. public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn) {
  33. super.setRendererDispatcher(rendererDispatcherIn);
  34. instance = this;
  35. }
  36.  
  37. public void renderSkull(float x, float y, float z, EnumFacing facing, float p_188190_5_, int destroyStage) {
  38.  
  39. if (destroyStage >= 0) {
  40. this.bindTexture(DESTROY_STAGES[destroyStage]);
  41. GlStateManager.matrixMode(5890);
  42. GlStateManager.pushMatrix();
  43. GlStateManager.scale(4.0F, 2.0F, 1.0F);
  44. GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
  45. GlStateManager.matrixMode(5888);
  46. GlStateManager.popMatrix();
  47. } else {
  48.  
  49.  
  50.  
  51. }
  52.  
  53. GlStateManager.pushMatrix();
  54. GlStateManager.disableCull();
  55. if (facing == EnumFacing.UP) {
  56. GlStateManager.translate(x + 0.5F, y, z + 0.5F);
  57. } else {
  58. switch (facing) {
  59. case NORTH:
  60. GlStateManager.translate(x + 0.5F, y + 0.25F, z + 0.74F);
  61. break;
  62. case SOUTH:
  63. GlStateManager.translate(x + 0.5F, y + 0.25F, z + 0.26F);
  64. p_188190_5_ = 180.0F;
  65. break;
  66. case WEST:
  67. GlStateManager.translate(x + 0.74F, y + 0.25F, z + 0.5F);
  68. p_188190_5_ = 270.0F;
  69. break;
  70. case EAST:
  71. default:
  72. GlStateManager.translate(x + 0.26F, y + 0.25F, z + 0.5F);
  73. p_188190_5_ = 90.0F;
  74. }
  75. GlStateManager.popMatrix();
  76. }
  77.  
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement