Résolu Craft porte
-
Bonjour j’ai un probleme avec le craft de mes porte car quand je les craft sa mes un porte en bois aulieux de la porte demander
Class principale
package fr.minecraftforgefrance.novamine.common; import java.awt.Color; import net.minecraft.block.Block; import net.minecraft.block.BlockGlowstone; import net.minecraft.block.BlockOre; 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.util.EnumHelper; 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; import fr.minecraftforgefrance.novamine.proxy.CommonProxy; @Mod(modid = "modnovamine", name = "Mod Novamine", version = "1.0.0") public class ModNovamine { public static final String MODID = "modnovamine"; public static final String MODNAME = "Mod Novamine"; public static final String MODVERSION = "1.0.0"; @SidedProxy(clientSide = "fr.minecraftforgefrance.novamine.proxy.ClientProxy", serverSide = "fr.minecraftforgefrance.novamine.proxy.CommonProxy") public static CommonProxy proxy; @Instance("modnovamine") public static ModNovamine instance; public static Item porteItem, porteItemA, porteItemB, porteItemDA, porteItemJ; public static Block porte, porteA, porteB, porteDA, porteJ; public static Item helmetEmerald, chestPlateEmerald, leggingsEmerald, bootsEmerald, swordEmerald, pickaxeEmerald, axeEmerald, shovelEmerald, hoeEmerald; public static Item itemSaphir, helmetSaphir, chestPlateSaphir, leggingsSaphir, bootsSaphir, swordSaphir, pickaxeSaphir, axeSaphir, shovelSaphir, hoeSaphir; public static Block invi, invil, Nova, LA, BlockSaphir; public static CreativeTabs Nova1_8 = new Nova1_8("Nova1_8"); public static CreativeTabs BlockNovaMine = new Nova1_8("BlockNovaMine"); public static CreativeTabs ItemNovaMine = new Nova1_8("ItemNovaMine"); public static CreativeTabs ArmurNovaMine = new Nova1_8("ArmurNovaMine"); public static ArmorMaterial armorEmerald = EnumHelper.addArmorMaterial("armorEmerald", 50, new int[] {4, 9, 7, 4}, 30); public static ArmorMaterial armorSaphir = EnumHelper.addArmorMaterial("armorSaphir", 60, new int[] {5, 10, 8, 5}, 35); public static ToolMaterial toolEmerald = EnumHelper.addToolMaterial("toolEmerald", 4, 2000, 10.0F, 4.0F, 18); public static ToolMaterial toolSaphir = EnumHelper.addToolMaterial("toolSaphir", 5, 2400, 10.0F, 5.0F, 19); /** Tool Armor WOOD(0, 59, 2.0F, 0.0F, 15), CLOTH(5, new int[]{1, 3, 2, 1}, 15), STONE(1, 131, 4.0F, 1.0F, 5), CHAIN(15, new int[]{2, 5, 4, 1}, 12), IRON(2, 250, 6.0F, 2.0F, 14), IRON(15, new int[]{2, 6, 5, 2}, 9), EMERALD(3, 1561, 8.0F, 3.0F, 10), GOLD(7, new int[]{2, 5, 3, 1}, 25), DIAMOND(33, new int[]{3, 8, 6, 3}, 10); */ @EventHandler public void preInit(FMLPreInitializationEvent event) { invi = new BlockInvisible(Material.rock).setBlockName("invi").setBlockTextureName(MODID + ":invi").setCreativeTab(BlockNovaMine); invil = new BlockInvisible(Material.rock).setBlockName("invil").setBlockTextureName(MODID + ":invi").setCreativeTab(BlockNovaMine).setLightLevel(1.0F); Nova = new BlockOre().setHardness(3.0F).setResistance(5.0F).setBlockName("oreIron").setBlockTextureName("iron_ore").setCreativeTab(BlockNovaMine).setStepSound(Block.soundTypeStone); LA = new BlockGlowstone(Material.glass).setHardness(0.3F).setStepSound(Block.soundTypeGlass).setLightLevel(1.0F).setBlockName("LA").setBlockTextureName(MODID + ":la").setCreativeTab(Nova1_8); helmetEmerald = new ItemEmeraldArmor(armorEmerald, 0).setUnlocalizedName("helmetEmerald").setTextureName(MODID + ":Emerald_helmet").setCreativeTab(ArmurNovaMine); chestPlateEmerald = new ItemEmeraldArmor(armorEmerald, 1).setUnlocalizedName("chestPlateEmerald").setTextureName(MODID + ":Emerald_chestplate").setCreativeTab(ArmurNovaMine); leggingsEmerald = new ItemEmeraldArmor(armorEmerald, 2).setUnlocalizedName("leggingsEmerald").setTextureName(MODID + ":Emerald_leggings").setCreativeTab(ArmurNovaMine); bootsEmerald = new ItemEmeraldArmor(armorEmerald, 3).setUnlocalizedName("bootsEmerald").setTextureName(MODID + ":Emerald_boots").setCreativeTab(ArmurNovaMine); swordEmerald = new ItemEmeraldSword(toolEmerald).setUnlocalizedName("swordEmerald").setTextureName(MODID + ":Emerald_sword").setCreativeTab(ItemNovaMine); pickaxeEmerald = new ItemEmeraldPickaxe(toolEmerald).setUnlocalizedName("pickaxeEmerald").setTextureName(MODID + ":Emerald_pickaxe").setCreativeTab(ItemNovaMine); axeEmerald = new ItemEmeraldAxe(toolEmerald).setUnlocalizedName("axeEmerald").setTextureName(MODID + ":Emerald_hatchet").setCreativeTab(ItemNovaMine); shovelEmerald = new ItemEmeraldShovel(toolEmerald).setUnlocalizedName("shovelEmerald").setTextureName(MODID + ":Emerald_shovel").setCreativeTab(ItemNovaMine); hoeEmerald = new ItemEmeraldHoe(toolEmerald).setUnlocalizedName("hoeEmerald").setTextureName(MODID + ":Emerald_hoe").setCreativeTab(ItemNovaMine); itemSaphir = new Item().setUnlocalizedName("Saphir").setCreativeTab(ItemNovaMine).setTextureName(MODID + ":Saphir"); helmetSaphir = new ItemSaphirArmor(armorSaphir, 0).setUnlocalizedName("Saphir_helmet").setTextureName(MODID + ":Saphir_helmet").setCreativeTab(ArmurNovaMine); chestPlateSaphir = new ItemSaphirArmor(armorSaphir, 1).setUnlocalizedName("Saphir_chestplate").setTextureName(MODID + ":Saphir_chestplate").setCreativeTab(ArmurNovaMine); leggingsSaphir = new ItemSaphirArmor(armorSaphir, 2).setUnlocalizedName("Saphir_leggings").setTextureName(MODID + ":Saphir_leggings").setCreativeTab(ArmurNovaMine); bootsSaphir = new ItemSaphirArmor(armorSaphir, 3).setUnlocalizedName("Saphir_boots").setTextureName(MODID + ":Saphir_boots").setCreativeTab(ArmurNovaMine); swordSaphir = new ItemSaphirSword(toolSaphir).setUnlocalizedName("Saphir_sword").setTextureName(MODID + ":Saphir_sword").setCreativeTab(ItemNovaMine); pickaxeSaphir = new ItemSaphirPickaxe(toolSaphir).setUnlocalizedName("Saphir_pickaxe").setTextureName(MODID + ":Saphir_pickaxe").setCreativeTab(ItemNovaMine); axeSaphir = new ItemSaphirAxe(toolSaphir).setUnlocalizedName("Saphir_axe").setTextureName(MODID + ":Saphir_axe").setCreativeTab(ItemNovaMine); shovelSaphir = new ItemSaphirShovel(toolSaphir).setUnlocalizedName("Saphir_shovel").setTextureName(MODID + ":Saphir_shovel").setCreativeTab(ItemNovaMine); hoeSaphir = new ItemSaphirHoe(toolSaphir).setUnlocalizedName("Saphir_hoe").setTextureName(MODID + ":Saphir_hoe").setCreativeTab(ItemNovaMine); BlockSaphir = new BlockSaphir (Material.rock).setBlockName("BlockSaphir").setBlockTextureName(MODID + ":Saphir_block").setCreativeTab(BlockNovaMine); porte = new Porte().setBlockName("Sporte").setBlockTextureName(MODID + ":spruce"); porteItem = new ItemPorte().setUnlocalizedName("ItemSporte").setTextureName(MODID + ":spruce").setCreativeTab(ItemNovaMine); porteA = new PorteA().setBlockName("Aporte").setBlockTextureName(MODID + ":acacia"); porteItemA = new ItemPorteA().setUnlocalizedName("ItemAporte").setTextureName(MODID + ":acacia").setCreativeTab(ItemNovaMine); porteB = new PorteB().setBlockName("Bporte").setBlockTextureName(MODID + ":birch"); porteItemB = new ItemPorteB().setUnlocalizedName("ItemBporte").setTextureName(MODID + ":birch").setCreativeTab(ItemNovaMine); porteDA = new PorteDA().setBlockName("DAporte").setBlockTextureName(MODID + ":dark_oak"); porteItemDA = new ItemPorteDA().setUnlocalizedName("ItemDAporte").setTextureName(MODID + ":dark_oak").setCreativeTab(ItemNovaMine); porteJ = new porteJ().setBlockName("Jporte").setBlockTextureName(MODID + ":jungle"); porteItemJ = new porteItemJ().setUnlocalizedName("ItemJporte").setTextureName(MODID + ":jungle").setCreativeTab(ItemNovaMine); } @EventHandler public void init(FMLInitializationEvent event) { GameRegistry.registerBlock(porte, "porte"); GameRegistry.registerItem(porteItem, "porteItem"); GameRegistry.registerBlock(porteA, "porteA"); GameRegistry.registerItem(porteItemA, "porteItemA"); GameRegistry.registerBlock(porteB, "porteB"); GameRegistry.registerItem(porteItemB, "porteItemB"); GameRegistry.registerBlock(porteDA, "porteDA"); GameRegistry.registerItem(porteItemDA, "porteItemDA"); GameRegistry.registerBlock(porteJ, "porteJ"); GameRegistry.registerItem(porteItemJ, "porteItemJ"); GameRegistry.registerBlock(invi, "invi"); GameRegistry.registerBlock(invil, "invil"); GameRegistry.registerBlock(Nova, "Nova"); GameRegistry.registerBlock(LA, "LA"); GameRegistry.registerItem(helmetEmerald, "helmetEmerald"); GameRegistry.registerItem(chestPlateEmerald, "chestPlateEmerald"); GameRegistry.registerItem(leggingsEmerald, "leggingsEmerald"); GameRegistry.registerItem(bootsEmerald, "bootsEmerald"); GameRegistry.registerItem(swordEmerald, "swordEmerald"); GameRegistry.registerItem(pickaxeEmerald, "pickaxeEmerald"); GameRegistry.registerItem(axeEmerald, "axeEmerald"); GameRegistry.registerItem(shovelEmerald, "shovelEmerald"); GameRegistry.registerItem(hoeEmerald, "hoeEmerald"); GameRegistry.registerItem(itemSaphir, "itemSaphir"); GameRegistry.registerItem(helmetSaphir, "helmetSaphir"); GameRegistry.registerItem(chestPlateSaphir, "chestPlateSaphir"); GameRegistry.registerItem(leggingsSaphir, "leggingsSaphir"); GameRegistry.registerItem(bootsSaphir, "bootsSaphir"); GameRegistry.registerItem(swordSaphir, "swordSaphir"); GameRegistry.registerItem(pickaxeSaphir, "pickaxeSaphir"); GameRegistry.registerItem(axeSaphir, "axeSaphir"); GameRegistry.registerItem(shovelSaphir, "shovelSaphir"); GameRegistry.registerItem(hoeSaphir, "hoeSaphir"); GameRegistry.registerBlock(BlockSaphir, "BlockSaphir"); //recette GameRegistry.addRecipe(new ItemStack(swordEmerald, 1), new Object[] { " E ", " E ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(swordEmerald, 1), new Object[] { "E ", "E ", "S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(swordEmerald, 1), new Object[] { " E", " E", " S", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(pickaxeEmerald, 1), new Object[] { "EEE", " S ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(axeEmerald, 1), new Object[] { " EE", " SE", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(axeEmerald, 1), new Object[] { "EE ", "ES ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(shovelEmerald, 1), new Object[] { " E ", " S ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(shovelEmerald, 1), new Object[] { "E ", "S ", "S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(shovelEmerald, 1), new Object[] { " E", " S", " S", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(hoeEmerald, 1), new Object[] { "EE ", " S ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(hoeEmerald, 1), new Object[] { " EE", " S ", " S ", 'S', Items.stick, 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(helmetEmerald, 1), new Object[] { "EEE", "E E", " ", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(helmetEmerald, 1), new Object[] { " ", "EEE", "E E", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(chestPlateEmerald, 1), new Object[] { "E E", "EEE", "EEE", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(leggingsEmerald, 1), new Object[] { "EEE", "E E", "E E", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(bootsEmerald, 1), new Object[] { " ", "E E", "E E", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(bootsEmerald, 1), new Object[] { "E E", "E E", " ", 'E', Items.emerald }); GameRegistry.addRecipe(new ItemStack(BlockSaphir, 1), new Object[] { "SSS", "SSS", "SSS", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(swordSaphir, 1), new Object[] { " S ", " S ", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(swordSaphir, 1), new Object[] { "S ", "S ", "0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(swordSaphir, 1), new Object[] { " S", " S", " 0", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(pickaxeSaphir, 1), new Object[] { "SSS", " 0 ", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(axeSaphir, 1), new Object[] { " SS", " 0S", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(axeSaphir, 1), new Object[] { " SS", " 0S", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(shovelSaphir, 1), new Object[] { " S ", " 0 ", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(shovelSaphir, 1), new Object[] { "S ", "0 ", "0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(shovelSaphir, 1), new Object[] { " S", " 0", " 0", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(hoeSaphir, 1), new Object[] { " SS", " 0 ", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(hoeSaphir, 1), new Object[] { "SS ", " 0 ", " 0 ", '0', Items.stick, 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(helmetSaphir, 1), new Object[] { "SSS", "S S", " ", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(helmetSaphir, 1), new Object[] { " ", "SSS", "S S", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(chestPlateSaphir, 1), new Object[] { "S S", "SSS", "SSS", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(leggingsSaphir, 1), new Object[] { "SSS", "S S", "S S", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(bootsSaphir, 1), new Object[] { "S S", "S S", " ", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(bootsSaphir, 1), new Object[] { " ", "S S", "S S", 'S', ModNovamine.itemSaphir }); GameRegistry.addRecipe(new ItemStack(porte, 1), new Object[] { "SS ", "SS ", "SS ", 'S', Blocks.dark_oak_stairs }); //GameRegistry.addShapelessRecipe(new ItemStack(tutoBlock, 2), Blocks.dirt, Blocks.dirt, tutoItem); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } }
Class porte
package fr.minecraftforgefrance.novamine.common; import java.util.Random; import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class Porte extends BlockDoor { public Porte() { super(Material.wood); this.setHardness(3.0F); this.setResistance(5.0F); this.disableStats(); } @Override public Item getItemDropped(int metadata, Random rand, int fortune) { return (metadata & 8) != 0 ? null : ModNovamine.porteItem; } @Override @SideOnly(Side.CLIENT) public Item getItem(World world, int x, int y, int z) { return ModNovamine.porteItem; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { int i1 = this.func_150012_g(world, x, y, z); int j1 = i1 & 7; j1 ^= 4; //ouvre la porte if ((i1 & 8) == 0) { world.setBlockMetadataWithNotify(x, y, z, j1, 2); world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); } else { world.setBlockMetadataWithNotify(x, y - 1, z, j1, 2); world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); } //jouer le son world.playAuxSFXAtEntity(player, 1003, x, y, z, 0); return true; } }
Class item porte
package fr.minecraftforgefrance.novamine.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemPorte extends Item { public ItemPorte() { this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabBlock); } public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if(side != 1) { return false; } else { ++y; Block block = ModNovamine.porte; if(player.canPlayerEdit(x, y, z, side, itemStack) && player.canPlayerEdit(x, y + 1, z, side, itemStack)) { if(!block.canPlaceBlockAt(world, x, y, z)) { return false; } else { int i1 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; placeDoorBlock(world, x, y, z, i1, block); –itemStack.stackSize; return true; } } else { return false; } } } public static void placeDoorBlock(World world, int x, int y, int z, int side, Block block) { byte b0 = 0; byte b1 = 0; if(side == 0) { b1 = 1; } if(side == 1) { b0 = -1; } if(side == 2) { b1 = -1; } if(side == 3) { b0 = 1; } int i1 = (world.getBlock(x - b0, y, z - b1).isNormalCube() ? 1 : 0) + (world.getBlock(x - b0, y + 1, z - b1).isNormalCube() ? 1 : 0); int j1 = (world.getBlock(x + b0, y, z + b1).isNormalCube() ? 1 : 0) + (world.getBlock(x + b0, y + 1, z + b1).isNormalCube() ? 1 : 0); boolean flag = world.getBlock(x - b0, y, z - b1) == block || world.getBlock(x - b0, y + 1, z - b1) == block; boolean flag1 = world.getBlock(x + b0, y, z + b1) == block || world.getBlock(x + b0, y + 1, z + b1) == block; boolean flag2 = false; if(flag && !flag1) { flag2 = true; } else if(j1 > i1) { flag2 = true; } world.setBlock(x, y, z, block, side, 2); world.setBlock(x, y + 1, z, block, 8 | (flag2 ? 1 : 0), 2); world.notifyBlocksOfNeighborChange(x, y, z, block); world.notifyBlocksOfNeighborChange(x, y + 1, z, block); } }
-
En craft, il faut utilise l’Item de ta porte et non son block.
PS : c’est mieux de nous dire quel craft est concerné car on va pas toujours chercher à ta place !
-
GameRegistry.addRecipe(new ItemStack(porteItem, 1), new Object[] { "SS ", "SS ", "SS ", 'S', Blocks.dark_oak_stairs });
Sa ne marche pas toujour la porte de base
-
En fait, c’est bien ta porte qui est donnée, sauf que vu que tu n’as rien modifié le nom et la texture restent la même.
PS : pense à apprendre le java car j’ai l’impression que tu as juste fait du copié-collé :
porteItemDA = new ItemPorteDA().setUnlocalizedName("ItemDAporte").setTextureName(MODID + ":dark_oak").setCreativeTab(ItemNovaMine); // Convention respectée porteJ = new porteJ().setBlockName("Jporte").setBlockTextureName(MODID + ":jungle"); // Convention non respectée
-
porteItemDA est un item et porteJ un block
-
Tu as quoi dans ItemPorte ?
-
Il y a sa
package fr.minecraftforgefrance.novamine.common; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class ItemPorte extends Item { public ItemPorte() { this.maxStackSize = 1; this.setCreativeTab(CreativeTabs.tabBlock); } public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) { if(side != 1) { return false; } else { ++y; Block block = ModNovamine.porte; if(player.canPlayerEdit(x, y, z, side, itemStack) && player.canPlayerEdit(x, y + 1, z, side, itemStack)) { if(!block.canPlaceBlockAt(world, x, y, z)) { return false; } else { int i1 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; placeDoorBlock(world, x, y, z, i1, block); –itemStack.stackSize; return true; } } else { return false; } } } public static void placeDoorBlock(World world, int x, int y, int z, int side, Block block) { byte b0 = 0; byte b1 = 0; if(side == 0) { b1 = 1; } if(side == 1) { b0 = -1; } if(side == 2) { b1 = -1; } if(side == 3) { b0 = 1; } int i1 = (world.getBlock(x - b0, y, z - b1).isNormalCube() ? 1 : 0) + (world.getBlock(x - b0, y + 1, z - b1).isNormalCube() ? 1 : 0); int j1 = (world.getBlock(x + b0, y, z + b1).isNormalCube() ? 1 : 0) + (world.getBlock(x + b0, y + 1, z + b1).isNormalCube() ? 1 : 0); boolean flag = world.getBlock(x - b0, y, z - b1) == block || world.getBlock(x - b0, y + 1, z - b1) == block; boolean flag1 = world.getBlock(x + b0, y, z + b1) == block || world.getBlock(x + b0, y + 1, z + b1) == block; boolean flag2 = false; if(flag && !flag1) { flag2 = true; } else if(j1 > i1) { flag2 = true; } world.setBlock(x, y, z, block, side, 2); world.setBlock(x, y + 1, z, block, 8 | (flag2 ? 1 : 0), 2); world.notifyBlocksOfNeighborChange(x, y, z, block); world.notifyBlocksOfNeighborChange(x, y + 1, z, block); } }
-
Je parle du nom de la classe, une classe commence toujours par une majuscule, donc çà devrait être new PorteJ au lieu de new porteJ.
-
Je ne vois pas de problème … Théoriquement c’est sensé poser la bonne porte …
-
Ouais mais sa ne regle pas mon probleme lier au craft
-
Ah je crois savoir pourquoi ton craft ne fonctionne pas.
Car la porte de base peut être crafté avec tous les types de bois. Il faudrait retirer les craft de base, ou faire un craft différent. -
Oui mais comment changer le craft de base
-
Normalement non, y’a pas besoin : y’a pas longtemps j’ai fait une porte avec du bois de spruce et çà marchais très bien.
-
Voici les craft de minecraft de base
this.addRecipe(new ItemStack(Items.wooden_door, 1), new Object[] {"##", "##", "##", '#', Blocks.planks}); this.addRecipe(new ItemStack(Items.iron_door, 1), new Object[] {"##", "##", "##", '#', Items.iron_ingot});
-
Il y a plusieurs posts d’aide sur le forum qui demande comment retirer un craft avec la solution, faut chercher un peu.
Mais essaye de mettre tes recettes dans postInit, ça corrigera peut-être le problème. -
Moi je pense que c’est juste que tu ne vois pas le changement car tu n’as pas modifié la texture ni le nom, essaie de modifier le nom ou ré-écris la fonction addInformation.
-
A la place de Blocks.dark_oak_stairs vous n’avez pas le code pour les dark wood planks
GameRegistry.addRecipe(new ItemStack(porte, 1), new Object[] { "SS ", "SS ", "SS ", 'S', Blocks.dark_oak_stairs });
-
Il faut utiliser les metadatas : new ItemStack(Items.planks, 1, meta)
-
Donc
GameRegistry.addRecipe(new ItemStack(Items.planks, 1, meta), new Object[] { "SS ", "SS ", "SS ", 'S', Blocks.dark_oak_stairs });
mais je veut changer cette ligne , ‘S’, Blocks.dark_oak_stairs
Mais je peut remplacer sa Blocks.dark_oak_stairs par Items.planks, 1, meta -
Apprends le java, çà devient désespérant…
GameRegistry.addRecipe(new ItemStack(porte), "SS", "SS", "SS", 'S', new ItemStack(Items.planks, 1, 5))
PS : la prochaine fois penses à mettre la balise 1.7.10.