Texture dans TileEntityRender
-
Oui Shape4 c’est le centre
sa change quelque chose si c’est dans le rendu plutot que dans le modèle ? a par de la lisibilité
-
Non, je ne crois pas que ça change autre chose que la lisibilité.
Et donc ton problème c’est qu’il rend toujours le shape4 et jamais le Shape1 ?
-
Oui comme si que la condition n’etait jamais remplie
-
Tu as bien placé le bloc en dessous ?
-
Oui j’ai placer un block de pipe en dessous et sa change rien
-
Étrange tout ça, tu peux m’envoyer tout ton code ? je vais regarder quand j’aurai le temps.
-
TileEntitySpecialRender :
package com.bowser.robotic.proxy; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import com.bowser.robotic.client.IInventoryRenderer; import com.bowser.robotic.common.Robotic; import com.bowser.robotic.common.TileEntityBlockPipeTest; import com.bowser.robotic.common.TileEntityFourArc; import com.bowser.robotic.common.techne.FourArc; import com.bowser.robotic.common.techne.Pipe; public class TileEntityBlockPipeTestSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer { private final Pipe model = new Pipe(); public static final ResourceLocation textureLocation = new ResourceLocation(Robotic.modid, "textures/blocks/pipetest.png"); public TileEntityBlockPipeTestSpecialRender() { this.func_147497_a(TileEntityRendererDispatcher.instance); } @Override public void renderInventory(double x, double y, double z) { this.renderTileEntityBlockPipeTestAt(null, x, y, z, 0.0F); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) { this.renderTileEntityBlockPipeTestAt((TileEntityBlockPipeTest)te, x, y, z, f); } public void renderTileEntityBlockPipeTestAt(TileEntityBlockPipeTest te, double x, double y, double z, float f) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5F, y + 1.5F, z + 0.5F); this.bindTexture(textureLocation); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); if(te!= null) { this.model.core(0.0625F, te.getWorldObj(), (int)x, (int)y, (int)z); } GL11.glPopMatrix(); } }
la classe du bloc :
package com.bowser.robotic.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; public class BlockPipeTest extends Block { protected BlockPipeTest(Material material) { super(material); } public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBlockPipeTest(); } public boolean hasTileEntity(int metadata) { return true; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } public boolean isOpaqueCube() { return false; } }
et le model techne :
// Date: 28/10/2014 12:09:37 // Template version 1.1 // Java generated by Techne // Keep in mind that you still need to fill in some blanks // - ZeuX package com.bowser.robotic.common.techne; import com.bowser.robotic.common.Robotic; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.world.World; public class Pipe extends ModelBase { //fields public static ModelRenderer Shape1; public static ModelRenderer Shape2; public static ModelRenderer Shape3; public static ModelRenderer Shape4; public static ModelRenderer Shape5; public static ModelRenderer Shape6; public static ModelRenderer Shape7; public Pipe() { textureWidth = 64; textureHeight = 32; Shape1 = new ModelRenderer(this, 0, 0); Shape1.addBox(0F, 0F, 0F, 6, 4, 4); Shape1.setRotationPoint(2F, 14F, -2F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 0, 10); Shape2.addBox(0F, 0F, 0F, 4, 4, 6); Shape2.setRotationPoint(-2F, 14F, 2F); Shape2.setTextureSize(64, 32); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0F); Shape3 = new ModelRenderer(this, 0, 21); Shape3.addBox(0F, 0F, 0F, 6, 4, 4); Shape3.setRotationPoint(-8F, 14F, -2F); Shape3.setTextureSize(64, 32); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 21, 0); Shape4.addBox(0F, 0F, 0F, 4, 4, 4); Shape4.setRotationPoint(-2F, 14F, -2F); Shape4.setTextureSize(64, 32); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0F); Shape5 = new ModelRenderer(this, 21, 9); Shape5.addBox(0F, 0F, 0F, 4, 4, 6); Shape5.setRotationPoint(-2F, 14F, -8F); Shape5.setTextureSize(64, 32); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 21, 20); Shape6.addBox(0F, 0F, 0F, 4, 6, 4); Shape6.setRotationPoint(-2F, 8F, -2F); Shape6.setTextureSize(64, 32); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0F); Shape7 = new ModelRenderer(this, 44, 3); Shape7.addBox(0F, 0F, 0F, 4, 6, 4); Shape7.setRotationPoint(-2F, 18F, -2F); Shape7.setTextureSize(64, 32); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); } /** public void render(float f, World world, int x, int y, int z) { if(world.getBlock(x,y-1,z+1) == Robotic.fourArc) { Shape1.render(f); } else { Shape4.render(f); } //Shape1.render(f); //Shape2.render(f); //Shape3.render(f); //Shape4.render(f); Core //Shape5.render(f); //Shape6.render(f); //Shape7.render(f); } * @param z * @param y * @param x * @param world */ public void core(float f, World world, int x, int y, int z){ //CENTER Shape4.render(f); } public void top(float f, World world, int x, int y, int z){ Shape3.render(f); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void render(float f) { // TODO Auto-generated method stub } }
Sa marche mais il ne me manque plus qu’a ajouter la fonction pour que le rendu change en fonction des blocs autour