Rendu complexe de bloc via TESR
-
Pour les questions concernant les animations, merci de poster dans ce poste :
http://www.minecraftforgefrance.fr/showthread.php?tid=375Et oui, c’est possible, il te suffit de faire une méthode dans ton modèle qui ne rend que le morceaux que tu veux déplacer :
public void renderMorceauxVoulu(float f) { nomDuMorceau.render(f); }et tu retire le morceau de la méthode render(float f)
Ensuite dans ton tile entity spécial render, tu refais un Gl11.pull();, tu rends ce morceau, et tu le déplace avec Gl11.translatef(x, y, z); et tu refais un Gl11.push();
-
je n’est pas bien compris comment faire pour le rendu dans l’inventaire
-
Mets juste :
@Override public void renderInventory(double x, double y, double z) { this.renderTileEntitySculptureAt(null, x, y, z, 0.0F); }Et c’est bon, il va faire la même chose que pour le rendu sur le monde.
-
@Override public void renderInventory(double x, double y, double z) { // TODO Auto-generated method stub this.renderTileEntityCopperAt(null, x, y, z, 0.0F); }dans TileEntityCopperSpecialRender
mais cela ne fait rien -
Le rendu sur le monde se fait bien ? Si non, tu as un problème dans la méthode renderTileEntityCopperAt.
Si oui, tu as loupé quelque chose au niveau du TESRInventoryRenderer. -
TESRInventoryRenderer:
package Mineralherb; 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 Mineralherb.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="">(); public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { return true; } public boolean shouldRender3DInInventory() { return true; } public int getRenderId() { return ClientProxy.renderInventoryTESRId; } @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { // TODO Auto-generated method stub } }TileEntityCopperSpecialRender:
package Mineralherb; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import Mineralherb.Blocks.ModelCoppermineral; import Mineralherb.Blocks.TileEntityCopper; import Mineralherb.client.IInventoryRenderer; public class TileEntityCopperSpecialRender extends TileEntitySpecialRenderer implements IInventoryRenderer { private final ModelCoppermineral model = new ModelCoppermineral(); public static final ResourceLocation textureLocation = new ResourceLocation("mineralherb", "textures/blocks/coppermineral.png"); public TileEntityCopperSpecialRender() { this.setTileEntityRenderer(TileEntityRenderer.instance); } public void renderTileEntityCopperAt(TileEntityCopper 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(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float tick) { // TODO Auto-generated method stub this.renderTileEntityCopperAt((TileEntityCopper)te, x, y, z, tick); } @Override public void renderInventory(double x, double y, double z) { // TODO Auto-generated method stub this.renderTileEntityCopperAt(null, x, y, z, 0.0F); } } ```</tesrindex,></tesrindex,> -
Je voudrais corriger la boite de collision de mon rendu TESR, j’ai cherché mais franchement je ne voit pas vraiment de quel méthode cela peut venir…
Il s’affiche bien mais vu que c’est un gros rendu, on peut traverser le block… Qui n’est pas du tout pratique.
@isador34 Ta bien rajouté “public int getRenderType()” dans la class de ton block ?
-
oui:
@SideOnly(Side.CLIENT) public int getRenderType() { return ClientProxy.renderInventoryTESRId; }mon clientproxy:
package Mineralherb; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import Mineralherb.Blocks.TileEntityCopper; public class ClientProxy extends CommonProxy{ public static int renderInventoryTESRId; @Override public void registerRenderers(){ //Ici les futurs registrys renderInventoryTESRId = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new TESRInventoryRenderer()); } @Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCopper.class, new TileEntityCopperSpecialRender()); } } -
Et dans ta classe principale tu as bien proxy.registerRenderers(); ?
-
proxy.registerRenderers();
proxy.registerTileEntityRender(); -
Ha, je sais ce qu’il manque :
TESRInventoryRenderer.blockByTESR.put(new TESRIndex(ClassePrincipale.nomDuBloc, metadata), new TonTileEntitySpecialRender());
À mettre dans registerTileEntityRender(). -
proxy.registerTileEntityRender(TESRInventoryRenderer.blockByTESR.put(new TESRIndex(MineralherbMain.coppermineral, metadata), new TileEntityCopperSpecialRender()));erreur a registerTileEntityRender: The method registerTileEntityRender() in the type CommonProxy is not applicable for the arguments (IInventoryRenderer)
à MineralherbMain.coppermineral: Cannot make a static reference to the non-static field MineralherbMain.coppermineral
et à metadata: metadata cannot be resolved to a variable
-
…
@Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCopper.class, new TileEntityCopperSpecialRender()); }Devient
@Override public void registerTileEntityRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCopper.class, new TileEntityCopperSpecialRender()); TESRInventoryRenderer.blockByTESR.put(new TESRIndex(MineralherbMain.coppermineral, 0), new TileEntityCopperSpecialRender()); }Et metadata, tu le remplace par le metadata du bloc, donc 0 je suppose.
-
cela ne fait rien le rendu ne se fait toujours pas
-
Dans ce cas je ne sais pas.
-
bon bha pas grave
-
J’ai un problème avec la boite de collision ce qui permet de faire des choses pas cool…

-
Bloc sur deux bloc de haut ? Déjà traité dans la parti support, un bloc ne peut pas avoir une collision supérieur à la taille d’un bloc, il faire que lorsqu’on place le bloc, un deuxième se pose, et que lorsqu’on le détruit, l’autre se détruit avec. Cf : le lampadaire et la parasol de Nanotech mod city.
-
J’ai un probleme quand je charge le monde
craft Crash Report –-- // Uh... Did I do that? Time: 03/03/14 21:38 Description: Exception in server tick loop java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Unknown Source) at java.util.ArrayList.grow(Unknown Source) at java.util.ArrayList.ensureExplicitCapacity(Unknown Source) at java.util.ArrayList.ensureCapacityInternal(Unknown Source) at java.util.ArrayList.add(Unknown Source) at net.minecraft.util.AABBPool.getAABB(AABBPool.java:51) at net.minecraft.block.Block.getCollisionBoundingBoxFromPool(Block.java:602) at net.minecraft.block.Block.addCollisionBoxesToList(Block.java:568) at net.minecraft.world.World.getCollidingBoundingBoxes(World.java:1684) at net.minecraft.entity.player.EntityPlayerMP.<init>(EntityPlayerMP.java:187) at net.minecraft.server.management.ServerConfigurationManager.createPlayerForUser(ServerConfigurationManager.java:389) at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:91) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:691) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:587) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.6.4 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0_51, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 10989104 bytes (10 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 13845150 (775328400 bytes; 739 MB) allocated, 13845150 (775328400 bytes; 739 MB) used Suspicious classes: FML and Forge are installed IntCache: cache: 0, tcache: 0, allocated: 23, tallocated: 41 FML: MCP v8.11 FML v6.4.45.953 Minecraft Forge 9.11.1.953 4 mods loaded, 4 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{6.4.45.953} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{9.11.1.953} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available UltimateUniverseMod{1.0.0} [Ultimate Universe Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 915 (51240 bytes; 0 MB) allocated, 915 (51240 bytes; 0 MB) used Player Count: 0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' ```</init> -
On pourrait voir les classes que tu as utilisées?
