Non résolu Problème incompréhensible du rendu TESR de mon block v1.7.10
-
Bonjour,
J’ai un problème avec le rendu TESR de mon block : lorsque je le pose, le rendu se déplace en même temps que moi, lorsque je saute, je marche, je cours… sauf lorsque je me déplace vers le block en le regardant, en marchant tout droit devant moi.
Je décris le mieux possible ce problème mais je n’arrive pas à le comprendre .
N’ayant aucun rapport de crash, voici mes classes :Ma classe Principale (ModReality) :
package fr.minecraft.reality.common; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.minecraft.reality.proxy.CommonProxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkSystem; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; @Mod(modid = ModReality.MODID, name = "Mod Reality", version = "1.0.0") public class ModReality { public static final String MODID = "modreality"; @Instance(MODID) public static ModReality instance; @SidedProxy(clientSide = "fr.minecraft.reality.proxy.ClientProxy", serverSide = "fr.minecraft.reality.proxy.CommonProxy") public static CommonProxy proxy; //blocks public static Block plastic; public static Block compacted_plastic; public static Block craftingTable5x5; public static Block decomposeurChimique; public static Block petrolFurnace; //Electricité public static Block cableElectriqueSimpleNégatif; public static Block cableElectriqueSimplePositif; public static Block cableElectriqueDouble; public static Block cableElectriqueQuadruple; //items //lingots public static Item plasticIngot; public static Item silverIngot; //armures public static Item silverHelmet; public static Item silverChestPlate; public static Item silverLeggins; public static Item silverBoots; //outils public static Item bedrockSword; //atomes public static Item atome_hydrogene; public static Item atome_helium; public static Item atome_lithium; public static Item atome_beryllium; public static Item atome_bore; public static Item atome_carbone; public static Item atome_azote; public static Item atome_oxygene; public static Item atome_fluor; public static Item atome_neon; public static Item atome_sodium; public static Item atome_magnesium; public static Item atome_aluminium; public static Item atome_silicium; public static Item atome_phosphore; public static Item atome_soufre; public static Item atome_chlore; public static Item atome_argon; //aliments public static Item vegetablePuck; //autres public static Item bedrockFragment; public static Item blazeStick; //Creatives Tabs public static CreativeTabs tabAtomes = new CreativeTabs("atomes") { @SideOnly(Side.CLIENT) public Item getTabIconItem() { return ModReality.atome_hydrogene; } }; public static CreativeTabs tabPlastic = new CreativeTabs("plastic") { @SideOnly(Side.CLIENT) public Item getTabIconItem() { return ModReality.plasticIngot; } }; public static CreativeTabs tabEnergy = new CreativeTabs("energy") { @SideOnly(Side.CLIENT) public Item getTabIconItem() { return Item.getItemFromBlock(cableElectriqueSimpleNégatif); } }; public static ArmorMaterial silverArmor = EnumHelper.addArmorMaterial("silverArmor", 13, new int[]{2, 6, 4, 2}, 17); public static ToolMaterial toolBedrock = EnumHelper.addToolMaterial("toolBedrock", 1000000, 1000000000, 1000000, 1000000, 1000000); //fonction de pré-initialisation @EventHandler public void preInit(FMLPreInitializationEvent event) { //blocks plastic = new Plastic(Material.rock).setBlockName("plastic").setHardness(1.5F).setResistance(8.0F).setBlockTextureName(MODID + ":plastic").setCreativeTab(tabPlastic); compacted_plastic = new Plastic(Material.rock).setHardness(1.5F).setResistance(11.0F).setBlockName("compacted_plastic").setBlockTextureName(MODID + ":compacted_plastic").setCreativeTab(tabPlastic); decomposeurChimique = new DecomposeurChimique().setHardness(1.5F).setResistance(10.0F).setBlockName("decomposeur_chimique").setBlockTextureName(MODID + ":decomposeur_chimique").setCreativeTab(tabAtomes); craftingTable5x5 = new CraftingTable5x5().setHardness(2.0F).setResistance(5.0F).setBlockName("crafting_table_5x5").setStepSound(Block.soundTypeWood).setCreativeTab(CreativeTabs.tabDecorations); petrolFurnace = new PetrolFurnace().setHardness(3.5F).setStepSound(Block.soundTypePiston).setResistance(9.0F).setBlockName("petrol_furnace").setCreativeTab(CreativeTabs.tabDecorations); //Electricité cableElectriqueSimpleNégatif = new CableElectriqueSimpleNégatif(Material.iron).setHardness(1.2F).setResistance(8.0F).setBlockName("cable_electrique_simple_negatif").setCreativeTab(tabEnergy); cableElectriqueSimplePositif = new CableElectriqueSimplePositif(Material.iron).setHardness(1.2F).setResistance(8.0F).setBlockName("cable_electrique_simple_negatif").setCreativeTab(tabEnergy); //items plasticIngot = new PlasticIngot().setUnlocalizedName("plasticIngot").setTextureName(MODID + ":plastic_ingot").setCreativeTab(tabPlastic); silverIngot = new SilverIngot().setUnlocalizedName("silverIngot").setTextureName(MODID + ":silver_ingot").setCreativeTab(CreativeTabs.tabMaterials); //armures silverHelmet = new ItemSilverArmor(silverArmor, 0).setUnlocalizedName("silverHelmet").setTextureName(MODID + ":silver_helmet"); silverChestPlate = new ItemSilverArmor(silverArmor, 1).setUnlocalizedName("silverChestPlate").setTextureName(MODID + ":silver_chestplate"); silverLeggins = new ItemSilverArmor(silverArmor, 2).setUnlocalizedName("silverLeggins").setTextureName(MODID + ":silver_leggins"); silverBoots = new ItemSilverArmor(silverArmor, 3).setUnlocalizedName("silverBoots").setTextureName(MODID + ":silver_boots"); //outils bedrockSword = new bedRockSword(toolBedrock).setUnlocalizedName("bedrockSword").setTextureName(MODID + ":bedrock_sword").setCreativeTab(CreativeTabs.tabCombat); //atomes atome_hydrogene = new Item().setUnlocalizedName("atome_hydrogene").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_hydrogene"); atome_helium = new Item().setUnlocalizedName("atome_helium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_helium"); atome_lithium = new Item().setUnlocalizedName("atome_lithium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_lithium"); atome_beryllium = new Item().setUnlocalizedName("atome_beryllium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_beryllium"); atome_bore = new Item().setUnlocalizedName("atome_bore").setCreativeTab(ModReality.tabAtomes).setTextureName(MODID + ":atome_bore"); atome_carbone = new Item().setUnlocalizedName("atome_carbone").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_carbone"); atome_azote = new Item().setUnlocalizedName("atome_azote").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_azote"); atome_oxygene = new Item().setUnlocalizedName("atome_oxygene").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_oxygene"); atome_fluor = new Item().setUnlocalizedName("atome_fluor").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_fluor"); atome_neon = new Item().setUnlocalizedName("atome_neon").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_neon"); atome_sodium = new Item().setUnlocalizedName("atome_sodium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_sodium"); atome_magnesium = new Item().setUnlocalizedName("atome_magnesium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_magnesium"); atome_aluminium = new Item().setUnlocalizedName("atome_aluminium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_aluminium"); atome_silicium = new Item().setUnlocalizedName("atome_silicium").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_silicium"); atome_phosphore = new Item().setUnlocalizedName("atome_phosphore").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_phosphore"); atome_soufre = new Item().setUnlocalizedName("atome_soufre").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_soufre"); atome_chlore = new Item().setUnlocalizedName("atome_chlore").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_chlore"); atome_argon = new Item().setUnlocalizedName("atome_argon").setCreativeTab(tabAtomes).setTextureName(MODID + ":atome_argon"); //autres bedrockFragment = new Item().setUnlocalizedName("bedrock_fragment").setCreativeTab(CreativeTabs.tabMisc).setTextureName(MODID + ":bedrock_fragment"); blazeStick = new Item().setUnlocalizedName("blaze_stick").setCreativeTab(CreativeTabs.tabMisc).setTextureName(MODID + ":blaze_stick"); vegetablePuck = new Item().setUnlocalizedName("vegetablePuck").setCreativeTab(CreativeTabs.tabFood).setTextureName(MODID + ":vegetablePuck"); //enregistrement des blocks GameRegistry.registerBlock(plastic, "plastic"); GameRegistry.registerBlock(compacted_plastic, "compacted_plastic"); GameRegistry.registerBlock(craftingTable5x5, "craftingTable5x5"); GameRegistry.registerBlock(decomposeurChimique, "decomposeurChimique"); GameRegistry.registerBlock(petrolFurnace, "petrolFurnace"); //Electricité GameRegistry.registerBlock(cableElectriqueSimpleNégatif, "cableElectriqueSimpleNégatif"); GameRegistry.registerBlock(cableElectriqueSimplePositif, "cableElectriqueSimplePositif"); //enregistrement des items //lingots GameRegistry.registerItem(plasticIngot, "plasticIngot"); GameRegistry.registerItem(silverIngot, "silverIngot"); //armures GameRegistry.registerItem(silverHelmet, "silver_helmet"); GameRegistry.registerItem(silverChestPlate, "silver_chest_plate"); GameRegistry.registerItem(silverLeggins, "silver_leggins"); GameRegistry.registerItem(silverBoots, "silver_boots"); //outils GameRegistry.registerItem(bedrockSword, "bedrock_sword"); //atomes GameRegistry.registerItem(atome_hydrogene, "atome_hydrogene"); GameRegistry.registerItem(atome_helium, "atome_helium"); GameRegistry.registerItem(atome_lithium, "atome_lithium"); GameRegistry.registerItem(atome_beryllium, "atome_beryllium"); GameRegistry.registerItem(atome_bore, "atome_bore"); GameRegistry.registerItem(atome_carbone, "atome_carbone"); GameRegistry.registerItem(atome_azote, "atome_azote"); GameRegistry.registerItem(atome_oxygene, "atome_oxygene"); GameRegistry.registerItem(atome_fluor, "atome_fluor"); GameRegistry.registerItem(atome_neon, "atome_neon"); GameRegistry.registerItem(atome_sodium, "atome_sodium"); GameRegistry.registerItem(atome_magnesium, "atome_magnesium"); GameRegistry.registerItem(atome_aluminium, "atome_aluminium"); GameRegistry.registerItem(atome_silicium, "atome_silicium"); GameRegistry.registerItem(atome_phosphore, "atome_phosphore"); GameRegistry.registerItem(atome_soufre, "atome_soufre"); GameRegistry.registerItem(atome_chlore, "atome_chlore"); GameRegistry.registerItem(atome_argon, "atome_argon"); //aliments GameRegistry.registerItem(vegetablePuck, "vegetable_puck"); //autres GameRegistry.registerItem(bedrockFragment, "bedrock_fragment"); GameRegistry.registerItem(blazeStick, "blaze_stick"); //TileEntity GameRegistry.registerTileEntity(PetrolFurnaceTileEntity.class, MODID + "PetrolFunace"); //Crafts GameRegistry.addRecipe(new ItemStack(bedrockFragment), new Object[]{"XOX", "IPI", "XOX", 'X', Blocks.beacon, 'O', Blocks.diamond_block, 'I', Blocks.emerald_block, 'P', Items.ender_eye}); GameRegistry.addRecipe(new ItemStack(Blocks.bedrock), new Object[]{"XXX", "XXX", "XXX", 'X', bedrockFragment}); GameRegistry.addRecipe(new ItemStack(bedrockSword), new Object[]{" X ", " X ", " I ", 'X', blazeStick, 'I', Blocks.bedrock}); GameRegistry.addRecipe(new ItemStack(blazeStick), new Object[]{"XIX", "XIX", "XIX", 'X', Items.blaze_rod, 'I', Items.stick}); } //fonction d'initialisation @EventHandler public void init(FMLInitializationEvent event) { NetworkRegistry.INSTANCE.registerGuiHandler(instance, new PetrolFurnaceGuiHandler()); proxy.registerRender(); } //fonction de post-initialisation @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
La classe de mon block (CableElectriqueSimpleNegatif) :
package fr.minecraft.reality.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class CableElectriqueSimpleNegatif extends Block { protected CableElectriqueSimpleNegatif(Material material) { super(material); } @Override public boolean hasTileEntity(int metadata) { return true; } @Override public TileEntity createTileEntity(World world, int metadata) { return new CableElectriqueSimpleNegatifTileEntity(); } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return -1; } }
La classe du TileEntity de mon block (CableElectriqueSimpleNegatif) :
package fr.minecraft.reality.common; import net.minecraft.tileentity.TileEntity; public class CableElectriqueSimpleNegatifTileEntity extends TileEntity { }
La classe TileEntitySpecialRenderer (CableElectriqueSimpleNegatifTileEntitySpecialRenderer) :
package fr.minecraft.reality.proxy; import org.lwjgl.opengl.GL11; import fr.minecraft.reality.client.ModelCableElectriqueSimpleNegatif; import fr.minecraft.reality.common.CableElectriqueSimpleNegatifTileEntity; import fr.minecraft.reality.common.ModReality; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; public class CableElectriqueSimpleNegatifTileEntitySpecialRenderer extends TileEntitySpecialRenderer { public static ModelCableElectriqueSimpleNegatif model = new ModelCableElectriqueSimpleNegatif(); private ResourceLocation texture = new ResourceLocation(ModReality.MODID, "textures/models/blocks/cableElectriqueSimpleNegatifTexture.png"); @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialRenderTick) { this.renderCableElectriqueSimpleNegatifTileEntityAt((CableElectriqueSimpleNegatifTileEntity)tile, x, y, z, partialRenderTick); } private void renderCableElectriqueSimpleNegatifTileEntityAt(CableElectriqueSimpleNegatifTileEntity tile, double x, double y, double z, float partialRenderTick) { GL11.glPushMatrix(); //contenu GL11.glRotated(180, 0.0F, 0.0F, 1.0F); GL11.glTranslated(x + 0.5F, y + 1.5F, z + 0.5F); this.bindTexture(texture); this.model.renderAll(); GL11.glPopMatrix(); } }
Et enfin la classe du modèle (ModelCableElectriqueSimpleNegatif) :
package fr.minecraft.reality.client; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; @SideOnly(Side.CLIENT) public class ModelCableElectriqueSimpleNegatif extends ModelBase { ModelRenderer GuenneUp; ModelRenderer GuenneDown; ModelRenderer GuenneLeft; ModelRenderer GuenneRight; ModelRenderer fil_de_cuivre; public ModelCableElectriqueSimpleNegatif() { textureWidth = 64; textureHeight = 64; GuenneUp = new ModelRenderer(this, 0, 0); GuenneUp.addBox(0F, 0F, 0F, 4, 1, 16); GuenneUp.setRotationPoint(-2F, 14F, -8F); GuenneUp.setTextureSize(64, 64); GuenneDown = new ModelRenderer(this, 0, 0); GuenneDown.addBox(0F, 0F, 0F, 4, 1, 16); GuenneDown.setRotationPoint(-2F, 17F, -8F); GuenneDown.setTextureSize(64, 64); GuenneLeft = new ModelRenderer(this, 0, 0); GuenneLeft.addBox(0F, 0F, 0F, 1, 2, 16); GuenneLeft.setRotationPoint(1F, 15F, -8F); GuenneLeft.setTextureSize(64, 64); GuenneRight = new ModelRenderer(this, 0, 0); GuenneRight.addBox(0F, 0F, 0F, 1, 2, 16); GuenneRight.setRotationPoint(-2F, 15F, -8F); GuenneRight.setTextureSize(64, 64); fil_de_cuivre = new ModelRenderer(this, 0, 20); fil_de_cuivre.addBox(0F, 0F, 0F, 2, 2, 16); fil_de_cuivre.setRotationPoint(-1F, 15F, -8F); fil_de_cuivre.setTextureSize(64, 64); } public void renderAll() { GuenneUp.render(0.0625F); GuenneDown.render(0.0625F); GuenneLeft.render(0.0625F); GuenneRight.render(0.0625F); fil_de_cuivre.render(0.0625F); } }
Merci d’avance et désolé pour la longueur des noms de mes classes
-
@Binaire J’avais le même problème rajoutes un @SideOnly(Side.CLIENT) à getRenderType moi ça a marché en tous cas.
-
@KAH Salut, j’ai testé cela ne marche pas de mon côté. Merci quand même