Posted July 29, 201510 yr I'm trying to make a block that uses a special crafting system There are two inputs and one output I'm getting stuck at the part were I ask for the recipe list I want the crafting to be like in an anvil/alchemy station package com.neosup.VampZ.tileentity; import com.neosup.VampZ.MainClass; import com.neosup.VampZ.container.ContainerBloodMixer; import com.neosup.VampZ.handler.BloodSmeltingRecipe; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.InventoryBasic; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.ForgeHooks; public class TileEntityBloodMixer extends TileEntity implements ISidedInventory { private String localizedName; private static final int[] slots_top = new int []{0}; private static final int[] slots_bottom = new int[]{2, 1}; private static final int[] slots_side = new int[]{3, 4, 5, 6}; private ItemStack[] slots = new ItemStack[8]; public int speed = 60; public int CurrentItemTransTime; public int TransTime; private IInventory outputSlot = new InventoryCraftResult(); private IInventory inputSlots = new InventoryBasic("Combine", true, 2); private ContainerBloodMixer container; private String Result; public void setGuiDisplayName(String name) { this.localizedName = name; } public String getInventoryName() { return this.hasCustomInventoryName() ? this.localizedName : "container.bloodMixer"; } public boolean hasCustomInventoryName() { return this.localizedName != null && this.localizedName.length() > 0; } public int getSizeInventory() { return this.slots.length; } @Override public ItemStack getStackInSlot(int item) { return this.slots[item]; } @Override public ItemStack decrStackSize(int item, int stack) { if(this.slots[item] != null){ ItemStack itemstack; if(this.slots[item].stackSize <= stack){ itemstack = this.slots[item]; this.slots[item] = null; return itemstack; }else{ itemstack = this.slots[item].splitStack(stack); if(this.slots[item].stackSize == 0){ this.slots[item] = null; } return itemstack; } }else{ return null; } } @Override public ItemStack getStackInSlotOnClosing(int i) { if(this.slots != null){ ItemStack itemstack = this.slots; this.slots = null; return itemstack; } return null; } @Override public void setInventorySlotContents(int i, ItemStack stack) { this.slots = stack; if(stack != null && stack.stackSize > this.getInventoryStackLimit()){ stack.stackSize = this.getInventoryStackLimit(); } } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer player) { return this.worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openInventory(){} public void closeInventory(){} @Override public int[] getAccessibleSlotsFromSide(int slot) { return slot == 1 ? slots_bottom : (slot == 2 ? slots_top : slots_side); } public boolean isBurning() { return this.TransTime > 0; } @Override public boolean canInsertItem(int i, ItemStack itemstack, int j) { return this.isItemValidForSlot(i, itemstack); } @Override public boolean canExtractItem(int i, ItemStack itemstack, int j) { return j != 0 || i != 1 || i != 4 || j != 5 || i != 6 || j != 7; } public void updateResultOutput(){ ItemStack stack = this.inputSlots.getStackInSlot(0); if(stack == null){ this.outputSlot.setInventorySlotContents(0, (ItemStack)null); } else { ItemStack item = stack.copy(); ItemStack item1 = this.inputSlots.getStackInSlot(1); if(item1 != null){ if(item1.isItemDamaged()){ return; } else { } } } } @Override public boolean isItemValidForSlot(int i, ItemStack itemstack) { return false; } public int getTransProgressScaled(int i) { return this.TransTime * i / this.speed; } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("Items", 10); this.slots = new ItemStack[this.getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound compound =(NBTTagCompound) list.getCompoundTagAt(i); byte b = compound.getByte("Slot"); if(b >= 0 && b < this.slots.length) { this.slots = ItemStack.loadItemStackFromNBT(compound); } } this.TransTime = (int)nbt.getShort("TransTime"); this.CurrentItemTransTime = (int)nbt.getShort("CurrentItemTransTime"); if(nbt.hasKey("CustomName")) { this.localizedName = nbt.getString("CustomName"); } } public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setShort("TransTime", (short)this.TransTime); nbt.setShort("CurrentItemTransTime", (short)this.CurrentItemTransTime); NBTTagList list = new NBTTagList(); for (int i = 0; i < this.slots.length; i++) { if(this.slots != null) { NBTTagCompound compound = new NBTTagCompound(); compound.setByte("Slot", (byte)i); this.slots.writeToNBT(compound); list.appendTag(compound); } } nbt.setTag("Items", list); if(this.hasCustomInventoryName()) { nbt.setString("CustomName", localizedName); } } } VampZ modder
July 29, 201510 yr Author I just fix it with the finding of the recipe class but now it removes the items that will be used in the recipe and returns nothing. Class TileEntity: https://github.com/NeoSup2130/Neo/blob/master/TileEntityBloodMixer Class Recipe: https://github.com/NeoSup2130/Neo/blob/master/BloodTransRecipe VampZ modder
July 29, 201510 yr Not the cause but should your <=1 should be <= 0 if(this.slots[0].stackSize <= 0 && this.slots[1].stackSize <= 1) { this.slots[0] = null; this.slots[1] = null; System.out.println("Aaaaaand it's gone"); } right below "ItemStack itemstack = BloodTransRecipe.Transforming().getTransformingResult(this.slots[0]);", put a print statement to make see what it is telling you it found as an item. That will probably answer what is up. I'm betting it is null. I haven't messed with custom recipes like that much, but something is up. you are passing in two source items, but only using the first one as you progress through your functions. private BloodTransRecipe() { this.func_151396_a(Items.iron_sword, MainClass.CorruptedBlood, new ItemStack(MainClass.CorruptedIronSword)); } public void func_151396_a(Item inputI, Item inputI2, ItemStack output) { this.func_151394_a(new ItemStack(inputI, 1, 32767), output); } public void func_151394_a(ItemStack inputI, ItemStack output) { this.CraftList.put(inputI, output); } Long time Bukkit & Forge Programmer Happy to try and help
July 29, 201510 yr Author right below "ItemStack itemstack = BloodTransRecipe.Transforming().getTransformingResult(this.slots[0]);", put a print statement to make see what it is telling you it found as an item. That will probably answer what is up. I'm betting it is null. True I'm not returning anything back Maybe the recipe class is messed up.... I bet that's what it is VampZ modder
July 29, 201510 yr Did you look at the other items I mentioned above? Long time Bukkit & Forge Programmer Happy to try and help
July 29, 201510 yr Author Yes And it didn't return anything when I did System.out.println(itemstack); VampZ modder
July 29, 201510 yr I told you to look at two other things than that. Long time Bukkit & Forge Programmer Happy to try and help
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.