Résolu Texture block inventaire
-
Bonsoir j’ai un problème,
J’arrive pas a rendre la texture de mon bloc dans mon inventaire.
Mon code:
package com.CSC.net.block; import com.CSC.net.Main; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class CSCBlocks { public static final Block block_propre = new block1(Material.rock).setUnlocalizedName("block1").setCreativeTab(CreativeTabs.tabDecorations); public static final Block sechelinge = new Blocksechelinge(Material.rock).setUnlocalizedName("Seche linge").setCreativeTab(CreativeTabs.tabDecorations); public static final Block blockcuve = new Blockcuve(Material.rock).setUnlocalizedName("Cuve a linge").setCreativeTab(CreativeTabs.tabDecorations); public static final Block machinelaver = new blockmachinelaver(Material.rock).setUnlocalizedName("Machine a laver").setCreativeTab(CreativeTabs.tabDecorations); public static final Block block_sale = new block2(Material.rock).setUnlocalizedName("block sale").setCreativeTab(CreativeTabs.tabDecorations); public static void registerBlock() { GameRegistry.registerBlock(block_propre, "block_block_propre"); GameRegistry.registerBlock(block_sale, "block_block_sale"); GameRegistry.registerBlock(sechelinge, "block_sechelinge"); GameRegistry.registerBlock(machinelaver, "block_machinelaver"); GameRegistry.registerTileEntity(TileEntitySecheLinge.class, "tileentitysechelinge"); GameRegistry.registerBlock(blockcuve, "block_blockcuve"); GameRegistry.registerTileEntity(TileEntityCuve.class, "tileentitycuve"); GameRegistry.registerTileEntity(TileEntityMachineLaver.class, "tileentitymachinelaver"); } @SideOnly(Side.CLIENT) public static void registerItemsBlocksModels() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block_propre), 0, new ModelResourceLocation(Main.MODID + ":block_propre", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block_sale), 0, new ModelResourceLocation(Main.MODID + ":block_sale", "inventory")); } }
ClientProxy:
@Override public void preInit(File configFile) { super.preInit(configFile); CSCItems.registerItemsModels(); CSCBlocks.registerItemsBlocksModels(); }
Je vous passe mon dossier assets comme ça vous êtes tranquille et j’ai pas tout mettre en balise code:
Merci d’avance
-
Tout semble bon, les jsons sont bien visible sur eclipse ?
-
C’est moi ou ça:
.setUnlocalizedName("Seche linge")
C’est limite limite ?
-
@‘robin4002’:
Tout semble bon, les jsons sont bien visible sur eclipse ?
Oui j’ai même fais un f5 …
Benjamin,
Tu parles de l’espace entre Seche et Linge ?
Il faut un tiré du bas a la place des espaces non ?
-
Oui, en fait tu as 5 blocs dans ta classe, tu ne précises pas lequel ne fonctionne pas, ou tous ?
-
@‘Benjamin Loison’:
Oui, en fait tu as 5 blocs dans ta classe, tu ne précises pas lequel ne fonctionne pas, ou tous ?
Bah j’ai que deux texture pour le moment donc pour l’instant deux.
Mais le truc que je comprends pas c’est que tout est bon et bien appeler par la classe client.
Et la texture marche une fois le bloc posé c’est juste dans l’inventaire et dans la main que la texture s’affiche pas.
Dans les logs je viens de voir ça:
[09:47:04] [Client thread/ERROR] [FML]: Model definition for location csc:block_block_sale#inventory not found
[09:47:04] [Client thread/ERROR] [FML]: Model definition for location csc:block_block_propre#inventory not foundDu coup j’ai ajouter un block dans le chemin vers le json
donc j’ai ça:@SideOnly(Side.CLIENT) public static void registerItemsBlocksModels() { System.out.println("registerItemsBlocksModels"); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block_propre), 0, new ModelResourceLocation(Main.MODID + ":block_block_propre", "inventory")); ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block_sale), 0, new ModelResourceLocation(Main.MODID + ":block_block_sale", "inventory")); } }
Mais c’est pareil et je viens de voir la fonction est bien appeler !
-
Personne ?
-
Ah bha oui, ça explique tout.
GameRegistry.registerBlock(block_propre, "block_block_propre"); GameRegistry.registerBlock(block_sale, "block_block_sale");
devient :
GameRegistry.registerBlock(block_propre, "block_propre"); GameRegistry.registerBlock(block_sale, "block_sale");
Et dans ta fonction registerItemsBlocksModels remet qu’une seul fois block_ et non deux
-
@‘robin4002’:
Ah bha oui, ça explique tout.
GameRegistry.registerBlock(block_propre, "block_block_propre"); GameRegistry.registerBlock(block_sale, "block_block_sale");
devient :
GameRegistry.registerBlock(block_propre, "block_propre"); GameRegistry.registerBlock(block_sale, "block_sale");
Et dans ta fonction registerItemsBlocksModels remet qu’une seul fois block_ et non deux
ah ok,
Du coup la texture block_propre c’est bon ça marche nickel mais le block_sale marche pas… il se rend toujours pas dans l’inventaire mais il se rend en jeu j’ai bien tout vérifier j’ai tout renommé en block_sale
EDIT:
Et j’ai une question:
Pour avoir plusieurs texture sur le bloc comment je peux faire, un bloc avec plusieurs textures sur les faces.
-
Re,
Le block_sale ne se rend toujours pas dans l’inventaire, mais c’est pas bien grave c’est un bloc.
J’ai un autre soucis:
J’ai pris les json de la citrouille car je fais un bloc avec deux textures.
Mon problème est que le bloc se rend dans l’inventaire et dans la main nickel mais une fois posé par terre la texture ne s’affiche pas.
JSON:
models/block:
block_machinelaver.json:
{ "parent": "block/orientable", "textures": { "top": "csc:blocks/block_machinelaver", "front": "csc:blocks/block_machinelaver_face", "side": "csc:blocks/block_machinelaver" } }
blockstates:
block_machinelaver.json
{ "variants": { "facing=north": { "model": "csc:block_machinelaver" }, "facing=south": { "model": "csc:block_machinelaver", "y": 180 }, "facing=west": { "model": "csc:block_machinelaver", "y": 270 }, "facing=east": { "model": "csc:block_machinelaver", "y": 90 } } }
models/item
block_machinelaver.json
{ "parent": "csc:block/block_machinelaver", "display": { "thirdperson": { "rotation": [ 10, -45, 170 ], "translation": [ 0, 1.5, -2.75 ], "scale": [ 0.375, 0.375, 0.375 ] } } }
Screen:
-
Il me faut la classe de ton bloc ainsi que les logs au lancement.
-
@‘robin4002’:
Il me faut la classe de ton bloc ainsi que les logs au lancement.
Tien:
Classe du bloc:
package com.CSC.net.block; import java.util.Random; import com.CSC.net.Main; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.InventoryHelper; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class blockmachinelaver extends BlockContainer { public static boolean isBurning; protected blockmachinelaver(Material rock) { super(rock); } @Override public TileEntity createNewTileEntity(World world, int metadata) { return new TileEntityMachineLaver(); } @Override public boolean hasTileEntity() { return true; } @Override public void breakBlock(World world, BlockPos pos, IBlockState state) { TileEntity tile = world.getTileEntity(pos); if(tile instanceof TileEntityMachineLaver) { InventoryHelper.dropInventoryItems(world, pos, (TileEntityMachineLaver)tile); } super.breakBlock(world, pos, state); } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) { if(world.isRemote) { return true; } else { player.openGui(Main.instance, 5, world, pos.getX(), pos.getY(), pos.getZ()); return true; } } @Override public int getRenderType() { return 3; } @SideOnly(Side.CLIENT) public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (this.isBurning) { double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D; double d2 = (double)pos.getZ() + 0.5D; double d3 = 0.52D; double d4 = rand.nextDouble() * 0.6D - 0.3D; worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 - d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d4, d1, d2 - d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); worldIn.spawnParticle(EnumParticleTypes.SPELL_INSTANT, d0 + d4, d1, d2 + d3, 0.0D, 0.0D, 0.0D, new int[0]); } } }
logs:
[18:37:55] [main/INFO] [GradleStart]: username: floriangabet [18:37:55] [main/INFO] [GradleStart]: Extra: [] [18:37:55] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --username, floriangabet, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker] [18:37:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker [18:37:55] [main/INFO] [FML]: Forge Mod Loader version 8.0.37.1334 for Minecraft 1.8 loading [18:37:55] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre [18:37:55] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [18:37:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker [18:37:55] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin [18:37:55] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin [18:37:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker [18:37:55] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:37:55] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [18:37:56] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [18:37:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper [18:37:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker [18:37:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker [18:37:56] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker [18:37:56] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker [18:37:56] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [18:37:56] [Client thread/INFO]: Setting user: floriangabet [18:37:57] [Client thread/INFO]: LWJGL Version: 2.9.1 [18:37:58] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [18:37:58] [Client thread/INFO] [FML]: MinecraftForge v11.14.1.1334 Initialized [18:37:58] [Client thread/INFO] [FML]: Replaced 204 ore recipies [18:37:58] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [18:37:58] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Desktop\CSC\eclipse\mods for mods [18:37:58] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [18:37:58] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, csc] at CLIENT [18:37:58] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, csc] at SERVER [18:37:58] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Cite Sous Controle [18:37:58] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [18:37:58] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations [18:37:58] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [18:37:59] [Client thread/INFO] [STDOUT]: [com.CSC.net.block.CSCBlocks:registerItemsBlocksModels:38]: registerItemsBlocksModels [18:37:59] [Client thread/INFO] [FML]: Applying holder lookups [18:37:59] [Client thread/INFO] [FML]: Holder lookups applied [18:37:59] [Sound Library Loader/INFO]: Starting up SoundSystem… [18:37:59] [Thread-7/INFO]: Initializing LWJGL OpenAL [18:37:59] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [18:37:59] [Thread-7/INFO]: OpenAL initialized. [18:37:59] [Sound Library Loader/INFO]: Sound engine started [18:38:00] [Client thread/INFO]: Created: 2048x1024 textures-atlas [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_batonP#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_panierlinge#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_lesive#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_coli#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_balai#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_propre_sec#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:block_sale#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge_propre_mouiller#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:block_blockcuve#normal not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:block_blockcuve#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_medic#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge_sale#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_belier#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_clefm#inventory not found [18:38:00] [Client thread/ERROR] [FML]: Model definition for location csc:item_lingette#inventory not found [18:38:01] [Client thread/INFO] [STDOUT]: [com.CSC.net.Main:init:63]: [18:38:01] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods [18:38:01] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Cite Sous Controle [18:38:01] [Client thread/INFO]: SoundSystem shutting down… [18:38:01] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com [18:38:01] [Sound Library Loader/INFO]: Starting up SoundSystem… [18:38:01] [Thread-9/INFO]: Initializing LWJGL OpenAL [18:38:01] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [18:38:01] [Thread-9/INFO]: OpenAL initialized. [18:38:01] [Sound Library Loader/INFO]: Sound engine started [18:38:02] [Client thread/INFO]: Created: 2048x1024 textures-atlas [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_batonP#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_panierlinge#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_lesive#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_coli#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_balai#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_propre_sec#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_sale#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge_propre_mouiller#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_blockcuve#normal not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_blockcuve#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_medic#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge_sale#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_belier#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_clefm#inventory not found [18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:item_lingette#inventory not found [18:38:02] [Client thread/INFO] [STDOUT]: [com.CSC.net.proxy.ClientProxy:onGuiOpen:172]: net.minecraft.client.gui.GuiMainMenu@dbf042
-
[18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found
Regardes BlockPumpkin, la classe est extends BlockHorizontal (en tout cas en 1.10.2, c’est surement la même chose en 1.8).
Dans BlockHorizontal il y a une PropertyDirection “FACING” et dans BlockPumpkin il y a pas mal de fonction qui utilise cette propriété.
Sans ça la direction ne peut pas fonctionner.Le json ne gère que la texture pas le reste.
-
@‘robin4002’:
[18:38:02] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found
Regardes BlockPumpkin, la classe est extends BlockHorizontal (en tout cas en 1.10.2, c’est surement la même chose en 1.8).
Dans BlockHorizontal il y a une PropertyDirection “FACING” et dans BlockPumpkin il y a pas mal de fonction qui utilise cette propriété.
Sans ça la direction ne peut pas fonctionner.Le json ne gère que la texture pas le reste.
Ah ouais super merci robin !
Et dis moi tu serrais pas pour le block_sale ?
Problème réglé j’ai refais le json et c’est bon merci !!