Résolu Comment créer une barrière et un Mur
-
Bonjour, j’ai voulu ajouter une barrière dans le jeu avec le code de la 1.6.4
blockTutoriel = new BlockFence(Material.wood)
sauf que dans les parentheses il me rajoute null
Imports fait corectement
le block est bien initialisé et la aucune erreur je lance et la crash!le code doit etre different en 1.7
et d’après ce que j’ai compris il faut une texture d’un bloc normal pour la texture de la barriere
merci de m’aiderlien de la 1.6.4 : http://www.minecraftforgefrance.fr/showthread.php?tid=261
-
@‘monpetitflocon’:
Bonjour, j’ai voulu ajouter une barrière dans le jeu avec le code de la 1.6.4
blockTutoriel = new BlockFence(Material.wood)
sauf que dans les parentheses il me rajoute null
Imports fait corectement
le block est bien initialisé et la aucune erreur je lance et la crash!le code doit etre different en 1.7
et d’apres cce que j’ai comprs il faut une texture d’un bloc normal pour la texture de la barriere
merci de m’aiderlien de la 1.6.4 : http://www.minecraftforgefrance.fr/showthread.php?tid=261
CHANGEMENT DE LA 1.7 : plus d’utilisation des IDs, regarde si ça vient de là.
PS: ce sera plus facile de t’aider avec le code source, une ligne de code suffit pas.
-
voici le code source de la classe principale
package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new BlockFence(null, Material.wood).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
-
@‘monpetitflocon’:
voici le code source de la classe principale
package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new BlockFence(null, Material.wood).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Il faut créer une classe extends BlockFence et rajouter dans le constructeur ce que tu veux.
-
ok merci je vais essayer___je met quoi a cette ligne la ? surtout a “null”
blockTutoriel3 = new FenceBlock(null, Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel3").setBlockTextureName(MODID + ":block_tutoriel3");
Classe Principale:
:::package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new FenceBlock(null, Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel3").setBlockTextureName(MODID + ":block_tutoriel3"); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
Et Que dois je mettre dans le constructeur de cette classe :
Classe de la barrière :
:::package com.google.monpetitflocon.modtest.common; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; public class FenceBlock extends BlockFence { public FenceBlock(String p_i45406_1_, Material material) { super(p_i45406_1_, material); } }
:::
-
@‘monpetitflocon’:
je met quoi a cette ligne la ? surtout a “null”
blockTutoriel3 = new FenceBlock(null, Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel3").setBlockTextureName(MODID + ":block_tutoriel3");
Classe Principale:
:::
package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new FenceBlock(null, Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel3").setBlockTextureName(MODID + ":block_tutoriel3"); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
Et Que dois je mettre dans le constructeur de cette classe :
Classe de la barrière ::::
package com.google.monpetitflocon.modtest.common; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; public class FenceBlock extends BlockFence { public FenceBlock(String p_i45406_1_, Material material) { super(p_i45406_1_, material); } }
:::
Il n’y a pas besoin du setBlockTextureName, il faut juste mettre en premier paramètre quel bois tu veux utiliser (minecraft utilise “planks_oak” pour les barrière normales, qui est la texture du bois de chêne de base).
exemple : si tu veux mettre du bois d’acacia, mets “planks_acacia” en premier paramètre.
-
sa me met une erreur partout a chaque emplacement ou je veux le mettre et ce que j’aimerais c’est d’avoir une propre texture pas celle qui existe deja.
il me faudrait un code et savoir dans quelle classe faut le mettre pour que je comprenne merci
j’ai enlever le setblocktexturename -
@‘monpetitflocon’:
sa me met une erreur partout a chaque emplacement ou je veux le mettre et ce que j’aimerais c’est d’avoir une propre texture pas celle qui existe deja.
il me faudrait un code et savoir dans quelle classe faut le mettre pour que je comprenne merci
j’ai enlever le setblocktexturenametonBlock = new FenceBlock("MODID:taTexture" /*Qui se trouvera dans assets/modid/blocks/taTexture.png*/, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("tonNom")
(pour les setters, j’ai utilisé les valeurs de minecraft)
-
merci beaucoup sa marche nikel j’ai juste replacer MODID:Tatexture par MODID +“:tatexture”
et sa marche et je ne conaissait pas le coup du setstepsound
et pour les murs c’est le meme code que la 1.6.4 ?___Le code est totalement different et sa a l’air encore plus compliquer -
@‘monpetitflocon’:
Le code est totalement different et sa a l’air encore plus compliquer
D’après ce que je vois, c’est simple : tonBlockWall = new BlockWall(tonBlockDeBase).
-
merci je vais test___impossible d’importer ou de creer une classe il y a des erreurs partout
-
@‘monpetitflocon’:
impossible d’importer ou de creer une classe il y a des erreurs partout
c’est à dire ?
-
Attention au double poste. Je fusionne tes deux messages.
-
a ok merci robin
Tout est bon sauf que j’ai un gros probleme de texture j’ai le mur de cobble :huh:
j’ai pas eu besoin de classe et apres je me demande comment je vais pouvoirs le metre dans ma creative tab -
@‘monpetitflocon’:
a ok merci robin
Tout est bon sauf que j’ai un gros probleme de texture j’ai le mur de cobble :huh:
j’ai pas eu besoin de classe et apres je me demande comment je vais pouvoirs le metre dans ma creative tabIl nous faut le code source pour t’aider.
Pour les creatives tabs c’est : tonBlock = new ClasseDeTonBlock(tesParamètres).setCreativeTab(CreativeTabs.tabCeQueTuVeux)
-
oui je sais mais comme il y avait pas de classe sinon tient :
Classe principale :
:::package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockWall; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3,blocktutorialstairs,Wallblock; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new FenceBlock(MODID +":block_tutoriel3", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("tutoriel3"); blocktutorialstairs = new BlockTutorialStairs(ModTest.blockTutoriel3, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("TutorialStairs").setBlockTextureName(MODID + ":block_tutoriel3"); Wallblock = new BlockWall(blockTutoriel3); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerBlock(blocktutorialstairs, "TutorialStairs"); GameRegistry.registerBlock(Wallblock, "Wall_block"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
et c’est un mur de cobble j’ai esayer avec un set texture name et sa ne change rien -
@‘monpetitflocon’:
oui je sais mais comme il y avait pas de classe sinon tient :
Classe principale ::::
package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.BlockWall; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3,blocktutorialstairs,Wallblock; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new FenceBlock(MODID +":block_tutoriel3", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("tutoriel3"); blocktutorialstairs = new BlockTutorialStairs(ModTest.blockTutoriel3, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("TutorialStairs").setBlockTextureName(MODID + ":block_tutoriel3"); Wallblock = new BlockWall(blockTutoriel3); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerBlock(blocktutorialstairs, "TutorialStairs"); GameRegistry.registerBlock(Wallblock, "Wall_block"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
et c’est un mur de cobble j’ai esayer avec un set texture name et sa ne change rien
Normal : le block passé en paramètre est une barrière, essaie avec un vrai bloc.
-
ne change rien et c’est pire car sa ma mit tile.null.name a la place du tecte donc sa vien pas de la et j’ai envie davoir la texture du bloc 3
j’ai test avec le bloc normal le 2 et sa change rien appart le titre du bloc -
Un bloc wall utilise un autre bloc sur lequel il est basé (dans le cas de mc vanilla, une fois c’est la cobble, l’autre fois la cobble moussue).
La tu essayes de faire un blockWall en te basant sur une barrière, ce n’est pas possible. Il faut un bloc normal.
(ou alors il faut refaire son propre mur sans se base sur BlockWall)Il suffit juste de faire une classe extends BlockWall puis ajoute cette fonction pour la texture :
@SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return ClassePrincipale.blocVoulu.getBlockTextureFromSide(side); }
-
classe :
package com.google.monpetitflocon.modtest.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockWall; import net.minecraft.util.IIcon; public class WallBlock extends BlockWall { public WallBlock(Block p_i45435_1_) { super(p_i45435_1_); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return ModTest.blockTutoriel3.getBlockTextureFromSide(side); } }
:::
Classe Principale je ne sais pas quoit mettre à la place de null (l.80) :
:::package com.google.monpetitflocon.modtest.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import com.google.monpetitflocon.modtest.proxy.CommonProxy; import cpw.mods.fml.common.FMLCommonHandler; 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.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "ModTest.MODID", name = "Mod Test", version = "1.0.0") public class ModTest { public static final String MODID = "modtest"; @Instance("MODID") public static ModTest instance; @SidedProxy(clientSide = "com.google.monpetitflocon.modtest.proxy.ClientProxy", serverSide ="com.google.monpetitflocon.modtest.proxy.CommonProxy") public static CommonProxy proxy; public static Item letest, helmetTuto, chestPlateTuto, leggingsTuto, bootsTuto, swordTuto, pickaxeTuto, axeTuto, shovelTuto, hoeTuto; public static Block blockTutoriel, blockTutoriel2, blockMetadataTuto,blockTutoriel3,blocktutorialstairs,Wallblock; public static ArmorMaterial armorTuto = EnumHelper.addArmorMaterial("armorTuto", 45, new int[] {4, 9, 7, 4}, 30); public static ToolMaterial toolTuto = EnumHelper.addToolMaterial("toolTuto", 3, 1000, 12.0F, 14.0F, 20); public static CreativeTabs tutorialCreativeTabs = new TutorialCreativeTabs("tutorial_creative_tabs"); WorldGeneration worldgeneration = new WorldGeneration(); @EventHandler public void preInit(FMLPreInitializationEvent event) { letest = new Letest().setUnlocalizedName("letest").setTextureName(MODID + ":Item_letest"); helmetTuto = new ItemTutoArmor(armorTuto, 0).setUnlocalizedName("helmetTuto").setTextureName(MODID + ":helmet_tutoriel"); chestPlateTuto = new ItemTutoArmor(armorTuto, 1).setUnlocalizedName("chestPlateTuto").setTextureName(MODID + ":chestplate_tutoriel"); leggingsTuto = new ItemTutoArmor(armorTuto, 2).setUnlocalizedName("leggingsTuto").setTextureName(MODID + ":leggings_tutoriel"); bootsTuto = new ItemTutoArmor(armorTuto, 3).setUnlocalizedName("bootsTuto").setTextureName(MODID + ":boots_tutoriel"); swordTuto = new ItemTutoSword(toolTuto).setUnlocalizedName("swordTuto").setTextureName(MODID + ":sword_tutoriel"); pickaxeTuto = new ItemTutoPickaxe(toolTuto).setUnlocalizedName("pickaxeTuto").setTextureName(MODID + ":pickaxe_tutoriel"); axeTuto = new ItemTutoAxe(toolTuto).setUnlocalizedName("axeTuto").setTextureName(MODID + ":axe_tutoriel"); shovelTuto = new ItemTutoShovel(toolTuto).setUnlocalizedName("shovelTuto").setTextureName(MODID + ":shovel_tutoriel"); hoeTuto = new ItemTutoHoe(toolTuto).setUnlocalizedName("hoeTuto").setTextureName(MODID + ":hoe_tutoriel"); GameRegistry.registerItem(letest, "item_letest"); GameRegistry.registerItem(helmetTuto, "item_tuto_helmet"); GameRegistry.registerItem(chestPlateTuto, "item_tuto_chestplate"); GameRegistry.registerItem(leggingsTuto, "item_tuto_leggings"); GameRegistry.registerItem(bootsTuto, "item_tuto_boots"); GameRegistry.registerItem(swordTuto, "item_tuto_sword"); GameRegistry.registerItem(pickaxeTuto, "item_tuto_pickaxe"); GameRegistry.registerItem(axeTuto, "item_tuto_axe"); GameRegistry.registerItem(shovelTuto, "item_tuto_shovel"); GameRegistry.registerItem(hoeTuto, "item_tuto_hoe"); blockTutoriel = new BlockOreTutoriel(Material.rock).setHardness(15.0F).setResistance(10.0F).setBlockName("tutoriel").setBlockTextureName(MODID + ":block_tutoriel"); blockTutoriel2 = new BlockTutoriel(Material.wood).setHardness(1.5F).setResistance(10.0F).setBlockName("tutoriel2").setBlockTextureName(MODID + ":block_tutoriel2"); blockMetadataTuto = new BlockTutorielMetadata().setBlockName("metadataTuto").setHardness(1.5F).setResistance(10.0F).setCreativeTab(CreativeTabs.tabBlock); blockTutoriel3 = new FenceBlock(MODID +":block_tutoriel3", Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("tutoriel3"); blocktutorialstairs = new BlockTutorialStairs(ModTest.blockTutoriel3, 0, Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("TutorialStairs").setBlockTextureName(MODID + ":block_tutoriel3"); Wallblock = new WallBlock(null); GameRegistry.registerBlock(blockTutoriel, "block_tutoriel"); GameRegistry.registerBlock(blockTutoriel2, "block_tutoriel2"); GameRegistry.registerBlock(blockMetadataTuto, ItemBlockMetadataTutoriel.class, "block_tuto_metadata", new Object[]{BlockTutorielMetadata.subBlock}); GameRegistry.registerBlock(blockTutoriel3, "block_tutoriel3"); GameRegistry.registerBlock(blocktutorialstairs, "TutorialStairs"); GameRegistry.registerBlock(Wallblock, "Wall_block"); GameRegistry.registerWorldGenerator(worldgeneration, 0); } @EventHandler public void init(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new LivingEventHandler()); FMLCommonHandler.instance().bus().register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); //Recipes GameRegistry.addRecipe(new ItemStack(helmetTuto), new Object[]{"XXX", "X X", " ", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(chestPlateTuto), new Object[]{"X X", "XXX", "XXX", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(leggingsTuto), new Object[]{"XXX", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(bootsTuto), new Object[]{" ", "X X", "X X", 'X', ModTest.letest}); GameRegistry.addRecipe(new ItemStack(swordTuto), new Object[]{" X ", " X ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(pickaxeTuto), new Object[]{"XXX", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(axeTuto), new Object[]{" XX", " YX", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(shovelTuto), new Object[]{" X ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); GameRegistry.addRecipe(new ItemStack(hoeTuto), new Object[]{"XX ", " Y ", " Y ", 'X', ModTest.letest, 'Y', new ItemStack(Items.stick),}); proxy.registerRender(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
:::
j’ai déja essayer de changer de bloc sa fait pareil