Jump to content

[1.12.2] Help to enable/disable itemslots being rendered/interactable depending on condition.


Mekelaina

Recommended Posts

So, I have my item that stores card Items. I have part of the inventory that should only be available/interactable depending on whether a different slot has an item in it. (the inventory uses should then be the item in the determining slot). Maybe this screenshot would make things more clear, the spaces I want to enable and disable are circled in black and the special slot is circled in pink. I'd also like to change the gui background with this state change, but that comes later.

How would I best go about this? Would I have to modify the capability to communicate between container and gui?

 

 

gui.png

Link to comment
Share on other sites

So if I understand you correctly you want to enable the slots on the left if there is an item in the pink slot in the middle?

See ContainerHorseInventory and GuiScreenHorseInventory for an example. It basically overrides Slot#isEnabled to check for whether the slot should be active and the GUI itself is modular with the slots not being drawn if they are not enabled.

Link to comment
Share on other sites

 

@V0idWa1k3r Ok, so I'm trying to do something similar to the way horse inventories work, but encountering an error that doesn't really make sense. When I try to open the container, its throwing index out of bound exceptions as if the size of my inventory is 46. I've no idea where it got that number from because I originally set it to 52 slots. I tried setting the size to 100 for the sake of testing but it still only uses 46? I made an item that could hold 90 items plus the player's standard inventory and hotbar and didn't get this problem.

 

This is the error log:

[16:43:00] [main/INFO] [GradleStart]: Extra: []
[16:43:01] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/ChloeRae/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[16:43:01] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[16:43:01] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[16:43:01] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[16:43:01] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[16:43:01] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading
[16:43:01] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_201, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jre1.8.0_201
[16:43:01] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[16:43:01] [main/ERROR] [FML]: Full: C:\Users\ChloeRae\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[16:43:01] [main/ERROR] [FML]: Trimmed: c:/users/chloerae/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[16:43:01] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[16:43:01] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
2019-04-23 16:43:02,427 main WARN Disabling terminal, you're running in an unsupported environment.
[16:43:02] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[16:43:02] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[16:43:02] [main/INFO] [FML]: Searching C:\Users\ChloeRae\Desktop\All modern minecraft modding shiz\duelcraftprogram\Duelcraft\run\.\mods for mods
[16:43:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[16:43:02] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[16:43:02] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[16:43:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[16:43:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[16:43:02] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[16:43:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[16:43:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[16:43:02] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[16:43:04] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[16:43:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[16:43:04] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[16:43:05] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[16:43:05] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[16:43:05] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[16:43:05] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[16:43:05] [main/INFO] [minecraft/Minecraft]: Setting user: Player129
[16:43:08] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[16:43:08] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
[16:43:09] [main/INFO] [FML]: -- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 10 (amd64) version 10.0
	Java Version: 1.8.0_201, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 269072512 bytes (256 MB) / 434110464 bytes (414 MB) up to 3810525184 bytes (3634 MB)
	JVM Flags: 0 total; 
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 425.31' Renderer: 'GeForce GTX 1050 Ti/PCIe/SSE2'
[16:43:09] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized
[16:43:09] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[16:43:09] [main/INFO] [FML]: Replaced 1036 ore ingredients
[16:43:10] [main/INFO] [FML]: Searching C:\Users\ChloeRae\Desktop\All modern minecraft modding shiz\duelcraftprogram\Duelcraft\run\.\mods for mods
[16:43:11] [Thread-3/INFO] [FML]: Using sync timing. 200 frames of Display.update took 17746484 nanos
[16:43:14] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[16:43:14] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, duelcraft] at CLIENT
[16:43:14] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, duelcraft] at SERVER
[16:43:15] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Duelcraft
[16:43:15] [main/INFO] [FML]: Processing ObjectHolder annotations
[16:43:15] [main/INFO] [FML]: Found 1168 ObjectHolder annotations
[16:43:15] [main/INFO] [FML]: Identifying ItemStackHolder annotations
[16:43:15] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
[16:43:15] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
[16:43:15] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[16:43:15] [main/INFO] [STDOUT]: [com.mekelaina.duelcraft.util.handlers.CardLoadingHandler:loadCardInfo:66]: Loaded data successfully
[16:43:15] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[16:43:15] [main/WARN] [FML]: ****************************************
[16:43:15] [main/WARN] [FML]: * Invalid registration attempt for an Ore Dictionary item with name oreKaibaCrystal has occurred. The registration has been denied to prevent crashes. The mod responsible for the registration needs to correct this.
[16:43:15] [main/WARN] [FML]: *  at net.minecraftforge.oredict.OreDictionary.registerOreImpl(OreDictionary.java:660)
[16:43:15] [main/WARN] [FML]: *  at net.minecraftforge.oredict.OreDictionary.registerOre(OreDictionary.java:646)
[16:43:15] [main/WARN] [FML]: *  at net.minecraftforge.oredict.OreDictionary.registerOre(OreDictionary.java:645)
[16:43:15] [main/WARN] [FML]: *  at com.mekelaina.duelcraft.blocks.BlockOreBase.initOreDict(BlockOreBase.java:71)
[16:43:15] [main/WARN] [FML]: *  at com.mekelaina.duelcraft.util.handlers.RegistryHandler.onBlockRegister(RegistryHandler.java:51)
[16:43:15] [main/WARN] [FML]: *  at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_4_RegistryHandler_onBlockRegister_Register.invoke(.dynamic)...
[16:43:15] [main/WARN] [FML]: ****************************************
[16:43:15] [main/INFO] [FML]: Applying holder lookups
[16:43:15] [main/INFO] [FML]: Holder lookups applied
[16:43:15] [main/INFO] [FML]: Applying holder lookups
[16:43:15] [main/INFO] [FML]: Holder lookups applied
[16:43:15] [main/INFO] [FML]: Applying holder lookups
[16:43:15] [main/INFO] [FML]: Holder lookups applied
[16:43:15] [main/INFO] [FML]: Applying holder lookups
[16:43:15] [main/INFO] [FML]: Holder lookups applied
[16:43:15] [main/INFO] [FML]: Injecting itemstacks
[16:43:15] [main/INFO] [FML]: Itemstack injection complete
[16:43:21] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem...
[16:43:21] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL
[16:43:21] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[16:43:21] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized.
[16:43:21] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started
[16:43:26] [main/WARN] [minecraft/ModelBlock]: Unable to resolve texture due to upward reference: #1 in duelcraft:models/item/deckbox
[16:43:29] [main/INFO] [FML]: Max texture size: 16384
[16:43:30] [main/INFO] [minecraft/TextureMap]: Created: 1024x512 textures-atlas
[16:43:31] [main/INFO] [FML]: Applying holder lookups
[16:43:31] [main/INFO] [FML]: Holder lookups applied
[16:43:31] [main/INFO] [FML]: Injecting itemstacks
[16:43:31] [main/INFO] [FML]: Itemstack injection complete
[16:43:31] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
[16:43:31] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[16:43:31] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: The following texture errors were found.
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:   DOMAIN minecraft
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: --------------------------------------------------
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:   domain minecraft is missing 2 textures
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:     domain minecraft has 3 locations:
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.DefaultResourcePack : Default
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Forge Mod Loader
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:       unknown resourcepack type net.minecraft.client.resources.LegacyV2Adapter : FMLFileResourcePack:Minecraft Forge
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:     The missing resources for domain minecraft are:
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:       textures/block/quartz_block_side.png
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:       textures/block/quartz_pillar.png
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: -------------------------
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]:     No other errors exist for domain minecraft
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: ==================================================
[16:43:32] [main/ERROR] [FML.TEXTURE_ERRORS]: +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
[16:43:32] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[16:43:40] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.12.2
[16:43:40] [Server thread/INFO] [minecraft/IntegratedServer]: Generating keypair
[16:43:40] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[16:43:41] [Server thread/INFO] [FML]: Registry Block: Found a missing id from the world duelcraft:card_table
[16:43:41] [Server thread/INFO] [FML]: Applying holder lookups
[16:43:41] [Server thread/INFO] [FML]: Holder lookups applied
[16:43:41] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@740eda40)
[16:43:41] [Server thread/INFO] [minecraft/AdvancementList]: Loaded 488 advancements
[16:43:41] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@740eda40)
[16:43:41] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@740eda40)
[16:43:42] [Server thread/INFO] [minecraft/MinecraftServer]: Preparing start region for level 0
[16:43:42] [Server thread/WARN] [minecraft/WorldServer]: Keeping entity minecraft:horse that already exists with UUID 16879d4a-e028-4138-a421-a1e485891759
[16:43:42] [Server thread/INFO] [FML]: Unloading dimension -1
[16:43:42] [Server thread/INFO] [FML]: Unloading dimension 1
[16:43:42] [Server thread/INFO] [minecraft/IntegratedServer]: Changing view distance to 12, from 10
[16:43:44] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 2
[16:43:44] [Netty Server IO #1/INFO] [FML]: Client protocol version 2
[16:43:44] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 5 mods : minecraft@1.12.2,FML@8.0.99.99,forge@14.23.5.2768,duelcraft@1.0,mcp@9.42
[16:43:44] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[16:43:44] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[16:43:44] [Server thread/INFO] [minecraft/PlayerList]: Player129[local:E:7ddde36d] logged in with entity id 75 at (-441.66149210798767, 4.0, -329.20041860417973)
[16:43:44] [Server thread/INFO] [minecraft/MinecraftServer]: Player129 joined the game
[16:43:45] [Server thread/INFO] [minecraft/IntegratedServer]: Saving and pausing game...
[16:43:45] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'New World'/overworld
[16:43:45] [pool-2-thread-1/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@54286e0b[id=3584c7cd-614b-3687-b1ad-b239e7a37bd8,name=Player129,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
	at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?]
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
	at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?]
	at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3181) [Minecraft.class:?]
	at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_201]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_201]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 46, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.setAll(Container.java:565) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleWindowItems(NetHandlerPlayClient.java:1314) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:68) ~[SPacketWindowItems.class:?]
	at net.minecraft.network.play.server.SPacketWindowItems.processPacket(SPacketWindowItems.java:13) ~[SPacketWindowItems.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 61, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 61, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 69, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 69, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 70, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 70, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 78, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 78, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more
[16:43:48] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 79, Size: 46
	at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	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_201]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 79, Size: 46
	at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
	at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
	at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]
	at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
	at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
	at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
	... 15 more

 

and this is the container code:

package com.mekelaina.duelcraft.container;

import com.mekelaina.duelcraft.items.ItemCard;
import com.mekelaina.duelcraft.items.ItemCardBinder;
import com.mekelaina.duelcraft.items.ItemDeckbox;

import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.SlotItemHandler;

public class ContainerBinder extends CommonContainer
{
	
	private int refX;
	private int refY;
	private InventoryPlayer playerInv;
	IItemHandler binderInv;
	
	//private GuiBinder GuiInstance;
	
	private static final int SLOT_WIDTH = 18;
	private static final int XSTART_DECKBOX = 140;
	private static final int YSTART_DECKBOX = 32;
	private static final int XSTART_BINDER = XSTART_DECKBOX + 112;
	private static final int YSTART_BINDER = YSTART_DECKBOX;
	private static final int XSTART_MID = XSTART_DECKBOX + 42;
	private static final int YSTART_MID = YSTART_DECKBOX + 13;
	//private static final int numRows = 5;
	
	private ItemCardBinder binderItem;
	
	public ContainerBinder(InventoryPlayer playerInv, IItemHandler binderInv, int numSlots, Item ItemIn) 
	{
		super(numSlots);
		this.playerInv = playerInv;
		this.binderInv = binderInv;
		this.binderItem = (ItemCardBinder) ItemIn;
		
		IItemHandler deckboxInv = new ItemStackHandler(ItemDeckbox.getInvSize());
		
		
		int numRows = 5;
		int numColumns = 5;
		
		for(int y = 0; y < numRows; ++y)
		{
			for(int x = 0; x < numColumns; ++x)
			{
				int index = x + (y * numColumns);
				int xPos = XSTART_BINDER + (x * SLOT_WIDTH);
				int yPos = YSTART_BINDER + (y * SLOT_WIDTH);
				
				this.addSlotToContainer(new SlotItemHandler(binderInv, index, xPos, yPos)
				{
					@Override
					public boolean isItemValid(ItemStack stack)
					{
						if(stack.getItem() instanceof ItemCard && stack.hasTagCompound())
						{
							return true;
						}
						return false;
					}
				});
			}
		}
		
		this.addSlotToContainer(new SlotItemHandler(binderInv, 26, 117, 41)
		{
			@Override
			public boolean isItemValid(ItemStack stack)
			{
				if(stack.getItem() instanceof ItemDeckbox)
				{
					return true;
				}
				return false;
			}
			
			@Override
			public int getSlotStackLimit() 
			{
				return 1;
			}
		});
		
		
    
		/*if(binderItem.hasDeckbox())
		{*/
			for(int y = 0; y < numRows; ++y)
			{
				for(int x = 0; x < numColumns; ++x)
				{
					int index = x + (y * numColumns);
					int xPos = XSTART_DECKBOX + (x * SLOT_WIDTH);
					int yPos = YSTART_DECKBOX + (y * SLOT_WIDTH);
					
					this.addSlotToContainer(new SlotItemHandler(deckboxInv, index, xPos, yPos)
					{
						@Override
						public boolean isItemValid(ItemStack stack)
						{
							if(stack.getItem() instanceof ItemCard && stack.hasTagCompound())
							{
								return true;
							}
							return false;
						}
						
						@Override
						public boolean isEnabled()
						{
							if(binderItem.hasDeckbox())
							{
								return true;
							}
							return false;
						}
					});
				}
			}
		//}
			
			 for (int y = 0; y < 3; ++y)
		        {
		            for (int x = 0; x < 9; ++x)
		            {
		                this.addSlotToContainer(new Slot(playerInv, x + y * 9 + 9, (x * 18) + 8, 106 + y * 18));
		                // x + y * 9 + 9
		                // 0 + 0 * 9 + 9 = 9
		                // 1 + 0 * 9 + 9 = 10
		                // 2 + 0 * 9 + 9 = 11
		                // 3 + 0 * 9 + 9 = 12
		                // 4 + 0 * 9 + 9 = 13
		                // 5 + 0 * 9 + 9 = 14
		                // 6 + 0 * 9 + 9 = 15
		                // 7 + 0 * 9 + 9 = 16
		                // 8 + 0 * 9 + 9 = 17
		                // 0 + 1 * 9 + 9 = 18
		                // 1 + 1 * 9 + 9 = 19
		                // 2 + 1 * 9 + 9 = 20
		                // 3 + 1 * 9 + 9 = 21
		                // 4 + 1 * 9 + 9 = 22
		                // 5 + 1 * 9 + 9 = 23
		                // 6 + 1 * 9 + 9 = 24
		                // 7 + 1 * 9 + 9 = 25
		                // 8 + 1 * 9 + 9 = 26
		                // ...
		            }
		        }

		        // Hot bar
		        for (int x = 0; x < 9; ++x)
		        {
		            this.addSlotToContainer(new Slot(playerInv, x, (x * 18) + 8, 164));
		        }
		
		
	}
	

	
	public void setRefValues(int x, int y)
	{
		refX = x;
		refY = y;
	}
	
	public void setDeckboxStatus(ItemStack stack)
	{
		
	}
	
	
	
	
}

 

and the Common container the above extends:

package com.mekelaina.duelcraft.container;

import javax.annotation.Nonnull;

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

public class CommonContainer extends Container
{
	private final int numSlots;
	
	public CommonContainer(int numSlots)
	{
		this.numSlots = numSlots;
	}
	
	
	@Override
	public boolean canInteractWith(EntityPlayer playerIn)
	{
		return true;
	}
	

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

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

			if (index <  numSlots) {
				if (!this.mergeItemStack(itemstack1, numSlots, this.inventorySlots.size(), true)) {
					return ItemStack.EMPTY;
				}
			}
			else if (!this.mergeItemStack(itemstack1, 0, numSlots, false)) {
				return ItemStack.EMPTY;
			}

			if (itemstack1.getCount() == 0) {
				slot.putStack(ItemStack.EMPTY);
			}
			else {
				slot.onSlotChanged();
			}
		}

		return itemstack;
	}
	
	@Override
	protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection){
		boolean flag = false;
		int i = startIndex;
		if (reverseDirection) i = endIndex - 1;
		
		if (stack.isStackable()){
			while (stack.getCount() > 0 && (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex)){
				Slot slot = (Slot)this.inventorySlots.get(i);
				ItemStack itemstack = slot.getStack();
				int maxLimit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
				
				if (!itemstack.isEmpty() && areItemStacksEqual(stack, itemstack)){
					int j = itemstack.getCount() + stack.getCount();
					if (j <= maxLimit){
						stack.setCount(0);
						itemstack.setCount(j);
						slot.onSlotChanged();
						flag = true;
						
					}else if (itemstack.getCount() < maxLimit){
						stack.shrink(maxLimit - itemstack.getCount());
						itemstack.setCount(maxLimit);
						slot.onSlotChanged();
						flag = true;
					}
				}
				if (reverseDirection){ 
					--i;
				}else ++i;
			}
		}
		if (stack.getCount() > 0){
			if (reverseDirection){
				i = endIndex - 1;
			}else i = startIndex;

			while (!reverseDirection && i < endIndex || reverseDirection && i >= startIndex){
				Slot slot1 = (Slot)this.inventorySlots.get(i);
				ItemStack itemstack1 = slot1.getStack();

				if (itemstack1.isEmpty() && slot1.isItemValid(stack)){ // Forge: Make sure to respect isItemValid in the slot.
					if(stack.getCount() <= slot1.getSlotStackLimit()){
						slot1.putStack(stack.copy());
						slot1.onSlotChanged();
						stack.setCount(0);
						flag = true;
						break;
					}else{
						itemstack1 = stack.copy();
						stack.shrink(slot1.getSlotStackLimit());
						itemstack1.setCount(slot1.getSlotStackLimit());
						slot1.putStack(itemstack1);
						slot1.onSlotChanged();
						flag = true;
					}					
				}
				if (reverseDirection){
					--i;
				}else ++i;
			}
		}
		return flag;
	}
	
	private static boolean areItemStacksEqual(ItemStack stackA, ItemStack stackB)
	{
		return stackB.getItem() == stackA.getItem() && (!stackA.getHasSubtypes() || stackA.getMetadata() == stackB.getMetadata()) && ItemStack.areItemStackTagsEqual(stackA, stackB);
	}
}

 

Link to comment
Share on other sites

7 hours ago, Mekelaina said:

IItemHandler deckboxInv = new ItemStackHandler(ItemDeckbox.getInvSize());

I don't think you want to do this since this inventory will be discarded once the container is closed.

 

You could use the debugger to at least find out what inventory those slots belong to since as it stands I can't find an index greater than 35

Link to comment
Share on other sites

@V0idWa1k3r After some testing, I've found that the size I give it has no effect. Rather The List<Slot> object is being capped at 46 for some reason (so 0-45), As you can see here:

 

Quote

[02:34:56] [main/FATAL] [minecraft/Minecraft]: Error executing task
java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index: 70, Size: 46
    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_201]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_201]
    at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
    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_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_201]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_201]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.IndexOutOfBoundsException: Index: 70, Size: 46
    at java.util.ArrayList.rangeCheck(Unknown Source) ~[?:1.8.0_201]
    at java.util.ArrayList.get(Unknown Source) ~[?:1.8.0_201]
    at net.minecraft.inventory.Container.getSlot(Container.java:141) ~[Container.class:?]
    at net.minecraft.inventory.Container.putStackInSlot(Container.java:557) ~[Container.class:?]

    at net.minecraft.client.network.NetHandlerPlayClient.handleSetSlot(NetHandlerPlayClient.java:1270) ~[NetHandlerPlayClient.class:?]
    at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:33) ~[SPacketSetSlot.class:?]
    at net.minecraft.network.play.server.SPacketSetSlot.processPacket(SPacketSetSlot.java:11) ~[SPacketSetSlot.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_201]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_201]
    at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
    ... 15 more

 

 

as it doesn't tell me the spot where the size is being limited, I've no idea what's the problem. And It's only on this container. Could the problem be that I'm trying to add more than the player's Inventory and one other IInventory? Because the code you mentioned:

IItemHandler deckboxInv = new ItemStackHandler(90);

Is meant to be a placeholder for the inventory of the deckbox, which is what gets placed in the center slot I circled in pink at the start of this thread. 

 

I'm so lost here, This shouldn't be this complicated

Edited by Mekelaina
forgot a zero
Link to comment
Share on other sites

What you've bolded in your error message means that the issue happens when the game fills the slots based on the packet it received from the server. It is still the same issue - the inventory specified doesn't have the slot with that index. So I'll repeat myself again - use the debugger. The code you've provided shouldn't cause this issue, maning something's wrong somewhere else. You could also provide your mod as a github repository so I can debug it for you.

Link to comment
Share on other sites

You've never called a super implementation of GuiContainer#initGui from the override in your GUI thus the player's open container never updates to reflect yours thus the packet that arrives on the client carries the new slot indices but the client still thinks it has the regular inventory open thus causing the issue.

It also causes a bunch of other issues that I am surprized you haven't told us about.

 

You are also using a ton of bad practices that you must drop, like CommonProxy and static initializers. They WILL cause issues later on.

 

Also you probably shouldn't include all those files in your repository while you have not implemented them yet. It took me the good part of an hour to download and setup your repository because of 8000+ useless resources you've got.

Edited by V0idWa1k3r
Link to comment
Share on other sites

@V0idWa1k3r Wow, I'm sorry it gave you such a hard time. All of my stuff is self-taught so I didn't know that they were bad. Those files aren't useless tho. Each one is a card that is to be implemented, I just shortened the amount actually loaded to speed up launching while I worked on the rest. Granted I should probably remove them when not in use, but I didn't exactly plan to upload it to GitHub yet, lol. Do you have a list somewhere of good practices to do? Or could you maybe list what I did that was bad? All of the framework stuff was cobbled together from outdated tutorials, as there wasn't really any better options for someone new to modding. That's why I didn't mess with GitHub until now tbh because my code is ugly and gross as I was trying to figure out how things work. (here's to hoping that the 1.14 tutorials will be better)

Link to comment
Share on other sites

9 minutes ago, Mekelaina said:

here's to hoping that the 1.14 tutorials will be better

I highly doubt that, considering the 1.13 tutorials that people are making now still continue with those outdated practices like static initializers that should've been gone by now and with the new loading system are causing a ton of issue.

 

So yeah, the issues I saw:

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/BlockBase.java

Block/Item/WhateverBase is an antipattern that abuses inheritance. Don't use it, you don't need it. There is already a BlockBase, it's called Block. If you want to set common data of your block don't abuse inheritance, use a helper method.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/util/interfaces/IHasModel.java

IHasModel is a bad practice, drop it. Not only do you not need it at all, you actually end up writing almost 3 times as much code using it compared to the amount of code you would write without it. I have no idea why everybody got so attached to this stupid thing. Oh well, at least 1.13 practically killed it with automatic item model registration.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/CommonProxy.java

A common proxy makes no sense. Proxies exist to separate sided-only operations, if your code is common it goes anywhere else but your proxy. Even besides that I would say that if you need to use a proxy for an operation common executing code is not possible at all.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/CommonProxy.java#L18

This makes no sense. On a server that would just return you the english translation. On the client you can use I18n directly.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/ClientProxy.java#L23

Don't make your proxies into event handlers, that invalidates the whole purpose of a proxy - a class that would only be loaded on the respecive physical side.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/Duelcraft.java#L76

A CommonProxy is bad enough, but having it as your ServerProxy makes even less sense. Server proxy executes the code that would crash on the client with ClassNotFoundException. This is the opposite of common code.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/init/ModBlocks.java

Don't use static initializers for your Registry entries ever since you can't control the loading order of those classes. It WILL mess everything up at some point. Registry entries must be instantinated in the appropriate registry event.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/tileentities/BlockTileEntity.java#L14 

I don't understand the point of this class at all. Just override Block#hasTileEntity and Block#createTileEntity in your block classes. 

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/tileentities/TileEntityPillar.java#L58

Don't "request a sync" from the client ever. The server knows perfectly well when to sync and what to sync, the client shouldn't have a say in this at all ever or it will be abused by malicious clients. Override TileEntity#getUpdatePacket, TileEntity#getUpdateTag, TileEntity#onDataPacket and TileEntity#handleUpdateTag instead.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/util/handlers/RegistryHandler.java#L37

This is too early to add new entries to the ore dictionary, and if you would look at the output log of your game as it starts up forge tells you that with a bunch of errors already.

  • Like 2
Link to comment
Share on other sites

On 4/25/2019 at 4:09 AM, V0idWa1k3r said:

I highly doubt that, considering the 1.13 tutorials that people are making now still continue with those outdated practices like static initializers that should've been gone by now and with the new loading system are causing a ton of issue.

 

So yeah, the issues I saw:

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/BlockBase.java

Block/Item/WhateverBase is an antipattern that abuses inheritance. Don't use it, you don't need it. There is already a BlockBase, it's called Block. If you want to set common data of your block don't abuse inheritance, use a helper method.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/util/interfaces/IHasModel.java

IHasModel is a bad practice, drop it. Not only do you not need it at all, you actually end up writing almost 3 times as much code using it compared to the amount of code you would write without it. I have no idea why everybody got so attached to this stupid thing. Oh well, at least 1.13 practically killed it with automatic item model registration.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/CommonProxy.java

A common proxy makes no sense. Proxies exist to separate sided-only operations, if your code is common it goes anywhere else but your proxy. Even besides that I would say that if you need to use a proxy for an operation common executing code is not possible at all.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/CommonProxy.java#L18

This makes no sense. On a server that would just return you the english translation. On the client you can use I18n directly.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/proxy/ClientProxy.java#L23

Don't make your proxies into event handlers, that invalidates the whole purpose of a proxy - a class that would only be loaded on the respecive physical side.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/Duelcraft.java#L76

A CommonProxy is bad enough, but having it as your ServerProxy makes even less sense. Server proxy executes the code that would crash on the client with ClassNotFoundException. This is the opposite of common code.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/init/ModBlocks.java

Don't use static initializers for your Registry entries ever since you can't control the loading order of those classes. It WILL mess everything up at some point. Registry entries must be instantinated in the appropriate registry event.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/tileentities/BlockTileEntity.java#L14 

I don't understand the point of this class at all. Just override Block#hasTileEntity and Block#createTileEntity in your block classes. 

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/blocks/tileentities/TileEntityPillar.java#L58

Don't "request a sync" from the client ever. The server knows perfectly well when to sync and what to sync, the client shouldn't have a say in this at all ever or it will be abused by malicious clients. Override TileEntity#getUpdatePacket, TileEntity#getUpdateTag, TileEntity#onDataPacket and TileEntity#handleUpdateTag instead.

 

https://github.com/Mekelaina/Duelcraft/blob/master/src/main/java/com/mekelaina/duelcraft/util/handlers/RegistryHandler.java#L37

This is too early to add new entries to the ore dictionary, and if you would look at the output log of your game as it starts up forge tells you that with a bunch of errors already. 

Thank you for this, and for all your help! It's greatly appreciated

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



×
×
  • Create New...

Important Information

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