Rendu complexe de bloc via TESR
-
Il faut que tu ajoute ```java
proxy.registerTileRenders()dans la partie Init de ta classe principale Et utilise les balises java, merci. -
@‘kevin_68’:
Il faut que tu ajoute ```java
proxy.registerTileRenders()dans la partie Init de ta classe principale Et utilise les balises java, merci.Cela n’avais rien changé, mais après l’ajout de
Shape1.render(f5); Shape2.render(f5); Shape3.render(f5);dans la partie render de mon model tout marche, merci !
@‘kevin_68’:
Il faut que tu ajoute ```java
proxy.registerTileRenders()dans la partie Init de ta classe principale Et utilise les balises java, merci.Cela n’avais rien changé, mais après l’ajout de
Shape1.render(f5); Shape2.render(f5); Shape3.render(f5);dans la partie render de mon model tout marche, merci !
-
Ah, dernière question !
Comment peut on positionner l’objet dans une orientation différente suivant l’angle dans lequel on le pose ? ? -
J’ai déjà cherché mais je n’est pas encore trouvé, il faudrait voir pour faire un metadata pour chaque positionnement et avec ça dans le rendu un GL11.glRotate() dans le rendu par rapport au métadata
-
@‘kevin_68’:
J’ai déjà cherché mais je n’est pas encore trouvé, il faudrait voir pour faire un metadata pour chaque positionnement et avec ça dans le rendu un GL11.glRotate() dans le rendu par rapport au métadata
Oh mon dieu, je n’en ai pas fini si je dois faire sa Oo
-
Bonjour,
Mon block reste transparent et le rendu dans la main est un item type sans texture.Voici ma classe principal:
http://pastebin.com/BkhQWDThLa classe du block:
http://pastebin.com/qM168aC4Le render de mon Block:
http://pastebin.com/Y2MkyihuEt je ne pense pas avoir fait d’érreur dans le ClientProxy et le TileEntity.
Merci d’avance.
-
Dans la classe principale, dans la fonction init ajoute proxy.registerRender(); (ou le nom de ta fonction)
Sinon pour le rendu en main c’est normal, le tutoriel ne permet que de faire le rendu en jeu (je compte voir pour faire aussi le rendu en main).
-
Merci pour ta réponse!
Et pour le rendu en main ce n’est pas le plus important tant que le rendu en jeu marche c’est le principal.
-
Tutoriel entièrement refait.
Il gère maintenant le rendu en main / dans l’inventaire.
Faite attention de ne pas vous perdre, il y a beaucoup de classe. N’hésitez pas à regarder le commit sur github pour voir tous les ajouts à faire. -
J’ai un nullPointerException au moment de lancer le jeu, juste après avoir fait les rendus de l’inventaire. J’ai pourtant suivi à la lettre le tuto :huh:
J’ai mis mon crash report en pièce jointe.
-
Envoi tes class TESRInventoryRenderer, ClientProxy, Mod_FearZ.
-
voila mon client proxy
(je ne peut mettre qu’une seul pièce jointe par message. j’envoie les deux autres à la suite)___
Mon mod_FearZ___
et mon TESEInventoryRender -
N’envoie pas tes class en pièce joint, met ton code dans des balises [java][/java] sans les *.
-
Ok, désolé.
Mod_FearZ.java
package _fearZ.mod; import org.lwjgl.util.glu.Registry; import net.minecraft.block.Block; import net.minecraft.block.BlockChest; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import _fearZ.mod.common.CommonProxy; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PreInit; 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.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "fearz", name = "FearZ", version = "1.0.0") @NetworkMod(clientSideRequired = true, serverSideRequired = true) public class Mod_FearZ { @Instance("FearZMod") public static Mod_FearZ modInstance; @SidedProxy(clientSide="_fearZ.mod.client.ClientProxy", serverSide="_fearZ.mod.common.CommonProxy") public static CommonProxy proxy; /**blocks*/ public static Block armoirePh; /**Items*/ /**Creative Tabs*/ public static final CreativeTabs onglet = new OngletCreatif(CreativeTabs.getNextID(), "FearZ"); @EventHandler public void PreInit(FMLPreInitializationEvent event) { /**Blocks*/ Block armoirePh = new BlockPharmacie (1800).setBlockUnbreakable().setHardness(10000f).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("ArmoirePharmacie"); GameRegistry.registerBlock(armoirePh, "armoirePh"); } @EventHandler public void Init(FMLInitializationEvent event) { /**Mobs*/ /**Render*/ proxy.registerRender(); proxy.registerTileEntityRender(); /**NetWork*/ /**Recipes*/ /**TileEntityRegistry*/ GameRegistry.registerTileEntity(TileEntityArmoirePh.class, "pharmacie"); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { /**Integration avec les autres mods*/ } }ClientProxy.java
package _fearZ.mod.client; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import _fearZ.mod.Mod_FearZ; import _fearZ.mod.TileEntityArmoirePh; import _fearZ.mod.client.TESRInventoryRenderer.TESRIndex; import _fearZ.mod.common.CommonProxy; public class ClientProxy extends CommonProxy { public static int renderInventoryTESRId; @Override public void registerRender() { renderInventoryTESRId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); } @Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArmoirePh.class, new TileEntityArmoirePhSpecialRender()); TESRInventoryRenderer.blockByTESR.put(new TESRIndex(Mod_FearZ.armoirePh, 0), new TileEntityArmoirePhSpecialRender()); } }TESRInventoryRenderer
package _fearZ.mod.client; import java.util.HashMap; import _fearZ.mod.IInventoryRenderer; 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 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() { return true; } @Override public int getRenderId() { return ClientProxy.renderInventoryTESRId; } } ```</tesrindex,></tesrindex,> -
Change ton implementation :
public class TESRInventoryRenderer implements ISimpleBlockRenderingHandlerpar
public class TESRInventoryRenderer extends TileEntitySpecialRenderer implements IInventoryRendererEDIT: J’ai rien dis
-
Je me disais aussi qu’avec le nombre d’erreurs qu’il m’affichait en faisant ça, ça marcherais pas. ^^
-
/**blocks*/ public static Block armoirePh; […] @EventHandler public void PreInit(FMLPreInitializationEvent event) { /**Blocks*/ /*Block*/ armoirePh = new BlockPharmacie (1800).setBlockUnbreakable().setHardness(10000f).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("ArmoirePharmacie"); GameRegistry.registerBlock(armoirePh, "armoirePh"); }Ici tu as déclaré dans ta classe une variable du type Block nommé armoirePh. Plus bas, dans la méthode preInit, tu as créer une variable local nommé armoirePh et tu l’a initialisé.
Donc la variable de la classe reste null, d’où ton nullPointerException.
Il faut donc que tu enlève le Block que j’ai mit en commentaire. -
Merci, ça marche nickel. Je n’avais en effet pas du tout fais attention à ça

-
bonjour a tous
j’ai le meme probleme, a savoir un bloc fait sous techne qui ne s’affiche pas, je suppose que j’ai un probleme de rendu/texture, ça fait plusieurs tuto que je fais avec le meme résultat. En fait le bloc existe mais il est transparent !
-
Sans tes class, on ne peut pas savoir d’où vient le problème.

