Jump to content

[1.7.10]Double furnace causes unexpected error


TheFakeMarkTwain

Recommended Posts

Hi, I made a double furnace in an older version of MCF and now I'm updating it, however, I get an "unexpected error" (null pointer) when the onBlockActivated() method is called. Help?

 

BlockSmelter

package blfngl.rpg.block;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import blfngl.rpg.BlfRPG;
import blfngl.rpg.tileentity.TileEntitySmelter;

public class BlockSmelter extends BlockContainer
{
public BlockSmelter()
{
	super(Material.rock);
}

@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
	return new TileEntitySmelter();
}

@Override
public boolean onBlockActivated(World world, int posX, int posY, int posZ, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
	TileEntitySmelter tileEntity = (TileEntitySmelter) world.getTileEntity(posX, posY, posZ);

	if (tileEntity != null)
	{
		player.openGui(BlfRPG.instance, BlfRPG.GUI_SMELTER_ID, world, posX, posY, posZ);
	}

	return true;
}
}

 

 

TileEntitySmelter

package blfngl.rpg.tileentity;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import blfngl.rpg.player.crafting.RecipesSmelter;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class TileEntitySmelter extends TileEntity implements IInventory
{
private ItemStack[] inventory = new ItemStack[4];

public static final int INGOT_SLOT_1_INDEX = 0;
public static final int INGOT_SLOT_2_INDEX = 1;
public static final int FUEL_INVENTORY_INDEX = 2;
public static final int OUTPUT_INVENTORY_INDEX = 3;

public int furnaceBurnTime = 0;
public int currentItemBurnTime = 0;
public int furnaceCookTime = 0;

public String customName;

@Override
public int getSizeInventory()
{
	return this.inventory.length;
}

@Override
public int getInventoryStackLimit()
{
	return 64;
}

@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
	return true;
}


@Override
public ItemStack getStackInSlot(int slot)
{
	return this.inventory[slot];
}

@SuppressWarnings("null")
@Override
public ItemStack decrStackSize(int slot, int amount)
{
	ItemStack itemStack = getStackInSlot(slot);
	if (itemStack != null)
	{
		setInventorySlotContents(slot, null);
	}

	else
	{
		itemStack = itemStack.splitStack(amount);
		if (itemStack.stackSize == 0)
		{
			setInventorySlotContents(slot, null);
		}
	}

	return itemStack;
}

@Override
public ItemStack getStackInSlotOnClosing(int slot)
{
	ItemStack itemStack = getStackInSlot(slot);
	if (itemStack != null)
	{
		setInventorySlotContents(slot, null);
	}

	return itemStack;
}

@Override
public void setInventorySlotContents(int slot, ItemStack itemStack)
{
	this.inventory[slot] = itemStack;
	if (itemStack != null && itemStack.stackSize > getInventoryStackLimit())
	{
		itemStack.stackSize = getInventoryStackLimit();
	}
}

@Override
public void readFromNBT(NBTTagCompound nbtTagCompound)
{
	super.readFromNBT(nbtTagCompound);
	NBTTagList tagList = nbtTagCompound.getTagList("Items", nbtTagCompound.getId());
	this.inventory = new ItemStack[this.getSizeInventory()];

	for (int i = 0; i < tagList.tagCount(); ++i)
	{
		NBTTagCompound tagCompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
		byte slot = tagCompound.getByte("Slot");
		if (slot >= 0 && slot < inventory.length)
		{
			this.inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
		}
	}

	this.furnaceBurnTime = nbtTagCompound.getShort("BurnTime");
	this.furnaceCookTime = nbtTagCompound.getShort("CookTime");
	this.currentItemBurnTime = getItemBurnTime(inventory[1]);

	if (nbtTagCompound.hasKey("CustomName", )
	{
		customName = nbtTagCompound.getString("CustomName");
	}
}

@Override
public void writeToNBT(NBTTagCompound nbtTagCompound)
{
	super.writeToNBT(nbtTagCompound);
	nbtTagCompound.setShort("BurnTime", (short) this.furnaceBurnTime);
	nbtTagCompound.setShort("CookTime", (short) this.furnaceCookTime);
	NBTTagList tagList = new NBTTagList();

	for (int currentIndex = 0; currentIndex < this.inventory.length; ++currentIndex)
	{
		if (this.inventory[currentIndex] != null)
		{
			NBTTagCompound tagCompound = new NBTTagCompound();
			tagCompound.setByte("Slot", (byte) currentIndex);
			this.inventory[currentIndex].writeToNBT(tagCompound);
			tagList.appendTag(tagCompound);
		}
	}

	nbtTagCompound.setTag("Items", tagList);

	if (this.hasCustomInventoryName())
	{
		nbtTagCompound.setString("CustomName", customName);
	}
}

@Override
public void updateEntity()
{
	boolean flag = this.furnaceBurnTime > 0;
	boolean flag1 = false;

	if (this.furnaceBurnTime > 0)
	{
		--this.furnaceBurnTime;
	}

	if (!this.worldObj.isRemote)
	{
		if (this.furnaceBurnTime == 0)
		{
			if (this.canDoubleSmelt())
			{
				this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.inventory[2]);

				if (this.furnaceBurnTime > 0)
				{
					flag1 = true;

					if (this.inventory[2] != null)
					{
						--this.inventory[2].stackSize;

						if (this.inventory[2].stackSize == 0)
						{
							this.inventory[2] = this.inventory[2].getItem().getContainerItem(inventory[2]);
						}
					}
				}
			}
		}

		if (this.isBurning() && this.canDoubleSmelt())
		{
			++this.furnaceCookTime;

			if (this.furnaceCookTime == 400)
			{
				this.furnaceCookTime = 0;
				this.smeltDoubleItem();
				flag1 = true;
			}
		}

		else
		{
			this.furnaceCookTime = 0;
		}

		if (flag != this.furnaceBurnTime > 0)
		{
			flag1 = true;
		}

		if (flag1)
		{
			this.markDirty();
			//BlockSmelter.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
		}
	}
}

@SideOnly(Side.CLIENT)
public int getBurnTimeRemainingScaled(int par1)
{
	if (this.currentItemBurnTime == 0)
	{
		this.currentItemBurnTime = 400;
	}

	return this.furnaceBurnTime * par1 / this.currentItemBurnTime;
}

public int getCookProgressScaled(int par1)
{
	return this.furnaceCookTime * par1 / 400;
}

public boolean isBurning()
{
	return this.furnaceBurnTime > 0;
}

private boolean canDoubleSmelt()
{
	if (this.inventory[0] == null)
	{
		return false;
	} 

	else if (this.inventory[1] == null)
	{
		return false;
	} 

	else
	{
		ItemStack itemstack = RecipesSmelter.smelting().getDoubleSmeltingResult(this.inventory[0], this.inventory[1]);

		if (itemstack == null) return false;
		if (this.inventory[0].stackSize < RecipesSmelter.smelting().getSlot1ReduceAmount(this.inventory[0]).stackSize) return false;
		if (this.inventory[1].stackSize < RecipesSmelter.smelting().getSlot2ReduceAmount(this.inventory[1]).stackSize) return false;
		if (this.inventory[3] == null) return true;
		if (!this.inventory[3].isItemEqual(itemstack)) return false;
		int result = inventory[3].stackSize + itemstack.stackSize;
		return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
	}
}

public void smeltDoubleItem()
{
	if (this.canDoubleSmelt())
	{
		ItemStack itemstack = RecipesSmelter.smelting().getDoubleSmeltingResult(this.inventory[0], this.inventory[1]);

		if (this.inventory[3] == null)
		{
			this.inventory[3] = itemstack.copy();
		}

		else if (this.inventory[3].isItemEqual(itemstack))
		{
			inventory[3].stackSize += itemstack.stackSize;
		}

		this.inventory[0].stackSize -= RecipesSmelter.smelting().getSlot1ReduceAmount(this.inventory[0]).stackSize;
		this.inventory[1].stackSize -= RecipesSmelter.smelting().getSlot2ReduceAmount(this.inventory[1]).stackSize;

		if (this.inventory[0].stackSize <= 0)
		{
			this.inventory[0] = null;
		}

		if (this.inventory[1].stackSize <= 0)
		{
			this.inventory[1] = null;
		}
	}
}

public static int getItemBurnTime(ItemStack itemStack)
{
	if (itemStack == null)
	{
		return 0;
	}

	else
	{
		Item burningItem = itemStack.getItem();
		Item item = itemStack.getItem();

		/*if (itemStack.getItem() instanceof ItemBlock) // && Block.blocksList[i] != null)
		{
			Block block = Block.blocksList[i];

			if (block == Block.woodSingleSlab)
			{
				return 15;
			}

			if (block.blockMaterial == Material.wood)
			{
				return 30;
			}
		}*/

		if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 10;
		if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 10;
		if (burningItem == Items.stick) return 5;
		if (burningItem == Items.coal) return 80;
		if (burningItem == Items.blaze_rod) return 120;
		if (burningItem == Items.lava_bucket) return 400;

		return GameRegistry.getFuelValue(itemStack);
	}
}

public static boolean isItemFuel(ItemStack itemStack)
{
	return getItemBurnTime(itemStack) > 0;
}

@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
	if (i == 3)
	{
		return false;
	}

	else
	{
		return true;
	}
}

@Override
public String getInventoryName()
{
	return "Smelter";
}

@Override
public boolean hasCustomInventoryName()
{
	return false;
}

@Override
public void openInventory() {}

@Override
public void closeInventory() {}
}

 

 

GuiHandler

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntity tileEntity = world.getTileEntity(x, y, z);

	if (ID == BlfRPG.GUI_SMELTER_ID && tileEntity != null)
	{
		System.out.println("topkek");
		return new ContainerSmelter(player.inventory, (TileEntitySmelter) tileEntity);
	}

	return null;
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
	TileEntity tileEntity = world.getTileEntity(x, y, z);

	if (ID == BlfRPG.GUI_SMELTER_ID && tileEntity != null)
	{
		System.out.println("topkek");
		return new GuiSmelter(player.inventory, (TileEntitySmelter) tileEntity);
	}

	return null;
}

 

 

ContainerSmelter

package blfngl.rpg.player.inventory;

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 blfngl.rpg.tileentity.TileEntitySmelter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ContainerSmelter extends Container
{
private TileEntitySmelter furnace;
private int lastCookTime = 0;
public int lastBurnTime = 0;
private int lastItemBurnTime = 0;

public ContainerSmelter(InventoryPlayer inventoryPlayer, TileEntitySmelter tileFurnace)
{
	this.furnace = tileFurnace;
	this.addSlotToContainer(new Slot(tileFurnace, TileEntitySmelter.INGOT_SLOT_1_INDEX, 26, 17));
	this.addSlotToContainer(new Slot(tileFurnace, TileEntitySmelter.INGOT_SLOT_2_INDEX, 64, 17));
	this.addSlotToContainer(new Slot(tileFurnace, TileEntitySmelter.FUEL_INVENTORY_INDEX, 45, 53));
	this.addSlotToContainer(new Slot(tileFurnace, TileEntitySmelter.OUTPUT_INVENTORY_INDEX, 126, 35));

	for (int invRow = 0; invRow < 3; ++invRow)
	{
		for (int invCol = 0; invCol < 9; ++invCol)
		{
			this.addSlotToContainer(new Slot(inventoryPlayer, invCol + invRow * 9 + 9, 8 + invCol * 18, 84 + invRow * 18));
		}
	}

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

@Override
public void addCraftingToCrafters(ICrafting par1ICrafting)
{
	super.addCraftingToCrafters(par1ICrafting);
	par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
	par1ICrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
	par1ICrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
}

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

	for (int i = 0; i < this.crafters.size(); ++i)
	{
		ICrafting icrafting = (ICrafting)this.crafters.get(i);

		if (this.lastCookTime != this.furnace.furnaceCookTime)
		{
			icrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime);
		}

		if (this.lastBurnTime != this.furnace.furnaceBurnTime)
		{
			icrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime);
		}

		if (this.lastItemBurnTime != this.furnace.currentItemBurnTime)
		{
			icrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime);
		}
	}

	this.lastCookTime = this.furnace.furnaceCookTime;
	this.lastBurnTime = this.furnace.furnaceBurnTime;
	this.lastItemBurnTime = this.furnace.currentItemBurnTime;
}

@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2)
{
	if (par1 == 0)
	{
		this.furnace.furnaceCookTime = par2;
	}

	if (par1 == 1)
	{
		this.furnace.furnaceBurnTime = par2;
	}

	if (par1 == 2)
	{
		this.furnace.currentItemBurnTime = par2;
	}
}

@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
	return true;
}

@Override
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int par2)
{
	return null;
}
}

 

 

Error Message

---- Minecraft Crash Report ----
// This is a token for 1 free hug. Redeem at your nearest Mojangsta: [~~HUG~~]

Time: 12/27/14 12:46 AM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:263)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at blfngl.rpg.block.BlockSmelter.onBlockActivated(BlockSmelter.java:31)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2033)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028)
at net.minecraft.client.Minecraft.run(Minecraft.java:951)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:263)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at blfngl.rpg.block.BlockSmelter.onBlockActivated(BlockSmelter.java:31)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player687'/352, l='MpServer', x=206.45, y=67.62, z=204.88]]
Chunk stats: MultiplayerChunkCache: 180, 180
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (128,64,256), Chunk: (at 0,4,0 in 8,16; contains blocks 128,0,256 to 143,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 40302 game time, 5175 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 61 total; [EntitySpider['Spider'/268, l='MpServer', x=236.00, y=12.00, z=146.06], EntitySkeleton['Skeleton'/269, l='MpServer', x=229.50, y=12.00, z=149.09], EntityCreeper['Creeper'/270, l='MpServer', x=237.53, y=25.00, z=205.88], EntityCreeper['Creeper'/271, l='MpServer', x=239.47, y=25.00, z=222.00], EntityCreeper['Creeper'/272, l='MpServer', x=239.63, y=25.00, z=217.97], EntityHorse['Horse'/147, l='MpServer', x=137.38, y=70.00, z=127.84], EntityZombie['Zombie'/149, l='MpServer', x=139.16, y=61.00, z=139.47], EntityHorse['Horse'/150, l='MpServer', x=136.72, y=69.00, z=136.81], EntityZombie['Zombie'/151, l='MpServer', x=143.50, y=48.00, z=148.91], EntityHorse['Horse'/152, l='MpServer', x=137.84, y=68.00, z=159.22], EntityCreeper['Creeper'/153, l='MpServer', x=139.47, y=40.00, z=169.00], EntityCreeper['Creeper'/154, l='MpServer', x=139.97, y=40.00, z=172.63], EntityHorse['Donkey'/155, l='MpServer', x=131.06, y=67.00, z=173.75], EntityEnderman['Enderman'/156, l='MpServer', x=129.59, y=35.00, z=226.03], EntityBat['Bat'/157, l='MpServer', x=126.94, y=38.17, z=231.93], EntitySkeleton['Skeleton'/158, l='MpServer', x=139.50, y=26.00, z=252.13], EntitySkeleton['Skeleton'/159, l='MpServer', x=132.53, y=25.00, z=252.84], EntityChicken['Chicken'/287, l='MpServer', x=241.47, y=64.00, z=142.25], EntityCreeper['Creeper'/288, l='MpServer', x=251.30, y=12.00, z=163.09], EntitySkeleton['Skeleton'/160, l='MpServer', x=142.31, y=22.00, z=251.50], EntityBat['Bat'/289, l='MpServer', x=251.84, y=15.10, z=169.50], EntitySkeleton['Skeleton'/161, l='MpServer', x=143.94, y=20.00, z=256.47], EntitySkeleton['Skeleton'/290, l='MpServer', x=255.34, y=29.00, z=175.91], EntityCreeper['Creeper'/162, l='MpServer', x=142.25, y=28.00, z=272.69], EntitySpider['Spider'/291, l='MpServer', x=242.66, y=42.00, z=249.00], EntityClientPlayerMP['Player687'/352, l='MpServer', x=206.45, y=67.62, z=204.88], EntitySpider['Spider'/172, l='MpServer', x=149.22, y=56.00, z=134.00], EntityZombie['Zombie'/173, l='MpServer', x=151.88, y=63.00, z=140.28], EntityCreeper['Creeper'/174, l='MpServer', x=154.63, y=54.00, z=140.16], EntityZombie['Zombie'/303, l='MpServer', x=263.97, y=21.00, z=188.53], EntitySkeleton['Skeleton'/175, l='MpServer', x=147.50, y=54.00, z=140.66], EntitySpider['Spider'/304, l='MpServer', x=268.54, y=21.00, z=178.02], EntitySkeleton['Skeleton'/176, l='MpServer', x=147.50, y=54.00, z=137.84], EntityCreeper['Creeper'/305, l='MpServer', x=265.91, y=21.00, z=183.16], EntitySkeleton['Skeleton'/177, l='MpServer', x=151.75, y=54.00, z=140.47], EntitySkeleton['Skeleton'/178, l='MpServer', x=144.34, y=48.00, z=149.50], EntityChicken['Chicken'/306, l='MpServer', x=264.56, y=69.00, z=182.41], EntityHorse['Donkey'/179, l='MpServer', x=157.34, y=68.00, z=149.72], EntitySkeleton['Skeleton'/180, l='MpServer', x=155.38, y=40.00, z=211.22], EntityCreeper['Creeper'/181, l='MpServer', x=151.48, y=22.60, z=254.49], EntityBat['Bat'/182, l='MpServer', x=150.61, y=23.86, z=259.13], EntitySkeleton['Skeleton'/183, l='MpServer', x=151.41, y=15.00, z=268.63], EntityBat['Bat'/184, l='MpServer', x=146.14, y=20.95, z=264.90], EntityBat['Bat'/185, l='MpServer', x=148.14, y=21.57, z=265.88], EntityHorse['Horse'/313, l='MpServer', x=283.03, y=66.00, z=152.38], EntityBat['Bat'/186, l='MpServer', x=148.00, y=19.07, z=264.16], EntityZombie['Zombie'/314, l='MpServer', x=286.88, y=45.00, z=216.53], EntitySpider['Spider'/201, l='MpServer', x=164.75, y=44.00, z=125.72], EntityCreeper['Creeper'/205, l='MpServer', x=175.47, y=43.00, z=128.44], EntityBat['Bat'/206, l='MpServer', x=161.30, y=44.26, z=128.50], EntityCreeper['Creeper'/207, l='MpServer', x=162.66, y=51.00, z=128.47], EntitySkeleton['Skeleton'/208, l='MpServer', x=174.50, y=46.00, z=156.50], EntityCreeper['Creeper'/209, l='MpServer', x=165.63, y=53.00, z=145.50], EntityZombie['Zombie'/210, l='MpServer', x=161.50, y=54.00, z=145.88], EntityBat['Bat'/211, l='MpServer', x=165.03, y=35.79, z=170.39], EntitySkeleton['Skeleton'/212, l='MpServer', x=160.38, y=39.00, z=230.75], EntityBat['Bat'/226, l='MpServer', x=189.50, y=33.10, z=150.50], EntitySkeleton['Skeleton'/227, l='MpServer', x=182.38, y=32.00, z=153.88], EntityCreeper['Creeper'/228, l='MpServer', x=183.00, y=42.00, z=234.44], EntitySkeleton['Skeleton'/242, l='MpServer', x=207.84, y=25.00, z=145.72], EntityZombie['Zombie'/243, l='MpServer', x=194.03, y=44.00, z=223.50]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2555)
at net.minecraft.client.Minecraft.run(Minecraft.java:980)
at net.minecraft.client.main.Main.main(Main.java:164)
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:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 853513480 bytes (813 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 13, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
blfrpg{v0.1} [blfRPG] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GTX 860M/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

 

Link to comment
Share on other sites

Did you register your GUI handler?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Null pointers are usually pretty easy to figure out compared to other errors. In your

onBlockActivated()

, there are a few things that could cause it (not limited to these two cases though):

[*]

world.getTileEntity()

, if

world

is null

[*]

player.openGui()

, if

 player

is null

 

Check if those are null when you run the code (using prints or your preferred method).

 

Basically, any time there is a

variable.something

, where

something

isn't static, you can potentially cause a null pointer, if

variable

is null.

 

Edit:

 

Actually, check the code inside of

NetworkRegistry.getLocalGuiContainer()

. There should be some variable that is incorrectly null inside that function. You can set a break point in that function and see exactly which line breaks when you run using debug mode. Then you can check what each variable is inside debug mode. It might also be caused by your

getClientGuiElement

returning null sometimes. Instead of just returning null, it's helpful to put some sort of notice when you reach that part of code. For example, you can put

System.err.println("something went wrong");

right before you return null.

 

 

Link to comment
Share on other sites

 

Null pointers are usually pretty easy to figure out compared to other errors. In your

onBlockActivated()

, there are a few things that could cause it (not limited to these two cases though):

[*]

world.getTileEntity()

, if

world

is null

[*]

player.openGui()

, if

 player

is null

 

Check if those are null when you run the code (using prints or your preferred method).

 

Basically, any time there is a

variable.something

, where

something

isn't static, you can potentially cause a null pointer, if

variable

is null.

 

Edit:

 

Actually, check the code inside of

NetworkRegistry.getLocalGuiContainer()

. There should be some variable that is incorrectly null inside that function. You can set a break point in that function and see exactly which line breaks when you run using debug mode. Then you can check what each variable is inside debug mode. It might also be caused by your

getClientGuiElement

returning null sometimes. Instead of just returning null, it's helpful to put some sort of notice when you reach that part of code. For example, you can put

System.err.println("something went wrong");

right before you return null.

 

So I did some debugging and the getClientGuiElement is never called, it will cut before it even gets there. It does seem to be something with getLocalGuiContainer() but I can't figure out how to fix it.

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.

Announcements



×
×
  • Create New...

Important Information

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