Guest User

TESpecialRenderer

a guest
Mar 8th, 2018
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package fr.hugoland.rpmod.client.renders;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import fr.hugoland.rpmod.client.models.ModelPancarte;
  6. import fr.hugoland.rpmod.common.RPMod;
  7. import fr.hugoland.rpmod.common.tileentity.TileEntityPancarte;
  8. import net.minecraft.client.gui.FontRenderer;
  9. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  10. import net.minecraft.tileentity.TileEntity;
  11. import net.minecraft.util.ResourceLocation;
  12.  
  13. public class TileEntityPancarteSpecialRenderer extends TileEntitySpecialRenderer
  14. {
  15.  
  16. public static ModelPancarte model = new ModelPancarte();
  17. public static ResourceLocation texture = new ResourceLocation(RPMod.MODID, "textures/models/blocks/pancarte.png");;
  18.  
  19. @Override
  20. public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base
  21. {
  22. this.renderTileEntityPancarteAt((TileEntityPancarte)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile
  23. }
  24.  
  25. private void renderTileEntityPancarteAt(TileEntityPancarte tile, double x, double y, double z, float partialRenderTick) // ma propre fonction
  26. {
  27. GL11.glPushMatrix(); // ouvre une matrix
  28. float f1 = 0.6666667F;
  29. float f3;
  30. GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); // déplace le bloc sur les coordonnés et le centre
  31. GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); // met droit le bloc (par défaut il est à l'envers)
  32. GL11.glRotatef(180F, 0.0F, 1.0F,0.0F);
  33. GL11.glRotatef(90F * tile.getDirection(), 0.0F, 1.0F, 0.0F);
  34. this.bindTexture(texture); // affiche la texture
  35. model.renderAll(); // rend le modèle
  36. FontRenderer fontrenderer = this.func_147498_b();
  37. f3 = 0.016666668F * f1;
  38. GL11.glTranslatef(0.0F, 0.5F * f1, 0.07F * f1);
  39. GL11.glScalef(f3, -f3, f3);
  40. GL11.glNormal3f(0.0F, 0.0F, -1.0F * f3);
  41. GL11.glDepthMask(false);
  42. byte b0 = 0;
  43.  
  44. for (int i = 0; i < tile.signText.length; ++i)
  45. {
  46. String s = tile.signText[i];
  47.  
  48. if (i == tile.lineBeingEdited)
  49. {
  50. s = "> " + s + " <";
  51. fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, i * 10 - tile.signText.length * 5, b0);
  52. }
  53. else
  54. {
  55. fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, i * 10 - tile.signText.length * 5, b0);
  56. }
  57. }
  58.  
  59. GL11.glDepthMask(true);
  60. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  61. GL11.glPopMatrix();
  62. }
  63.  
  64. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×