Posted August 12, 201411 yr I am creating a custom furnace, however i have three problems with it at the moment: 1. i cannot create recipes for the furnace, due to the fact that it is a 3 * 3 grid in which everything is being built (for this one i just need to know how to make the recipes, but i have been unable to find an help on this matter on the internet) 2. whenever i open the gui, there is a line in the middle that is not in the actual image file (http://s1273.photobucket.com/user/edy22174/library/?view=recent&page=1) 3. I have set my custom furnace to store fuel, however i cannot see where the fuel is being stored Here is all my code GUI Handler package net.mymod.Handler; import cpw.mods.fml.common.network.IGuiHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.mymod.mod.mymod; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; import net.mymod.mod.container.ContainerAngellicInfuser; import net.mymod.mod.gui.guiAngelicInfuser; public class GUIHandler implements IGuiHandler { @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getTileEntity(x, y, z); if(entity != null) { switch(ID) { case mymod.guiIdAngelicInfuser: if (entity instanceof TileEntityAngellicInfuser) { return new ContainerAngellicInfuser(player.inventory, (TileEntityAngellicInfuser) entity); } } } return null; } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getTileEntity(x, y, z); if(entity != null) { switch(ID) { case mymod.guiIdAngelicInfuser: if (entity instanceof TileEntityAngellicInfuser) { return new guiAngelicInfuser(player.inventory, (TileEntityAngellicInfuser) entity); } } } return null; } } Main Modding Class package net.mymod.mod; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.enchantment.Enchantment; 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 net.mymod.Handler.CraftingHandler; import net.mymod.Handler.GUIHandler; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; import net.mymod.mod.WorldGen.mymodWorldGen; import net.mymod.mod.armor.AngelArmor; import net.mymod.mod.armor.DemonArmor; import net.mymod.mod.blocks.AltarCore; import net.mymod.mod.blocks.AngellicInfuser; import net.mymod.mod.blocks.AngellicOre; import net.mymod.mod.blocks.DemonicCorrupter; import net.mymod.mod.blocks.DemonicOre; import net.mymod.mod.items.AngelBlade; import net.mymod.mod.items.AngelicIngot; import net.mymod.mod.items.AngellicAxe; import net.mymod.mod.items.AngellicHoe; import net.mymod.mod.items.AngellicPickaxe; import net.mymod.mod.items.AngellicSpade; import net.mymod.mod.items.ChaosDust; import net.mymod.mod.items.DemonicAxe; import net.mymod.mod.items.DemonicHoe; import net.mymod.mod.items.DemonicMace; import net.mymod.mod.items.DemonicPickaxe; import net.mymod.mod.items.DemonicSpade; import net.mymod.mod.items.InfusedStick; import net.mymod.mod.items.PowderedOrder; @Mod(modid = mymod.modid, version = mymod.version) public class mymod { public static final String modid = "mymod"; public static final String version = "Alpha 0.1"; mymodWorldGen eventWorldGen = new mymodWorldGen(); public static CreativeTabs SatangelicaTab; //tool material public static ToolMaterial AngelMaterial = EnumHelper.addToolMaterial("AngelMaterial", 3, 3000, 10.0f, 10.0f, 39); public static ToolMaterial DemonMaterial = EnumHelper.addToolMaterial("DemonMaterial", 3, 2000, 13.0f, 12.0f, 20); //armor material public static ArmorMaterial AngelArmor = EnumHelper.addArmorMaterial("AngelArmor", 10, new int[] {5, 8, 6, 5}, 40); public static ArmorMaterial DemonArmor = EnumHelper.addArmorMaterial("DemonArmor", 10, new int[] {4, 7, 5, 4}, 27); @Instance(modid) public static mymod instance; //blocks public static Block blockAltarCore; //ores public static Block oreAngellicOre; public static Block oreDemonicOre; //items public static Item itemInfusedStick; //ingots public static Item itemAngelicIngot; //dusts public static Item itemChaosDust; public static Item itemPowderedOrder; //tools public static Item itemAngelBlade; public static Item itemAngellicPickaxe; public static Item itemAngellicAxe; public static Item itemAngellicSpade; public static Item itemAngellicHoe; public static Item itemDemonicMace; public static Item itemDemonicPickaxe; public static Item itemDemonicHoe; public static Item itemDemonicSpade; public static Item itemDemonicAxe; //armor public static int armorAngelHelmId; public static int armorAngelChestplateId; public static int armorAngelLeggingsId; public static int armorAngelBootsId; public static int armorDemonHelmId; public static int armorDemonChestplateId; public static int armorDemonLeggingsId; public static int armorDemonBootsId; //armor (items) public static Item armorAngelHelm; public static Item armorAngelChestplate; public static Item armorAngelLeggings; public static Item armorAngelBoots; public static Item armorDemonHelm; public static Item armorDemonChestplate; public static Item armorDemonLeggings; public static Item armorDemonBoots; //Angellic Infuser public static Block blockAngellicInfuserIdle; public static Block blockAngellicInfuserActive; public static final int guiIdAngelicInfuser = 1; //Demonic Corrupter public static Block blockDemonicCorrupterIdle; public static Block blockDemonicCorrupterActive; public static final int guiIdDemonicCorrupter = 2; //Enchantments public static final Enchantment Absorbtion = new net.mymod.Enchantments.Absorbtion(111, 5); @EventHandler public void PreInit(FMLPreInitializationEvent preEvent){ SatangelicaTab = new CreativeTabs("mymod") { @SideOnly(Side.CLIENT) public Item getTabIconItem() { return Item.getItemFromBlock(mymod.blockAltarCore); } }; //blocks blockAltarCore = new AltarCore(Material.rock).setBlockName("Altar Core"); GameRegistry.registerBlock(blockAltarCore, "Altar Core"); //ores oreAngellicOre = new AngellicOre(Material.rock).setBlockName("Angellic Ore"); GameRegistry.registerBlock(oreAngellicOre, "Angellic Ore"); oreDemonicOre = new DemonicOre(Material.rock).setBlockName("Demonic Ore"); GameRegistry.registerBlock(oreDemonicOre, "Demonic Ore"); //items itemInfusedStick = new InfusedStick().setUnlocalizedName("Infused Stick"); GameRegistry.registerItem(itemInfusedStick, "Infused Stick"); //ingots itemAngelicIngot = new AngelicIngot().setUnlocalizedName("Angelic Ingot"); GameRegistry.registerItem(itemAngelicIngot, "Angelic Ingot"); //dusts itemChaosDust = new ChaosDust().setUnlocalizedName("Chaos Dust"); GameRegistry.registerItem(itemChaosDust, "Chaos Dust"); itemPowderedOrder = new PowderedOrder().setUnlocalizedName("Powdered Order"); GameRegistry.registerItem(itemPowderedOrder, "PowderedOrder"); //tools itemAngelBlade = new AngelBlade(AngelMaterial).setUnlocalizedName("Angel Blade"); GameRegistry.registerItem(itemAngelBlade, "Angel Blade"); itemAngellicPickaxe = new AngellicPickaxe(AngelMaterial).setUnlocalizedName("Angellic Pickaxe"); GameRegistry.registerItem(itemAngellicPickaxe, "Angellic Pickaxe"); itemAngellicAxe = new AngellicAxe(AngelMaterial).setUnlocalizedName("Angellic Axe"); GameRegistry.registerItem(itemAngellicAxe, "Angellic Axe"); itemAngellicSpade = new AngellicSpade(AngelMaterial).setUnlocalizedName("Angellic Spade"); GameRegistry.registerItem(itemAngellicSpade, "Angellic Spade"); itemAngellicHoe = new AngellicHoe(AngelMaterial).setUnlocalizedName("Angellic Hoe"); GameRegistry.registerItem(itemAngellicHoe, "Angellic Hoe "); itemDemonicMace = new DemonicMace(DemonMaterial).setUnlocalizedName("Demonic Mace"); GameRegistry.registerItem(itemDemonicMace, "Demonic Mace"); itemDemonicHoe = new DemonicHoe(DemonMaterial).setUnlocalizedName("Demonic Hoe"); GameRegistry.registerItem(itemDemonicHoe, "Demonic Hoe"); itemDemonicAxe = new DemonicAxe(DemonMaterial).setUnlocalizedName("Demonic Axe"); GameRegistry.registerItem(itemDemonicAxe, "Demonic Axe"); itemDemonicSpade = new DemonicSpade(DemonMaterial).setUnlocalizedName("Demonic Spade"); GameRegistry.registerItem(itemDemonicSpade, "Demonic Spade"); itemDemonicPickaxe = new DemonicPickaxe(DemonMaterial).setUnlocalizedName("Demonic Pickaxe"); GameRegistry.registerItem(itemDemonicPickaxe, "Demonic Pickaxe"); //armor armorAngelHelm = new AngelArmor(AngelArmor, armorAngelHelmId, 0).setUnlocalizedName("Angel Helm"); GameRegistry.registerItem(armorAngelHelm, "Angel Helm"); armorAngelChestplate = new AngelArmor(AngelArmor, armorAngelChestplateId, 1).setUnlocalizedName("Angel Chestplate"); GameRegistry.registerItem(armorAngelChestplate, "Angel Chestplate"); armorAngelLeggings = new AngelArmor(AngelArmor, armorAngelLeggingsId, 2).setUnlocalizedName("Angel Leggings"); GameRegistry.registerItem(armorAngelLeggings, "Angel Leggings"); armorAngelBoots = new AngelArmor(AngelArmor, armorAngelBootsId, 3).setUnlocalizedName("Angel Boots"); GameRegistry.registerItem(armorAngelBoots, "Angel Boots"); armorDemonHelm = new DemonArmor(DemonArmor, armorDemonHelmId, 0).setUnlocalizedName("Demon Helm"); GameRegistry.registerItem(armorDemonHelm, "Demon Helm"); armorDemonChestplate = new DemonArmor(DemonArmor, armorDemonChestplateId, 1).setUnlocalizedName("Demon Chestplate"); GameRegistry.registerItem(armorDemonChestplate, "Demon Chestplate"); armorDemonLeggings = new DemonArmor(DemonArmor, armorDemonLeggingsId, 2).setUnlocalizedName("DemonLeggings"); GameRegistry.registerItem(armorDemonLeggings, "Demon Leggings"); armorDemonBoots = new DemonArmor(DemonArmor, armorDemonBootsId, 3).setUnlocalizedName("Demon Boots"); GameRegistry.registerItem(armorDemonBoots, "Demon Boots"); //Angelic Infuser blockAngellicInfuserIdle = new AngellicInfuser(false).setBlockName("Angellic Infuser Idle").setCreativeTab(mymod.SatangelicaTab).setHardness(3.5F); GameRegistry.registerBlock(blockAngellicInfuserIdle, "Angellic Infuser Idle"); blockAngellicInfuserActive = new AngellicInfuser(true).setBlockName("Angellic Infuser Active").setHardness(3.5F); GameRegistry.registerBlock(blockAngellicInfuserActive, "Angellic Infuser Active"); //Demonic Corrupter blockDemonicCorrupterIdle = new DemonicCorrupter(false).setBlockName("Demonic Corrupter Idle").setCreativeTab(mymod.SatangelicaTab).setHardness(3.5F); GameRegistry.registerBlock(blockDemonicCorrupterIdle, "Demonic Corrupter Idle"); blockDemonicCorrupterActive = new DemonicCorrupter(true).setBlockName("Demonic Corrupter Active").setHardness(3.5F); GameRegistry.registerBlock(blockDemonicCorrupterActive, "Demonic Corrupter Active"); //spawn }; @EventHandler public void Init(FMLInitializationEvent event){ //Gui Handler FMLCommonHandler.instance().bus().register(new CraftingHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GUIHandler()); GameRegistry.registerTileEntity(TileEntityAngellicInfuser.class, "AngellicInfuser"); //Recipes GameRegistry.addRecipe(new ItemStack(blockAltarCore), new Object[]{"SIS", "SIS", "SIS", 'S', Blocks.stone, 'I', mymod.itemInfusedStick}); GameRegistry.addRecipe(new ItemStack(itemInfusedStick), new Object []{ "CSO", "OSC", "CSO", 'C', mymod.itemChaosDust, 'S', Items.stick, 'O', mymod.itemPowderedOrder}); GameRegistry.addSmelting(oreAngellicOre, new ItemStack(itemPowderedOrder, 3), 5); GameRegistry.addSmelting(oreDemonicOre, new ItemStack(itemChaosDust, 3), 5); GameRegistry.registerTileEntity(TileEntityAngellicInfuser.class, "TEAngellicInfuser"); } @EventHandler public void PostInit(FMLPostInitializationEvent postEvent){ } } Block Class package net.mymod.mod.blocks; import java.util.Random; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.mymod.mod.mymod; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; public class AngellicInfuser extends BlockContainer { private Random rand; private final boolean isActive; private static boolean keepInventory = true; @SideOnly(Side.CLIENT) private IIcon iconFront; public AngellicInfuser(boolean blockState) { super(Material.iron); rand = new Random(); isActive = blockState; } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon(mymod.modid + ":" + "Angellic Infuser Side"); this.iconFront = iconRegister.registerIcon(mymod.modid + ":" + (this.isActive ? "Angellic Infuser Front Active" : "Angellic Infuser Front Idle")); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon); } public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } private void setDefaultDirection(World world, int x, int y, int z) { if(!world.isRemote){ Block block1 = world.getBlock(x, y, z - 1); Block block2 = world.getBlock(x, y, z + 1); Block block3 = world.getBlock(x - 1, y, z); Block block4 = world.getBlock(x + 1, y, z); byte b0 = 3; if(block1.func_149730_j() && !block2.func_149730_j()){ b0 = 3; } if(block2.func_149730_j() && !block1.func_149730_j()){ b0 = 2; } if(block3.func_149730_j() && !block4.func_149730_j()){ b0 = 5; } if(block4.func_149730_j() && !block3.func_149730_j()){ b0 = 4; } world.setBlockMetadataWithNotify(x, y, x, b0, 2); } } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityPlayer, ItemStack itemstack) { int i = MathHelper.floor_double((double)(entityPlayer.rotationYaw * 4.0F / 360F) + 0.5D) & 3; if (i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if (i == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if (i == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if (i == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if(itemstack.hasDisplayName()) { } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; }else if (!player.isSneaking()) { TileEntityAngellicInfuser entity = (TileEntityAngellicInfuser) world.getTileEntity(x, y, z); if (entity != null) { FMLNetworkHandler.openGui(player, mymod.instance, mymod.guiIdAngelicInfuser, world, x, y, z); } return true; }else{ return false; } } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityAngellicInfuser(); } public static void updateBlockState(boolean isMashing, World world, int xCoord, int yCoord, int zCoord) { int i = world.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity entity = world.getTileEntity(xCoord, yCoord, zCoord); keepInventory = true; if (isMashing) { world.setBlock(xCoord, yCoord, zCoord, mymod.blockAngellicInfuserActive); }else{ world.setBlock(xCoord, yCoord, zCoord, mymod.blockAngellicInfuserIdle); } keepInventory = false; world.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2); if (entity != null) { entity.validate(); world.setTileEntity(xCoord, yCoord, zCoord, entity); } } } Container Class package net.mymod.mod.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; import net.mymod.mod.slot.SlotAngellicInfuser; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; public class ContainerAngellicInfuser extends Container { private TileEntityAngellicInfuser infuser; private int dualCookTime; private int dualPower; private int lastItemBurnTime; public ContainerAngellicInfuser(InventoryPlayer invPlayer, TileEntityAngellicInfuser teAngellicInfuser) { dualCookTime = 0; dualPower = 0; lastItemBurnTime = 0; infuser = teAngellicInfuser; this.addSlotToContainer(new Slot(teAngellicInfuser, 0, 49, 35)); this.addSlotToContainer(new Slot(teAngellicInfuser, 1, 49, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 2, 7, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 5, 67, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 6, 67, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 7, 67, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 8, 85, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 9, 85, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 10, 85, 53)); this.addSlotToContainer(new SlotAngellicInfuser(invPlayer.player, teAngellicInfuser, 3, 143, 34)); //Inventory for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } //ActionBar for(int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); } } public void addCraftingToCrafters (ICrafting crafting) { super.addCraftingToCrafters(crafting); crafting.sendProgressBarUpdate(this, 0, this.infuser.dualCookTime); crafting.sendProgressBarUpdate(this, 1, this.infuser.dualPower); } public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 && par2 != 0) { if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityFurnace.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } @Override public boolean canInteractWith(EntityPlayer player) { return infuser.isUseableByPlayer(player); } } GUI Class package net.mymod.mod.gui; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.mymod.mod.mymod; import net.mymod.mod.container.ContainerAngellicInfuser; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; public class guiAngelicInfuser extends GuiContainer { public ResourceLocation texture = new ResourceLocation(mymod.modid + ":" + "/textures/gui/Angelic Infuser GUI.png"); public TileEntityAngellicInfuser AngellicInfuser; public guiAngelicInfuser(InventoryPlayer invPlayer, TileEntityAngellicInfuser teAngellicInfuser) { super(new ContainerAngellicInfuser(invPlayer, teAngellicInfuser)); AngellicInfuser = teAngellicInfuser; this.xSize = 176; this.ySize = 166; } protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.AngellicInfuser.hasCustomInventoryName() ? this.AngellicInfuser.getInventoryName() : I18n.format(this.AngellicInfuser.getInventoryName()); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.ContainerAngellicInfuser"), 8, this.ySize - 96 + 5, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); if (AngellicInfuser.hasPower()) { int i1 = AngellicInfuser.getPowerRemainingScaled(45); drawTexturedModalRect(guiLeft + 8, guiTop + 53 - i1, 176, 62 - i1, 16, i1); } int i1 = AngellicInfuser.getMasherProgressScaled(24); drawTexturedModalRect(guiLeft + 79, guiTop + 34, 176, 0, i1 + 1, 16); } } Slot Class package net.mymod.mod.slot; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.mymod.mod.TileEntity.TileEntityAngellicInfuser; public class SlotAngellicInfuser extends Slot { public SlotAngellicInfuser(EntityPlayer player, IInventory iiventory, int i, int j, int k) { super(iiventory, i, j, k); // TODO Auto-generated constructor stub } Tile Entity Class package net.mymod.mod.TileEntity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.mymod.mod.mymod; import net.mymod.mod.blocks.AngellicInfuser; import net.mymod.mod.crafting.AngellicInfuserRecipes; public class TileEntityAngellicInfuser extends TileEntity implements ISidedInventory { private ItemStack slots[]; public int dualPower; public int dualCookTime; public static final int maxPower = 10000; public static final int infusingSpeed = 100; private static final int[] slots_top = new int[] {0, 1}; private static final int[] slots_bottom = new int[] {3}; private static final int[] slots_side = new int[] {2}; private String customName; public TileEntityAngellicInfuser() { slots = new ItemStack[11]; } @Override public int getSizeInventory() { return slots.length; } @Override public ItemStack getStackInSlot(int i) { return slots[i]; } @Override public ItemStack getStackInSlotOnClosing(int i) { if (slots[i] != null) { ItemStack itemstack = slots[i]; slots[i] = null; return itemstack; }else{ return null; } } @Override public void setInventorySlotContents(int i, ItemStack itemstack) { slots[i] = itemstack; if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { itemstack.stackSize = getInventoryStackLimit(); } } @Override public int[] getAccessibleSlotsFromSide(int i) { return i == 0 ? slots_bottom : (i == 1 ? slots_top : slots_side); } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; }else{ return player.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64; } } public void openInventory() {} public void closeInventory() {} @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return i == 2 ? false : (i == 1 ? hasItemPower(itemstack) : true); } public boolean hasItemPower(ItemStack itemstack) { return getItemPower(itemstack) > 0; } private static int getItemPower (ItemStack itemstack) { if (itemstack == null) { return 0; }else{ Item item = itemstack.getItem(); if (item == mymod.itemPowderedOrder) return 50; return 0; } } public ItemStack decrStackSize(int i, int j) { if (slots[i] != null) { if (slots[i].stackSize <= j) { ItemStack itemstack = slots[i]; slots[i] = null; return itemstack; } ItemStack itemstack1 = slots[i].splitStack(j); if (slots[i].stackSize == 0) { slots[i] = null; } return itemstack1; }else{ return null; } } public void readFromNBT (NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("Items", 10); slots = new ItemStack[getSizeInventory()]; for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound nbt1 = (NBTTagCompound)list.getCompoundTagAt(i); byte b0 = nbt1.getByte("Slot"); if (b0 >= 0 && b0 < slots.length) { slots[b0] = ItemStack.loadItemStackFromNBT(nbt1); } } dualPower = nbt.getShort("PowerTime"); dualCookTime = nbt.getShort("CookTime"); } public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setShort("PowerTime", (short)dualPower); nbt.setShort("CookTime", (short)dualCookTime); NBTTagList list = new NBTTagList(); for (int i = 0; i < slots.length; i++) { if (slots[i] != null) { NBTTagCompound nbt1 = new NBTTagCompound(); nbt1.setByte("Slot", (byte)i); slots[i].writeToNBT(nbt1); list.appendTag(nbt1); } } nbt.setTag("Items", list); } @Override public String getInventoryName() { return "container.AngellicInfuser"; } @Override public boolean canInsertItem(int var1, ItemStack itemstack, int var3) { return this.isItemValidForSlot(var1, itemstack); } @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { return j != 0 || i != 1 || itemstack.getItem() == Items.bucket; } @Override public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } public int getMasherProgressScaled(int i) { return (dualCookTime * i) / this.infusingSpeed; } public int getPowerRemainingScaled(int i) { return (dualPower * i) / maxPower; } private boolean canMash() { if (slots[0] == null || slots[1] == null) { return false; } ItemStack itemstack = AngellicInfuserRecipes.getMashingResult(slots[0].getItem(), slots[1].getItem()); if (itemstack == null) { return false; } if (slots[9] == null) { return true; } if (!slots[9].isItemEqual(itemstack)) { return false; } if (slots[9].stackSize < getInventoryStackLimit() && slots[3].stackSize < slots[3].getMaxStackSize()) { return true; }else{ return slots[9].stackSize < itemstack.getMaxStackSize(); } } private void mashItem() { if (canMash()) { ItemStack itemstack = AngellicInfuserRecipes.getMashingResult(slots[0].getItem(), slots[1].getItem()); if (slots[9] == null) { slots[9] = itemstack.copy(); }else if (slots[9].isItemEqual(itemstack)) { slots[9].stackSize += itemstack.stackSize; } for (int i = 0; i < 2; i++) { if (slots[i].stackSize <= 0) { slots[i] = new ItemStack(slots[i].getItem().setFull3D()); }else{ slots[i].stackSize--; } if (slots[i].stackSize <= 0){ slots[i] = null; } } } } public boolean hasPower() { return dualPower > 0; } public boolean isMashing() { return this.dualCookTime > 0; } public void updateEntity() { boolean flag = this.hasPower(); boolean flag1= false; if(hasPower() && this.isMashing()) { this.dualPower--; } if(!worldObj.isRemote) { if (this.hasItemPower(this.slots[2]) && this.dualPower < (this.maxPower - this.getItemPower(this.slots[2]))) { this.dualPower += getItemPower(this.slots[2]); if(this.slots[2] != null) { flag1 = true; this.slots[2].stackSize--; if(this.slots[2].stackSize == 0) { this.slots[2] = this.slots[2].getItem().getContainerItem(this.slots[2]); } } } if (hasPower() && canMash()) { dualCookTime++; if (this.dualCookTime == this.infusingSpeed) { this.dualCookTime = 0; this.mashItem(); flag1 = true; } }else{ dualCookTime = 0; } if (flag != this.isMashing()) { flag1 = true; AngellicInfuser.updateBlockState(this.isMashing(), this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } } That is everything, but the most useful thing to know would be how to create my recipes
August 13, 201411 yr I am at work now, so am not able to test anything, but are you trying to put something like coal into slot 2 of your furnace to smelt items. If no items are available to smelt, then to continue buring the coal and adding to a "battery" for later consumtion? There is nothing in the tile entity to show what is used for fuel. ScratchForFun tutorials on Windmill was a great help for me to adding a power progress bar to my gui. I also tried to pull up your gui picture, but said it was private and could not access it.
August 14, 201411 yr Author ok thanks, i will try scratch's tutorial, and make it so that my pictures can be seen, but i dont understand the glitchy bit of texture in the middle of the gui (cant really explain it, only show it with pictures).
August 14, 201411 yr Author just found this when trying to fix it: - I do have a fuel, it is one of my custom items, and it works (it is being stored, and before i increased how many slots it had, it was smelting off of stored fuel) - I cannot get the power bar or progress bar to work, which is why my fuel gauge doesnt work. - I still cant make recipes - here are the photos http://i1273.photobucket.com/albums/y415/edy22174/Minecraft%20Modding/notworking_zpse280e6ac.png[/img] http://i1273.photobucket.com/albums/y415/edy22174/Minecraft%20Modding/AngelicInfuserGUI_zpse8a8ffdc.png[/img]
August 15, 201411 yr Pardon if I didn't look close enough at your code, but I do not see you creating or positioning any of your AngelicInfuserSlots in your gui container. So, I think the default slot positions (for cooking item and fuel item) are showing up instead, -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
August 16, 201411 yr Author The slots are fine (apart from 2 of them being slightly out of place), however i am not sure if i have done it right, here is what i have for the setting the slots this.addSlotToContainer(new Slot(teAngellicInfuser, 0, 49, 35)); this.addSlotToContainer(new Slot(teAngellicInfuser, 1, 49, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 2, 7, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 5, 67, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 6, 67, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 7, 67, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 8, 85, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 9, 85, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 10, 85, 53)); this.addSlotToContainer(new SlotAngellicInfuser(invPlayer.player, teAngellicInfuser, 3, 143, 34));
August 16, 201411 yr The slots are fine (apart from 2 of them being slightly out of place), however i am not sure if i have done it right, here is what i have for the setting the slots this.addSlotToContainer(new Slot(teAngellicInfuser, 0, 49, 35)); this.addSlotToContainer(new Slot(teAngellicInfuser, 1, 49, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 2, 7, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 4, 49, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 5, 67, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 6, 67, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 7, 67, 53)); this.addSlotToContainer(new Slot(teAngellicInfuser, 8, 85, 17)); this.addSlotToContainer(new Slot(teAngellicInfuser, 9, 85, 40)); this.addSlotToContainer(new Slot(teAngellicInfuser, 10, 85, 53)); this.addSlotToContainer(new SlotAngellicInfuser(invPlayer.player, teAngellicInfuser, 3, 143, 34)); Try this: this.addSlotToContainer( new SlotAngellicInfuser( teAngellicInfuser, n, x, y) // replace n x and y with your own data. by using new Slot, you are accepting vanilla slot semantics which you have no control over. Also, if I understand your needs properly, 9 slots should be input/output, 1 slot needs to be fuel only, and one output only. So, one slot class will not likely suffice unless a vanilla slot type fits your needs. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
August 17, 201411 yr Author i changed the adding slots part, however i am a little confused about needing multiple slot classes, can you please explain a little bit. Also, i still have the problem with the gui image, and how to actually make recipes, if you can tell me how to do that, i would greatly appreciate it.
August 17, 201411 yr i changed the adding slots part, however i am a little confused about needing multiple slot classes, can you please explain a little bit. Also, i still have the problem with the gui image, and how to actually make recipes, if you can tell me how to do that, i would greatly appreciate it. mkay... first take a look at the Slot classes currently in Minercraft: Slot, BeaconSlot, CreativeSlot, Ingredient, Potion, SlotCrafting, SlotFurnace, SlotMerchantResult, and the dynamic new Slot calls. Each overrides certain slot checks, such as isItemValid(itemStack), canTakeStack(player), ... and such. Each slot controls the GUI of the container it is used with. So, in most cases (unless it's a generic accept anything input/output slot), you'd want to specialize it for your gui. Now, as far as recipes go, I cannot really help you with those as I have no idea how your infuser should work. If you could hash out the details on what goes in and what comes out, that would be a start. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
August 18, 201411 yr Author Recipes: (Custom item)(Custom item)(Custom item) (fuel)(iron ingot)(diamond)(iron ingot) (output(custom item 2) (Custom item)(Custom item)(Custom item) as for the needing another class, i dont believe i do, due to the fact that it is working at the moment aside from the visual parts
August 20, 201411 yr Recipes: (Custom item)(Custom item)(Custom item) (fuel)(iron ingot)(diamond)(iron ingot) (output(custom item 2) (Custom item)(Custom item)(Custom item) as for the needing another class, i dont believe i do, due to the fact that it is working at the moment aside from the visual parts Okay, so outside of the fuel slot, this seems similar to a crafting table. So, you can use the IRecipe interface. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.