Faire une plantation
-
donc j’enleve itemID dans la class du block et blockID dans la class principale et je change tilledField par setBlockName dans la class principale ?
-
a non ok j’ai plus qu’une erreur:
-
supprime, “, Block…”
-
comme sa?
-
Les blocs se situent dans la classe “Blocks” maintenant Change le “Block.tilledField” par “Blocks.tilledField” Et si tu ne trouve pas le bloc dans la classe, cherche un nom du genre.
-
comme ceci ?
-
Remplace le “Blocks.tilledfield” par “Blocks.farmland”.
-
Il n’y a plus d’erreur mais sa me fait crash quand je plante des graine
-
Tu as bien updaté le code en 1.7 ?
-
gradlewsetupDecompWorkspace et gradlew eclipse?
-
Non non, car ce tutoriel est prévu pour la 1.6.4 as tu modifié les noms de fonctions avec les nouvelles classes ?
-
ou alors c’est parsqu’il n’y a pas de texture non?
-
tien mes code:
class principal package com.google.smalycraft.misterfire.common; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemSeeds; import com.google.smalycraft.misterfire.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.GameRegistry; @Mod(modid = MisterFire.MODID, name = "MisterFire", version = "1.0.0") public class MisterFire { public static final String MODID = "misterfire"; @Instance("MisterFire") public static MisterFire instance; @SidedProxy(clientSide = "com.google.smalycraft.misterfire.proxy.ClientProxy" , serverSide = "com.google.smalycraft.misterfire.proxy.ClientProxy") public static CommonProxy proxy; public static Block BlockFraiseCulture; public static Item fraise ,ItemFraiseGraine; @EventHandler public void preInit(FMLPreInitializationEvent event) { fraise = new ItemFraise().setUnlocalizedName("fraise").setCreativeTab(CreativeTabs.tabFood); BlockFraiseCulture = new BlockFraiseCulture(2000).setBlockName("Culture de fraise"); ItemFraiseGraine = new ItemSeeds(this.BlockFraiseCulture, Blocks.farmland).setUnlocalizedName("Graines de fraise").setTextureName("modid:ItemFraiseGraine"); GameRegistry.registerBlock(BlockFraiseCulture, "Culture de fraise"); GameRegistry.registerItem(fraise, "fraise", "MisterFire"); GameRegistry.registerItem(ItemFraiseGraine, "Graines de fraise", "MisterFire"); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
class du block:
package com.google.smalycraft.misterfire.common; import javax.swing.Icon; import net.minecraft.block.BlockCarrot; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.util.IIcon; public class BlockFraiseCulture extends BlockCarrot{ public static String[] type = new String[]{"Culture de fraise_0", "Culture de fraise_1", "Culture de fraise_2", "Culture de fraise_3", "Culture de fraise_4", "Culture de fraise_5", "Culture de fraise_6", "Culture de fraise_7"}; private Icon[] IconArray; public BlockFraiseCulture (int id) { super(); } public IIcon getIcon(int side, int metadata) { return (IIcon) (metadata < type.length && metadata >= 0 ? IconArray[metadata] : IconArray[0]); } public void registerIcons(IIconRegister iconregister) { IconArray = new Icon[type.length]; for(int i = 0; i < type.length; i++) { IconArray* = (Icon) iconregister.registerIcon("MisterFire:" + type*); } } protected Item getSeedItem() { return MisterFire.ItemFraiseGraine; } protected Item getCropItem() { return MisterFire.fraise; } public int damageDropped(int metadata) { return metadata; } }
class de la fraise:
package com.google.smalycraft.misterfire.common; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemFraise extends Item { public static final String MODID = "fraise"; @Override public void registerIcons(IIconRegister iconregister) { this.itemIcon = iconregister.registerIcon(ItemFraise.MODID + ":fraise"); } public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.eat; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (player.canEat(false)) // Mettre true pour que le joueur puisse manger l'item même s'il n'a pas faim { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); } return stack; } public int getMaxItemUseDuration(ItemStack stack) { return 32; } public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { –stack.stackSize; player.getFoodStats().addStats(8, 4); // nombre de demi-gigots + saturation world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); return stack; } }
-
Ouais aussi ^^
-
le probleme c’est que je ne sait pas comment faire pour apliquer la texture ^^
-
Recherche sur le foruùm y’a des autres "cas " comme toi
-
je le ferai demain la jen peu plus f’au que j’dorme x)
-
@‘MrAzErTy31’:
Recherche sur le foruùm y’a des autres "cas " comme toi
dsl mais j’ai chercher mais je n’ai rien trouver qui a marcher aucune texture ne marche
aussi quand j’ai créer la fraise la texture et les langue je les ai mis dans un dossier nommer fraise ( il y a que comme sa de la texture marcher ) je ne sait pas si j’aurrai du mettre le nom de mon mod (MisterFire) mais avec fraise sa marcher, peu etre l’erreur vient de la. -
Dans la classe du bloc :
registerIcons -> registerBlockIcons -
sa ne marche pas:
console:
[13:26:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Using primary tweak class name cpw.mods.fml.common.launcher.FMLTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLTweaker [13:26:04] [main/INFO] [FML]: Forge Mod Loader version 7.2.217.1147 for Minecraft 1.7.2 loading [13:26:04] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_11, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre8 [13:26:04] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation [13:26:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLDeobfTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLInjectionAndSortingTweaker [13:26:04] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [13:26:04] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work! [13:26:06] [main/ERROR] [FML]: The minecraft jar file:/C:/Users/Sebastien/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1147/forgeSrc-1.7.2-10.12.2.1147.jar!/net/minecraft/client/ClientBrandRetriever.class appears to be corrupt! There has been CRITICAL TAMPERING WITH MINECRAFT, it is highly unlikely minecraft will work! STOP NOW, get a clean copy and try again! [13:26:06] [main/ERROR] [FML]: FML has been ordered to ignore the invalid or missing minecraft certificate. This is very likely to cause a problem! [13:26:06] [main/ERROR] [FML]: Technical information: ClientBrandRetriever was at jar:file:/C:/Users/Sebastien/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.2-10.12.2.1147/forgeSrc-1.7.2-10.12.2.1147.jar!/net/minecraft/client/ClientBrandRetriever.class, there were 0 certificates for it [13:26:06] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing [13:26:06] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.relauncher.CoreModManager$FMLPluginWrapper [13:26:06] [main/INFO] [LaunchWrapper]: Calling tweak class cpw.mods.fml.common.launcher.FMLDeobfTweaker [13:26:06] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main} [13:26:07] [main/INFO]: Setting user: Player650 [13:26:09] [Client thread/INFO]: LWJGL Version: 2.9.0 [13:26:09] [Client thread/ERROR]: Couldn't set icon javax.imageio.IIOException: Can't read input file! at javax.imageio.ImageIO.read(Unknown Source) ~[?:1.8.0_11] at net.minecraft.client.Minecraft.readImage(Minecraft.java:641) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:892) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] [13:26:10] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization [13:26:10] [Client thread/INFO] [FML]: MinecraftForge v10.12.2.1147 Initialized [13:26:10] [Client thread/INFO] [FML]: Replaced 182 ore recipies [13:26:10] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization [13:26:10] [Client thread/INFO] [FML]: Searching C:\Users\Sebastien\Desktop\modding\forge-1.7.2\eclipse\mods for mods [13:26:11] [Client thread/ERROR] [FML]: FML has detected a mod that is using a package name based on 'net.minecraft.src' : net.minecraft.src.FMLRenderAccessLibrary. This is generally a severe programming error. There should be no mod code in the minecraft namespace. MOVE YOUR MOD! If you're in eclipse, select your source code and 'refactor' it into a new package. Go on. DO IT NOW! [13:26:13] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load [13:26:14] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:MisterFire [13:26:14] [Client thread/INFO] [FML]: Processing ObjectHolder annotations [13:26:14] [Client thread/INFO] [FML]: Found 341 ObjectHolder annotations [13:26:14] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0 [13:26:14] [Client thread/INFO] [FML]: Applying holder lookups [13:26:14] [Client thread/INFO] [FML]: Holder lookups applied Starting up SoundSystem… Initializing LWJGL OpenAL (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) OpenAL initialized. [13:26:15] [Sound Library Loader/INFO]: Sound engine started –-- Minecraft Crash Report ---- // Hi. I'm Minecraft, and I'm a crashaholic. Time: 18/09/14 13:26 Description: Initializing game java.lang.ClassCastException: net.minecraft.client.renderer.texture.TextureAtlasSprite cannot be cast to javax.swing.Icon at com.google.smalycraft.misterfire.common.BlockFraiseCulture.registerBlockIcons(BlockFraiseCulture.java:32) at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:315) at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57) at net.minecraft.client.Minecraft.startGame(Minecraft.java:578) 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 com.google.smalycraft.misterfire.common.BlockFraiseCulture.registerBlockIcons(BlockFraiseCulture.java:32) at net.minecraft.client.renderer.texture.TextureMap.registerIcons(TextureMap.java:315) at net.minecraft.client.renderer.texture.TextureMap.<init>(TextureMap.java:57) at net.minecraft.client.Minecraft.startGame(Minecraft.java:578) -- 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 7 (amd64) version 6.1 Java Version: 1.8.0_11, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 703487408 bytes (670 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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.217.1147 Minecraft Forge 10.12.2.1147 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{7.2.217.1147} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized Forge{10.12.2.1147} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized misterfire{1.0.0} [MisterFire] (bin) Unloaded->Constructed->Pre-initialized Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: Intel(R) HD Graphics 3000 GL version 3.1.0 - Build 8.15.10.2653, Intel 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)
class principal:
package com.google.smalycraft.misterfire.common; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemSeeds; import com.google.smalycraft.misterfire.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.GameRegistry; @Mod(modid = MisterFire.MODID, name = "MisterFire", version = "1.0.0") public class MisterFire { public static final String MODID = "misterfire"; @Instance("MisterFire") public static MisterFire instance; @SidedProxy(clientSide = "com.google.smalycraft.misterfire.proxy.ClientProxy" , serverSide = "com.google.smalycraft.misterfire.proxy.ClientProxy") public static CommonProxy proxy; public static Block BlockFraiseCulture; public static Item fraise ,ItemFraiseGraine; @EventHandler public void preInit(FMLPreInitializationEvent event) { fraise = new ItemFraise().setUnlocalizedName("fraise").setCreativeTab(CreativeTabs.tabFood); BlockFraiseCulture = new BlockFraiseCulture(2000).setBlockName("Culture de fraise"); ItemFraiseGraine = new ItemSeeds(this.BlockFraiseCulture, Blocks.farmland).setUnlocalizedName("Graines de fraise").setTextureName("modid:ItemFraiseGraine"); GameRegistry.registerBlock(BlockFraiseCulture, "Culture de fraise"); GameRegistry.registerItem(fraise, "fraise", "MisterFire"); GameRegistry.registerItem(ItemFraiseGraine, "Graines de fraise", "MisterFire"); } @EventHandler public void init(FMLInitializationEvent event) { proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
class du block:
package com.google.smalycraft.misterfire.common; import javax.swing.Icon; import net.minecraft.block.BlockCarrot; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.util.IIcon; public class BlockFraiseCulture extends BlockCarrot{ public static String[] type = new String[]{"Culture de fraise_0", "Culture de fraise_1", "Culture de fraise_2", "Culture de fraise_3", "Culture de fraise_4", "Culture de fraise_5", "Culture de fraise_6", "Culture de fraise_7"}; private Icon[] IconArray; public BlockFraiseCulture (int id) { super(); } public IIcon getIcon(int side, int metadata) { return (IIcon) (metadata < type.length && metadata >= 0 ? IconArray[metadata] : IconArray[0]); } public void registerBlockIcons(IIconRegister iconregister) { IconArray = new Icon[type.length]; for(int i = 0; i < type.length; i++) { IconArray* = (Icon) iconregister.registerIcon("MisterFire:" + type*); } } protected Item getSeedItem() { return MisterFire.ItemFraiseGraine; } protected Item getCropItem() { return MisterFire.fraise; } public int damageDropped(int metadata) { return metadata; } }
class de la fraise:
package com.google.smalycraft.misterfire.common; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemFraise extends Item { public static final String MODID = "fraise"; @Override public void registerIcons(IIconRegister iconregister) { this.itemIcon = iconregister.registerIcon(ItemFraise.MODID + ":fraise"); } public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.eat; } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (player.canEat(false)) // Mettre true pour que le joueur puisse manger l'item même s'il n'a pas faim { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); } return stack; } public int getMaxItemUseDuration(ItemStack stack) { return 32; } public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { –stack.stackSize; player.getFoodStats().addStats(8, 4); // nombre de demi-gigots + saturation world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); return stack; } }
contenue en us
item.fraise.name=strawberry item.ItemFraiseGraine.name=graine de fraise tile.Culture de fraise.Culture de fraise_0.name=fraisier0 tile.Culture de fraise.Culture de fraise_1.name=fraisier1 tile.Culture de fraise.Culture de fraise_2.name=fraisier2 tile.Culture de fraise.Culture de fraise_3.name=fraisier3 tile.Culture de fraise.Culture de fraise_4.name=fraisier4 tile.Culture de fraise.Culture de fraise_5.name=fraisier5 tile.Culture de fraise.Culture de fraise_6.name=fraisier6 tile.Culture de fraise.Culture de fraise_7.name=fraisier7
contenue fr fr
item.fraise.name=fraise item.ItemFraiseGraine.name=graine de fraise tile.Culture de fraise.Culture de fraise_0.name=fraisier0 tile.Culture de fraise.Culture de fraise_1.name=fraisier1 tile.Culture de fraise.Culture de fraise_2.name=fraisier2 tile.Culture de fraise.Culture de fraise_3.name=fraisier3 tile.Culture de fraise.Culture de fraise_4.name=fraisier4 tile.Culture de fraise.Culture de fraise_5.name=fraisier5 tile.Culture de fraise.Culture de fraise_6.name=fraisier6 tile.Culture de fraise.Culture de fraise_7.name=fraisier7
screen:
</init></init>