Résolu Rendu de bloc avec model Techne via TileEntity foireux ~
-
Bonjour/Bonsoir à vous !
Je sais que le titre n’est pas très explicite mais je n’ai rien trouvé de mieux, vous m’en excuserez.
Explications
Sur ce, passons au sujet principal ! Ayant suivi le tutoriel “Rendu de bloc avec un model Techne via TileEntity”, au final je n’obtiens simplement qu’un bloc normal pour texture un damier rose/noir. :s
:::
:::Etant donné qu’aucune erreur est à déclarer dans le code, je n’arrive malheureusement pas à trouver l’origine de celui-ci…
Je vous passe ainsi mes codes dans l’espoir qu’une bonne âme réussira à y répondre, non pas forcément m’envoyer la solution directe mais en tout cas m’y aider !
Code
Mines - Classe Principale :
package mines.common; import mines.block.BlockBasicMine; import mines.proxies.MinesCommonProxy; import net.minecraft.block.Block; import net.minecraft.item.Item; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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; @Mod(modid = "MinesByKanar", name = "Mines", version = "1.0.0") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class Mines { public static Block BasicMine; @SidedProxy(clientSide = "mines.proxies.MinesClientProxy", serverSide = "mines.proxies.MinesCommonProxy") public static MinesCommonProxy proxy; @EventHandler public void PreInit(FMLPreInitializationEvent event) { BasicMine = new BlockBasicMine(3954).func_111022_d("minesbykanar:BasicMine"); } @EventHandler public void Init(FMLInitializationEvent event) { MinesRegister.BlockRegister(); MinesRegister.EntityRegister(); MinesRegister.ItemRegister(); MinesRegister.LoadRecipe(); proxy.registerRender(); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { } }
BlockBasicMine :
package mines.block; import mines.tileentity.TileEntityBasicMine; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockBasicMine extends Block { public BlockBasicMine(int id) { super(id, Material.iron); this.setCreativeTab(CreativeTabs.tabBlock); this.setUnlocalizedName("BasicMine"); } @Override public TileEntity createTileEntity(World world, int metadata) { return new TileEntityBasicMine(); } public boolean hasTileEntity(int metadata) { return true; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 0; } }
MinesRegister :
package mines.common; import cpw.mods.fml.common.registry.GameRegistry; public class MinesRegister { public static void BlockRegister() { GameRegistry.registerBlock(Mines.BasicMine, "BasicMine"); } public static void ItemRegister() { } public static void LoadRecipe() { } public static void EntityRegister() { } }
TileEntityBasicMine :
package mines.tileentity; import net.minecraft.tileentity.TileEntity; public class TileEntityBasicMine extends TileEntity { }
TileEntityBasicMineRender :
package mines.render; import mines.model.ModelBasicMine; import mines.tileentity.TileEntityBasicMine; import net.minecraft.block.Block; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; public class TileEntityBasicMineRender extends TileEntitySpecialRenderer { private final ModelBasicMine model; protected static final ResourceLocation texture = new ResourceLocation("minesbykanar:textures/blocks/BasicMineTexture.png"); public TileEntityBasicMineRender() { this.model = new ModelBasicMine(); } private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float scale) { this.renderTileEntityAtBlockTutorielTechne((TileEntityBasicMine)tileentity, x, y, z, scale); } public void renderTileEntityAtBlockTutorielTechne(TileEntityBasicMine tileentity, double x, double y, double z, float scale) { GL11.glPushMatrix(); GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F); this.func_110628_a(texture); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } private void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; float brightness = block.getBlockBrightness(world, i, j, k); int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int modulousModifier = skyLight % 65536; int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)modulousModifier, divModifier); } }
MinesClientProxy :
package mines.proxies; import mines.render.TileEntityBasicMineRender; import mines.tileentity.TileEntityBasicMine; import cpw.mods.fml.client.registry.ClientRegistry; public class MinesClientProxy extends MinesCommonProxy { @Override public void registerRender() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBasicMine.class, new TileEntityBasicMineRender()); } }
ModelBasicMine :
package mines.model; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelBasicMine extends ModelBase { //fields ModelRenderer Button; ModelRenderer Base; ModelRenderer RFeet; ModelRenderer BFeet; ModelRenderer LFeet; ModelRenderer FFeet; public ModelBasicMine() { textureWidth = 64; textureHeight = 32; Button = new ModelRenderer(this, 0, 20); Button.addBox(0F, 0F, 0F, 2, 1, 2); Button.setRotationPoint(-1F, 21F, -1F); Button.setTextureSize(64, 32); Button.mirror = true; setRotation(Button, 0F, 0F, 0F); Base = new ModelRenderer(this, 0, 10); Base.addBox(0F, 0F, 0F, 4, 2, 4); Base.setRotationPoint(-2F, 22F, -2F); Base.setTextureSize(64, 32); Base.mirror = true; setRotation(Base, 0F, 0F, 0F); RFeet = new ModelRenderer(this, 0, 5); RFeet.addBox(0F, 0F, 0F, 1, 1, 2); RFeet.setRotationPoint(-3F, 23F, -1F); RFeet.setTextureSize(64, 32); RFeet.mirror = true; setRotation(RFeet, 0F, 0F, 0F); BFeet = new ModelRenderer(this, 10, 0); BFeet.addBox(0F, 0F, 0F, 2, 1, 1); BFeet.setRotationPoint(-1F, 23F, 2F); BFeet.setTextureSize(64, 32); BFeet.mirror = true; setRotation(BFeet, 0F, 0F, 0F); LFeet = new ModelRenderer(this, 20, 0); LFeet.addBox(0F, 0F, 0F, 1, 1, 2); LFeet.setRotationPoint(2F, 23F, -1F); LFeet.setTextureSize(64, 32); LFeet.mirror = true; setRotation(LFeet, 0F, 0F, 0F); FFeet = new ModelRenderer(this, 10, 5); FFeet.addBox(0F, 0F, 0F, 2, 1, 1); FFeet.setRotationPoint(-1F, 23F, -3F); FFeet.setTextureSize(64, 32); FFeet.mirror = true; setRotation(FFeet, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); Button.render(f5); Base.render(f5); RFeet.render(f5); BFeet.render(f5); LFeet.render(f5); FFeet.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } }
Fin
Désolé de l’abondance des codes mais cela est sûrement nécessaire pour y trouver une réponse.
Et merci à vous pour l’attention donné à ce sujet.
Cordialement, Kanar.
-
Tu as oublié d’enregistrer le TileEntity via cette ligne : ```java
GameRegistry.registerTileEntity(TileEntityBasicMine.class, “TileEntityBasicMine”); -
@‘Superloup10’:
Tu as oublié d’enregistrer le TileEntity via cette ligne : ```java
GameRegistry.registerTileEntity(TileEntityBasicMine.class, “TileEntityBasicMine”);Code rajouté mais cela ne change rien, toujours cet horrible bloc à damier noir/rose.
-
Si tu mais
java protected static final ResourceLocation texture = new ResourceLocation("minesbykanar:BasicMineTexture.png");
à la place de ```java
protected static final ResourceLocation texture = new ResourceLocation(“minesbykanar:textures/blocks/BasicMineTexture.png”);ça change quelque chose?
-
@‘Superloup10’:
Si tu mais
java protected static final ResourceLocation texture = new ResourceLocation("minesbykanar:BasicMineTexture.png");
à la place de ```java
protected static final ResourceLocation texture = new ResourceLocation(“minesbykanar:textures/blocks/BasicMineTexture.png”);ça change quelque chose?
Merci mais malheureusement non. ^^’
-
Fail de Kévin dans le tutoriel, le renderType doit retourner -1.
-
@‘robin4002’:
Fail de Kévin dans le tutoriel, le renderType doit retourner -1.
Et moi qui lui faisais confiance !
Sinon problème résolu mais malgré cela, désormais c’est ma texture qui ne charge pas :(, voici ce que dit la console :
:::
août 25, 2013 6:27:21 PM net.minecraft.launchwrapper.LogWrapper log
INFO: Using tweak class name cpw.mods.fml.common.launcher.FMLTweaker
2013-08-25 18:27:21 [INFO] [ForgeModLoader] Forge Mod Loader version 6.2.43.829 for Minecraft 1.6.2 loading
2013-08-25 18:27:21 [INFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_06, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7
2013-08-25 18:27:21 [INFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-08-25 18:27:22 [INFO] [STDOUT] Loaded 39 rules from AccessTransformer config file fml_at.cfg
2013-08-25 18:27:22 [INFO] [STDOUT] Loaded 107 rules from AccessTransformer config file forge_at.cfg
2013-08-25 18:27:23 [SEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!
2013-08-25 18:27:23 [INFO] [ForgeModLoader] Launching wrapped minecraft
2013-08-25 18:27:24 [INFO] [Minecraft-Client] Setting user: Player50
2013-08-25 18:27:24 [INFO] [Minecraft-Client] (Session ID is null)
2013-08-25 18:27:26 [INFO] [Minecraft-Client] LWJGL Version: 2.9.0
2013-08-25 18:27:27 [INFO] [Minecraft-Client] Reloading ResourceManager: Default
2013-08-25 18:27:27 [INFO] [STDOUT]
2013-08-25 18:27:27 [INFO] [STDOUT] Starting up SoundSystem…
2013-08-25 18:27:27 [INFO] [STDOUT] Initializing LWJGL OpenAL
2013-08-25 18:27:27 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
2013-08-25 18:27:28 [INFO] [STDOUT] OpenAL initialized.
2013-08-25 18:27:28 [INFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-08-25 18:27:28 [INFO] [STDOUT] MinecraftForge v9.10.0.829 Initialized
2013-08-25 18:27:28 [INFO] [ForgeModLoader] MinecraftForge v9.10.0.829 Initialized
2013-08-25 18:27:28 [INFO] [STDOUT]
2013-08-25 18:27:28 [INFO] [STDOUT] Replaced 101 ore recipies
2013-08-25 18:27:28 [INFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-08-25 18:27:28 [INFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Killian Guennec\Desktop\Mines\mcp\jars\config\logging.properties
2013-08-25 18:27:28 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-08-25 18:27:28 [INFO] [ForgeModLoader] Searching C:\Users\Killian Guennec\Desktop\Mines\mcp\jars\mods for mods
2013-08-25 18:27:31 [INFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-08-25 18:27:31 [INFO] [mcp] Activating mod mcp
2013-08-25 18:27:31 [INFO] [FML] Activating mod FML
2013-08-25 18:27:31 [INFO] [Forge] Activating mod Forge
2013-08-25 18:27:31 [INFO] [MinesByKanar] Activating mod MinesByKanar
2013-08-25 18:27:31 [WARNING] [Mines] Mod Mines is missing a pack.mcmeta file, things may not work well
2013-08-25 18:27:31 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Mines
2013-08-25 18:27:31 [INFO] [STDOUT]
2013-08-25 18:27:31 [INFO] [STDOUT] SoundSystem shutting down…
2013-08-25 18:27:32 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
2013-08-25 18:27:32 [INFO] [STDOUT]
2013-08-25 18:27:32 [INFO] [STDOUT]
2013-08-25 18:27:32 [INFO] [STDOUT] Starting up SoundSystem…
2013-08-25 18:27:32 [INFO] [ForgeModLoader] Registering Forge Packet Handler
2013-08-25 18:27:32 [INFO] [ForgeModLoader] Succeeded registering Forge Packet Handler
2013-08-25 18:27:32 [INFO] [STDOUT] Initializing LWJGL OpenAL
2013-08-25 18:27:32 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
2013-08-25 18:27:32 [INFO] [STDOUT] OpenAL initialized.
2013-08-25 18:27:32 [INFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-08-25 18:27:32 [INFO] [STDOUT]
2013-08-25 18:27:33 [SEVERE] [Minecraft-Client] Unable to parse animation metadata from minesbykanar:textures/blocks/BasicMine.png: broken aspect ratio and not an animation
2013-08-25 18:27:34 [INFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2013-08-25 18:27:34 [WARNING] [Mines] Mod Mines is missing a pack.mcmeta file, things may not work well
2013-08-25 18:27:34 [INFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Mines
2013-08-25 18:27:34 [SEVERE] [Minecraft-Client] Unable to parse animation metadata from minesbykanar:textures/blocks/BasicMine.png: broken aspect ratio and not an animation
2013-08-25 18:27:34 [INFO] [STDOUT]
2013-08-25 18:27:34 [INFO] [STDOUT] SoundSystem shutting down…
2013-08-25 18:27:34 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
2013-08-25 18:27:34 [INFO] [STDOUT]
2013-08-25 18:27:34 [INFO] [STDOUT]
2013-08-25 18:27:34 [INFO] [STDOUT] Starting up SoundSystem…
2013-08-25 18:27:35 [INFO] [STDOUT] Initializing LWJGL OpenAL
2013-08-25 18:27:35 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
2013-08-25 18:27:35 [INFO] [STDOUT] OpenAL initialized.
2013-08-25 18:27:35 [INFO] [STDOUT]
2013-08-25 18:27:36 [SEVERE] [Minecraft-Client] Realms: Invalid session id
2013-08-25 18:27:41 [INFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.2
2013-08-25 18:27:41 [INFO] [Minecraft-Server] Generating keypair
2013-08-25 18:27:41 [INFO] [ForgeModLoader] Loading dimension 0 (Mines) (net.minecraft.server.integrated.IntegratedServer@7d215c0b)
2013-08-25 18:27:42 [INFO] [ForgeModLoader] Loading dimension 1 (Mines) (net.minecraft.server.integrated.IntegratedServer@7d215c0b)
2013-08-25 18:27:42 [INFO] [ForgeModLoader] Loading dimension -1 (Mines) (net.minecraft.server.integrated.IntegratedServer@7d215c0b)
2013-08-25 18:27:42 [INFO] [Minecraft-Server] Preparing start region for level 0
2013-08-25 18:27:43 [INFO] [Minecraft-Server] Preparing spawn area: 86%
2013-08-25 18:27:43 [INFO] [STDOUT] loading single player
2013-08-25 18:27:43 [INFO] [Minecraft-Server] Player50[/127.0.0.1:0] logged in with entity id 29 at (674.0141934529976, 4.0, -1238.885535198218)
2013-08-25 18:27:43 [INFO] [Minecraft-Server] Player50 joined the game
2013-08-25 18:27:44 [INFO] [STDOUT] Setting up custom skins
2013-08-25 18:27:45 [WARNING] [Minecraft-Client] Failed to load texture: minesbykanar:BasicMine.png
java.io.FileNotFoundException: minesbykanar:BasicMine.png
at net.minecraft.client.resources.FallbackResourceManager.func_110536_a(FallbackResourceManager.java:64)
at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:63)
at net.minecraft.client.renderer.texture.SimpleTexture.func_110551_a(SimpleTexture.java:31)
at net.minecraft.client.renderer.texture.TextureManager.func_110579_a(TextureManager.java:84)
at net.minecraft.client.renderer.texture.TextureManager.func_110577_a(TextureManager.java:41)
at net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer.func_110628_a(TileEntitySpecialRenderer.java:27)
at mines.render.TileEntityBasicMineRender.renderTileEntityAtBlockBasicMine(TileEntityBasicMineRender.java:44)
at mines.render.TileEntityBasicMineRender.renderTileEntityAt(TileEntityBasicMineRender.java:37)
at net.minecraft.client.renderer.tileentity.TileEntityRenderer.renderTileEntityAt(TileEntityRenderer.java:172)
at net.minecraft.client.renderer.tileentity.TileEntityRenderer.renderTileEntity(TileEntityRenderer.java:157)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:536)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1160)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1006)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)
at net.minecraft.client.main.Main.main(Main.java:93)
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:57)
at net.minecraft.launchwrapper.Launch.main(Launch.java:18)
2013-08-25 18:28:00 [INFO] [Minecraft-Server] Saving and pausing game…
2013-08-25 18:28:00 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/Overworld
2013-08-25 18:28:00 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/Nether
2013-08-25 18:28:00 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/The End
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Stopping server
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Saving players
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Player50 left the game
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Saving worlds
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/Overworld
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/Nether
2013-08-25 18:28:01 [INFO] [Minecraft-Server] Saving chunks for level ‘Mines’/The End
2013-08-25 18:28:01 [INFO] [ForgeModLoader] Unloading dimension 0
2013-08-25 18:28:01 [INFO] [ForgeModLoader] Unloading dimension -1
2013-08-25 18:28:01 [INFO] [ForgeModLoader] Unloading dimension 1
2013-08-25 18:28:02 [INFO] [Minecraft-Client] Stopping!
2013-08-25 18:28:02 [INFO] [STDOUT]
2013-08-25 18:28:02 [INFO] [STDOUT] SoundSystem shutting down…
2013-08-25 18:28:02 [INFO] [STDOUT] Author: Paul Lamb, www.paulscode.com
2013-08-25 18:28:02 [INFO] [STDOUT]
::: -
@‘Superloup10’:
Si tu mets
java protected static final ResourceLocation texture = new ResourceLocation("minesbykanar:BasicMineTexture.png");
à la place de ```java
protected static final ResourceLocation texture = new ResourceLocation(“minesbykanar:textures/blocks/BasicMineTexture.png”);ça change quelque chose?
-
@‘robin4002’:
@‘Superloup10’:
Si tu mets
java protected static final ResourceLocation texture = new ResourceLocation("minesbykanar:BasicMineTexture.png");
à la place de ```java
protected static final ResourceLocation texture = new ResourceLocation(“minesbykanar:textures/blocks/BasicMineTexture.png”);ça change quelque chose?
Erf, du coup oui … Merci, problème résolu !