Jump to content

[1.6.2] Problems with custom furnace [NOT SOLVED]


AppliedOnce

Recommended Posts

Hi, I have just made myself a furnace that takes to inputs (plus the fuel) to make one output.

 

All this works just fine, but the moment I exit the game, if it is any items in the machine, the items disappear. How am I supposed to get rid of this error?

 

CustomFurnaceBlock Class

package net.blazecoding.magicpowders.block;

import java.util.Random;

import net.blazecoding.magicpowders.MagicPowders;
import net.blazecoding.magicpowders.lib.Strings;
import net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockMagicInfuser extends BlockContainer {

private final Random furnaceRand = new Random();

private final boolean isActive;

private static boolean keepFurnaceInventory = false;

@SideOnly(Side.CLIENT)
private Icon magicInfuserTop;
@SideOnly(Side.CLIENT)
private Icon magicInfuserFront;

protected BlockMagicInfuser(int id, boolean active) {
	super(id, Material.rock);
	setUnlocalizedName(Strings.MAGICINFUSERACTIVE_NAME);

	if (!active) {
		setUnlocalizedName(Strings.MAGICINFUSER_NAME);
		setCreativeTab(MagicPowders.tabMP);
	}

	this.isActive = active;
	setHardness(3.0F);
	setResistance(8.0F);
}

public int idDropped(int id, Random random, int meta) {
	return ModBlocks.magicInfuserIdle.blockID;
}

public void onBlockAdded(World par1World, int par2, int par3, int par4) {
	super.onBlockAdded(par1World, par2, par3, par4);
	this.setDefaultDirection(par1World, par2, par3, par4);
}

private void setDefaultDirection(World par1World, int par2, int par3, int par4) {

	if (!par1World.isRemote) {

		int l = par1World.getBlockId(par2, par3, par4 - 1);

		int i1 = par1World.getBlockId(par2, par3, par4 + 1);
		int j1 = par1World.getBlockId(par2 - 1, par3, par4);
		int k1 = par1World.getBlockId(par2 + 1, par3, par4);

		byte b0 = 3;

		if (Block.opaqueCubeLookup[l] && !Block.opaqueCubeLookup[i1]) {
			b0 = 3;
		}

		if (Block.opaqueCubeLookup[i1] && !Block.opaqueCubeLookup[l]) {
			b0 = 2;
		}

		if (Block.opaqueCubeLookup[j1] && !Block.opaqueCubeLookup[k1]) {
			b0 = 5;
		}

		if (Block.opaqueCubeLookup[k1] && !Block.opaqueCubeLookup[j1]) {
			b0 = 4;
		}

		par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);

	}

}

@SideOnly(Side.CLIENT)
public Icon getIcon(int par1, int par2) {
	return par1 == 1 ? this.magicInfuserTop : (par1 == 0 ? this.magicInfuserTop : (par1 != par2 ? this.blockIcon : this.magicInfuserFront));
}

@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {

	this.blockIcon = par1IconRegister.registerIcon("furnace_side");
	this.magicInfuserFront = par1IconRegister.registerIcon(this.isActive ? "furnace_front_on" : "furnace_front_off");
	this.magicInfuserTop = par1IconRegister.registerIcon("furnace_top");

}

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float g, float t) {

	TileEntity tile_entity = world.getBlockTileEntity(x, y, z);

	if (tile_entity == null || player.isSneaking()) {
		return false;
	}

	player.openGui(MagicPowders.instance, 0, world, x, y, z);

	return true;

}

public static void updateFurnaceBlockState(boolean par0, World par1World, int par2, int par3, int par4) {

	int l = par1World.getBlockMetadata(par2, par3, par4);
	TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
	keepFurnaceInventory = true;

	if (par0) {
		par1World.setBlock(par2, par3, par4, ModBlocks.magicInfuserActive.blockID);
	} else {
		par1World.setBlock(par2, par3, par4, ModBlocks.magicInfuserIdle.blockID);
	}

	keepFurnaceInventory = false;
	par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);

	if (tileentity != null) {
		tileentity.validate();
		par1World.setBlockTileEntity(par2, par3, par4, tileentity);
	}

}

@SideOnly(Side.CLIENT)
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {

}

public TileEntity createNewTileEntity(World world) {
	return new TileEntityMagicInfuser();
}

public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {

	int l = MathHelper.floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

	if (l == 0) {
		par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
	}

	if (l == 1) {
		par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2);
	}

	if (l == 2) {
		par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
	}

	if (l == 3) {
		par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
	}

	if (par6ItemStack.hasDisplayName()) {
		((TileEntityFurnace) par1World.getBlockTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName());
	}

}

public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {

	if (!keepFurnaceInventory) {

		TileEntityMagicInfuser tileentityfurnace = (TileEntityMagicInfuser) par1World.getBlockTileEntity(par2, par3, par4);

		if (tileentityfurnace != null) {

			for (int j1 = 0; j1 < tileentityfurnace.getSizeInventory(); ++j1) {

				ItemStack itemstack = tileentityfurnace.getStackInSlot(j1);

				if (itemstack != null) {

					float f = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
					float f1 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;
					float f2 = this.furnaceRand.nextFloat() * 0.8F + 0.1F;

					while (itemstack.stackSize > 0) {

						int k1 = this.furnaceRand.nextInt(21) + 10;

						if (k1 > itemstack.stackSize) {
							k1 = itemstack.stackSize;
						}

						itemstack.stackSize -= k1;
						EntityItem entityitem = new EntityItem(par1World, (double) ((float) par2 + f), (double) ((float) par3 + f1), (double) ((float) par4 + f2), new ItemStack(itemstack.itemID, k1, itemstack.getItemDamage()));

						if (itemstack.hasTagCompound()) {
							entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
						}

						float f3 = 0.05F;

						entityitem.motionX = (double) ((float) this.furnaceRand.nextGaussian() * f3);
						entityitem.motionY = (double) ((float) this.furnaceRand.nextGaussian() * f3 + 0.2F);
						entityitem.motionZ = (double) ((float) this.furnaceRand.nextGaussian() * f3);

						par1World.spawnEntityInWorld(entityitem);

					}

				}

			}
			par1World.func_96440_m(par2, par3, par4, par5);
		}

	}
	super.breakBlock(par1World, par2, par3, par4, par5, par6);
}

public boolean hasComparatorInputOverride() {
	return true;
}

public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
	return Container.calcRedstoneFromInventory((IInventory) par1World.getBlockTileEntity(par2, par3, par4));
}

}

 

Custom TileEntityFurnace class

package net.blazecoding.magicpowders.tileentity;

import net.blazecoding.magicpowders.item.ModItems;
import net.blazecoding.magicpowders.recipe.MagicInfuserRecipes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.common.registry.GameRegistry;

public class TileEntityMagicInfuser extends TileEntity implements IInventory {

private ItemStack infuserItemStacks[];

public int dualBurnTime;
public int currentItemBurnTime;
public int dualCookTime;

private String magicInfuserName;

public TileEntityMagicInfuser() {
	infuserItemStacks = new ItemStack[4];
	dualBurnTime = 0;
	currentItemBurnTime = 0;
	dualCookTime = 0;
}

public int getSizeInventory() {
	return infuserItemStacks.length;
}

public ItemStack getStackInSlot(int i) {
	return infuserItemStacks[i];
}

public void setInventorySlotConatainers(int i, ItemStack itemstack) {

	infuserItemStacks[i] = itemstack;

	if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
		itemstack.stackSize = getInventoryStackLimit();
	}

}

public void readFromNBT(NBTTagCompound nbttagcompound) {

	super.readFromNBT(nbttagcompound);
	NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
	infuserItemStacks = new ItemStack[getSizeInventory()];

	for (int i = 0; i < nbttaglist.tagCount(); i++) {

		NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);
		byte byte0 = nbttagcompound1.getByte("Slot");

		if (byte0 >= 0 && byte0 < infuserItemStacks.length) {
			infuserItemStacks[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
		}

	}

	dualBurnTime = nbttagcompound.getShort("BurnTime");
	dualCookTime = nbttagcompound.getShort("CookTime");
	currentItemBurnTime = getItemBurnTime(infuserItemStacks[1]);

}

public void writeToNBT(NBTTagCompound nbttagcompound) {
	super.writeToNBT(nbttagcompound);
	nbttagcompound.setShort("BurnTime", (short) dualBurnTime);
	nbttagcompound.setShort("CookTime", (short) dualCookTime);
	NBTTagList nbttaglist = new NBTTagList();

	for (int i = 0; i < infuserItemStacks.length; i++) {

		if (infuserItemStacks[i] != null) {

			NBTTagCompound nbttagcompound1 = new NBTTagCompound();
			nbttagcompound1.setByte("Slot", (byte) i);
			infuserItemStacks[i].writeToNBT(nbttagcompound1);
			nbttaglist.appendTag(nbttagcompound1);

		}

	}
	nbttagcompound.setTag("Items", nbttaglist);
}

public int getInventoryStackLimit() {
	return 64;
}

public int getCookProgressScaled(int i) {
	return (dualCookTime * i) / 200;
}

public int getBurnTimeRemainingScaled(int i) {

	if (currentItemBurnTime == 0) {
		currentItemBurnTime = 200;
	}

	return (dualBurnTime * i) / currentItemBurnTime;

}

public boolean isBurning() {
	return dualBurnTime > 0;
}

public void updateEntity() {

	boolean flag = dualBurnTime > 0;
	boolean flag1 = false;

	if (dualBurnTime > 0) {
		dualBurnTime--;
	}

	if (!worldObj.isRemote) {

		if (dualBurnTime == 0 && canSmelt()) {

			currentItemBurnTime = dualBurnTime = getItemBurnTime(infuserItemStacks[2]);

			if (dualBurnTime > 0) {

				flag1 = true;

				if (infuserItemStacks[2] != null) {

					if (infuserItemStacks[2].stackSize == 0) {

						infuserItemStacks[2] = new ItemStack(infuserItemStacks[2].getItem().setFull3D());

					} else {

						infuserItemStacks[2].stackSize--;

					}

					if (infuserItemStacks[2].stackSize == 0) {
						infuserItemStacks[2] = null;
					}

				}

			}

		}

		if (isBurning() && canSmelt()) {

			dualCookTime++;

			if (dualCookTime == 200) {

				dualCookTime = 0;
				smeltItem();
				flag1 = true;

			}

		} else {

			dualCookTime = 0;

		}

		if (flag != (dualBurnTime > 0)) {
			flag1 = true;
		}

	}

	if (flag1) {
		onInventoryChanged();
	}

}

private boolean canSmelt() {

	if (infuserItemStacks[0] == null || infuserItemStacks[1] == null) {
		return false;
	}

	ItemStack itemstack = MagicInfuserRecipes.getSmeltingResult(infuserItemStacks[0].getItem().itemID, infuserItemStacks[1].getItem().itemID);

	if (itemstack == null) {
		return false;
	}

	if (infuserItemStacks[3] == null) {
		return true;
	}

	if (!infuserItemStacks[3].isItemEqual(itemstack)) {
		return false;
	}

	if (infuserItemStacks[3].stackSize < getInventoryStackLimit() && infuserItemStacks[3].stackSize < infuserItemStacks[3].getMaxStackSize()) {
		return true;

	} else {
		return infuserItemStacks[3].stackSize < itemstack.getMaxStackSize();
	}

}

public void smeltItem() {

	if (!canSmelt()) {
		return;
	}

	ItemStack itemstack = MagicInfuserRecipes.getSmeltingResult(infuserItemStacks[0].getItem().itemID, infuserItemStacks[1].getItem().itemID);

	if (infuserItemStacks[3] == null) {

		infuserItemStacks[3] = itemstack.copy();

	} else if (infuserItemStacks[3].itemID == itemstack.itemID) {
		infuserItemStacks[3].stackSize++;
	}

	for (int i = 0; i < 2; i++) {

		if (infuserItemStacks[i].stackSize <= 0) {
			infuserItemStacks[i] = new ItemStack(infuserItemStacks[i].getItem().setFull3D());

		} else {

			infuserItemStacks[i].stackSize--;
		}

		if (infuserItemStacks[i].stackSize <= 0) {
			infuserItemStacks[i] = null;
		}

	}

}

private int getItemBurnTime(ItemStack itemstack) {

	if (itemstack == null) {
		return 0;
	}

	int i = itemstack.getItem().itemID;

	if (i == ModItems.magicDust.itemID) {

		return 2000;

	} else {
		return GameRegistry.getFuelValue(itemstack);
	}

}

public boolean isUseableByPlayer(EntityPlayer entityplayer) {

	if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) {
		return false;
	} else {
		return entityplayer.getDistanceSq((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D;
	}

}

public ItemStack decrStackSize(int i, int j) {

	if (infuserItemStacks[i] != null) {

		if (infuserItemStacks[i].stackSize <= j) {

			ItemStack itemstack = infuserItemStacks[i];
			infuserItemStacks[i] = null;
			return itemstack;

		}

		ItemStack itemstack1 = infuserItemStacks[i].splitStack(j);

		if (infuserItemStacks[i].stackSize == 0) {
			infuserItemStacks[i] = null;
		}

		return itemstack1;

	} else {
		return null;
	}

}

public void setInventorySlotContents(int i, ItemStack itemstack) {

	infuserItemStacks[i] = itemstack;

	if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
		itemstack.stackSize = getInventoryStackLimit();
	}

}

public String getInvName() {
	return "container.infuser";
}

public void openChest() {
}

public void closeChest() {
}

public ItemStack getStackInSlotOnClosing(int i) {

	if (infuserItemStacks[i] != null) {

		ItemStack itemstack = infuserItemStacks[i];
		infuserItemStacks[i] = null;
		return itemstack;

	} else {

		return null;

	}

}

public boolean isInvNameLocalized() {
	return (this.magicInfuserName != null) && (this.magicInfuserName.length() > 0);
}

public void setCustomName(String name) {
	this.magicInfuserName = name;
}

public boolean isItemValidForSlot(int i, ItemStack itemstack) {
	return false;
}

}

 

Custom Container Class

package net.blazecoding.magicpowders.inventory;

import net.blazecoding.magicpowders.inventory.slot.SlotMagicInfuser;
import net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser;
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;

public class ContainerMagicInfuser extends Container {

private TileEntityMagicInfuser infuser;

private int dualCookTime;
private int dualBurnTime;
private int lastItemBurnTime;

public ContainerMagicInfuser(InventoryPlayer inventoryplayer, TileEntityMagicInfuser tileentityInputFurnace) {

	dualCookTime = 0;
	dualBurnTime = 0;
	lastItemBurnTime = 0;

	infuser = tileentityInputFurnace;

	this.addSlotToContainer(new Slot(tileentityInputFurnace, 0, 38, 17));
	this.addSlotToContainer(new Slot(tileentityInputFurnace, 1, 74, 17));
	this.addSlotToContainer(new Slot(tileentityInputFurnace, 2, 56, 53));
	this.addSlotToContainer(new SlotMagicInfuser(inventoryplayer.player, tileentityInputFurnace, 3, 116, 35));

	for (int i = 0; i < 3; i++) {

		for (int k = 0; k < 9; k++) {
			this.addSlotToContainer(new Slot(inventoryplayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18));
		}

	}

	for (int j = 0; j < 9; j++) {
		this.addSlotToContainer(new Slot(inventoryplayer, j, 8 + j * 18, 142));
	}

}

public void addCraftingToCrafters(ICrafting par1ICrafting) {
	super.addCraftingToCrafters(par1ICrafting);
	par1ICrafting.sendProgressBarUpdate(this, 0, this.infuser.dualCookTime);
	par1ICrafting.sendProgressBarUpdate(this, 1, this.infuser.dualBurnTime);
	par1ICrafting.sendProgressBarUpdate(this, 2, this.infuser.currentItemBurnTime);
}

public void detectAndSendChanges() {
	super.detectAndSendChanges();

	for (int var1 = 0; var1 < this.crafters.size(); ++var1) {

		ICrafting var2 = (ICrafting) this.crafters.get(var1);

		if (this.dualCookTime != this.infuser.dualCookTime) {
			var2.sendProgressBarUpdate(this, 0, this.infuser.dualCookTime);
		}

		if (this.dualBurnTime != this.infuser.dualBurnTime) {
			var2.sendProgressBarUpdate(this, 1, this.infuser.dualBurnTime);
		}

		if (this.lastItemBurnTime != this.infuser.currentItemBurnTime) {
			var2.sendProgressBarUpdate(this, 2, this.infuser.currentItemBurnTime);
		}

	}

	this.dualCookTime = this.infuser.dualCookTime;
	this.dualBurnTime = this.infuser.dualBurnTime;
	this.lastItemBurnTime = this.infuser.currentItemBurnTime;

}

public void updateProgressBar(int i, int j) {

	if (i == 0) {
		infuser.dualCookTime = j;
	}

	if (i == 1) {
		infuser.dualBurnTime = j;
	}

	if (i == 2) {
		infuser.currentItemBurnTime = j;
	}

}

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 == 2) {

			if (!mergeItemStack(itemstack1, 3, 39, true)) {
				return null;
			}

		} else if (par2 >= 3 && par2 < 30) {

			if (!mergeItemStack(itemstack1, 30, 39, false)) {
				return null;
			}

		} else if (par2 >= 30 && par2 < 39) {

			if (!mergeItemStack(itemstack1, 3, 30, false)) {
				return null;
			}

		} else if (!mergeItemStack(itemstack1, 3, 39, 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;
}

public boolean canInteractWith(EntityPlayer entityplayer) {
	return infuser.isUseableByPlayer(entityplayer);
}
}

 

Custom FurnaceSlot class

package net.blazecoding.magicpowders.inventory.slot;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class SlotMagicInfuser extends Slot {

public SlotMagicInfuser(EntityPlayer entityplayer, IInventory iinventory, int i, int j, int k) {
	super(iinventory, i, j, k);
}

public boolean isItemValid(ItemStack itemstack) {
	return false;
}

public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) {

	this.onCrafting(par2ItemStack);
	super.onPickupFromSlot(par1EntityPlayer, par2ItemStack);

}
}

Link to comment
Share on other sites

Now that I look at it I also get this error in the Console:

 

aug 25, 2013 10:26:18 PM net.minecraft.launchwrapper.LogWrapper log

INFO: Using tweak class name cpw.mods.fml.common.launcher.FMLTweaker

2013-08-25 22:26:18 [iNFO] [ForgeModLoader] Forge Mod Loader version 6.2.35.804 for Minecraft 1.6.2 loading

2013-08-25 22:26:18 [iNFO] [ForgeModLoader] Java is Java HotSpot 64-Bit Server VM, version 1.7.0_25, running on Windows 7:amd64:6.1, installed at C:\Program Files\Java\jre7

2013-08-25 22:26:18 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

2013-08-25 22:26:18 [iNFO] [sTDOUT] Loaded 39 rules from AccessTransformer config file fml_at.cfg

2013-08-25 22:26:18 [iNFO] [sTDOUT] Loaded 107 rules from AccessTransformer config file forge_at.cfg

2013-08-25 22:26:19 [sEVERE] [ForgeModLoader] The binary patch set is missing. Either you are in a development environment, or things are not going to work!

2013-08-25 22:26:20 [iNFO] [ForgeModLoader] Launching wrapped minecraft

2013-08-25 22:26:21 [iNFO] [Minecraft-Client] Setting user: Xetosphere

2013-08-25 22:26:21 [iNFO] [Minecraft-Client] (Session ID is null)

2013-08-25 22:26:23 [iNFO] [Minecraft-Client] LWJGL Version: 2.9.0

2013-08-25 22:26:23 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default

2013-08-25 22:26:25 [iNFO] [sTDOUT]

2013-08-25 22:26:25 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-08-25 22:26:25 [iNFO] [MinecraftForge] Attempting early MinecraftForge initialization

2013-08-25 22:26:25 [iNFO] [sTDOUT] MinecraftForge v9.10.0.804 Initialized

2013-08-25 22:26:25 [iNFO] [ForgeModLoader] MinecraftForge v9.10.0.804 Initialized

2013-08-25 22:26:25 [iNFO] [sTDOUT] Replaced 101 ore recipies

2013-08-25 22:26:25 [iNFO] [MinecraftForge] Completed early MinecraftForge initialization

2013-08-25 22:26:25 [iNFO] [ForgeModLoader] Reading custom logging properties from C:\Development\forge\mcp\jars\config\logging.properties

2013-08-25 22:26:25 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL

2013-08-25 22:26:25 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-08-25 22:26:25 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-08-25 22:26:25 [iNFO] [ForgeModLoader] Searching C:\Development\forge\mcp\jars\mods for mods

2013-08-25 22:26:25 [iNFO] [sTDOUT] OpenAL initialized.

2013-08-25 22:26:25 [iNFO] [sTDOUT]

2013-08-25 22:26:29 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 5 mods to load

2013-08-25 22:26:29 [iNFO] [mcp] Activating mod mcp

2013-08-25 22:26:29 [iNFO] [FML] Activating mod FML

2013-08-25 22:26:29 [iNFO] [Forge] Activating mod Forge

2013-08-25 22:26:29 [iNFO] [MP] Activating mod MP

2013-08-25 22:26:29 [iNFO] [Tales] Activating mod Tales

2013-08-25 22:26:29 [WARNING] [Magic Powders] Mod Magic Powders is missing a pack.mcmeta file, things may not work well

2013-08-25 22:26:29 [WARNING] [Tales] Mod Tales is missing a pack.mcmeta file, things may not work well

2013-08-25 22:26:29 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Magic Powders, FMLFileResourcePack:Tales

2013-08-25 22:26:29 [iNFO] [sTDOUT]

2013-08-25 22:26:29 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-08-25 22:26:29 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-08-25 22:26:29 [iNFO] [sTDOUT]

2013-08-25 22:26:29 [iNFO] [sTDOUT]

2013-08-25 22:26:29 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-08-25 22:26:29 [iNFO] [ForgeModLoader] Registering Forge Packet Handler

2013-08-25 22:26:29 [iNFO] [ForgeModLoader] Succeeded registering Forge Packet Handler

2013-08-25 22:26:29 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-08-25 22:26:29 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-08-25 22:26:29 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0

2013-08-25 22:26:30 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/HardOakSapling.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/EnchOakLogtop.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Unable to parse animation metadata from tales:textures/blocks/EnchOakSapling.png: broken aspect ratio and not an animation

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/HardOakLogtop.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/HarpyFeather.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Tome.png

2013-08-25 22:26:31 [iNFO] [sTDOUT] OpenAL initialized.

2013-08-25 22:26:31 [iNFO] [sTDOUT]

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/DwarvenSteel.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/SinisterIngot.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Venom.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/InscribedBone.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/SandsofTime.png

2013-08-25 22:26:31 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Knife.png

2013-08-25 22:26:32 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 5 mods

2013-08-25 22:26:32 [WARNING] [Magic Powders] Mod Magic Powders is missing a pack.mcmeta file, things may not work well

2013-08-25 22:26:32 [WARNING] [Tales] Mod Tales is missing a pack.mcmeta file, things may not work well

2013-08-25 22:26:32 [iNFO] [Minecraft-Client] Reloading ResourceManager: Default, FMLFileResourcePack:Magic Powders, FMLFileResourcePack:Tales

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/HarpyFeather.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Tome.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/DwarvenSteel.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/SinisterIngot.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Venom.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/InscribedBone.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/SandsofTime.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/items/Knife.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/HardOakSapling.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/EnchOakLogtop.png

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Unable to parse animation metadata from tales:textures/blocks/EnchOakSapling.png: broken aspect ratio and not an animation

2013-08-25 22:26:32 [sEVERE] [Minecraft-Client] Using missing texture, unable to load: tales:textures/blocks/HardOakLogtop.png

2013-08-25 22:26:32 [iNFO] [sTDOUT]

2013-08-25 22:26:32 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-08-25 22:26:33 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-08-25 22:26:33 [iNFO] [sTDOUT]

2013-08-25 22:26:33 [iNFO] [sTDOUT]

2013-08-25 22:26:33 [iNFO] [sTDOUT] Starting up SoundSystem...

2013-08-25 22:26:33 [iNFO] [sTDOUT] Initializing LWJGL OpenAL

2013-08-25 22:26:33 [iNFO] [sTDOUT]    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

2013-08-25 22:26:34 [iNFO] [sTDOUT] OpenAL initialized.

2013-08-25 22:26:34 [iNFO] [sTDOUT]

2013-08-25 22:26:35 [sEVERE] [Minecraft-Client] Realms: Invalid session id

2013-08-25 22:26:38 [iNFO] [Minecraft-Server] Starting integrated minecraft server version 1.6.2

2013-08-25 22:26:38 [iNFO] [Minecraft-Server] Generating keypair

2013-08-25 22:26:38 [iNFO] [ForgeModLoader] Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@5089aad7)

2013-08-25 22:26:38 [iNFO] [ForgeModLoader] Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@5089aad7)

2013-08-25 22:26:38 [iNFO] [ForgeModLoader] Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@5089aad7)

2013-08-25 22:26:38 [iNFO] [Minecraft-Server] Preparing start region for level 0

2013-08-25 22:26:39 [iNFO] [Minecraft-Server] Preparing spawn area: 79%

2013-08-25 22:26:40 [iNFO] [sTDOUT] loading single player

2013-08-25 22:26:40 [iNFO] [Minecraft-Server] Xetosphere[/127.0.0.1:0] logged in with entity id 15 at (-529.0626161516961, 4.0, -216.45339028413898)

2013-08-25 22:26:40 [iNFO] [Minecraft-Server] Xetosphere joined the game

2013-08-25 22:26:42 [iNFO] [sTDOUT] Setting up custom skins

2013-08-25 22:27:25 [sEVERE] [ForgeModLoader] A TileEntity type net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser has throw an exception trying to write state. It will not persist. Report this to the mod author

java.lang.RuntimeException: class net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser is missing a mapping! This is a bug!

at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:108)

at net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser.writeToNBT(TileEntityMagicInfuser.java:72)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:317)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:127)

at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232)

at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:284)

at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:897)

at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:358)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:591)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

2013-08-25 22:27:38 [iNFO] [Minecraft-Server] Saving and pausing game...

2013-08-25 22:27:38 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld

2013-08-25 22:27:38 [sEVERE] [ForgeModLoader] A TileEntity type net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser has throw an exception trying to write state. It will not persist. Report this to the mod author

java.lang.RuntimeException: class net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser is missing a mapping! This is a bug!

at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:108)

at net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser.writeToNBT(TileEntityMagicInfuser.java:72)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:317)

at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:127)

at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:232)

at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:284)

at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:897)

at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:358)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:124)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)

at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)

2013-08-25 22:27:38 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether

2013-08-25 22:27:38 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Stopping server

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Saving players

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Xetosphere left the game

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Saving worlds

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether

2013-08-25 22:27:39 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End

2013-08-25 22:27:39 [iNFO] [ForgeModLoader] Unloading dimension 0

2013-08-25 22:27:39 [iNFO] [ForgeModLoader] Unloading dimension -1

2013-08-25 22:27:39 [iNFO] [ForgeModLoader] Unloading dimension 1

2013-08-25 22:27:40 [iNFO] [Minecraft-Client] Stopping!

2013-08-25 22:27:40 [iNFO] [sTDOUT]

2013-08-25 22:27:40 [iNFO] [sTDOUT] SoundSystem shutting down...

2013-08-25 22:27:40 [iNFO] [sTDOUT]    Author: Paul Lamb, www.paulscode.com

2013-08-25 22:27:40 [iNFO] [sTDOUT]

 

 

 

Don't care about the missing textures, that is a mod that someone else is working on.

Link to comment
Share on other sites

I want a "furnace" with two input and a fuel input.

 

And here is where I get the recipes:

 

package net.blazecoding.magicpowders.recipe;

import net.blazecoding.magicpowders.item.ModItems;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class MagicInfuserRecipes {

public MagicInfuserRecipes() {
}

public static ItemStack getInfusingResult(int i, int j, int k, int l) {
	return getOutput(i, j, k, l);
}

private static ItemStack getOutput(int i, int j, int k, int l) {

	if (i == ModItems.magicDust.itemID && k == 0 && j == Item.ingotIron.itemID && l == 0 || i == Item.ingotIron.itemID && k == 0 && j == ModItems.magicDust.itemID && l == 0) {
		return new ItemStack(ModItems.magicIngot, 1, 0);
	}

	if (i == ModItems.magicDust.itemID && k == 1 && j == Item.ingotIron.itemID && l == 0 || i == Item.ingotIron.itemID && k == 0 && j == ModItems.magicDust.itemID && l == 1) {
		return new ItemStack(ModItems.magicIngot, 1, 1);
	}

	if (i == ModItems.magicDust.itemID && k == 2 && j == Item.ingotIron.itemID && l == 0 || i == Item.ingotIron.itemID && k == 0 && j == ModItems.magicDust.itemID && l == 2) {
		return new ItemStack(ModItems.magicIngot, 1, 2);
	}

	return null;

}

}

Link to comment
Share on other sites

The most obvious problem I saw by skim reading is that you are saving the itemstacks in the slots to "Items" and "Slots". The Vanilla furnace code uses these names and, since the Vanilla furnace has nothing in them, they are returning null. Try changing these names to make them unique (perhaps add your mod ID or just change the names).

Link to comment
Share on other sites

The most obvious problem I saw by skim reading is that you are saving the itemstacks in the slots to "Items" and "Slots". The Vanilla furnace code uses these names and, since the Vanilla furnace has nothing in them, they are returning null. Try changing these names to make them unique (perhaps add your mod ID or just change the names).

 

I would be inclined to agree with you on this one.

 

@OP: Try changing them to "MagicInfuserItems" and "MagicInfuserSlots". Or you could do as MrrGingerNinja says and use your modid. But i would personally would do something more like: "*Modid*MagicInfuserItems" and "*Modid*MagicInfuserSlots" ( where *Modid* is your mod's modid ).

 

But really, it is up to you.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

The most obvious problem I saw by skim reading is that you are saving the itemstacks in the slots to "Items" and "Slots". The Vanilla furnace code uses these names and, since the Vanilla furnace has nothing in them, they are returning null. Try changing these names to make them unique (perhaps add your mod ID or just change the names).

 

I would be inclined to agree with you on this one.

 

@OP: Try changing them to "MagicInfuserItems" and "MagicInfuserSlots". Or you could do as MrrGingerNinja says and use your modid. But i would personally would do something more like: "*Modid*MagicInfuserItems" and "*Modid*MagicInfuserSlots" ( where *Modid* is your mod's modid ).

 

But really, it is up to you.

 

i donot agree lol ...

 

iv made a 2 input furnace  awhile back .. and i dotn see this working at all .. your recipes..

in my eyes wont work in this way you need to make the recipes for 2 inputs also..

 

and as for the rest the tile entity is n your own styl not perfectly sure if that is perfectly working or not i think it might when you got the recipe set up correctly ..

Link to comment
Share on other sites

The recipes works without any problems, it takes information from both slots and checks if they are the item they need to be. The only thing that is not working is the writing to NBT, it gives an error on the super.writeToNBT(nbttagcompound); line in the TileEntity.

 

BTW: Changing the names did nothing.

Link to comment
Share on other sites

this is what i use in my tile entity:

 

 

public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.readFromNBT(par1NBTTagCompound);
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items");
        this.combmachineItemStacks = new ItemStack[this.getSizeInventory()];

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
            byte b0 = nbttagcompound1.getByte("Slot");

            if (b0 >= 0 && b0 < this.combmachineItemStacks.length)
            {
                this.combmachineItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
            }
        }

        this.combmachineCombTime = par1NBTTagCompound.getShort("CombTime");
        this.combmachineCombDCurTime = par1NBTTagCompound.getShort("CombDurTime");
        this.currentItemCombTime = getItemCombTime(this.combmachineItemStacks[ints.FUELSLOT]);
        //this.ReduceTime = getItemReduceTime(this.combmachineItemStacks[ints.UPGRADESLOT]);

        if (par1NBTTagCompound.hasKey("Combiner Machine"))
        {
            this.field_94130_e = par1NBTTagCompound.getString("Combiner Machine");
        }
    }

    public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    {
        super.writeToNBT(par1NBTTagCompound);
        par1NBTTagCompound.setShort("CombTime", (short)this.combmachineCombTime);
        par1NBTTagCompound.setShort("CombDurTime", (short)this.combmachineCombDCurTime);
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 0; i < this.combmachineItemStacks.length; ++i)
        {
            if (this.combmachineItemStacks[i] != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                nbttagcompound1.setByte("Slot", (byte)i);
                this.combmachineItemStacks[i].writeToNBT(nbttagcompound1);
                nbttaglist.appendTag(nbttagcompound1);
            }
        }

        par1NBTTagCompound.setTag("Items", nbttaglist);

        if (this.isInvNameLocalized())
        {
            par1NBTTagCompound.setString("Combiner Machine", this.field_94130_e);
        }
    }

 

 

this worked for mine :) ..

Link to comment
Share on other sites

  • 2 months later...

Sorry if Im late, but I had a very similar problem. In your log file it says this:

java.lang.RuntimeException: class net.blazecoding.magicpowders.tileentity.TileEntityMagicInfuser is missing a mapping! This is a bug!

This means Minecraft doesn't know the save id of the Tile Entity. You need to assign it. Idk if Forge has a different way of doing it, but I added this line to the mod initiator:

TileEntity.addMapping(TileEntityFoo.class, "Foo");

The first parameter is your TileEntityClass, and the second parameter is the save game id.

 

Note: I actually didn't have a problem, but when I see a stack trace in the Eclipse console, I know somethings wrong

Link to comment
Share on other sites

Yeah Forge has a 'different' way of doing it:

GameRegistry.registerTileEntity(Class<? extends TileEntity>, String id);

 

Which calls in the end the same method you mentioned PisuCat.

public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
{
     TileEntity.addMapping(tileEntityClass, id);
}

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.