Jump to content

[1.7.10] [Solved] Gui Crashing Game!


Awesome_Spider

Recommended Posts

My gui was working fine but now it crashes the game when I open it. Here is the crash report:

net.minecraft.util.ReportedException: Updating screen events
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1734) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1028) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_11]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_11]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_11]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.gui.inventory.GuiContainer.getSlotAtPosition(GuiContainer.java:330) ~[GuiContainer.class:?]
at net.minecraft.client.gui.inventory.GuiContainer.mouseMovedOrUp(GuiContainer.java:502) ~[GuiContainer.class:?]
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:354) ~[GuiScreen.class:?]
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313) ~[GuiScreen.class:?]
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1720) ~[Minecraft.class:?]
... 11 more
[21:25:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:388]: ---- Minecraft Crash Report ----
// Oops.

Time: 12/5/14 9:25 PM
Description: Updating screen events

java.lang.NullPointerException: Updating screen events
at net.minecraft.client.gui.inventory.GuiContainer.getSlotAtPosition(GuiContainer.java:330)
at net.minecraft.client.gui.inventory.GuiContainer.mouseMovedOrUp(GuiContainer.java:502)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:354)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1720)
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 net.minecraft.client.gui.inventory.GuiContainer.getSlotAtPosition(GuiContainer.java:330)
at net.minecraft.client.gui.inventory.GuiContainer.mouseMovedOrUp(GuiContainer.java:502)
at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:354)
at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:313)

-- Affected screen --
Details:
Screen name: com.awsp8.wizardry.gui.ArcaneHarnesserGui

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player622'/302, l='MpServer', x=149.94, y=67.62, z=-152.04]]
Chunk stats: MultiplayerChunkCache: 289, 289
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (149,64,-154), Chunk: (at 5,4,6 in 9,-10; contains blocks 144,0,-160 to 159,255,-145), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1)
Level time: 107838 game time, 6637 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: 105 total; [ArcanePowerMatrix['entity.powerMatrix.name'/525, l='MpServer', x=0.00, y=0.00, z=0.00], ArcanePowerMatrix['entity.powerMatrix.name'/541, l='MpServer', x=0.00, y=0.00, z=0.00], ArcanePowerMatrix['entity.powerMatrix.name'/543, l='MpServer', x=0.00, y=0.00, z=0.00], EntityClientPlayerMP['Player622'/302, l='MpServer', x=149.94, y=67.62, z=-152.04], ArcanePowerMatrix['entity.powerMatrix.name'/560, l='MpServer', x=0.00, y=0.00, z=0.00], ArcanePowerMatrix['entity.powerMatrix.name'/564, l='MpServer', x=0.00, y=0.00, z=0.00], ArcanePowerMatrix['entity.powerMatrix.name'/571, l='MpServer', x=0.00, y=0.00, z=0.00], EntityCow['Cow'/64, l='MpServer', x=75.47, y=68.00, z=-225.53], EntitySheep['Sheep'/71, l='MpServer', x=90.81, y=65.00, z=-224.50], EntitySheep['Sheep'/72, l='MpServer', x=82.24, y=66.00, z=-223.50], EntitySheep['Sheep'/73, l='MpServer', x=92.91, y=69.00, z=-187.94], ArcanePowerMatrix['entity.powerMatrix.name'/590, l='MpServer', x=0.00, y=0.00, z=0.00], EntitySheep['Sheep'/81, l='MpServer', x=100.47, y=68.00, z=-191.84], EntitySheep['Sheep'/82, l='MpServer', x=95.34, y=70.00, z=-194.81], ArcanePowerMatrix['entity.powerMatrix.name'/605, l='MpServer', x=0.00, y=0.00, z=0.00], EntityBat['Bat'/100, l='MpServer', x=140.72, y=40.10, z=-156.72], EntitySheep['Sheep'/101, l='MpServer', x=136.19, y=62.04, z=-152.25], EntitySkeleton['Skeleton'/107, l='MpServer', x=133.13, y=40.00, z=-132.38], EntitySkeleton['Skeleton'/108, l='MpServer', x=132.41, y=39.00, z=-129.84], EntityZombie['Zombie'/109, l='MpServer', x=139.53, y=47.00, z=-136.09], EntitySkeleton['Skeleton'/118, l='MpServer', x=142.09, y=18.00, z=-89.50], EntitySpider['Spider'/119, l='MpServer', x=140.72, y=19.00, z=-89.66], EntitySheep['Sheep'/128, l='MpServer', x=155.13, y=63.00, z=-210.91], EntityZombie['Zombie'/129, l='MpServer', x=143.88, y=21.00, z=-199.41], EntityCreeper['Creeper'/130, l='MpServer', x=151.69, y=22.00, z=-180.56], EntityZombie['Zombie'/131, l='MpServer', x=150.63, y=23.00, z=-180.75], EntityZombie['Zombie'/132, l='MpServer', x=145.50, y=24.00, z=-189.50], EntityZombie['Zombie'/133, l='MpServer', x=146.00, y=23.00, z=-179.56], EntityBat['Bat'/134, l='MpServer', x=147.69, y=38.10, z=-160.63], EntityCreeper['Creeper'/135, l='MpServer', x=158.50, y=48.00, z=-168.06], EntityBat['Bat'/136, l='MpServer', x=153.95, y=30.00, z=-159.00], EntityBat['Bat'/137, l='MpServer', x=156.25, y=46.10, z=-144.44], ArcanePowerMatrix['entity.powerMatrix.name'/393, l='MpServer', x=0.00, y=0.00, z=0.00], EntitySkeleton['Skeleton'/138, l='MpServer', x=159.25, y=41.00, z=-154.97], EntitySkeleton['Skeleton'/139, l='MpServer', x=164.31, y=36.00, z=-155.31], EntityCreeper['Creeper'/140, l='MpServer', x=157.97, y=32.00, z=-153.38], EntitySkeleton['Skeleton'/141, l='MpServer', x=149.93, y=47.00, z=-146.49], ArcanePowerMatrix['entity.powerMatrix.name'/397, l='MpServer', x=0.00, y=0.00, z=0.00], EntitySheep['Sheep'/143, l='MpServer', x=159.50, y=64.00, z=-159.50], ArcanePowerMatrix['entity.powerMatrix.name'/409, l='MpServer', x=0.00, y=0.00, z=0.00], EntityBat['Bat'/155, l='MpServer', x=156.25, y=46.10, z=-143.47], EntitySkeleton['Skeleton'/156, l='MpServer', x=155.50, y=42.00, z=-140.13], ArcanePowerMatrix['entity.powerMatrix.name'/412, l='MpServer', x=0.00, y=0.00, z=0.00], EntityBat['Bat'/157, l='MpServer', x=145.75, y=47.10, z=-128.50], ArcanePowerMatrix['entity.powerMatrix.name'/413, l='MpServer', x=0.00, y=0.00, z=0.00], EntityBat['Bat'/158, l='MpServer', x=152.47, y=48.10, z=-129.47], ArcanePowerMatrix['entity.powerMatrix.name'/419, l='MpServer', x=0.00, y=0.00, z=0.00], EntityZombie['Zombie'/170, l='MpServer', x=147.97, y=43.00, z=-118.56], EntityBat['Bat'/171, l='MpServer', x=142.85, y=42.00, z=-119.20], EntitySkeleton['Skeleton'/172, l='MpServer', x=150.50, y=15.00, z=-106.50], ArcanePowerMatrix['entity.powerMatrix.name'/428, l='MpServer', x=0.00, y=0.00, z=0.00], EntityCreeper['Creeper'/173, l='MpServer', x=147.50, y=14.00, z=-105.50], EntityCreeper['Creeper'/174, l='MpServer', x=146.00, y=13.00, z=-101.44], EntitySpider['Spider'/175, l='MpServer', x=145.28, y=18.00, z=-97.25], ArcanePowerMatrix['entity.powerMatrix.name'/433, l='MpServer', x=0.00, y=0.00, z=0.00], EntitySheep['Sheep'/178, l='MpServer', x=168.81, y=66.00, z=-206.13], EntitySkeleton['Skeleton'/179, l='MpServer', x=168.50, y=24.00, z=-176.50], EntityCreeper['Creeper'/180, l='MpServer', x=172.50, y=15.00, z=-194.69], ArcanePowerMatrix['entity.powerMatrix.name'/436, l='MpServer', x=0.00, y=0.00, z=0.00], EntityCreeper['Creeper'/181, l='MpServer', x=171.50, y=16.00, z=-186.50], EntityCreeper['Creeper'/182, l='MpServer', x=173.00, y=15.00, z=-190.44], EntityBat['Bat'/183, l='MpServer', x=161.16, y=19.10, z=-163.31], EntityZombie['Zombie'/184, l='MpServer', x=168.50, y=24.00, z=-162.50], EntityZombie['Zombie'/185, l='MpServer', x=161.88, y=43.00, z=-163.63], EntitySpider['Spider'/186, l='MpServer', x=160.00, y=41.00, z=-160.16], EntityCreeper['Creeper'/187, l='MpServer', x=168.53, y=51.00, z=-174.88], EntityCreeper['Creeper'/188, l='MpServer', x=164.00, y=50.00, z=-172.44], EntitySkeleton['Skeleton'/189, l='MpServer', x=166.84, y=51.00, z=-175.59], EntityZombie['Zombie'/190, l='MpServer', x=163.53, y=43.69, z=-163.61], EntitySheep['Sheep'/191, l='MpServer', x=167.50, y=64.00, z=-160.59], EntitySkeleton['Skeleton'/192, l='MpServer', x=162.47, y=11.00, z=-159.16], ArcanePowerMatrix['entity.powerMatrix.name'/448, l='MpServer', x=0.00, y=0.00, z=0.00], EntityZombie['Zombie'/193, l='MpServer', x=162.31, y=38.00, z=-157.69], EntityZombie['Zombie'/194, l='MpServer', x=164.69, y=36.00, z=-156.59], EntityEnderman['Enderman'/195, l='MpServer', x=164.69, y=36.00, z=-154.31], EntitySkeleton['Skeleton'/196, l='MpServer', x=163.25, y=38.00, z=-157.38], EntitySkeleton['Skeleton'/197, l='MpServer', x=175.09, y=64.00, z=-155.50], EntityBat['Bat'/198, l='MpServer', x=163.13, y=46.10, z=-134.63], EntityBat['Bat'/199, l='MpServer', x=161.25, y=46.10, z=-134.56], EntityBat['Bat'/200, l='MpServer', x=159.25, y=43.00, z=-127.72], EntityBat['Bat'/201, l='MpServer', x=172.36, y=31.00, z=-123.50], EntityCreeper['Creeper'/205, l='MpServer', x=186.50, y=14.00, z=-210.78], EntityCreeper['Creeper'/206, l='MpServer', x=186.50, y=14.00, z=-209.94], EntitySkeleton['Skeleton'/207, l='MpServer', x=186.03, y=15.00, z=-207.50], EntityCreeper['Creeper'/208, l='MpServer', x=187.69, y=14.00, z=-214.03], EntityZombie['Zombie'/209, l='MpServer', x=182.50, y=17.00, z=-195.50], ArcanePowerMatrix['entity.powerMatrix.name'/465, l='MpServer', x=0.00, y=0.00, z=0.00], EntityZombie['Zombie'/215, l='MpServer', x=186.50, y=17.00, z=-199.96], EntityZombie['Zombie'/216, l='MpServer', x=200.50, y=64.00, z=-202.50], EntityCreeper['Creeper'/217, l='MpServer', x=205.50, y=20.00, z=-183.50], EntityCreeper['Creeper'/218, l='MpServer', x=204.50, y=20.00, z=-183.50], EntityZombie['Zombie'/219, l='MpServer', x=206.66, y=20.32, z=-185.66], EntitySheep['Sheep'/220, l='MpServer', x=199.94, y=63.00, z=-184.06], EntityZombie['Zombie'/225, l='MpServer', x=226.13, y=26.00, z=-229.34], EntityCreeper['Creeper'/229, l='MpServer', x=221.50, y=22.00, z=-207.50], EntitySkeleton['Skeleton'/230, l='MpServer', x=224.50, y=22.00, z=-206.03], EntityZombie['Zombie'/231, l='MpServer', x=224.00, y=19.00, z=-207.44], EntityCreeper['Creeper'/232, l='MpServer', x=215.50, y=31.00, z=-168.72], EntityBat['Bat'/233, l='MpServer', x=211.01, y=31.84, z=-147.52], EntityZombie['Zombie'/237, l='MpServer', x=227.13, y=26.00, z=-226.06], EntitySpider['Spider'/238, l='MpServer', x=229.91, y=33.00, z=-214.09], EntitySpider['Spider'/239, l='MpServer', x=229.44, y=11.00, z=-202.19], ArcanePowerMatrix['entity.powerMatrix.name'/495, l='MpServer', x=0.00, y=0.00, z=0.00], EntitySkeleton['Skeleton'/240, l='MpServer', x=224.50, y=22.00, z=-206.97], EntityZombie['Zombie'/241, l='MpServer', x=224.50, y=21.00, z=-197.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:973)
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 (x86) version 6.3
Java Version: 1.8.0_11, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 763148048 bytes (727 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 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: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1232 Minecraft Forge 10.13.2.1232 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.1232} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.2.1232} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1232.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
wizardry{1.0.0} [Wizardry] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics GL version 4.0.0 - Build 10.18.10.3349, Intel
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)
[21:25:04] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Wyatt\Desktop\Mods\1.7.10\Wizardry\eclipse\.\crash-reports\crash-2014-12-05_21.25.04-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

It's a NullPointer which is usually easy to fix, but it doesn't mention any of my classes in the stack trace so I have no idea.

 

Here is my code:

 

 

My gui class:

package com.awsp8.wizardry.gui;

import com.awsp8.wizardry.Arcane.Blocks.TileEntityArcaneHarnesser;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerFurnace;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.ResourceLocation;

public class ArcaneHarnesserGui 
			extends GuiContainer{

private TileEntityArcaneHarnesser tileEntity;

public ArcaneHarnesserGui(InventoryPlayer inv, TileEntityArcaneHarnesser tileEntity) {
	super(null);
	this.tileEntity = tileEntity;
}

public static final int GUI_ID = 20;

private static final ResourceLocation guiTexture = new ResourceLocation("wizardry", "/textures/gui/arcaneHarnesserGui.png");

private int ImageWidth = 176;
    private int ImageHeight = 166;
    
    @Override
    public void drawScreen(int x, int y, float par3){ 	
        int k = (this.width - this.ImageWidth) / 2;
        byte b0 = 2;
    	
        this.mc.getTextureManager().bindTexture(guiTexture);                                  
        
    	this.drawTexturedModalRect(k, b0, 0, 0, this.ImageWidth, this.ImageHeight);   
    }

@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
		int p_146976_2_, int p_146976_3_) {

}
}

 

My TileEntity:

package com.awsp8.wizardry.Arcane.Blocks;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

public class TileEntityArcaneHarnesser extends TileEntity implements IInventory {

    private ItemStack[] inv;

    public TileEntityArcaneHarnesser(){
            inv = new ItemStack[9];
    }
    
    @Override
    public int getSizeInventory() {
            return inv.length;
    }

    @Override
    public ItemStack getStackInSlot(int slot) {
            return inv[slot];
    }
    
    @Override
    public void setInventorySlotContents(int slot, ItemStack stack) {
            inv[slot] = stack;
            if (stack != null && stack.stackSize > getInventoryStackLimit()) {
                    stack.stackSize = getInventoryStackLimit();
            }               
    }

    @Override
    public ItemStack decrStackSize(int slot, int amt) {
            ItemStack stack = getStackInSlot(slot);
            if (stack != null) {
                    if (stack.stackSize <= amt) {
                            setInventorySlotContents(slot, null);
                    } else {
                            stack = stack.splitStack(amt);
                            if (stack.stackSize == 0) {
                                    setInventorySlotContents(slot, null);
                            }
                    }
            }
            return stack;
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
            ItemStack stack = getStackInSlot(slot);
            if (stack != null) {
                    setInventorySlotContents(slot, null);
            }
            return stack;
    }
    
    @Override
    public int getInventoryStackLimit() {
            return 64;
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
            return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&
            player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
    }
    
    @Override
    public void readFromNBT(NBTTagCompound tagCompound) {
            super.readFromNBT(tagCompound);
            
            NBTTagList tagList = tagCompound.getTagList("Inventory", 1);
            for (int i = 0; i < tagList.tagCount(); i++) {
                    NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
                    byte slot = tag.getByte("Slot");
                    if (slot >= 0 && slot < inv.length) {
                            inv[slot] = ItemStack.loadItemStackFromNBT(tag);
                    }
            }
    }

    @Override
    public void writeToNBT(NBTTagCompound tagCompound) {
            super.writeToNBT(tagCompound);
                            
            NBTTagList itemList = new NBTTagList();
            for (int i = 0; i < inv.length; i++) {
                    ItemStack stack = inv[i];
                    if (stack != null) {
                            NBTTagCompound tag = new NBTTagCompound();
                            tag.setByte("Slot", (byte) i);
                            stack.writeToNBT(tag);
                            itemList.appendTag(tag);
                    }
            }
            tagCompound.setTag("Inventory", itemList);
    }


@Override
public String getInventoryName() {
	return "wizardry.arcane.harnesser";
}

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

@Override
public void openInventory() {

}

@Override
public void closeInventory() {

}

@Override
public boolean isItemValidForSlot(int p_94041_1_,
				ItemStack p_94041_2_) {
	return true;
}
}

 

My Container class:

package com.awsp8.wizardry.Arcane.Blocks;

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

public class ContainerArcaneHarnesser
			extends Container{

TileEntityArcaneHarnesser tileEntity;

public ContainerArcaneHarnesser(InventoryPlayer inv, TileEntityArcaneHarnesser tileHarnesser)
    {
        tileEntity = tileHarnesser;
	addSlotToContainer(new Slot(tileEntity, 0, 80, 35));
	bindPlayerInventory(inv);
    }

@Override
public boolean canInteractWith(EntityPlayer player) {
	return this.tileEntity.isUseableByPlayer(player);
}

protected void bindPlayerInventory(InventoryPlayer inventoryPlayer) {
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 9; j++) {
			addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
		}
	}

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

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
	ItemStack stack = null;
	Slot slotObject = (Slot) inventorySlots.get(slot);

	//null checks and checks if the item can be stacked (maxStackSize > 1)
	if (slotObject != null && slotObject.getHasStack()) {
		ItemStack stackInSlot = slotObject.getStack();
		stack = stackInSlot.copy();

		//merges the item into player inventory since its in the tileEntity
		if (slot < 9) {
			if (!this.mergeItemStack(stackInSlot, 0, 35, true)) {
				return null;
			}
		}
		//places it into the tileEntity is possible since its in the player inventory
		else if (!this.mergeItemStack(stackInSlot, 0, 9, false)) {
			return null;
		}

		if (stackInSlot.stackSize == 0) {
			slotObject.putStack(null);
		} else {
			slotObject.onSlotChanged();
		}

		if (stackInSlot.stackSize == stack.stackSize) {
			return null;
		}
		slotObject.onPickupFromSlot(player, stackInSlot);
	}
	return stack;
}

@Override
protected boolean mergeItemStack(ItemStack itemstack, int i, int j, boolean flag) {
	// The default implementation in Slot doesn't take into account the Slot.isItemValid() and Slot.getSlotStackLimit() values.
	// So here is a modified implementation. I have only modified the parts with a comment.

	boolean flag1 = false;
	int k = i;
	if (flag) {
		k = j - 1;
	}
	if (itemstack.isStackable()) {
		while (itemstack.stackSize > 0 && (!flag && k < j || flag && k >= i)) {
			Slot slot = (Slot)inventorySlots.get(k);
			ItemStack itemstack1 = slot.getStack();

			if (flag) {
				k--;
			}
			else {
				k++;
			}

			// Check if item is valid:
			if (!slot.isItemValid(itemstack)) {
				continue;
			}

			if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.getHasSubtypes() || itemstack.getItemDamage() == itemstack1.getItemDamage())
					&& ItemStack.areItemStackTagsEqual(itemstack, itemstack1)) {
				//ItemStack.areItemStacksEqual(par0ItemStack, par1ItemStack)
				//ItemStack.areItemStackTagsEqual(par0ItemStack, par1ItemStack)
				int i1 = itemstack1.stackSize + itemstack.stackSize;

				// Don't put more items than the slot can take:
				int maxItemsInDest = Math.min(itemstack1.getMaxStackSize(), slot.getSlotStackLimit());

				if (i1 <= maxItemsInDest) {
					itemstack.stackSize = 0;
					itemstack1.stackSize = i1;
					slot.onSlotChanged();
					flag1 = true;
				}
				else if (itemstack1.stackSize < maxItemsInDest) {
					itemstack.stackSize -= maxItemsInDest - itemstack1.stackSize;
					itemstack1.stackSize = maxItemsInDest;
					slot.onSlotChanged();
					flag1 = true;
				}
			}

		}
	}
	if (itemstack.stackSize > 0) {
		int l;
		if (flag) {
			l = j - 1;
		}
		else {
			l = i;
		}
		do {
			if ((flag || l >= j) && (!flag || l < i)) {
				break;
			}
			Slot slot1 = (Slot)inventorySlots.get(l);
			ItemStack itemstack2 = slot1.getStack();

			if (flag) {
				l--;
			}
			else {
				l++;
			}

			// Check if item is valid:
			if (!slot1.isItemValid(itemstack)) {
				continue;
			}

			if (itemstack2 == null) {

				// Don't put more items than the slot can take:
				int nbItemsInDest = Math.min(itemstack.stackSize, slot1.getSlotStackLimit());
				ItemStack itemStack1 = itemstack.copy();
				itemstack.stackSize -= nbItemsInDest;
				itemStack1.stackSize = nbItemsInDest;

				slot1.putStack(itemStack1);
				slot1.onSlotChanged();
				// itemstack.stackSize = 0;
				flag1 = true;
				break;
			}
		} while (true);
	}
	return flag1;
}
}

 

 

 

Any help is appreciated, I'm stumped. :(

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • SANGOMA IN MANKWENG ╬✯{+2760{680}{4550}✯╬TRADITIONAL HEALER IN POLOKWANE.Turfloop, Loius Trichardt Mokopane, Seshego, Lebowakgomo, Tzaneen, Mankweng, Mokopane, Lephalale, Burgersfort, Jane furse, Bochum, Phalaborwa Let me try and help you with love spells, traditional healing, native healing, fortune telling, witchcraft, psychic readings, black magic, voodoo, herbalist healing, or any other service your may desire within the realm of african native healing, the spirits and the ancestors. I am a sangoma and healer. I could help you to connect with the ancestors , interpret dreams, diagnose illness through divination with bones, and help you heal both physical and spiritual illness. We facilitate the deepening of your relationship to the spirit world and the ancestors. Working in partnership with one\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’s ancestors is a gift representing a close link with the spirit realm as a mediator between the worlds.*   Witchdoctors, or sorcerers, are often purveyors of mutis and charms that cause harm to people. we believe that we are here for only one purpose, to heal through love and compassion.*   African people share a common understanding of the importance of ancestors in daily life. When they have lost touch with their ancestors, illness may result or bad luck. Then a traditional healer, or sangoma, is sought out who may prescribe herbs, changes in lifestyle, a career change, or changes in relationships. The client may also be told to perform a ceremony or purification ritual to appease the ancestors.*   Let us solve your problems using powerful African traditional methods. We believe that our ancestors and spirits give us enlightenment, wisdom, divine guidance, enabling us to overcome obstacles holding your life back. Our knowledge has been passed down through centuries, being refined along the way from generation to generation. We believe in the occult, the paranormal, the spirit world, the mystic world.*   The services here are based on the African Tradition Value system/religion,where we believe the ancestors and spirits play a very important role in society. The ancestors and spirits give guidance and counsel in society. They could enable us to see into the future and give solutions to the problems affecting us. We use rituals, divination, spells, chants and prayers to enable us tackle the task before us.*   I have experience in helping and guiding many people from all over the world. My psychic abilities may help you answer and resolve many unanswered questions
    • I tried playing my Minecraft world, it kept on making me leave the world and also kept on saying "Connection lost, invalid player data" and there was a button that said "Back to server list". And when I clicked it, it led me to the MULTIPLAYER MENU! Remember, this was a singleplayer world, NOT multiplayer. Its ever that I need to update forge (Which maybe is the reason why there is a flashing symbol right next to the Forge section in the mods menu), or its one of those stupid bugs. if its a bug, tell me that it is AND tell me how to fix it. If I cant, then just fix the bug for the new Forge update. ADIOS! -LiveZezo
    • Hi guys, I have a Minecraft mod pack 1.19.2 Could anyone help me to find the mod that causes this bug? When I place the item to craft something in the crafting table, the item that I want to craft doesn't show up on the right of the crafting table, but if I click in the square I can get it. Please help me   Here there is the mods list: https://pastebin.com/GwP38utW   Here are the logs: https://mega.nz/file/g39QhQbB#dIM_xytlAcIJVYh9rp81QrM3V2USvACG9hPamJ00Bq4
    • Recently updated the mod pack on my hosted server and from what I've see on the server logs this is a client side issue. When I try to join not just my server but a testing server (Purple Prison if it helps), I get the error IndexOutOfBoundsException on both ones. Mine is modded while the testing server is a vanilla server. The modpack works just fine when doing a single player world so I think it might just be a connection issue? To be fair, I don't have the best internet so not sure if this is just a connection issue from my internet that likes to be spotty with connection sometimes. I have reset my router already if that makes a difference. Any help please?
  • Topics

×
×
  • Create New...

Important Information

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