Jump to content

Recommended Posts

Posted

I'm working on a GUI that melts items and turns them into molten versions of the original but when ever I try to open the GUI it creates a crash in the container class...

Crash report:

[14:54:12] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 3122ms behind, skipping 62 tick(s)
[14:54:17] [server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_91]
at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.util.Util.runTask(Util.java:24) [util.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:738) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
Caused by: java.lang.NullPointerException
at net.minecraft.inventory.Slot.getStack(Slot.java:81) ~[slot.class:?]
at net.minecraft.inventory.Container.getInventory(Container.java:62) ~[Container.class:?]
at net.minecraft.inventory.Container.onCraftGuiOpened(Container.java:51) ~[Container.class:?]
at com.moreoresmod.main.container.ContainerMelter.onCraftGuiOpened(ContainerMelter.java:49) ~[ContainerMelter.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2693) ~[EntityPlayer.class:?]
at com.moreoresmod.main.block.Melter.onBlockActivated(Melter.java:100) ~[Melter.class:?]
at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:473) ~[PlayerInteractionManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processRightClickBlock(NetHandlerPlayServer.java:706) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:68) ~[CPacketPlayerTryUseItem.class:?]
at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:13) ~[CPacketPlayerTryUseItem.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_91]
at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.util.Util.runTask(Util.java:23) ~[util.class:?]
... 5 more
[14:54:17] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking player
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:785) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
Caused by: java.lang.NullPointerException
at net.minecraft.inventory.Slot.getStack(Slot.java:81) ~[slot.class:?]
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:84) ~[Container.class:?]
at com.moreoresmod.main.container.ContainerMelter.detectAndSendChanges(ContainerMelter.java:58) ~[ContainerMelter.class:?]
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:290) ~[EntityPlayerMP.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2086) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:864) ~[WorldServer.class:?]
at net.minecraft.world.World.updateEntity(World.java:2051) ~[World.class:?]
at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:666) ~[WorldServer.class:?]
at net.minecraft.world.World.updateEntities(World.java:1858) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:637) ~[WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:779) ~[MinecraftServer.class:?]
... 4 more
[14:54:17] [server thread/ERROR]: This crash report has been saved to: C:\Users\Tyler\Documents\Coding\Minecraft\forge-1.9-12.16.1.1904-mdk\run\.\crash-reports\crash-2016-05-21_14.54.17-server.txt
[14:54:17] [server thread/INFO]: Stopping server
[14:54:17] [server thread/INFO]: Saving players
[14:54:17] [server thread/INFO]: Saving worlds
[14:54:17] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[14:54:17] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: ---- Minecraft Crash Report ----
// Why did you do that?

Time: 5/21/16 2:54 PM
Description: Ticking player

java.lang.NullPointerException: Ticking player
at net.minecraft.inventory.Slot.getStack(Slot.java:81)
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:84)
at com.moreoresmod.main.container.ContainerMelter.detectAndSendChanges(ContainerMelter.java:58)
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:290)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2086)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:864)
at net.minecraft.world.World.updateEntity(World.java:2051)
at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:666)
at net.minecraft.world.World.updateEntities(World.java:1858)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:637)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:779)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532)
at java.lang.Thread.run(Unknown Source)


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

-- Head --
Stacktrace:
at net.minecraft.inventory.Slot.getStack(Slot.java:81)
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:84)
at com.moreoresmod.main.container.ContainerMelter.detectAndSendChanges(ContainerMelter.java:58)
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:290)
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2086)
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:864)
at net.minecraft.world.World.updateEntity(World.java:2051)

-- Player being ticked --
Details:
Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
Entity ID: 293
Entity Name: KingOfMiners
Entity's Exact location: -152.14, 77.00, 213.08
Entity's Block location: World: (-153,77,213), Chunk: (at 7,4,5 in -10,13; contains blocks -160,0,208 to -145,255,223), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, -0.08, 0.00
Entity's Passengers: []
Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:666)
at net.minecraft.world.World.updateEntities(World.java:1858)
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:637)

-- Affected level --
Details:
Level name: New World
All players: 1 total; [EntityPlayerMP['KingOfMiners'/293, l='New World', x=-152.14, y=77.00, z=213.08]]
Chunk stats: ServerChunkCache: 626 Drop: 0
Level seed: -3586914615813754399
Level generator: ID 00 - default, ver 1. Features enabled: true
Level generator options: 
Level spawn location: World: (-151,64,223), Chunk: (at 9,4,15 in -10,13; contains blocks -160,0,208 to -145,255,223), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 1911 game time, 1911 day time
Level dimension: 0
Level storage version: 0x04ABD - Anvil
Level weather: Rain time: 127287 (now: false), thunder time: 90567 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true
Stacktrace:
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:779)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:683)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:155)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:532)
at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
Minecraft Version: 1.9
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 609791384 bytes (581 MB) / 2114977792 bytes (2017 MB) up to 8589934592 bytes (8192 MB)
JVM Flags: 1 total; -Xmx9G
IntCache: cache: 1, tcache: 1, allocated: 12, tallocated: 94
FML: MCP 9.23 Powered by Forge 12.16.1.1907 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9-12.16.1.1907.jar) 
UCHIJAAAA	Forge{12.16.1.1907} [Minecraft Forge] (forgeSrc-1.9-12.16.1.1907.jar) 
UCHIJAAAA	MoreOresMod{1.4 beta} [MoreOresMod] (bin) 
Loaded coremods (and transformers): 
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Player Count: 1 / 8; [EntityPlayerMP['KingOfMiners'/293, l='New World', x=-152.14, y=77.00, z=213.08]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[14:54:17] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2016-05-21_14.54.17-server.txt
[14:54:17] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
[14:54:18] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[14:54:18] [server thread/INFO]: Saving chunks for level 'New World'/The End
[14:54:18] [server thread/INFO]: Saving chunks for level 'New World'/Otherlyworld
[14:54:18] [server thread/INFO] [FML]: Unloading dimension 0
[14:54:18] [server thread/INFO] [FML]: Unloading dimension -1
[14:54:18] [server thread/INFO] [FML]: Unloading dimension 1
[14:54:18] [server thread/INFO] [FML]: Unloading dimension 2
[14:54:18] [server thread/INFO] [FML]: Applying holder lookups
[14:54:18] [server thread/INFO] [FML]: Holder lookups applied
[14:54:18] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[14:54:18] [Client thread/INFO] [FML]: Server terminated.
[14:54:18] [Client Shutdown Thread/INFO]: Stopping server
[14:54:18] [Client Shutdown Thread/INFO]: Saving players
AL lib: (EE) alc_cleanup: 1 device not closed

 

Container class file:

package com.moreoresmod.main.container;

import com.moreoresmod.main.container.slot.SlotMelterFuel;
import com.moreoresmod.main.container.slot.SlotMelterOutput;

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.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class ContainerMelter extends Container {

private final IInventory tileMelter;
private int meltTime;
private int totalMeltTime;
private int melterTime;
private int currentMeltTime;

public ContainerMelter(InventoryPlayer playerInventory, IInventory melterInventory){
	this.tileMelter = melterInventory;
	this.addSlotToContainer(new Slot(melterInventory, 0, 56, 17));
	this.addSlotToContainer(new SlotMelterFuel(melterInventory, 1, 8, 53));
	this.addSlotToContainer(new SlotMelterOutput(playerInventory.player, melterInventory, 2, 116, 35));

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

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

public void onCraftGuiOpened(ICrafting listener)
    {
        super.onCraftGuiOpened(listener);
        listener.sendAllWindowProperties(this, this.tileMelter);
    }

    /**
     * Looks for changes made in the container, sends them to every listener.
     */
    public void detectAndSendChanges()
    {
        super.detectAndSendChanges();

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

            if (this.meltTime != this.tileMelter.getField(2))
            {
                icrafting.sendProgressBarUpdate(this, 2, this.tileMelter.getField(2));
            }

            if (this.melterTime != this.tileMelter.getField(0))
            {
                icrafting.sendProgressBarUpdate(this, 0, this.tileMelter.getField(0));
            }

            if (this.currentMeltTime != this.tileMelter.getField(1))
            {
                icrafting.sendProgressBarUpdate(this, 1, this.tileMelter.getField(1));
            }

            if (this.totalMeltTime != this.tileMelter.getField(3))
            {
                icrafting.sendProgressBarUpdate(this, 3, this.tileMelter.getField(3));
            }
        }

        this.meltTime = this.tileMelter.getField(2);
        this.melterTime = this.tileMelter.getField(0);
        this.currentMeltTime = this.tileMelter.getField(1);
        this.totalMeltTime = this.tileMelter.getField(3);
    }

    @SideOnly(Side.CLIENT)
    public void updateProgressBar(int id, int data)
    {
        this.tileMelter.setField(id, data);
    }

@Override
public boolean canInteractWith(EntityPlayer playerIn) {
	return this.tileMelter.isUseableByPlayer(playerIn);
}

public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
    {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (index == 2)
            {
                if (!this.mergeItemStack(itemstack1, 3, 39, true))
                {
                    return null;
                }

                slot.onSlotChange(itemstack1, itemstack);
            }
            else if (index != 1 && index != 0)
            {
                if (FurnaceRecipes.instance().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 (index >= 3 && index < 30)
                {
                    if (!this.mergeItemStack(itemstack1, 30, 39, false))
                    {
                        return null;
                    }
                }
                else if (index >= 30 && index < 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(playerIn, itemstack1);
        }

        return itemstack;
    }

}

 

Could somone please help?

Posted

Ok.

 

package com.moreoresmod.main.tileentity;

import com.moreoresmod.main.block.Melter;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerFurnace;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ItemStackHelper;
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.minecraft.util.math.MathHelper;
import net.minecraft.util.text.ITextComponent;

public class TileEntityMelter extends TileEntity implements IInventory {

private ItemStack[] melterItemStacks = new ItemStack[3];
private int melterTime;
private int currentMeltTime;
private int meltTime;
private int totalMeltTime;
private String melterCustomName;

public void update(){
	boolean flag = this.isMelting();
	boolean flag1 = false;

	if(flag){
		--this.melterTime;
	}

	if(!this.worldObj.isRemote){
		if(flag || this.melterItemStacks[1] != null && this.melterItemStacks[0] != null){
			if(!flag && this.canMelt()){
				this.currentMeltTime = this.melterTime = this.getMeltIntager(this.melterItemStacks[1]);

				if(flag){
					flag1 = true;

					if(this.melterItemStacks[1] != null){
						--this.melterItemStacks[1].stackSize;

						if(this.melterItemStacks[1].stackSize == 0){
							this.melterItemStacks[1] = this.melterItemStacks[1].getItem().getContainerItem(this.melterItemStacks[1]);
						}
					}
				}
			}

			if(flag && this.canMelt()){
				++this.meltTime;
				if(this.meltTime == this.totalMeltTime){
					this.meltTime = 0;
					this.totalMeltTime = this.getMeltTime(this.melterItemStacks[0]);
					this.meltItem();
					flag1 = true;
				}
			}else{
				this.meltTime = 0;
			}

		}else if(!flag && this.meltTime > 0){
			this.meltTime = MathHelper.clamp_int(this.meltTime - 2, 0, this.totalMeltTime);
		}

		if(flag != this.isMelting()){
			flag1 = true;
			Melter.setState(this.isMelting(), this.worldObj, this.pos);
		}
	}

	if(flag1) {
		this.markDirty();
	}
}

@Override
public String getName() {
	return this.hasCustomName() ? this.melterCustomName : "container.melter";
}

@Override
public boolean hasCustomName() {
	return this.melterCustomName != null && !this.melterCustomName.isEmpty();
}

@Override
public ITextComponent getDisplayName() {

	return null;
}

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

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

@Override
public ItemStack decrStackSize(int index, int count) {
	return ItemStackHelper.func_188382_a(this.melterItemStacks, index, count);
}

@Override
public ItemStack removeStackFromSlot(int index) {
	return ItemStackHelper.func_188383_a(this.melterItemStacks, index);
}

@Override
public void setInventorySlotContents(int index, ItemStack stack) {
	boolean flag = stack != null && stack.isItemEqual(this.melterItemStacks[index]) && ItemStack.areItemStackTagsEqual(stack, this.melterItemStacks[index]);
	if (stack != null && stack.stackSize > this.getInventoryStackLimit()){
		stack.stackSize = this.getInventoryStackLimit();
	}

	if (index == 0 && !flag){
		this.totalMeltTime = 400;
		this.meltTime = 0;
		this.markDirty();
	}
}

@Override
public int getInventoryStackLimit() {

	return 1;
}

public int getMeltTime(ItemStack stack){
	return 400;
}

@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	NBTTagList taglist = compound.getTagList("Items", 10);

	for(int i = 0; i < taglist.tagCount(); i++){
		NBTTagCompound tagcompound = taglist.getCompoundTagAt(i);
		int j = tagcompound.getByte("Slot");

		if(j >= 0 && j < this.melterItemStacks.length){
			this.melterItemStacks[j] = ItemStack.loadItemStackFromNBT(tagcompound);
		}

	}

	this.melterTime = compound.getInteger("MelterTime");
	this.meltTime = compound.getInteger("MeltTime");
	this.totalMeltTime= compound.getInteger("MeltTimeTotal");
	this.currentMeltTime = getMeltIntager(this.melterItemStacks[1]);

	if(compound.hasKey("CustomName", ){
		this.melterCustomName = compound.getString("CustomName");
	}
}

@Override
public void writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	compound.setInteger("MelterTime", this.melterTime);
	compound.setInteger("MeltTime", this.meltTime);
	compound.setInteger("MeltTimeTotal", this.totalMeltTime);
	NBTTagList nbttaglist = new NBTTagList();

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

        compound.setTag("Items", nbttaglist);

        if (this.hasCustomName())
        {
            compound.setString("CustomName", this.melterCustomName);
        }

}


@Override
public boolean isUseableByPlayer(EntityPlayer player) {

	return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}

@Override
public void openInventory(EntityPlayer player) {}

@Override
public void closeInventory(EntityPlayer player) {}

@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
	if(index == 2 && stack.getItem() == Items.bucket){
		return true;
	}else if(index == 0){
		return true;
	}else if(index == 1){
		return getMeltIntager(stack) > 0;
	}else{
		return false;
	}
}

public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn){
        return new ContainerFurnace(playerInventory, this);
    }

@Override
public int getField(int id) {
	switch (id){
		case 0:
			return this.melterTime;
		case 1:
			return this.currentMeltTime;
		case 2:
			return this.meltTime;
		case 3:
			return this.totalMeltTime;
		default:
			return 0;
	}
}

@Override
public void setField(int id, int value) {
	switch (id){
		case 0:
			this.melterTime = value;
			break;
		case 1:
			this.currentMeltTime = value;
			break;
		case 2:
			this.meltTime = value;
			break;
		case 3:
			this.totalMeltTime = value;
			break;
	}
}

@Override
public int getFieldCount() {
	return 4;
}

@Override
public void clear() {
	for(int i = 0; i < this.melterItemStacks.length; i++){
		this.melterItemStacks[i] = null;
	}
}

public void setCustomInventoryName(String customName)
    {
        this.melterCustomName = customName;
    }

public boolean isMelting() {
	return this.melterTime > 0;
}

public static boolean isBurning(IInventory inventory){
	return inventory.getField(0) > 0;
}

public static int getMeltIntager(ItemStack stack){
	if(stack == null){
		return 0;
	}else{
		Item item = stack.getItem();

		if (item == Items.coal){
			return 10000;
		}else{
			return 0;
		}


	}
}

private boolean canMelt(){
	if(this.melterItemStacks[0] == null){
		return false;
	}else{
		ItemStack stack = MelterRecipes.instance().getMeltResult(this.melterItemStacks[0]);
		if(stack == null) return false;
		if(!this.melterItemStacks[2].isItemEqual(new ItemStack(Items.bucket))) return false;
		int result = melterItemStacks[2].stackSize + stack.stackSize;;
		return result <= getInventoryStackLimit() && result <= this.melterItemStacks[2].getMaxStackSize();
	}
}

public void meltItem(){
	if (this.canMelt()){
		ItemStack stack = MelterRecipes.instance().getMeltResult(this.melterItemStacks[0]);
		if(this.melterItemStacks[2] == null){
			this.melterItemStacks[2] = stack.copy();
		}

		this.melterItemStacks[0].stackSize--;

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

	}
}
}

 

package com.moreoresmod.main.block;

import java.util.Random;

import com.moreoresmod.main.GuiHandler;
import com.moreoresmod.main.MoreOresModMain;
import com.moreoresmod.main.init.MoreOresModBlocks;
import com.moreoresmod.main.tileentity.TileEntityMelter;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Mirror;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class Melter extends BlockContainer {

public static final PropertyDirection FACING = BlockHorizontal.FACING;
private final boolean isMelting;
private static boolean keepInventory;

public Melter(boolean active) {
	super(Material.rock);
	this.isMelting = active;
}

@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	return Item.getItemFromBlock(MoreOresModBlocks.melter);
}

@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
	this.setDefaultFacing(worldIn, pos, state);
}

private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!worldIn.isRemote)
        {
            IBlockState iblockstate = worldIn.getBlockState(pos.north());
            IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
            IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
            IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
            EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);

            if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
            {
                enumfacing = EnumFacing.SOUTH;
            }
            else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
            {
                enumfacing = EnumFacing.NORTH;
            }
            else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
            {
                enumfacing = EnumFacing.EAST;
            }
            else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
            {
                enumfacing = EnumFacing.WEST;
            }

            worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
        }
    }

@Override
public void randomDisplayTick(IBlockState worldIn, World pos, BlockPos state, Random rand) {
	if(this.isMelting){
		EnumFacing efacing = (EnumFacing)worldIn.getValue(FACING);
	}
}

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
	if(worldIn.isRemote){
		return true;
	}else{
		TileEntity te = worldIn.getTileEntity(pos);
		if(te instanceof TileEntityMelter){
			playerIn.openGui(MoreOresModMain.instance, GuiHandler.MELTER_ID, worldIn, 0, 0, 0);
		}
		return true;
	}
}

public static void setState(boolean active, World worldIn, BlockPos pos)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        TileEntity tileentity = worldIn.getTileEntity(pos);
        keepInventory = true;

        if (active)
        {
            worldIn.setBlockState(pos, MoreOresModBlocks.melter_active.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
            worldIn.setBlockState(pos, MoreOresModBlocks.melter_active.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        }
        else
        {
            worldIn.setBlockState(pos, MoreOresModBlocks.melter.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
            worldIn.setBlockState(pos, MoreOresModBlocks.melter.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3);
        }

        keepInventory = false;

        if (tileentity != null)
        {
            tileentity.validate();
            worldIn.setTileEntity(pos, tileentity);
        }
    }

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
	return new TileEntityMelter();
}

@Override
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
	return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
}

@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
	worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing().getOpposite()), 2);

        if (stack.hasDisplayName())
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityMelter)
            {
                ((TileEntityMelter)tileentity).setCustomInventoryName(stack.getDisplayName());
            }
        }
}

public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
    {
        if (!keepInventory)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityFurnace)
            {
                InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityFurnace)tileentity);
                worldIn.updateComparatorOutputLevel(pos, this);
            }
        }

        super.breakBlock(worldIn, pos, state);
    }

public boolean hasComparatorInputOverride(IBlockState state)
    {
        return true;
    }

    public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos)
    {
        return Container.calcRedstone(worldIn.getTileEntity(pos));
    }
    
    public EnumBlockRenderType getRenderType(IBlockState state)
    {
        return EnumBlockRenderType.MODEL;
    }

    public IBlockState getStateFromMeta(int meta)
    {
        EnumFacing enumfacing = EnumFacing.getFront(meta);

        if (enumfacing.getAxis() == EnumFacing.Axis.Y)
        {
            enumfacing = EnumFacing.NORTH;
        }

        return this.getDefaultState().withProperty(FACING, enumfacing);
    }

    public int getMetaFromState(IBlockState state)
    {
        return ((EnumFacing)state.getValue(FACING)).getIndex();
    }

    public IBlockState withRotation(IBlockState state, Rotation rot)
    {
        return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
    }

    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
    {
        return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {FACING});
    }

}

Posted

Oh, sorry.

 

GuiHandler:

package com.moreoresmod.main;

import com.moreoresmod.main.container.ContainerMelter;
import com.moreoresmod.main.container.ContainerParidoxemer;
import com.moreoresmod.main.gui.GuiMelter;
import com.moreoresmod.main.gui.GuiParidoxemer;
import com.moreoresmod.main.tileentity.TileEntityMelter;
import com.moreoresmod.main.tileentity.TileEntityParidoxemer;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;

public class GuiHandler implements IGuiHandler {

public static final int PARIDOXEMER_ID = 0;
public static final int MELTER_ID = 1;

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if(ID == PARIDOXEMER_ID){
		return new ContainerParidoxemer(player.inventory, (TileEntityParidoxemer) world.getTileEntity(new BlockPos(x, y, z)));
	}else if(ID == MELTER_ID){
		return new ContainerMelter(player.inventory, (TileEntityMelter) world.getTileEntity(new BlockPos(x, y, z)));
	}else{
		return null;
	}
}

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
	if(ID == PARIDOXEMER_ID){
		return new GuiParidoxemer(player.inventory, (TileEntityParidoxemer) world.getTileEntity(new BlockPos(x, y, z)));
	}else if(ID == MELTER_ID){ 
		return new GuiMelter(player.inventory, (TileEntityMelter) world.getTileEntity(new BlockPos(x, y, z)));
	}else{
		return null;
	}
}
}

Posted

Thanks, I fixed it but im getting another crash, could you help with this one?

 

net.minecraft.util.ReportedException: Rendering screen
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1174) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1135) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:401) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_91]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_91]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.NullPointerException
at com.moreoresmod.main.gui.GuiMelter.drawGuiContainerForegroundLayer(GuiMelter.java:27) ~[GuiMelter.class:?]
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:136) ~[GuiContainer.class:?]
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:356) ~[ForgeHooksClient.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1147) ~[EntityRenderer.class:?]
... 15 more
[15:29:56] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: ---- Minecraft Crash Report ----
// But it works on my machine.

Time: 5/21/16 3:29 PM
Description: Rendering screen

java.lang.NullPointerException: Rendering screen
at com.moreoresmod.main.gui.GuiMelter.drawGuiContainerForegroundLayer(GuiMelter.java:27)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:136)
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:356)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1147)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1135)
at net.minecraft.client.Minecraft.run(Minecraft.java:401)
at net.minecraft.client.main.Main.main(Main.java:118)
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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)


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

-- Head --
Stacktrace:
at com.moreoresmod.main.gui.GuiMelter.drawGuiContainerForegroundLayer(GuiMelter.java:27)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:136)
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:356)

-- Screen render details --
Details:
Screen name: com.moreoresmod.main.gui.GuiMelter
Mouse location: Scaled: (213, 119). Absolute: (427, 240)
Screen size: Scaled: (427, 240). Absolute: (854, 480). Scale factor of 2

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['KingOfMiners'/293, l='MpServer', x=-152.14, y=77.00, z=213.08]]
Chunk stats: MultiplayerChunkCache: 478, 478
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (-151,64,223), Chunk: (at 9,4,15 in -10,13; contains blocks -160,0,208 to -145,255,223), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Level time: 1976 game time, 1976 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: 116 total; [EntityPlayerSP['KingOfMiners'/293, l='MpServer', x=-152.14, y=77.00, z=213.08], EntityCreeper['Creeper'/45, l='MpServer', x=-231.50, y=48.00, z=133.50], EntitySkeleton['Skeleton'/46, l='MpServer', x=-226.50, y=28.00, z=146.50], EntityBat['Bat'/47, l='MpServer', x=-229.59, y=53.08, z=189.68], EntitySkeleton['Skeleton'/49, l='MpServer', x=-217.50, y=17.00, z=135.50], EntitySkeleton['Skeleton'/50, l='MpServer', x=-223.50, y=46.00, z=138.50], EntityBat['Bat'/51, l='MpServer', x=-214.25, y=51.10, z=156.25], EntityZombie['Zombie'/52, l='MpServer', x=-211.50, y=49.00, z=154.50], EntityWolf['Wolf'/53, l='MpServer', x=-210.70, y=61.37, z=169.51], EntityItem['item.tile.cloth.white'/54, l='MpServer', x=-213.33, y=61.00, z=175.51], EntityItem['item.item.muttonRaw'/55, l='MpServer', x=-215.24, y=62.00, z=174.43], EntityItem['item.tile.cloth.white'/56, l='MpServer', x=-213.66, y=62.00, z=173.09], EntityItem['item.item.muttonRaw'/57, l='MpServer', x=-213.38, y=62.00, z=172.54], EntityItem['item.tile.cloth.white'/58, l='MpServer', x=-211.74, y=61.00, z=174.36], EntityItem['item.item.muttonRaw'/59, l='MpServer', x=-210.91, y=61.00, z=171.45], EntitySkeleton['Skeleton'/60, l='MpServer', x=-213.47, y=49.00, z=165.27], EntityBat['Bat'/61, l='MpServer', x=-222.34, y=54.02, z=191.77], EntityWolf['Wolf'/62, l='MpServer', x=-215.85, y=64.00, z=182.24], EntityWolf['Wolf'/63, l='MpServer', x=-217.45, y=64.00, z=185.39], EntitySheep['Sheep'/66, l='MpServer', x=-208.45, y=63.00, z=211.89], EntitySheep['Sheep'/67, l='MpServer', x=-208.70, y=63.00, z=212.93], EntitySheep['Sheep'/68, l='MpServer', x=-211.50, y=63.00, z=214.50], EntitySheep['Sheep'/69, l='MpServer', x=-221.21, y=63.00, z=209.62], EntityPig['Pig'/71, l='MpServer', x=-195.70, y=63.00, z=222.25], EntityPig['Pig'/72, l='MpServer', x=-198.53, y=63.00, z=223.27], EntityPig['Pig'/73, l='MpServer', x=-201.99, y=63.00, z=214.59], EntityPig['Pig'/74, l='MpServer', x=-203.26, y=64.00, z=212.69], EntityZombie['Zombie'/76, l='MpServer', x=-187.72, y=46.00, z=154.45], EntityCreeper['Creeper'/77, l='MpServer', x=-178.51, y=47.00, z=157.92], EntitySheep['Sheep'/78, l='MpServer', x=-180.50, y=63.00, z=175.50], EntitySkeleton['Skeleton'/79, l='MpServer', x=-178.51, y=48.00, z=171.22], EntitySheep['Sheep'/80, l='MpServer', x=-180.50, y=63.00, z=178.50], EntitySheep['Sheep'/81, l='MpServer', x=-188.23, y=63.00, z=182.48], EntitySquid['Squid'/82, l='MpServer', x=-186.63, y=60.00, z=198.39], EntitySquid['Squid'/90, l='MpServer', x=-160.40, y=61.96, z=181.85], EntityBat['Bat'/91, l='MpServer', x=-167.70, y=12.12, z=210.66], EntityBat['Bat'/92, l='MpServer', x=-167.25, y=27.10, z=220.52], EntitySquid['Squid'/93, l='MpServer', x=-170.40, y=60.66, z=214.91], EntityZombie['Zombie'/94, l='MpServer', x=-160.50, y=17.00, z=235.50], EntitySheep['Sheep'/95, l='MpServer', x=-164.50, y=79.00, z=252.46], EntitySheep['Sheep'/96, l='MpServer', x=-161.30, y=77.00, z=240.50], EntitySheep['Sheep'/97, l='MpServer', x=-165.26, y=80.00, z=251.52], EntitySkeleton['Skeleton'/98, l='MpServer', x=-162.35, y=33.00, z=286.82], EntitySpider['Spider'/99, l='MpServer', x=-165.99, y=33.00, z=286.99], EntitySheep['Sheep'/104, l='MpServer', x=-150.50, y=63.00, z=146.50], EntitySheep['Sheep'/105, l='MpServer', x=-149.50, y=63.00, z=145.50], EntitySquid['Squid'/106, l='MpServer', x=-145.47, y=61.67, z=153.52], EntitySheep['Sheep'/107, l='MpServer', x=-149.50, y=64.00, z=144.50], EntitySheep['Sheep'/108, l='MpServer', x=-146.50, y=64.00, z=144.50], EntityCreeper['Creeper'/109, l='MpServer', x=-151.43, y=22.00, z=198.88], EntityZombie['Zombie'/110, l='MpServer', x=-146.50, y=14.00, z=212.50], EntityCreeper['Creeper'/111, l='MpServer', x=-147.50, y=25.00, z=228.50], EntitySheep['Sheep'/112, l='MpServer', x=-154.76, y=77.00, z=228.47], EntityZombie['Zombie'/113, l='MpServer', x=-148.33, y=57.00, z=246.67], EntityBat['Bat'/114, l='MpServer', x=-148.25, y=60.10, z=240.48], EntityCreeper['Creeper'/115, l='MpServer', x=-151.50, y=20.00, z=265.50], EntitySpider['Spider'/116, l='MpServer', x=-145.40, y=29.00, z=264.00], EntitySkeleton['Skeleton'/123, l='MpServer', x=-135.50, y=8.00, z=148.50], EntityBat['Bat'/124, l='MpServer', x=-130.25, y=18.10, z=160.25], EntityZombie['Zombie'/125, l='MpServer', x=-128.50, y=30.00, z=177.50], EntitySkeleton['Skeleton'/126, l='MpServer', x=-128.50, y=29.00, z=184.50], EntityZombie['Zombie'/127, l='MpServer', x=-128.68, y=20.00, z=203.50], EntityCreeper['Creeper'/128, l='MpServer', x=-132.83, y=16.00, z=222.53], EntityCreeper['Creeper'/129, l='MpServer', x=-133.50, y=22.00, z=210.50], EntityZombie['Zombie'/130, l='MpServer', x=-135.27, y=16.00, z=221.52], EntityZombie['Zombie'/131, l='MpServer', x=-131.52, y=47.00, z=239.80], EntitySheep['Sheep'/132, l='MpServer', x=-130.77, y=81.00, z=230.52], EntitySheep['Sheep'/133, l='MpServer', x=-128.81, y=82.00, z=227.68], EntityCreeper['Creeper'/134, l='MpServer', x=-134.78, y=47.00, z=241.50], EntitySheep['Sheep'/135, l='MpServer', x=-140.19, y=80.00, z=241.44], EntityCreeper['Creeper'/136, l='MpServer', x=-139.50, y=47.00, z=272.50], EntityCreeper['Creeper'/137, l='MpServer', x=-139.50, y=46.00, z=273.50], EntityCreeper['Creeper'/138, l='MpServer', x=-137.89, y=44.00, z=280.59], EntityBat['Bat'/145, l='MpServer', x=-122.64, y=28.10, z=156.03], EntitySheep['Sheep'/146, l='MpServer', x=-116.22, y=69.00, z=153.45], EntityChicken['Chicken'/147, l='MpServer', x=-115.47, y=77.00, z=184.80], EntityChicken['Chicken'/148, l='MpServer', x=-112.72, y=78.00, z=190.18], EntitySheep['Sheep'/149, l='MpServer', x=-115.05, y=78.00, z=189.21], EntityZombie['Zombie'/150, l='MpServer', x=-115.50, y=29.00, z=204.50], EntityBat['Bat'/151, l='MpServer', x=-128.48, y=40.87, z=199.56], EntitySheep['Sheep'/152, l='MpServer', x=-118.18, y=77.00, z=196.52], EntityZombie['Zombie'/153, l='MpServer', x=-125.50, y=35.00, z=222.50], EntitySkeleton['Skeleton'/154, l='MpServer', x=-124.50, y=57.00, z=217.50], EntityBat['Bat'/155, l='MpServer', x=-121.25, y=37.10, z=226.75], EntityBat['Bat'/156, l='MpServer', x=-111.46, y=63.39, z=228.91], EntitySheep['Sheep'/157, l='MpServer', x=-117.50, y=85.00, z=238.27], EntityBat['Bat'/158, l='MpServer', x=-117.25, y=20.10, z=250.25], EntityCreeper['Creeper'/159, l='MpServer', x=-118.50, y=22.00, z=246.50], EntityCreeper['Creeper'/160, l='MpServer', x=-116.50, y=39.00, z=246.50], EntitySkeleton['Skeleton'/161, l='MpServer', x=-117.68, y=39.00, z=247.50], EntitySheep['Sheep'/170, l='MpServer', x=-111.50, y=71.00, z=154.50], EntitySheep['Sheep'/171, l='MpServer', x=-110.45, y=70.00, z=152.74], EntitySheep['Sheep'/172, l='MpServer', x=-106.72, y=72.00, z=154.50], EntitySheep['Sheep'/173, l='MpServer', x=-112.79, y=78.00, z=187.50], EntitySheep['Sheep'/174, l='MpServer', x=-109.71, y=77.00, z=182.30], EntityChicken['Chicken'/175, l='MpServer', x=-111.50, y=77.00, z=179.50], EntityChicken['Chicken'/176, l='MpServer', x=-110.50, y=79.00, z=190.13], EntitySheep['Sheep'/177, l='MpServer', x=-101.50, y=93.00, z=181.50], EntitySheep['Sheep'/178, l='MpServer', x=-99.50, y=94.00, z=181.50], EntitySheep['Sheep'/179, l='MpServer', x=-100.46, y=93.55, z=181.26], EntitySheep['Sheep'/180, l='MpServer', x=-101.50, y=85.00, z=179.50], EntityBat['Bat'/181, l='MpServer', x=-109.49, y=26.56, z=208.54], EntityCow['Cow'/182, l='MpServer', x=-96.41, y=104.00, z=214.84], EntitySkeleton['Skeleton'/183, l='MpServer', x=-109.50, y=37.00, z=225.50], EntityZombie['Zombie'/184, l='MpServer', x=-100.50, y=29.00, z=248.50], EntitySkeleton['Skeleton'/185, l='MpServer', x=-104.50, y=31.00, z=251.50], EntitySpider['Spider'/186, l='MpServer', x=-105.50, y=32.00, z=252.50], EntitySkeleton['Skeleton'/187, l='MpServer', x=-109.50, y=35.00, z=262.50], EntityCreeper['Creeper'/190, l='MpServer', x=-80.53, y=24.00, z=135.17], EntitySkeleton['Skeleton'/191, l='MpServer', x=-83.50, y=12.00, z=151.50], EntityCreeper['Creeper'/192, l='MpServer', x=-80.50, y=13.00, z=163.50], EntityZombie['Zombie'/193, l='MpServer', x=-83.50, y=86.00, z=175.50], EntityCow['Cow'/194, l='MpServer', x=-93.48, y=104.00, z=219.25], EntityCow['Cow'/195, l='MpServer', x=-93.68, y=104.00, z=216.26], EntityCow['Cow'/196, l='MpServer', x=-92.50, y=104.00, z=222.50], EntitySpider['Spider'/198, l='MpServer', x=-76.50, y=22.00, z=136.50]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:445)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2766)
at net.minecraft.client.Minecraft.run(Minecraft.java:422)
at net.minecraft.client.main.Main.main(Main.java:118)
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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
Minecraft Version: 1.9
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_91, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 948534912 bytes (904 MB) / 1974468608 bytes (1883 MB) up to 8589934592 bytes (8192 MB)
JVM Flags: 1 total; -Xmx9G
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP 9.23 Powered by Forge 12.16.1.1907 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9-12.16.1.1907.jar) 
UCHIJAAAA	Forge{12.16.1.1907} [Minecraft Forge] (forgeSrc-1.9-12.16.1.1907.jar) 
UCHIJAAAA	MoreOresMod{1.4 beta} [MoreOresMod] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.5.13399 Compatibility Profile Context 15.201.1151.1008' Renderer: 'AMD Radeon(TM) R7 Graphics'
Launched Version: 1.9
LWJGL: 2.9.4
OpenGL: AMD Radeon(TM) R7 Graphics GL version 4.5.13399 Compatibility Profile Context 15.201.1151.1008, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: No
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)
CPU: 4x AMD A10-7700K Radeon R7, 10 Compute Cores 4C+6G
[15:29:56] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:646]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Tyler\Documents\Coding\Minecraft\forge-1.9-12.16.1.1904-mdk\run\.\crash-reports\crash-2016-05-21_15.29.56-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed

 

this is the code in my GuiMelter:

package com.moreoresmod.main.gui;

import com.moreoresmod.main.container.ContainerMelter;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;

public class GuiMelter extends GuiContainer {

private static final ResourceLocation melterGuiTexture = new ResourceLocation("moreoresmod:" + "textures/gui/container/melter.png");

private final InventoryPlayer playerInventory;
private IInventory tileMelter;

public GuiMelter(InventoryPlayer playerInv, IInventory melterInv) {
	super(new ContainerMelter(playerInv, melterInv));
	this.playerInventory = playerInv;
	this.tileMelter = melterInv;
}

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	String s = this.tileMelter.getDisplayName().getUnformattedText();
	this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
	this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(melterGuiTexture);
        int i = (this.width - this.xSize) / 2;
        int j = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
        
        if(this.tileMelter.getField(0) > 0){
        	int l = this.getMeltProgressScaled(48);
        	
        	int l1 = l >= 24 ? 24 : l;
        	this.drawTexturedModalRect(5, 28, 40, 176, 5, 24 - l1);
        	
        	int l2 = l - 24 <= 0 ? 0 : l - 24;
        	this.drawTexturedModalRect(79, 51, 176, 16, l2, 17);
        	
        	
        }
        
}

private int getMeltProgressScaled(int pixles){
	int i = this.tileMelter.getField(2);
	int j = this.tileMelter.getField(3);
	return i != 0 && j != 0 ? i * pixles / j : 0;
}

}

Posted

If the problem has been solved, you should post the solution and edit your title.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.