Guest User

TileEntitySpecialRenderer

a guest
Dec 8th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. package fr.shyfe.dcedo.proxy;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import BlocksPers.ModelFlagSpawn;
  6. import BlocksPers.ModelGrassB;
  7. import BlocksPers.TileEntityFlagSpawn;
  8. import BlocksPers.TileEntityGrassB;
  9. import BlocksPers.flagSpawn;
  10. import fr.shyfe.dcedo.common.Main;
  11. import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
  12. import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
  13. import net.minecraft.tileentity.TileEntity;
  14. import net.minecraft.util.ResourceLocation;
  15.  
  16. public class TileEntityFlagSpawnSpecialRenderer extends TileEntitySpecialRenderer {
  17.  
  18. public static ModelFlagSpawn model = new ModelFlagSpawn();
  19. public static ResourceLocation texture = new ResourceLocation(Main.MODID, "textures/models/blocks/FlagSpawn.png");
  20.  
  21. @Override
  22. public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) // la fonction qui était la de base
  23. {
  24. this.renderTileEntityFlagSpawnAt((TileEntityFlagSpawn)tile, x, y, z, partialRenderTick); // j'appelle ma fonction renderTileEntityTutorielAt en castant TileEntityTutoriel à l'argument tile
  25. }
  26.  
  27. private void renderTileEntityFlagSpawnAt(TileEntityFlagSpawn tile, double x, double y, double z, float partialRenderTick)
  28. {
  29. GL11.glPushMatrix(); // ouvre une matrix
  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(90F * tile.getDirection(), 0.0F, 1.0F, 0.0F);
  33. this.bindTexture(texture); // affiche la texture
  34. model.renderAll(); // rend le modèle
  35. GL11.glPopMatrix(); // ferme la matrix
  36. }
  37.  
  38. public TileEntityFlagSpawnSpecialRenderer() // TileEntityTutorielSpecialRenderer dans mon cas, c'est la classe que nous avons fait dans la partie précédente
  39. {
  40. this.func_147497_a(TileEntityRendererDispatcher.instance);
  41. }
  42. }
Add Comment
Please, Sign In to add comment