• 0

    posted a message on [FORGE] 1.6.2 Crafting Table with custom grid sizes [updating to 1.6.4] adding videos
    Quote from BlackFighter1112
    Can you please help me? When I click my table it doesn't do anything. There is no error and it doesn't crash.
    package BlackFighter111.BlackMagicMod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.MinecraftForge; 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.network.NetworkMod; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod (modid="blackmagicmod", name="Black Magic Mod", version="alpha 1.0") @NetworkMod (clientSideRequired=true, serverSideRequired=false) public class blackMagicMod { @Instance ("blackmagicmod") public static blackMagicMod instance; private GuiHandlerDarkStoneAltar guiHandlerDSA = new GuiHandlerDarkStoneAltar(); //Creative Tabs public static CreativeTabs blackMagicTab = new CreativeTabs("tabBlackMagic") { public ItemStack getIconItemStack() { return new ItemStack(blackMagicTome, 1, 0); } }; //Items public static Item darkStone = new itemDarkStone(4000).setMaxStackSize(64).setCreativeTab(blackMagicTab).setUnlocalizedName("DarkStone"); public static Item corruptedSoul = new itemCorruptedSoul(4001).setMaxStackSize(64).setCreativeTab(blackMagicTab).setUnlocalizedName("CorruptedSoul"); public static Item blackMagicTome = new itemBlackMagicTome(4002).setMaxStackSize(1).setCreativeTab(blackMagicTab).setUnlocalizedName("BlackMagicTome"); //Blocks public static Block darkStoneBlock = new blockDarkStone(4003, Material.rock).setHardness(5.0F).setStepSound(Block.soundStoneFootstep).setCreativeTab(blackMagicTab).setUnlocalizedName("DarkStoneBlock"); public static Block darkStoneOre = new blockOreDarkStone(4004, Material.rock).setHardness(3.0F).setStepSound(Block.soundStoneFootstep).setCreativeTab(blackMagicTab).setUnlocalizedName("OreDarkStone"); public static Block darkStoneTable = new blockDarkStoneAltar(4005, Material.wood).setHardness(3.5F).setResistance(2000.0F).setStepSound(Block.soundWoodFootstep).setCreativeTab(blackMagicTab).setUnlocalizedName("DarkStoneTable"); @SidedProxy (clientSide="BlackFighter111.BlackMagicMod.client.ClientProxy", serverSide="BlackFighter111.BlackMagicMod.CommonProxy") public static CommonProxy proxy; @EventHandler public void PreInit (FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new CorruptedSoulDrop()); } @EventHandler public void load (FMLInitializationEvent event) { //items LanguageRegistry.addName(darkStone, "Dark Stone"); LanguageRegistry.addName(corruptedSoul, "Corrupted Soul"); LanguageRegistry.addName(blackMagicTome, "Tome of Black Magic"); //blocks GameRegistry.registerBlock(darkStoneBlock, "darkStoneBlock"); LanguageRegistry.addName(darkStoneBlock, "Dark Stone Block"); MinecraftForge.setBlockHarvestLevel(darkStoneBlock, "pickaxe", 2); GameRegistry.registerBlock(darkStoneOre, "darkStoneOre"); LanguageRegistry.addName(darkStoneOre, "Dark Stone Ore"); MinecraftForge.setBlockHarvestLevel(darkStoneOre, "pickaxe", 2); GameRegistry.registerBlock(darkStoneTable, ItemBlock.class, "darkStoneTable"); LanguageRegistry.addName(darkStoneTable, "Dark Stone Altar"); MinecraftForge.setBlockHarvestLevel(darkStoneTable, "pickaxe", 2); //crafting GameRegistry.addRecipe(new ItemStack(darkStoneBlock), "DDD", "DDD", "DDD", 'D', darkStone); GameRegistry.addShapelessRecipe(new ItemStack(darkStone, 9), darkStoneBlock); GameRegistry.addRecipe(new ItemStack(blackMagicTome), " C ", "DBD", " C ", 'C', corruptedSoul, 'D', darkStone, 'B', Item.book); GameRegistry.addRecipe(new ItemStack(darkStoneTable), "CCC", "DTD", "DDD", 'C', corruptedSoul, 'D', darkStone, 'T', Block.workbench); //smelting GameRegistry.addSmelting(darkStone.itemID, new ItemStack(corruptedSoul), 0.1F); //world gens GameRegistry.registerWorldGenerator(new WorldGeneratorDarkStoneOre()); //creative tabs LanguageRegistry.instance().addStringLocalization("itemGroup.tabBlackMagic", "en_US", "Black Magic"); //tile entities //gui handlers NetworkRegistry.instance().registerGuiHandler(this, guiHandlerDSA); } @EventHandler public void PostInit (FMLPostInitializationEvent event) { } } 
    package BlackFighter111.BlackMagicMod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Icon; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class blockDarkStoneAltar extends Block { @SideOnly(Side.CLIENT) private Icon topTexture; protected blockDarkStoneAltar(int id, Material material) { super(id, material); } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister reg) { blockIcon = reg.registerIcon("blackmagicmod:DarkStoneAltar"); topTexture = reg.registerIcon("blackmagicmod:DarkStoneAltar_top"); } public Icon getIcon(int side, int meta) { if(side == 1) { return this.topTexture; } return this.blockIcon; } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int var6, int var7) { if(!player.isSneaking()) { player.openGui(blackMagicMod.instance, 0, world, x, y, z); return true; } else { return false; } } } 
    package BlackFighter111.BlackMagicMod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ContainerDarkStoneAltar extends Container { public InventoryCrafting craftMatrix; public IInventory craftResult; private World worldObj; private int posX; private int posY; private int posZ; public ContainerDarkStoneAltar(InventoryPlayer inventoryplayer, World world, int i, int j, int k) { craftMatrix = new InventoryCrafting(this, 5, 5); craftResult = new InventoryCraftResult(); worldObj = world; posX = i; posY = j; posZ = k; this.addSlotToContainer(new SlotCrafting(inventoryplayer.player, craftMatrix, craftResult, 0, 131, 36)); for(int l = 0; l < 5; l++) { for(int k1 = 0; k1 < 5; k1++) { this.addSlotToContainer(new Slot(craftMatrix, k1 + l * 5, 4 + k1 * 18, 3 + l * 18)); } } for(int i1 = 0; i1 < 3; i1++) { for(int l1 = 0; l1 < 9; l1++) { this.addSlotToContainer(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 94 + i1 * 18)); } } for(int j1 = 0; j1 < 9; j1++) { this.addSlotToContainer(new Slot(inventoryplayer, j1, 8 + j1 * 18, 148)); } onCraftMatrixChanged(craftMatrix); } public void onCraftMatrixChanged(IInventory iinventory) { craftResult.setInventorySlotContents(0, CraftingManagerDarkStoneAltar.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } public void onContainerClosed(EntityPlayer entityplayer) { super.onContainerClosed(entityplayer); if(worldObj.isRemote) { return; } for(int i = 0; i < 25; i++) { ItemStack itemstack = craftMatrix.getStackInSlot(i); if(itemstack != null) { entityplayer.dropPlayerItem(itemstack); } } } public boolean canInteractWith(EntityPlayer entityplayer) { if(worldObj.getBlockId(posX, posY, posZ) != blackMagicMod.darkStoneTable.blockID) { return false; } else { return entityplayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D; } } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)inventorySlots.get(par2); if(slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if(par2 == 0) { if(!mergeItemStack(itemstack1, 10, 46, true)) { return null; } } else if(par2 >= 10 && par2 < 37) { if(!mergeItemStack(itemstack1, 37, 46, false)) { return null; } } else if(par2 >= 37 && par2 < 46) { if(!mergeItemStack(itemstack1, 10, 37, false)) { return null; } } else if(!mergeItemStack(itemstack1, 10, 46, false)) { return null; } if(itemstack1.stackSize == 0) { slot.putStack(null); } else { slot.onSlotChanged(); } if(itemstack1.stackSize != itemstack.stackSize) { slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } else { return null; } } return itemstack; } }
    package BlackFighter111.BlackMagicMod; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; public class CraftingManagerDarkStoneAltar { public static final int WILDCARD_VALUE = Short.MAX_VALUE; private static final CraftingManagerDarkStoneAltar instance = new CraftingManagerDarkStoneAltar(); private List recipes = new ArrayList(); public static final CraftingManagerDarkStoneAltar getInstance() { return instance; } private CraftingManagerDarkStoneAltar() { recipes = new ArrayList(); //This is where your recipes will go this.addRecipe(new ItemStack(blackMagicMod.blackMagicTome, 1), new Object[] {" C ", " CCC ", "DCBCD", " CCC ", " C ", 'C', blackMagicMod.corruptedSoul, 'D', blackMagicMod.darkStone, 'B', Item.book}); Collections.sort(this.recipes, new RecipeSorterDarkStoneAltar(this)); System.out.println(this.recipes.size() + " recipes"); } public DarkStoneAltarShapedRecipies addRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; if (par2ArrayOfObj[var4] instanceof String[]) { String[] var7 = (String[])((String[])par2ArrayOfObj[var4++]); for (int var8 = 0; var8 < var7.length; ++var8) { String var9 = var7[var8]; ++var6; var5 = var9.length(); var3 = var3 + var9; } } else { while (par2ArrayOfObj[var4] instanceof String) { String var11 = (String)par2ArrayOfObj[var4++]; ++var6; var5 = var11.length(); var3 = var3 + var11; } } HashMap var12; for (var12 = new HashMap(); var4 < par2ArrayOfObj.length; var4 += 2) { Character var13 = (Character)par2ArrayOfObj[var4]; ItemStack var14 = null; if (par2ArrayOfObj[var4 + 1] instanceof Item) { var14 = new ItemStack((Item)par2ArrayOfObj[var4 + 1]); } else if (par2ArrayOfObj[var4 + 1] instanceof Block) { var14 = new ItemStack((Block)par2ArrayOfObj[var4 + 1], 1, -1); } else if (par2ArrayOfObj[var4 + 1] instanceof ItemStack) { var14 = (ItemStack)par2ArrayOfObj[var4 + 1]; } var12.put(var13, var14); } ItemStack[] var15 = new ItemStack[var5 * var6]; for (int var16 = 0; var16 < var5 * var6; ++var16) { char var10 = var3.charAt(var16); if (var12.containsKey(Character.valueOf(var10))) { var15[var16] = ((ItemStack)var12.get(Character.valueOf(var10))).copy(); } else { var15[var16] = null; } } DarkStoneAltarShapedRecipies var17 = new DarkStoneAltarShapedRecipies(var5, var6, var15, par1ItemStack); this.recipes.add(var17); return var17; } public void addShapelessRecipe(ItemStack par1ItemStack, Object ... par2ArrayOfObj) { ArrayList var3 = new ArrayList(); Object[] var4 = par2ArrayOfObj; int var5 = par2ArrayOfObj.length; for (int var6 = 0; var6 < var5; ++var6) { Object var7 = var4[var6]; if (var7 instanceof ItemStack) { var3.add(((ItemStack)var7).copy()); } else if (var7 instanceof Item) { var3.add(new ItemStack((Item)var7)); } else { if (!(var7 instanceof Block)) { throw new RuntimeException("Invalid shapeless recipy!"); } var3.add(new ItemStack((Block)var7)); } } this.recipes.add(new DarkStoneAltarShapelessRecipies(par1ItemStack, var3)); } public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) { int var3 = 0; ItemStack var4 = null; ItemStack var5 = null; int var6; for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6) { ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6); if (var7 != null) { if (var3 == 0) { var4 = var7; } if (var3 == 1) { var5 = var7; } ++var3; } } if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable()) { Item var11 = Item.itemsList[var4.itemID]; int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay(); int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay(); int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100; int var10 = var11.getMaxDamage() - var9; if (var10 < 0) { var10 = 0; } return new ItemStack(var4.itemID, 1, var10); } else { for (var6 = 0; var6 < this.recipes.size(); ++var6) { IRecipe var12 = (IRecipe)this.recipes.get(var6); if (var12.matches(par1InventoryCrafting, par2World)) { return var12.getCraftingResult(par1InventoryCrafting); } } return null; } } /** * returns the List<> of all recipes */ public List getRecipeList() { return this.recipes; } }
    package BlackFighter111.BlackMagicMod; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import org.lwjgl.opengl.GL11; public class GuiDarkStoneAltar extends GuiContainer { private ResourceLocation guiTexture = new ResourceLocation("blackmagicmod:textures/gui/darkStoneAltar.png"); public GuiDarkStoneAltar(InventoryPlayer inventoryplayer, World world, int i, int j, int k) { super(new ContainerDarkStoneAltar(inventoryplayer, world, i, j, k)); } public void onGuiClosed() { super.onGuiClosed(); } protected void drawGuiContainerForegroundLayer(int par1, int par2) { //this.fontRenderer.drawString(StatCollector.translateToLocal("\u00a76Better"), 120, 5, 0x404040); //this.fontRenderer.drawString(StatCollector.translateToLocal("\u00a76Crafting"), 116, 20, 0x404040); //this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 - 14, 0x404040); } protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(guiTexture); int l = (width - xSize) / 2; int i1 = (height - ySize) / 2; drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); } }
    package BlackFighter111.BlackMagicMod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandlerDarkStoneAltar implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getBlockTileEntity(x, y, z); switch(id) { case 0: return id == 0 && world.getBlockId(x, y, z) == blackMagicMod.darkStoneTable.blockID ? new ContainerDarkStoneAltar(player.inventory, world, x, y, z) : null; } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getBlockTileEntity(x, y, z); switch(id) { case 0: return id == 0 && world.getBlockId(x, y, z) == blackMagicMod.darkStoneTable.blockID ? new GuiDarkStoneAltar(player.inventory, world, x, y, z) : null; } return null; } } 
    package BlackFighter111.BlackMagicMod; import java.util.Comparator; import net.minecraft.item.crafting.IRecipe; public class RecipeSorterDarkStoneAltar implements Comparator { final CraftingManagerDarkStoneAltar craftingManagerDarkStoneAltar; public RecipeSorterDarkStoneAltar(CraftingManagerDarkStoneAltar par1CraftingManagerDarkStoneAltar) { this.craftingManagerDarkStoneAltar = par1CraftingManagerDarkStoneAltar; } public int compareRecipes(IRecipe par1IRecipe, IRecipe par2IRecipe) { return par1IRecipe instanceof DarkStoneAltarShapelessRecipies && par2IRecipe instanceof DarkStoneAltarShapedRecipies ? 1 : (par2IRecipe instanceof DarkStoneAltarShapelessRecipies && par1IRecipe instanceof DarkStoneAltarShapedRecipies ? -1 : (par2IRecipe.getRecipeSize() < par1IRecipe.getRecipeSize() ? -1 : (par2IRecipe.getRecipeSize() > par1IRecipe.getRecipeSize() ? 1 : 0))); } public int compare(Object par1Obj, Object par2Obj) { return this.compareRecipes((IRecipe)par1Obj, (IRecipe)par2Obj); } }
    package BlackFighter111.BlackMagicMod; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class DarkStoneAltarShapedRecipies implements IRecipe { /** How many horizontal slots this recipe is wide. */ public final int recipeWidth; /** How many vertical slots this recipe uses. */ public final int recipeHeight; /** Is a array of ItemStack that composes the recipe. */ public final ItemStack[] recipeItems; /** Is the ItemStack that you get when craft the recipe. */ private ItemStack recipeOutput; /** Is the itemID of the output item that you get when craft the recipe. */ public final int recipeOutputItemID; private boolean field_92101_f = false; public DarkStoneAltarShapedRecipies(int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack) { this.recipeOutputItemID = par4ItemStack.itemID; this.recipeWidth = par1; this.recipeHeight = par2; this.recipeItems = par3ArrayOfItemStack; this.recipeOutput = par4ItemStack; } public ItemStack getRecipeOutput() { return this.recipeOutput; } /** * Used to check if a recipe matches current crafting inventory */ public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) { for (int i = 0; i <= 5 - this.recipeWidth; ++i) { for (int j = 0; j <= 5 - this.recipeHeight; ++j) { if (this.checkMatch(par1InventoryCrafting, i, j, true)) { return true; } if (this.checkMatch(par1InventoryCrafting, i, j, false)) { return true; } } } return false; } /** * Checks if the region of a crafting inventory is match for the recipe. */ private boolean checkMatch(InventoryCrafting par1InventoryCrafting, int par2, int par3, boolean par4) { for (int k = 0; k < 5; ++k) { for (int l = 0; l < 5; ++l) { int i1 = k - par2; int j1 = l - par3; ItemStack itemstack = null; if (i1 >= 0 && j1 >= 0 && i1 < this.recipeWidth && j1 < this.recipeHeight) { if (par4) { itemstack = this.recipeItems[this.recipeWidth - i1 - 1 + j1 * this.recipeWidth]; } else { itemstack = this.recipeItems[i1 + j1 * this.recipeWidth]; } } ItemStack itemstack1 = par1InventoryCrafting.getStackInRowAndColumn(k, l); if (itemstack1 != null || itemstack != null) { if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) { return false; } if (itemstack.itemID != itemstack1.itemID) { return false; } if (itemstack.getItemDamage() != 32767 && itemstack.getItemDamage() != itemstack1.getItemDamage()) { return false; } } } } return true; } /** * Returns an Item that is the result of this recipe */ public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) { ItemStack itemstack = this.getRecipeOutput().copy(); if (this.field_92101_f) { for (int i = 0; i < par1InventoryCrafting.getSizeInventory(); ++i) { ItemStack itemstack1 = par1InventoryCrafting.getStackInSlot(i); if (itemstack1 != null && itemstack1.hasTagCompound()) { itemstack.setTagCompound((NBTTagCompound)itemstack1.stackTagCompound.copy()); } } } return itemstack; } /** * Returns the size of the recipe area */ public int getRecipeSize() { return this.recipeWidth * this.recipeHeight; } public DarkStoneAltarShapedRecipies func_92100_c() { this.field_92101_f = true; return this; } }
    package BlackFighter111.BlackMagicMod; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.World; public class DarkStoneAltarShapelessRecipies implements IRecipe { /** Is the ItemStack that you get when craft the recipe. */ private final ItemStack recipeOutput; /** Is a List of ItemStack that composes the recipe. */ public final List recipeItems; public DarkStoneAltarShapelessRecipies(ItemStack par1ItemStack, List par2List) { this.recipeOutput = par1ItemStack; this.recipeItems = par2List; } public ItemStack getRecipeOutput() { return this.recipeOutput; } /** * Used to check if a recipe matches current crafting inventory */ public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) { ArrayList arraylist = new ArrayList(this.recipeItems); for (int i = 0; i < 5; ++i) { for (int j = 0; j < 5; ++j) { ItemStack itemstack = par1InventoryCrafting.getStackInRowAndColumn(j, i); if (itemstack != null) { boolean flag = false; Iterator iterator = arraylist.iterator(); while (iterator.hasNext()) { ItemStack itemstack1 = (ItemStack)iterator.next(); if (itemstack.itemID == itemstack1.itemID && (itemstack1.getItemDamage() == 32767 || itemstack.getItemDamage() == itemstack1.getItemDamage())) { flag = true; arraylist.remove(itemstack1); break; } } if (!flag) { return false; } } } } return arraylist.isEmpty(); } /** * Returns an Item that is the result of this recipe */ public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting) { return this.recipeOutput.copy(); } /** * Returns the size of the recipe area */ public int getRecipeSize() { return this.recipeItems.size(); } }
    Thanks in advance!
    Quote from xXThe_ArchmageXx
    same for me no errors no nothin just wont open
    Quote from cheezcake19
    Dude i followed your code i have no problems in my code but when i go into minecraft and i try to open my crafting table the gui dosnt come up!!!!!! am so lost please help :Notch:


    Did you guys get your tables to work?
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on Anyone know a good mod tutorial?
    Personally, I have always liked kennethbgoodin and scratchforfun on youtube. Mouse tutorials is where is at as well.
    Posted in: Modification Development
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Got it all worked out. Credit to coolAlias for his code on the ArrowNock texture fix.

    Flarespire.java

    package net.flarespire.mod;
    
    import net.minecraft.block.Block;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    
    @Mod(modid = Flarespire.modid, name = "Flarespire", version = "Pre-Alpha v0.01")
    @NetworkMod(clientSideRequired = true, serverSideRequired = false)
    public class Flarespire {
    
    public static final String modid = "flarespire";
    public static EnumToolMaterial toolSomeName;
    public static Item itemBowSword;
    
    @EventHandler 
    public void load(FMLInitializationEvent e){
    toolSomeName = EnumHelper.addToolMaterial("topazToolMaterial", 2, 3000, 12.0F, 4.0F, 15);
    
    itemBowSword = new BowSword(13208, toolSomeName).setUnlocalizedName("BowSword");
    GameRegistry.registerItem(itemBowSword, "BowSword");
    LanguageRegistry.addName(itemBowSword, "BowSword");
    
    GameRegistry.addRecipe(new ItemStack(itemBowSword, 1), new Object[]{"ISG", "S G", "ISG", 'I', Item.ingotIron, 'S', Item.stick, 'G', Item.silk});
    }
    }


    BowSword.java

    package net.flarespire.mod;
    
    import com.google.common.collect.Multimap;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.flarespire.mod.Flarespire;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.enchantment.Enchantment;
    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.attributes.AttributeModifier;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityArrow;
    import net.minecraft.item.EnumAction;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.Icon;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.event.entity.player.ArrowLooseEvent;
    import net.minecraftforge.event.entity.player.ArrowNockEvent;
    
    public class BowSword extends Item
    {
        private float weaponDamage;
        private final EnumToolMaterial toolMaterial;
        public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"};
        @SideOnly(Side.CLIENT)
        private Icon[] iconArray;
    
        public BowSword(int par1, EnumToolMaterial par2EnumToolMaterial)
        {
            super(par1);
            this.toolMaterial = par2EnumToolMaterial;
            this.maxStackSize = 1;
            this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
            this.setCreativeTab(CreativeTabs.tabCombat);
            this.weaponDamage = 4.0F + par2EnumToolMaterial.getDamageVsEntity();
        }
    
        public float func_82803_g()
        {
            return this.toolMaterial.getDamageVsEntity();
        }
    
        /**
         * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
         * sword
         */
    
        public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
        {
            int j = this.getMaxItemUseDuration(par1ItemStack) - par4;
    
            ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.isCanceled())
            {
                return;
            }
            j = event.charge;
    
            boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
    
            if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
            {
                float f = (float)j / 20.0F;
                f = (f * f + f * 2.0F) / 3.0F;
    
                if ((double)f < 0.1D)
                {
                    return;
                }
    
                if (f > 1.0F)
                {
                    f = 1.0F;
                }
    
                EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 2.0F);
    
                if (f == 1.0F)
                {
                    entityarrow.setIsCritical(true);
                }
    
                int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
    
                if (k > 0)
                {
                    entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
                }
    
                int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
    
                if (l > 0)
                {
                    entityarrow.setKnockbackStrength(l);
                }
    
                if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
                {
                    entityarrow.setFire(100);
                }
    
                par1ItemStack.damageItem(1, par3EntityPlayer);
                par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
    
                if (flag)
                {
                    entityarrow.canBePickedUp = 2;
                }
                else
                {
                    par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
                }
    
                if (!par2World.isRemote)
                {
                    par2World.spawnEntityInWorld(entityarrow);
                }
            }
        }
    
        public EnumAction getItemUseAction(ItemStack par1ItemStack)
        {
            return EnumAction.bow;
        }
    
        /**
         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
         */
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.isCanceled())
            {
                return event.result;
            }
    
            if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
            {
                par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
    
            }
    
            return par1ItemStack;
        }
    
        public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
        {
            if (par2Block.blockID == Block.web.blockID)
            {
                return 15.0F;
            }
            else
            {
                Material material = par2Block.blockMaterial;
                return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.pumpkin ? 1.0F : 1.5F;
            }
        }
    
        /**
         * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
         * the damage on the stack.
         */
        public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
        {
            par1ItemStack.damageItem(1, par3EntityLivingBase);
            return true;
        }
    
        public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
        {
            if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
            {
                par1ItemStack.damageItem(2, par7EntityLivingBase);
            }
    
            return true;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * Returns True is the item is renderer in full 3D when hold.
         */
        public boolean isFull3D()
        {
            return true;
        }
    
        /**
         * returns the action that specifies what animation to play when the items is being used
         */
        /*public EnumAction getItemUseAction(ItemStack par1ItemStack)
        {
            return EnumAction.block;
        }*/
    
        /**
         * How long it takes to use or consume an item
         */
        public int getMaxItemUseDuration(ItemStack par1ItemStack)
        {
            return 72000;
        }
    
        /**
         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
         */
    
    
        /**
         * Returns if the item (tool) can harvest results from the block type.
         */
        public boolean canHarvestBlock(Block par1Block)
        {
            return par1Block.blockID == Block.web.blockID;
        }
    
        /**
         * Return the enchantability factor of the item, most of the time is based on material.
         */
        public int getItemEnchantability()
        {
            return this.toolMaterial.getEnchantability();
        }
    
        /**
         * Return the name for this tool's material.
         */
        public String getToolMaterialName()
        {
            return this.toolMaterial.toString();
        }
    
        /**
         * Return whether this item is repairable in an anvil.
         */
    
    
        /**
         * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
         */
        public Multimap getItemAttributeModifiers()
        {
            Multimap multimap = super.getItemAttributeModifiers();
            multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
            return multimap;
        }
    
        @SideOnly(Side.CLIENT)
        public void registerIcons(IconRegister par1IconRegister)
        {
            this.itemIcon = par1IconRegister.registerIcon((Flarespire.modid + ":" + this.getUnlocalizedName().substring(5)) + "_standby");
            this.iconArray = new Icon[bowPullIconNameArray.length];
    
            for (int i = 0; i < this.iconArray.length; ++i)
            {
             this.iconArray[i] = par1IconRegister.registerIcon((Flarespire.modid + ":" + this.getUnlocalizedName().substring(5)) + "_" + bowPullIconNameArray[i]);
            }
        }
    
        @Override
        @SideOnly(Side.CLIENT)
        public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
                if (usingItem == null) { return itemIcon; }
                int ticksInUse = stack.getMaxItemUseDuration() - useRemaining;
    
                if (ticksInUse > 18) {
                        return iconArray[2];
                } else if (ticksInUse > 14) {
                        return iconArray[1];
                } else if (ticksInUse > 0) {
                        return iconArray[0];
                } else {
                        return itemIcon;
                }
        }
    }


    I based the rextures above on the original bow and pulling textures. Feel free to do whatever you want along with the textures, EnumToolMaterial, and Recipe.

    Let me know if you need any help with implementation! :)
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from flarespire
    thanks nxwhitney...You're definitely going in the credits of my mod.Interesting idea isn't it should make combat a little more interesting.Also on a relate note, does anyone know how to make an item spawn with enchantments on it, like the enchanted books for example?
    So here's what I've come up with. Still having trouble with the textures when you're pulling the bow back, but other than that, it works.

    Main Class: Put these wherever you have your other stuff located. Note that you can't just copy/paste it over, the different parts will need to be in the load while the declarations just need to be in the class.


    public static EnumToolMaterial toolTopaz;
    public static Item itemTopazBowSword;
    
    toolTopaz = EnumHelper.addToolMaterial("topazToolMaterial", 2, 3000, 12.0F, 4.0F, 15);
    
    itemTopazBowSword = new ItemBowSword(13208, toolTopaz).setUnlocalizedName("TopazBowSword");registerItem(itemTopazBowSword, "Topaz BowSword");


    ItemBowSword Class:

    package net.flemyncraft.mod.item;
    
    import com.google.common.collect.Multimap;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import net.flemyncraft.mod.Flemyncraft;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.enchantment.Enchantment;
    import net.minecraft.enchantment.EnchantmentHelper;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.attributes.AttributeModifier;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityArrow;
    import net.minecraft.item.EnumAction;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.Icon;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.event.entity.player.ArrowLooseEvent;
    import net.minecraftforge.event.entity.player.ArrowNockEvent;
    
    public class ItemBowSword extends Item
    {
        private float weaponDamage;
        private final EnumToolMaterial toolMaterial;
        public static final String[] bowPullIconNameArray = new String[] {"_bspulling_0", "_bspulling_1", "_bspulling_2"};
        @SideOnly(Side.CLIENT)
        private Icon[] iconArray;
    
        public ItemBowSword(int par1, EnumToolMaterial par2EnumToolMaterial)
        {
            super(par1);
            this.toolMaterial = par2EnumToolMaterial;
            this.maxStackSize = 1;
            this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
            this.setCreativeTab(CreativeTabs.tabCombat);
            this.weaponDamage = 4.0F + par2EnumToolMaterial.getDamageVsEntity();
        }
    
        public float func_82803_g()
        {
            return this.toolMaterial.getDamageVsEntity();
        }
    
        /**
         * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if
         * sword
         */
    
        public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
        {
            int j = this.getMaxItemUseDuration(par1ItemStack) - par4;
    
            ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.isCanceled())
            {
                return;
            }
            j = event.charge;
    
            boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
    
            if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
            {
                float f = (float)j / 20.0F;
                f = (f * f + f * 2.0F) / 3.0F;
    
                if ((double)f < 0.1D)
                {
                    return;
                }
    
                if (f > 1.0F)
                {
                    f = 1.0F;
                }
    
                EntityArrow entityarrow = new EntityArrow(par2World, par3EntityPlayer, f * 2.0F);
    
                if (f == 1.0F)
                {
                    entityarrow.setIsCritical(true);
                }
    
                int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack);
    
                if (k > 0)
                {
                    entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
                }
    
                int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack);
    
                if (l > 0)
                {
                    entityarrow.setKnockbackStrength(l);
                }
    
                if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
                {
                    entityarrow.setFire(100);
                }
    
                par1ItemStack.damageItem(1, par3EntityPlayer);
                par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
    
                if (flag)
                {
                    entityarrow.canBePickedUp = 2;
                }
                else
                {
                    par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
                }
    
                if (!par2World.isRemote)
                {
                    par2World.spawnEntityInWorld(entityarrow);
                }
            }
        }
    
        public EnumAction getItemUseAction(ItemStack par1ItemStack)
        {
            return EnumAction.bow;
        }
    
        /**
         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
         */
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.isCanceled())
            {
                return event.result;
            }
    
            if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
            {
                par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
            }
    
            return par1ItemStack;
        }
    
        public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block)
        {
            if (par2Block.blockID == Block.web.blockID)
            {
                return 15.0F;
            }
            else
            {
                Material material = par2Block.blockMaterial;
                return material != Material.plants && material != Material.vine && material != Material.coral && material != Material.leaves && material != Material.pumpkin ? 1.0F : 1.5F;
            }
        }
    
        /**
         * Current implementations of this method in child classes do not use the entry argument beside ev. They just raise
         * the damage on the stack.
         */
        public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
        {
            par1ItemStack.damageItem(1, par3EntityLivingBase);
            return true;
        }
    
        public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLivingBase par7EntityLivingBase)
        {
            if ((double)Block.blocksList[par3].getBlockHardness(par2World, par4, par5, par6) != 0.0D)
            {
                par1ItemStack.damageItem(2, par7EntityLivingBase);
            }
    
            return true;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * Returns True is the item is renderer in full 3D when hold.
         */
        public boolean isFull3D()
        {
            return true;
        }
    
        /**
         * returns the action that specifies what animation to play when the items is being used
         */
        /*public EnumAction getItemUseAction(ItemStack par1ItemStack)
        {
            return EnumAction.block;
        }*/
    
        /**
         * How long it takes to use or consume an item
         */
        public int getMaxItemUseDuration(ItemStack par1ItemStack)
        {
            return 72000;
        }
    
        /**
         * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
         */
    
    
        /**
         * Returns if the item (tool) can harvest results from the block type.
         */
        public boolean canHarvestBlock(Block par1Block)
        {
            return par1Block.blockID == Block.web.blockID;
        }
    
        /**
         * Return the enchantability factor of the item, most of the time is based on material.
         */
        public int getItemEnchantability()
        {
            return this.toolMaterial.getEnchantability();
        }
    
        /**
         * Return the name for this tool's material.
         */
        public String getToolMaterialName()
        {
            return this.toolMaterial.toString();
        }
    
        /**
         * Return whether this item is repairable in an anvil.
         */
    
    
        /**
         * Gets a map of item attribute modifiers, used by ItemSword to increase hit damage.
         */
        public Multimap getItemAttributeModifiers()
        {
            Multimap multimap = super.getItemAttributeModifiers();
            multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)this.weaponDamage, 0));
            return multimap;
        }
    
        @SideOnly(Side.CLIENT)
        public void registerIcons(IconRegister par1IconRegister)
        {
        	this.itemIcon = par1IconRegister.registerIcon(Flemyncraft.modid + ":" + Flemyncraft.itemTopazBowSword.getUnlocalizedName().substring(5) + "_bsstandby");
            //this.itemIcon = par1IconRegister.registerIcon(this.getIconString() + "_bsstandby");
            this.iconArray = new Icon[bowPullIconNameArray.length];
    
            for (int i = 0; i < this.iconArray.length; ++i)
            {
                this.iconArray[i] = par1IconRegister.registerIcon(Flemyncraft.modid + ":" + Flemyncraft.itemTopazBowSword.getUnlocalizedName().substring(5) +  bowPullIconNameArray[i]);
                System.out.println(iconArray[i]);
            }
        }
        public Icon getItemIconForUseDuration(int par1)
        {
            return this.iconArray[par1];
        }
    }


    I wouldn't consider it ready for deployment yet, as I've hard-coded the textures in here, so this class will only ever show textures for the Topaz one I've created. Once I have the textures worked out I will upload the final. But this should give you an idea of how it will look. Textures included below.




    Not sure about the enchanted items. I will look around in the code and see what I can find.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from flarespire

    I have a question, Is it possible to make a bow that will fire normally on the right mouse button,but do the damage of say an iron sword when used in close combat as a melee weapon on the left mouse button?


    I think that's doable. I will do a mashup of the sword class and the bow class to see what I can come up with.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from superplayer

    Does anyone know how to make custom furnaces? As in, add a furnace that cooks faster and etc. If so please let me know! Thanks!


    Check out ScratchForFun's channel on YouTube. He has a very comprehensive Custom Furnace tutorial which he duplicates later on and turns that one into a Macerator.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on {1.7.2} How would i create a Functional GUI?
    Quote from JakeRobertson

    Yeah it sorta is, but i want it to where you craft a custom block that when right clicked oprns up a gui where it has 2 input slots and 1 output slot


    You have a couple different options here. You can check out some of the multiple input furnace tutorials and base a design off of those. While that will more than likely work for your needs, you are just doing some copypasta and not really learning how to make the block.

    I would recommend copying the code for the vanilla furnace and manipulating the tile entity so that you have two input slots rather than one. Additional modifications will need to be made to GUI and Container as well to support that extra furnace.
    Posted in: Modification Development
  • 0

    posted a message on 1.7.2 Item gets damage upon smelting and returned to inventory
    Quote from MCDigger

    How would I go about getting an item that is used in a smelting recipe to be damaged and returned to the inventory instead of disappearing? Same thing for crafting too, like a bucket but one that has a durability.


    If you're looking for a means to smelt, then you would probably want to make yourself multiple input furnace. A slot for the tool and a slot for the mats and then something to power them.

    It terms of durable items for crafting are you thinking along the lines of IC2 wrenches and hammers?

    Also since, you don't want them to be destroyed, are you later going to have a means to repair them?
    Posted in: Modification Development
  • 0

    posted a message on {1.7.2} How would i create a Functional GUI?
    Quote from JakeRobertson

    Where you can put a tool in 1 slot and another item into another slot then when you press a button it will output 1 different tool while using up the items you put into the slots.


    Is this something that is going to require fuel? Based on what you are describing here, it sounds like more of a crafting recipe to me.
    Posted in: Modification Development
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from flarespire

    @nxwhitney:

    Thank you so much, I couldn't figure out what was going on and you just saved my mod from being scrapped. I had to make some minor tweaks (mainly name mismatches where some uppercase letters had become lower case) but it works perfectly now.


    Glad to help! Don't hesitate to shout if you need anymore help! :)
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on {1.7.2} How would i create a Functional GUI?
    Quote from JakeRobertson

    Ive tried but i wanted 1.7.2 specific, i tried the link and changed some errors but this still isnt working


    What kind of block are you looking at making? Something like a furnace? Item in, item out? Everyone's happy?
    Posted in: Modification Development
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from flarespire

    Syn, I need some help.

    For some reason in my main code, I keep getting an error for the sword im trying to add, saying that the other class it is referencing is undefined, when, as far as I can tell, I have defined it.

    Main Class Code:

    package flarespire;
    
    //Basic importing
    
    import flarespire.tools.Flaresword;
    import net.minecraft.block.Block;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemFood;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    
    
    /*
    * Basic needed forge stuff
    */
    @Mod(modid="AdvancedWeapons",name="Advanced Weapons Mod",version="v1.0")
    @NetworkMod(clientSideRequired=true,serverSideRequired=false)
    public class ItemList {
    //ToolMaterial
    
    //Telling forge that we are creating these
    //items
    public static Item lightcrystal;
    public static Item shadowcrystal;
    public static Item firecrystal;
    public static Item watercrystal;
    public static Item aircrystal;
    public static Item thundercrystal;
    public static Item crystalvessle;
    public static Item ultimacore;
    public static Item ultimabase;
    public static Item crystalineblade;
    //tools
    public static EnumToolMaterial UltimaWeapon = EnumHelper.addToolMaterial("ultimaweapon", 3, 1950, 9.0F, 3.0F, 10);
    //Declaring Init
    @Init
    public void load(FMLInitializationEvent event){
    // define items
    lightcrystal = new Flareitems(2500).setUnlocalizedName("lightcrystal");
    shadowcrystal = new Flareitems(2501).setUnlocalizedName("shadowcrystal");
    firecrystal = new Flareitems(2502).setUnlocalizedName("firecrystal");
    watercrystal = new Flareitems(2503).setUnlocalizedName("watercrystal");
    aircrystal = new Flareitems(2504).setUnlocalizedName("aircrystal");
    thundercrystal = new Flareitems(2505).setUnlocalizedName("thundercrystal");
    crystalvessle = new Flareitems(2506).setUnlocalizedName("crystalvessle");
    ultimacore = new Flareitems(2507).setUnlocalizedName("ultimacore");
    ultimabase = new Flareitems(2508).setUnlocalizedName("ultimabase");
    crystalineblade = new Flareitems(2509).setUnlocalizedName("crystalineblade");
    // define tools
    UltimaWeapon = new Flaresword(2510, UltimaWeapon).setUnlocalizedName("ultimaweapon");
    // define blocks
    
    //adding names
    //items
    LanguageRegistry.addName(lightcrystal, "Light Crystal");
    LanguageRegistry.addName(shadowcrystal, "Shadow Crystal");
    LanguageRegistry.addName(firecrystal, "Fire Crystal");
    LanguageRegistry.addName(watercrystal, "Water Crystal");
    LanguageRegistry.addName(aircrystal, "Air Crystal");
    LanguageRegistry.addName(thundercrystal, "Thunder Crystal");
    LanguageRegistry.addName(crystalvessle, "Crystal Vessle");
    LanguageRegistry.addName(ultimacore, "Ultima Core");
    LanguageRegistry.addName(ultimabase, "Ultima Base");
    LanguageRegistry.addName(crystalineblade, "Crystaline Blade");
    //tools
    LanguageRegistry.addName(UltimaWeapon, "Ultima Weapon");
    //blocks
    //crafting
    GameRegistry.addRecipe(new ItemStack(ultimacore,1), new Object[]{
    "LFS","WVT","SAL",'V',crystalvessle,'L',lightcrystal,'S',shadowcrystal,'F',firecrystal,'W',watercrystal,'A',aircrystal,'T',thundercrystal,
    });
    
    GameRegistry.addRecipe(new ItemStack(ultimabase,1), new Object[]{
    "BOB","OCO","LSL",'C',ultimacore,'O',Block.obsidian,'L',Item.leather,'S',Item.stick,'B',Item.blazeRod,
    });
    
    GameRegistry.addRecipe(new ItemStack(crystalineblade,1), new Object[]{
    "QQQ","QDQ","QNQ",'N',Item.netherStar,'D',Item.diamond,'Q',Item.netherQuartz,
    });
    
    }
    }

    Supposed undefined class's code:

    package flarespire.tools;
    import flarespire.ItemList;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.ItemPickaxe;
    import net.minecraft.item.ItemSword;
    public class Flaresword extends ItemSword {
    public Flaresword(int ItemID, EnumToolMaterial ultimaweapon){
    super(ItemID, ultimaweapon);
    setCreativeTab(CreativeTabs.tabCombat); }//Tells the game what creative mode tab it goes in
    public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
    if (itemID == ItemList.ultimaweapon.itemID) {
    this.itemIcon = reg.registerIcon("ultimaweapon"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    }
    }


    I hope this issue can be resolved soon as its really driving me up the wall. Also, sorry for not using spoiler tags, I wasnt sure on how to impliment it here.


    This should take care of the problem. You had your Flaresword using the same variable as your EnumToolMaterial. I created a new variable for sword and moved the UltimaWeapon initialization into your load method. Not sure if that's required, but it's always done good by me.

    Main Modding Class ItemList.java

    package flarespire;
    
    //Basic importing
    
    import flarespire.tools.Flaresword;
    import net.minecraft.block.Block;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemFood;
    import net.minecraft.item.ItemStack;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    
    
    /*
    * Basic needed forge stuff
    */
    @Mod(modid="AdvancedWeapons",name="Advanced Weapons Mod",version="v1.0")
    @NetworkMod(clientSideRequired=true,serverSideRequired=false)
    public class Itemlist {
    //ToolMaterial
    
    //Telling forge that we are creating these
    //items
    public static Item lightcrystal;
    public static Item shadowcrystal;
    public static Item firecrystal;
    public static Item watercrystal;
    public static Item aircrystal;
    public static Item thundercrystal;
    public static Item crystalvessle;
    public static Item ultimacore;
    public static Item ultimabase;
    public static Item crystalineblade;
    
    public static Item flaresword;
    
    //tools
    public static EnumToolMaterial UltimaWeapon;
    //Declaring Init
    @Init
    public void load(FMLInitializationEvent event){
    // define items
    lightcrystal = new Flareitems(2500).setUnlocalizedName("lightcrystal");
    shadowcrystal = new Flareitems(2501).setUnlocalizedName("shadowcrystal");
    firecrystal = new Flareitems(2502).setUnlocalizedName("firecrystal");
    watercrystal = new Flareitems(2503).setUnlocalizedName("watercrystal");
    aircrystal = new Flareitems(2504).setUnlocalizedName("aircrystal");
    thundercrystal = new Flareitems(2505).setUnlocalizedName("thundercrystal");
    crystalvessle = new Flareitems(2506).setUnlocalizedName("crystalvessle");
    ultimacore = new Flareitems(2507).setUnlocalizedName("ultimacore");
    ultimabase = new Flareitems(2508).setUnlocalizedName("ultimabase");
    crystalineblade = new Flareitems(2509).setUnlocalizedName("crystalineblade");
    // define tools
    UltimaWeapon = EnumHelper.addToolMaterial("ultimaweaponMaterial", 3, 1950, 9.0F, 3.0F, 10);
    
    flaresword = new Flaresword(2510, UltimaWeapon).setUnlocalizedName("FlareSword");
    // define blocks
    
    //adding names
    //items
    LanguageRegistry.addName(lightcrystal, "Light Crystal");
    LanguageRegistry.addName(shadowcrystal, "Shadow Crystal");
    LanguageRegistry.addName(firecrystal, "Fire Crystal");
    LanguageRegistry.addName(watercrystal, "Water Crystal");
    LanguageRegistry.addName(aircrystal, "Air Crystal");
    LanguageRegistry.addName(thundercrystal, "Thunder Crystal");
    LanguageRegistry.addName(crystalvessle, "Crystal Vessle");
    LanguageRegistry.addName(ultimacore, "Ultima Core");
    LanguageRegistry.addName(ultimabase, "Ultima Base");
    LanguageRegistry.addName(crystalineblade, "Crystaline Blade");
    //tools
    LanguageRegistry.addName(UltimaWeapon, "Ultima Weapon");
    //blocks
    //crafting
    GameRegistry.addRecipe(new ItemStack(ultimacore,1), new Object[]{
    "LFS","WVT","SAL",'V',crystalvessle,'L',lightcrystal,'S',shadowcrystal,'F',firecrystal,'W',watercrystal,'A',aircrystal,'T',thundercrystal,
    });
    
    GameRegistry.addRecipe(new ItemStack(ultimabase,1), new Object[]{
    "BOB","OCO","LSL",'C',ultimacore,'O',Block.obsidian,'L',Item.leather,'S',Item.stick,'B',Item.blazeRod,
    });
    
    GameRegistry.addRecipe(new ItemStack(crystalineblade,1), new Object[]{
    "QQQ","QDQ","QNQ",'N',Item.netherStar,'D',Item.diamond,'Q',Item.netherQuartz,
    });
    
    }
    }


    And your Flaresword.java


    package flarespire.tools;
    import flarespire.Itemlist;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.ItemPickaxe;
    import net.minecraft.item.ItemSword;
    public class Flaresword extends ItemSword {
    public Flaresword(int ItemID, EnumToolMaterial ultimaweapon){
    super(ItemID, ultimaweapon);
    setCreativeTab(CreativeTabs.tabCombat); }//Tells the game what creative mode tab it goes in
    public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
    if (itemID == Itemlist.flaresword.itemID) {
    this.itemIcon = reg.registerIcon("ultimaweapon"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    }
    }

    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from Elfish Pro

    Hey Syn, so i have done everything in your videos and it's just not working. I'm not getting any errors but the blocks and items just dont show up in the creative tab and i can't spawn them in. I'm using 1.6.4 any help would be awesome.


    Drop your code in a reply and I can help you out.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [1.6.4] Minecraft Forge Modding Tutorial ~Synasonic~ SRC video tutorials
    Quote from nathan5541

    Can you help me out too? Here is the code and error message.

    Error:

    2014-02-12 16:45:54 [SEVERE] [ForgeModLoader] Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
    2014-02-12 16:45:54 [SEVERE] [ForgeModLoader]
    mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
    FML{6.4.49.965} [Forge Mod Loader] (bin) Unloaded->Constructed->Pre-initialized->Initialized
    Forge{9.11.1.965} [Minecraft Forge] (bin) Unloaded->Constructed->Pre-initialized->Initialized
    The LOL Mod{v1} [The LOL Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored
    2014-02-12 16:45:54 [SEVERE] [ForgeModLoader] The following problems were captured during this phase
    2014-02-12 16:45:54 [SEVERE] [ForgeModLoader] Caught exception from The LOL Mod
    java.lang.IllegalArgumentException: Illegal object for naming null
    at cpw.mods.fml.common.registry.LanguageRegistry.addNameForObject(LanguageRegistry.java:114)
    at cpw.mods.fml.common.registry.LanguageRegistry.addName(LanguageRegistry.java:122)
    at Syn.MyMod.TheLOLMod.load(TheLOLMod.java:49)
    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 cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:545)
    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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:201)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:181)
    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 com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:112)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:699)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:249)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:509)
    at net.minecraft.client.Minecraft.run(Minecraft.java:808)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:27)


    TheLOLMod.java:

    package Syn.MyMod; //Package directory
    /*
    * Basic importing
    */
    import net.minecraft.block.Block;
    import net.minecraft.item.EnumToolMaterial;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemFood;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.common.EnumHelper;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.network.NetworkMod;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    /*
    * Basic needed forge stuff
    */
    @Mod(modid="The LOL Mod",name="The LOL Mod",version="v1")
    @NetworkMod(clientSideRequired=true,serverSideRequired=false)
    public class TheLOLMod {
    /*
    * ToolMaterial
    */
    //Telling forge that we are creating these
    //items
    public static Item LOL;
    
    //blocks
    
    public static Block lolblock;
    
    //tools
    
    //Declaring Init
    @Init
    public void load(FMLInitializationEvent event){
    // define items
    LOL = new Synitems(1001).setUnlocalizedName("LOL");
    // define blocks
    
    //adding names
    //items
    LanguageRegistry.addName(LOL, "LOL");
    
    //blocks
    
    LanguageRegistry.addName(lolblock, "LOL Block");
    
    //define blocks
    
    lolblock = new LOLBlock(1002, "lolblock").setUnlocalizedName("lol_block").setHardness(50.0F).setStepSound(Block.soundMetalFootstep).setResistance(50.0F);
    GameRegistry.registerBlock(lolblock, "lolblock");
    
    //crafting
    }
    }


    Synitems.java:

    package Syn.MyMod;
    
    import net.minecraft.item.Item;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.*;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    
    public class Synitems extends Item {
    
    public Synitems(int par1) {
    super(par1); //Returns super constructor: par1 is ID
    setCreativeTab(CreativeTabs.tabMaterials); }//Tells the game what creative mode tab it goes in
    
    
    public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
    if (itemID == TheLOLMod.LOL.itemID) {
    this.itemIcon = reg.registerIcon("LOL"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    
    }
    }


    LOLBlock.java:

    package Syn.MyMod;
    import java.util.Random;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    public class LOLBlock extends Block {
    public LOLBlock(int par1, String texture) {
    super(par1, Material.iron);
    setCreativeTab(CreativeTabs.tabBlock); //place in creative tabs
    }
    //drops when broken with pickaxe
    public int idDropped(int par1, Random par2Random, int par3)
    {
    return TheLOLMod.lolblock.blockID;
    }
    public int quantityDropped(Random random)
    {
    return 1;
    }
    
    public void registerIcons(IconRegister reg) { // Make sure to import IconRegister!
    this.blockIcon = reg.registerIcon("lol_block"); // You can also replace blockID and blockIcon with itemID and itemIcon
    }
    }



    Here's you problem, friend. You need to move this:

    LanguageRegistry.addName(lolblock, "LOL Block");


    down below this:

    GameRegistry.registerBlock(lolblock, "lolblock");


    so it looks like this:

    lolblock = new LOLBlock(1002, "lolblock").setUnlocalizedName("lol_block").setHardness(50.0F).setStepSound(Block.soundMetalFootstep).setResistance(50.0F);
    GameRegistry.registerBlock(lolblock, "lolblock");
    LanguageRegistry.addName(lolblock, "LOL Block");


    That way it's registered as part of the mod before you go putting names on it. :)
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on [forge 1.6.4] Micro's Furnace Tutorials [will update all parts to 1.6.4]
    I am having trouble doubling my output for the dual input furnace. Basically, I want two items each time I cook and I get the two on the first pass, but subsequent ones are only one.

    Here is my recipe file:


    package net.smeltercraft.mod.crafting;
    
    import net.smeltercraft.mod.SmelterCraft;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    
    public class RotaryKilnRecipes
    {
    public RotaryKilnRecipes()
    {
    }
    
    public static ItemStack getSmeltingResult(int i, int j)
    {
    return getOutput(i, j);
    }
    
    private static ItemStack getOutput(int i, int j)
    {
    if (i == SmelterCraft.itemRawCuprum.itemID &amp;&amp; j == SmelterCraft.itemRawStannum.itemID || i == SmelterCraft.itemRawStannum.itemID &amp;&amp; j == SmelterCraft.itemRawCuprum.itemID)
    {
    return new ItemStack(SmelterCraft.itemRawBronze, 2);
    }
    if (i == SmelterCraft.rotaryKiln1 &amp;&amp; j == SmelterCraft.rotaryKiln2 || i == SmelterCraft.rotaryKiln2 &amp;&amp; j == SmelterCraft.rotaryKiln1)
    {
    return new ItemStack(SmelterCraft.itemRawBronze, 2);
    }
    return null;
    }
    }



    Edit: Figured out my problem, it was in the tileentitiy. ^_^
    Posted in: Mapping and Modding Tutorials
  • To post a comment, please .