Jump to content

[1.7.10]gui crashes when clicking on slots


NEG2013

Recommended Posts

My game crashes whenever I click on a inventory slot of any time(custom or other)

 

Crash Report

---- Minecraft Crash Report ----
// Would you like a cupcake?

Time: 4/27/16 6:55 PM
Description: Ticking memory connection

java.lang.IndexOutOfBoundsException: Index: 59, Size: 45
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at net.minecraft.inventory.Container.slotClick(Container.java:300)
at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)


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

-- Head --
Stacktrace:
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at net.minecraft.inventory.Container.slotClick(Container.java:300)
at net.minecraft.network.NetHandlerPlayServer.processClickWindow(NetHandlerPlayServer.java:955)
at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:41)
at net.minecraft.network.play.client.C0EPacketClickWindow.processPacket(C0EPacketClickWindow.java:113)
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@5df2deb8
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_74, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 867235496 bytes (827 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 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: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 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.05} [Minecraft Coder Pack] (minecraft.jar) 
UCHIJAAAA	FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar) 
UCHIJAAAA	ac{1.5.7} [Acsension] (bin) 
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player935'/331, l='New World', x=989.63, y=4.00, z=-783.32]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'

 

Container Class

package neg2013.acsension.inventory;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import neg2013.acsension.slot.CrusherInputSlot;
import neg2013.acsension.slot.CrusherOutputSlot;
import neg2013.acsension.slot.GenericSlot;
import neg2013.acsension.tile_entity.TECrusher;
import neg2013.acsension.tile_entity.TEDecomp;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;

public class DecompContainer extends Container{

private TEDecomp decomp;
private int slotId = -1;



private int nextId(){
	slotId++;
	return slotId;
}

public DecompContainer(InventoryPlayer invPlayer, TEDecomp decomp){

	this.decomp = decomp;



	// player inv
	//hot bar
	for(int x = 0; x < 9; x++){
		addSlotToContainer(new Slot(invPlayer, x, 8 + (18 * x), 146));
	}

	for(int x = 0; x < 9; x++){
		for(int y = 0; y < 3; y++){
			addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 88 + 18 * y));

			addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 15));			
			addSlotToContainer(new GenericSlot(decomp, nextId(), 60, 64));			
			addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 64));			
			addSlotToContainer(new GenericSlot(decomp, nextId(), 100, 64));			


		}

	}
	// player inv

}






@Override
public boolean canInteractWith(EntityPlayer player) {

	return true;
}



}

 

Please just ask if youd like to see any other classes

Link to comment
Share on other sites

addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 15));

 

Oh god, ew.  This isn't that hard to math.

 

(x + y * 9) * 4 + n

where

n

is 0,1,2,3 depending on which of those four slots.

 

Also.  All of those slots are added to the same XY coordinates so they'd stack on top of each other and only the top 4 will be usable.

 

It also appears that your TE only has 45 slots and you're creating 84 slots.

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

that bit of code does not draw them on top it draws them above so it makes the inventory I think

 

and how are there 80+ slots?

You add 5 slots per iteration of your for loops, and your for loops result in 27 iterations. 27 * 5 = 135 slots, plus the 8 you added for the hot bar. Move the 4 static (as in their position, not the Java keyword) slots outside of the loop:

for (int x = 0; x < 9; x++) {
	for (int y = 0; y < 3; y++) {
		// this line covers the regular player inventory
		addSlotToContainer(new Slot(invPlayer, x + y * 9 + 9, 8 + 18 * x, 88 + 18 * y));
		// and these 4 slots are added 27 times to the exact same location with a different id each time...
		//addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 15));	
		//addSlotToContainer(new GenericSlot(decomp, nextId(), 60, 64));	
		//addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 64));	
		//addSlotToContainer(new GenericSlot(decomp, nextId(), 100, 64));
}	
}
// moved outside of the loop they will work just fine
addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 15));	
addSlotToContainer(new GenericSlot(decomp, nextId(), 60, 64));	
addSlotToContainer(new GenericSlot(decomp, nextId(), 80, 64));	
addSlotToContainer(new GenericSlot(decomp, nextId(), 100, 64));

Link to comment
Share on other sites

I actually realized that and moved them this morning but it still has bugs like

 

you cant pick up a stack

 

if you pick it up using mouse wheel on creative you start being able to move the stacks around like a normal gui but after a few seconds the stacks start glitching around then it stops working again and then if you try to move them again using middle wheel it crashes

 

so ya its messed up

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am following a tutorial for modding minecraft 1.20.1, and while running the mod with the minecraft of the idea, no errors was present but, when I switched to real minecraft, it started to want a default constructor "public ZeroToAutomation()" instead of the one recomended by the video "public ZeroToAutomation(FMLJavaModLoadingContext context) {...}", and I can't use the default constructor because I need the FMLJavaModLoadingContext to register the blocks and items.   The problem is at: "net/myself/zerotoautomation/ZeroToAutomation.java" the file contains the default constructor, "Logger"s, and the code for the mod the defaut constructor was added after an error requesting it the Loggers was used to see which methods/constructors was used by the Launcher   things that I tried to fix the issue: remove the default constructor, but an error appeared "net.myself.zerotoautomation.ZeroToAutomation.<init>()", and nothing else on the class runs adding an "public static void init()" method, but it changed nothing   The mod files: https://github.com/Matwaua/Zero_To_Automation/tree/not-finished
    • It is an issue/conflict with distanthorizons
    • I have been trying to combat this issue between oculus and embeddium and to no avail... I have already tried a few online tutorials on how to get this working but it doesn't work at all. https://pastebin.com/geQgifjc
    • wow you sound like fun to play with
    • Instale el mod en mi servidor y este se queda iniciando por horas, en la consola me habla de algo de permisos y trate de seguir la ruta que me da pero no existe.   [13:05:32 INFO]: CustomNPC Permissions available: [13:05:32 INFO]: customnpcs.edit.blocks [13:05:32 INFO]: customnpcs.edit.villager [13:05:32 INFO]: customnpcs.global.bank [13:05:32 INFO]: customnpcs.global.dialog [13:05:32 INFO]: customnpcs.global.faction [13:05:32 INFO]: customnpcs.global.linked [13:05:32 INFO]: customnpcs.global.naturalspawn [13:05:32 INFO]: customnpcs.global.playerdata [13:05:32 INFO]: customnpcs.global.quest [13:05:32 INFO]: customnpcs.global.recipe [13:05:32 INFO]: customnpcs.global.transport [13:05:32 INFO]: customnpcs.npc.advanced [13:05:32 INFO]: customnpcs.npc.ai [13:05:32 INFO]: customnpcs.npc.clone [13:05:32 INFO]: customnpcs.npc.create [13:05:32 INFO]: customnpcs.npc.delete [13:05:32 INFO]: customnpcs.npc.display [13:05:32 INFO]: customnpcs.npc.freeze [13:05:32 INFO]: customnpcs.npc.gui [13:05:32 INFO]: customnpcs.npc.inventory [13:05:32 INFO]: customnpcs.npc.reset [13:05:32 INFO]: customnpcs.npc.stats [13:05:32 INFO]: customnpcs.scenes [13:05:32 INFO]: customnpcs.soulstone.all [13:05:32 INFO]: customnpcs.spawner.create [13:05:32 INFO]: customnpcs.spawner.mob [13:05:32 INFO]: customnpcs.tool.mounter [13:05:32 INFO]: customnpcs.tool.nbtbook [13:05:32 INFO]: customnpcs.tool.pather [13:05:32 INFO]: customnpcs.tool.scripter
  • Topics

×
×
  • Create New...

Important Information

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