Rendu complexe de bloc via TESR
-
public TileEntityChairSpecialRender() { this.func_147497_a(TileEntityRendererDispatcher.instance); }
Mets ça dans le constructeur, ça devrait être bon.
-
Ca marche :DD Merci beaucoup encore une fois !!!
-
Question dans le tuto tu dit ne suivez que la partie Création du modèle sur techne sauf que après tu parle du fichier en java alors il faut le mettre en java car dans la partie création c’est écrit de le mettre en png
-
Oui en effet, il faut aussi exporter le modèle en .java, c’est sous entendu par cette phrase :
Une fois votre modèle exporté en java
Il ne faut pas suivre la partie ou je modifie le modèle pour l’appliquer à un mob.
-
Escusez moi j’ai juste un problème quand j’applique les directions, seul deux côtés sont “bon” els autres sont à l’envers. Ah et je vodurait aussi que la direction s’apllique dans 8 direction c’est à dire que le block pivote de 45°.
-
Il faut gérer ça avec la fonction onBlockPlayerBy et il faut modifier la fonction glRotate.
-
Ouai sa j’avais compris mais je n’arrive pas à comprendre ce calcul : int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
-
living.rotationYaw est l’angle du joueur, tu peux faire un System.out.println(living.rotationYaw); pour voir comment cette variable varie en fonction de ta direction. Ensuite tu as juste à exploiter ce que tu as pu constater pour trouver la direction.
Rien ne t’oblige à reprendre la fonction de minecraft. -
Ouai je verrai amis il y a un truc qui me dérange c’est ceci “& 3” quesque sa fait dans un calcule ça ?
-
Si je ne me trompe pas, le & 3, correspond au metadata.
Envoyé de mon AN7DG3-LZ en utilisant Tapatalk
-
http://www.commentcamarche.net/contents/561-java-les-operateurs -> Les opérateurs bit-à-bit
-
Merci j’ai reussi !
-
Hello , je suis en 1.7.2 et j’ai essayé de faire le tuto puis de voir comment régler les soucis j’ai donc faits toutes mes classes et aucune erreur apparaît le problème est quand je lance le jeu il crash voici le report :
–-- Minecraft Crash Report ---- // Quite honestly, I wouldn't worry myself about that. Time: 19/07/14 1:14 Description: Initializing game java.lang.NullPointerException: Initializing game at mod.proxy.BarriereInventoryRenderer$TESRIndex.hashCode(BarriereInventoryRenderer.java:26) at java.util.HashMap.hash(Unknown Source) at java.util.HashMap.put(Unknown Source) at mod.proxy.ClientProxy.registerTileEntityRender(ClientProxy.java:41) at mod.common.ModMinecraft.init(ModMinecraft.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:585) at net.minecraft.client.Minecraft.run(Minecraft.java:892) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at mod.proxy.BarriereInventoryRenderer$TESRIndex.hashCode(BarriereInventoryRenderer.java:26) at java.util.HashMap.hash(Unknown Source) at java.util.HashMap.put(Unknown Source) at mod.proxy.ClientProxy.registerTileEntityRender(ClientProxy.java:41) at mod.common.ModMinecraft.init(ModMinecraft.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:513) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296) at com.google.common.eventbus.EventBus.post(EventBus.java:267) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at cpw.mods.fml.common.Loader.initializeMods(Loader.java:690) at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:288) at net.minecraft.client.Minecraft.startGame(Minecraft.java:585) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.run(Minecraft.java:892) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0_05, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 717832584 bytes (684 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.03 FML v7.2.211.1121 Minecraft Forge 10.12.2.1121 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized FML{7.2.211.1121} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized Forge{10.12.2.1121} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1121.jar) Unloaded->Constructed->Pre-initialized->Initialized modminecraft{1.0} [Mod Minecraft] (bin) Unloaded->Constructed->Pre-initialized->Errored Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: ~~ERROR~~ NullPointerException: null Anisotropic Filtering: Off (1)
Des idées ? J’ai cherché mais je n’ai rien trouvé
-
tu peux envoyer toute tes classe, n’oublie pas la balise spoiler :D.
-
Pas de soucis voici :
:::
BlockBarriere
package mod.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mod.proxy.ClientProxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockBarriere extends Block { public BlockBarriere(int id) { super(Material.rock); } public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBarriere(); } public boolean hasTileEntity(int metadata) { return true; } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } @SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryBarriere; } }
ModMiecraft ( classe principale )
package mod.common; import java.awt.Color; 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.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import mod.proxy.CommonProxy; 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.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "modminecraft", name = "Mod Minecraft", version ="1.0") public class ModMinecraft { public static Item itemFlechette; public static Item itemSarbacane; public static Item itemSeve; public static Item itemSevewithmosquito; public static Item itemFrogLegs; public static Item itemFlechetteEmpty; public static Item itemFrogLegsCooked; public static Item itemSyringe; public static Item itemSyringewithblood; public static Item itemADNofFrog; public static Block blockBarriere; @Instance("modminecraft") public static ModMinecraft instance; public static final String MODID = "modminecraft"; @SidedProxy(clientSide = "mod.proxy.ClientProxy", serverSide = "mod.proxy.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { itemFlechette = new DinoItem().setUnlocalizedName("itemFlechette").setCreativeTab(CreativeTabs.tabCombat); itemSarbacane = new SarbacaneItem().setUnlocalizedName("itemSarbacane").setCreativeTab(CreativeTabs.tabCombat); itemSeve = new SeveItem().setUnlocalizedName("itemSeve").setCreativeTab(CreativeTabs.tabMaterials); itemSevewithmosquito = new ItemSevewithmosquito().setUnlocalizedName("itemSevewithmosquito").setCreativeTab(CreativeTabs.tabMaterials); itemFrogLegs = new itemFrogLegs().setUnlocalizedName("itemFrogLegs").setCreativeTab(CreativeTabs.tabFood); itemFlechetteEmpty = new itemFlechetteEmpty().setUnlocalizedName("itemFlechetteEmpty").setCreativeTab(CreativeTabs.tabMaterials); itemFrogLegsCooked= new itemFrogLegsCooked(8, 0.3F, false).setUnlocalizedName("itemFrogLegsCooked").setCreativeTab(CreativeTabs.tabFood); itemSyringe = new itemSyringe().setUnlocalizedName("itemSyringe").setCreativeTab(CreativeTabs.tabTools).setMaxStackSize(1); itemSyringewithblood = new itemSyringewithblood().setUnlocalizedName("itemSyringeWithBlood").setCreativeTab(CreativeTabs.tabMaterials).setMaxStackSize(1); itemADNofFrog = new itemADNofFrog().setUnlocalizedName("itemADNofFrog").setCreativeTab(CreativeTabs.tabMaterials).setMaxStackSize(1); GameRegistry.registerItem(itemFlechette, "item_Flechette"); GameRegistry.registerItem(itemSarbacane, "item_Sarbacane"); GameRegistry.registerItem(itemSeve, "item_Seve"); GameRegistry.registerItem(itemSevewithmosquito, "item_Sevewithmosquito"); GameRegistry.registerItem(itemFrogLegs, "item_FrogLegs"); GameRegistry.registerItem(itemFlechetteEmpty, "item_FlechetteEmpty"); GameRegistry.registerItem(itemFrogLegsCooked, "item_FrogLegsCooked"); GameRegistry.registerItem(itemSyringe, "item_Syringe"); GameRegistry.registerItem(itemSyringewithblood, "item_SyringeWithBlood"); GameRegistry.registerItem(itemADNofFrog, "item_ADNofFrog"); GameRegistry.registerTileEntity(TileEntityBarriere.class, "Barriere"); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); proxy.registerTileEntityRender(); /**CRAFT**/ GameRegistry.addRecipe(new ItemStack(itemFlechette, 4), new Object[]{"ZX ", "XYX", " XE", 'X', Items.stick, 'Y', new ItemStack(Items.potionitem, 1, 16426), 'Z', Items.iron_ingot, 'E', new ItemStack(Blocks.wool, 1, 14)}); GameRegistry.addShapelessRecipe(new ItemStack(itemFlechette, 1), new Object[]{ new ItemStack(Items.potionitem, 1, 16426), new ItemStack(ModMinecraft.itemFlechetteEmpty, 1)}); GameRegistry.addRecipe(new ItemStack(itemSarbacane), new Object[]{"XZ ", "ZXZ", " ZX", 'X', Items.reeds, 'Z', Items.string}); GameRegistry.addRecipe(new ItemStack(itemSyringe), new Object[]{"ZX ", "X X", " XY", 'Z', Items.iron_ingot, 'Y', Items.stick, 'X', new ItemStack(Blocks.glass, 1)}); GameRegistry.addRecipe(new ItemStack(itemFlechetteEmpty, 4), new Object[]{"ZX ", "X X", " XE", 'X', Items.stick, 'Y', new ItemStack(Items.potionitem, 1, 16426), 'Z', Items.iron_ingot, 'E', new ItemStack(Blocks.wool, 1, 14)}); /**FOUR**/ GameRegistry.addSmelting(itemFrogLegs, new ItemStack(itemFrogLegsCooked, 1), 0.1f); /**ENTITY**/ EntityRegistry.registerGlobalEntityID(EntityFrog.class, "EntityFrog", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB()); EntityRegistry.registerModEntity(EntityFrog.class, "EntityFrog", 420/**Attention à changer l'id**/, this.instance, 40, 1, true); EntityRegistry.registerGlobalEntityID(EntityFlechette.class, "RenderFlechetteun", EntityRegistry.findGlobalUniqueEntityId()); EntityRegistry.registerModEntity(EntityFlechette.class, "RenderFlechetteun", 421 /**Attention à changer l'id**/, this.instance, 40, 1, true); EntityRegistry.registerGlobalEntityID(EntityBrachiosaurus.class, "EntityBrachiosaurus", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 255, 0).getRGB(), new Color(255, 0, 0).getRGB()); EntityRegistry.registerModEntity(EntityBrachiosaurus.class, "EntityBrachiosaurus", 422/**Attention à changer l'id**/, this.instance, 40, 1, true); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
TileEntityBarriere
package mod.common; import net.minecraft.tileentity.TileEntity; public class TileEntityBarriere extends TileEntity { }
TileEntityBarriereSpecialRender
package mod.common; import mod.proxy.IInventoryRenderer; import mod.proxy.ModelBarriere; 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 org.lwjgl.opengl.GL11; public class TileEntityBarriereSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer { private final ModelBarriere model = new ModelBarriere(); public static final ResourceLocation textureLocation = new ResourceLocation("craftech", "textures/blocks/Bariquade.png"); public TileEntityBarriereSpecialRender() { this.func_147497_a(TileEntityRendererDispatcher.instance); } @Override public void renderInventory(double x, double y, double z) { this.renderTileEntityBarriereAt(null, x, y, z, 0.0F); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick) { this.renderTileEntityBarriereAt((TileEntityBarriere)te, x, y, z, tick); } public void renderTileEntityBarriereAt(TileEntityBarriere te, double x, double y, double z, float tick) { 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); this.model.render(0.0625F); GL11.glPopMatrix(); } }
BarriereInventoryRenderer
package mod.proxy; import java.util.HashMap; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class BarriereInventoryRenderer implements ISimpleBlockRenderingHandler { public static class TESRIndex { Block block; int metadata; public TESRIndex(Block block, int metadata) { this.block = block; this.metadata = metadata; } @Override public int hashCode() { return block.hashCode() + metadata; } @Override public boolean equals(Object o) { if(!(o instanceof TESRIndex)) return false; TESRIndex tesr = (TESRIndex)o; return tesr.block == block && tesr.metadata == metadata; } } public static HashMap <tesrindex, iinventoryrenderer="">blockByTESR = new HashMap<tesrindex, iinventoryrenderer="">(); @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { // TODO Auto-generated method stub } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return true; } public boolean shouldRender3DInInventory(int modelId) { // TODO Auto-generated method stub return true; } @Override public int getRenderId() { return ClientProxy.renderInventoryBarriere; } }
ClientProxy
package mod.proxy; import net.minecraft.client.model.ModelBiped; import mod.common.EntityBrachiosaurus; import mod.common.EntityFlechette; import mod.common.EntityFrog; import mod.common.ModMinecraft; import mod.common.ModelBrachiosaurus; import mod.common.ModelFrog; import mod.common.RenderBrachiosaurus; import mod.common.RenderFlechette; import mod.common.RenderFrog; import mod.common.TileEntityBarriere; import mod.common.TileEntityBarriereSpecialRender; import mod.proxy.BarriereInventoryRenderer.TESRIndex; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { public static int renderInventoryBarriere; @Override public void registerRender() { System.out.println("render"); RenderingRegistry.registerEntityRenderingHandler(EntityFlechette.class, new RenderFlechette(null, 0)); RenderingRegistry.registerEntityRenderingHandler(EntityFrog.class, new RenderFrog(new ModelFrog(), 0.5F)); RenderingRegistry.registerEntityRenderingHandler(EntityBrachiosaurus.class, new RenderBrachiosaurus(new ModelBrachiosaurus(), 3.5F)); renderInventoryBarriere = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new BarriereInventoryRenderer()); } @Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBarriere.class, new TileEntityBarriereSpecialRender()); BarriereInventoryRenderer.blockByTESR.put(new TESRIndex(ModMinecraft.blockBarriere, 0), new TileEntityBarriereSpecialRender()); } }
IInventoryRenderer
package mod.proxy; public interface IInventoryRenderer { public void renderInventory(double x, double y, double z); }
ModelBarriere
package mod.proxy; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBarriere extends ModelBase { //fields ModelRenderer Shape1; ModelRenderer Shape2; ModelRenderer Shape3; ModelRenderer Shape4; ModelRenderer Shape5; ModelRenderer Shape6; ModelRenderer Shape7; ModelRenderer Shape8; ModelRenderer Shape9; ModelRenderer Shape10; ModelRenderer Shape11; ModelRenderer Shape12; ModelRenderer Shape13; ModelRenderer Shape14; ModelRenderer Shape15; ModelRenderer Shape16; ModelRenderer Shape17; ModelRenderer Shape18; ModelRenderer Shape19; ModelRenderer Shape20; ModelRenderer Shape21; ModelRenderer Shape22; ModelRenderer Shape23; public ModelBarriere() { textureWidth = 512; textureHeight = 256; Shape1 = new ModelRenderer(this, 216, 0); Shape1.addBox(-5F, 0F, -5F, 10, 24, 10); Shape1.setRotationPoint(-3F, 0F, -10F); Shape1.setTextureSize(64, 32); Shape1.mirror = true; setRotation(Shape1, 0F, 0F, 0F); Shape2 = new ModelRenderer(this, 216, 34); Shape2.addBox(0F, 0F, 0F, 10, 9, 10); Shape2.setRotationPoint(-5.4F, -8.6F, -15F); Shape2.setTextureSize(64, 32); Shape2.mirror = true; setRotation(Shape2, 0F, 0F, 0.2974289F); Shape3 = new ModelRenderer(this, 176, 0); Shape3.addBox(0F, 0F, 0F, 10, 24, 10); Shape3.setRotationPoint(-8F, 0F, 13F); Shape3.setTextureSize(64, 32); Shape3.mirror = true; setRotation(Shape3, 0F, 0F, 0F); Shape4 = new ModelRenderer(this, 176, 34); Shape4.addBox(0F, 0F, 0F, 10, 9, 10); Shape4.setRotationPoint(-5.4F, -8.6F, 13F); Shape4.setTextureSize(64, 32); Shape4.mirror = true; setRotation(Shape4, 0F, 0F, 0.2974289F); Shape5 = new ModelRenderer(this, 136, 0); Shape5.addBox(0F, -1F, 0F, 10, 24, 10); Shape5.setRotationPoint(30F, 1F, -15F); Shape5.setTextureSize(64, 32); Shape5.mirror = true; setRotation(Shape5, 0F, 0F, 0F); Shape6 = new ModelRenderer(this, 136, 34); Shape6.addBox(0F, 0F, 0F, 10, 9, 10); Shape6.setRotationPoint(32.6F, -8.6F, -15F); Shape6.setTextureSize(64, 32); Shape6.mirror = true; setRotation(Shape6, 0F, 0F, 0.2974289F); Shape7 = new ModelRenderer(this, 96, 0); Shape7.addBox(0F, 0F, 0F, 10, 24, 10); Shape7.setRotationPoint(30F, 0F, 13F); Shape7.setTextureSize(64, 32); Shape7.mirror = true; setRotation(Shape7, 0F, 0F, 0F); Shape8 = new ModelRenderer(this, 96, 34); Shape8.addBox(0F, 0F, -1F, 10, 9, 10); Shape8.setRotationPoint(32.6F, -8.6F, 14F); Shape8.setTextureSize(64, 32); Shape8.mirror = true; setRotation(Shape8, 0F, 0F, 0.2974289F); Shape9 = new ModelRenderer(this, 88, 73); Shape9.addBox(0F, 0F, 0F, 52, 23, 32); Shape9.setRotationPoint(-8F, -25F, -12F); Shape9.setTextureSize(64, 32); Shape9.mirror = true; setRotation(Shape9, 0F, 0F, 0.0743572F); Shape10 = new ModelRenderer(this, 0, 66); Shape10.addBox(0F, 0F, 0F, 20, 43, 19); Shape10.setRotationPoint(-23F, -43.2F, -6F); Shape10.setTextureSize(64, 32); Shape10.mirror = true; setRotation(Shape10, 0F, 0F, -0.3346075F); Shape11 = new ModelRenderer(this, 0, 24); Shape11.addBox(0F, 0F, 0F, 15, 27, 15); Shape11.setRotationPoint(-26F, -70F, -4F); Shape11.setTextureSize(64, 32); Shape11.mirror = true; setRotation(Shape11, 0F, 0F, -0.2230717F); Shape12 = new ModelRenderer(this, 256, 0); Shape12.addBox(0F, 0F, 0F, 10, 20, 10); Shape12.setRotationPoint(-28F, -88F, -2F); Shape12.setTextureSize(64, 32); Shape12.mirror = true; setRotation(Shape12, 0F, 0F, -0.2602503F); Shape13 = new ModelRenderer(this, 296, 0); Shape13.addBox(0F, 0F, 0F, 6, 6, 6); Shape13.setRotationPoint(-27.7F, -93F, 0F); Shape13.setTextureSize(64, 32); Shape13.mirror = true; setRotation(Shape13, 0F, 0F, -0.4089647F); Shape14 = new ModelRenderer(this, 320, 0); Shape14.addBox(0F, 0F, 0F, 6, 6, 6); Shape14.setRotationPoint(-30.3F, -97.5F, 0F); Shape14.setTextureSize(64, 32); Shape14.mirror = true; setRotation(Shape14, 0F, 0F, -0.5205006F); Shape15 = new ModelRenderer(this, 296, 12); Shape15.addBox(0F, 0F, 0F, 6, 6, 6); Shape15.setRotationPoint(-33.5F, -100.8F, 0F); Shape15.setTextureSize(64, 32); Shape15.mirror = true; setRotation(Shape15, 0F, 0F, -0.7435722F); Shape16 = new ModelRenderer(this, 320, 12); Shape16.addBox(0F, 0F, 0F, 6, 6, 6); Shape16.setRotationPoint(-35.8F, -99.7F, 0F); Shape16.setTextureSize(64, 32); Shape16.mirror = true; setRotation(Shape16, 0F, 0F, -1.449966F); Shape17 = new ModelRenderer(this, 256, 30); Shape17.addBox(0F, 0F, 0F, 11, 8, 8); Shape17.setRotationPoint(-45F, -107F, -1F); Shape17.setTextureSize(64, 32); Shape17.mirror = true; setRotation(Shape17, 0F, 0F, 0F); Shape18 = new ModelRenderer(this, 60, 34); Shape18.addBox(0F, 0F, 0F, 9, 5, 4); Shape18.setRotationPoint(-44F, -109F, 1F); Shape18.setTextureSize(64, 32); Shape18.mirror = true; setRotation(Shape18, 0F, 0F, 0F); Shape19 = new ModelRenderer(this, 60, 43); Shape19.addBox(0F, 0F, 0F, 9, 5, 5); Shape19.setRotationPoint(-50F, -101F, 0.5F); Shape19.setTextureSize(64, 32); Shape19.mirror = true; setRotation(Shape19, 0F, 0F, -0.2974289F); Shape20 = new ModelRenderer(this, 256, 46); Shape20.addBox(0F, 0F, 0F, 24, 12, 22); Shape20.setRotationPoint(34F, -19F, -7F); Shape20.setTextureSize(64, 32); Shape20.mirror = true; setRotation(Shape20, 0F, 0F, 0.3346075F); Shape21 = new ModelRenderer(this, 256, 80); Shape21.addBox(0F, 0F, 0F, 21, 10, 17); Shape21.setRotationPoint(49F, -13F, -5F); Shape21.setTextureSize(64, 32); Shape21.mirror = true; setRotation(Shape21, 0F, 0F, 0.4833219F); Shape22 = new ModelRenderer(this, 42, 0); Shape22.addBox(0F, 0F, 0F, 12, 8, 14); Shape22.setRotationPoint(64.7F, -2.3F, -3.5F); Shape22.setTextureSize(64, 32); Shape22.mirror = true; setRotation(Shape22, 0F, 0F, 0.2185276F); Shape23 = new ModelRenderer(this, 0, 0); Shape23.addBox(0F, 0F, 0F, 11, 5, 9); Shape23.setRotationPoint(72.93333F, 2F, -1F); Shape23.setTextureSize(64, 32); Shape23.mirror = true; setRotation(Shape23, 0F, 0F, 0F); } public void render(float f) { Shape1.render(f); Shape2.render(f); Shape3.render(f); Shape4.render(f); Shape5.render(f); Shape6.render(f); Shape7.render(f); Shape8.render(f); Shape9.render(f); Shape10.render(f); Shape11.render(f); Shape12.render(f); Shape13.render(f); Shape14.render(f); Shape15.render(f); Shape16.render(f); Shape17.render(f); Shape18.render(f); Shape19.render(f); Shape20.render(f); Shape21.render(f); Shape22.render(f); Shape23.render(f); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } }
:::
J’ai mis tous tous comme ça je suis sur que tu peut tout voir ;-)</tesrindex,></tesrindex,>
-
Ton bloc n’est pas initialisé ni enregistré …
-
Ah c’est bon ca marche ! Merci robin
-
bonjour j’ai un problème pour le rendu dans l’inventaire j’ai le carré sans texture, j’ai parcouru les 18 page pour voir si une solution a étai donné mais rien. je suis 1.7.2 le rendu du block TESR en monde fonctionne très bien, je vous envoie mon code pour que vous puissiez jeté un coup d’œil sur ce qui m’aurais échapper. merci d’avance
ps: Robin4002 si tu passe dans le coin " j’ai pas comprit ton truc de bouton ts! XD " une explication plus précise pour le ts m’aiderai bien lol ou au pire j’ai une adresse perso de ts que je loue que je te passe au besoin!
class principal
:::package fr.dayvrespect.common; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; 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.registry.GameRegistry; import fr.dayvrespect.proxy.CommonProxy; @Mod(modid = ModCrafter.MODID, name = "Mod Crafter", version = "1.0.0") public class ModCrafter { public static final String MODID = "modcrafter"; @Instance(MODID) public static ModCrafter instance; @SidedProxy(clientSide = "fr.dayvrespect.proxy.ClientProxy", serverSide = "fr.dayvrespect.proxy.CommonProxy") public static CommonProxy proxy; public static Block blockCraft; public static Block blockRender; @EventHandler public void preInit(FMLPreInitializationEvent event) { blockCraft = new BlockCraft().setBlockName("crafter").setCreativeTab(CreativeTabs.tabMaterials); blockRender = new BlockRender().setBlockName("render").setCreativeTab(CreativeTabs.tabMisc); GameRegistry.registerBlock(blockCraft, "block_craft"); GameRegistry.registerBlock(blockRender, "block_render"); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); proxy.registerTileEntityRender(); GameRegistry.registerTileEntity(TileEntityRender.class, "TileEntityRender"); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
class blockMod
:::package fr.dayvrespect.common; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import fr.dayvrespect.proxy.ClientProxy; public class BlockRender extends BlockContainer { protected BlockRender() { super(Material.wood); } public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityRender(); } public boolean haasTileEntity(int metadata) { return true; } public boolean renderAsNormalBlock() { return false; } public boolean isOpaqueCube() { return false; } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) { int direction = MathHelper.floor_double((double)(living.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; world.setBlockMetadataWithNotify(x, y, z, direction, 2); } @SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryTESR; } }
:::
class TESRInventoryRenderer
:::package fr.dayvrespect.proxy; import java.util.HashMap; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; import fr.dayvrespect.client.IInventoryRenderer; public class TESRInventoryRenderer implements ISimpleBlockRenderingHandler { public static class TESRIndex { Block block; int metadata; public TESRIndex(Block block, int metadata) { this.block = block; this.metadata = metadata; } @Override public int hashCode() { return block.hashCode() + metadata; } @Override public boolean equals(Object o) { if(!(o instanceof TESRIndex)) return false; TESRIndex tesr = (TESRIndex)o; return tesr.block == block && tesr.metadata == metadata; } } public static HashMap <tesrindex, iinventoryrenderer="">blockByTESR = new HashMap<tesrindex, iinventoryrenderer="">(); @Override public void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer) { TESRIndex index = new TESRIndex(block, metadata); if(blockByTESR.containsKey(index)) { blockByTESR.get(index).renderInventory(-0.5, -0.5, -0.5); } } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return true; } @Override public boolean shouldRender3DInInventory(int modelId) { return false; } @Override public int getRenderId() { return ClientProxy.renderInventoryTESR; } }
:::
class TileEntityModSpecialRender
:::
package fr.dayvrespect.client; 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 org.lwjgl.opengl.GL11; import fr.dayvrespect.common.ModCrafter; import fr.dayvrespect.common.TileEntityRender; public class TileEntityRenderSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer { public final ModelTuto model = new ModelTuto(); public static final ResourceLocation textureLocation = new ResourceLocation("modcrafter", "textures/blocks/base.png"); public TileEntityRenderSpecialRender() { this.func_147497_a(TileEntityRendererDispatcher.instance); //TileEntityRenderer(TileEntityRender.instance); } @Override public void renderInventory(double x, double y, double z) { this.renderTileEntityRenderAt(null, x, y, z, 0.0f); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick) { this.renderTileEntityRenderAt((TileEntityRender)te, x, y, z, tick); } public void renderTileEntityRenderAt(TileEntityRender te, double x, double y, double z, float tick) { 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); this.model.render(0.0625F); GL11.glPopMatrix(); } }
:::
et la class ClientProxy
:::
package fr.dayvrespect.proxy; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import fr.dayvrespect.client.TileEntityRenderSpecialRender; import fr.dayvrespect.common.ModCrafter; import fr.dayvrespect.common.TileEntityRender; import fr.dayvrespect.proxy.TESRInventoryRenderer.TESRIndex; public class ClientProxy extends CommonProxy { public static int renderInventoryTESR; @Override public void registerRender() { renderInventoryTESR = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); } @Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRender.class, new TileEntityRenderSpecialRender()); TESRInventoryRenderer.blockByTESR.put(new TESRIndex(ModCrafter.blockRender, 0), new TileEntityRenderSpecialRender()); } }
:::</tesrindex,></tesrindex,>
-
Sinon pour le rendu en main c’est étrange, je ne vois pas de problème o_O
-
euh pour le bouton ts je ne l’ai pas sur mon navigateur Xd j’utilise google chrome je passe sous mozilla voir!