Slot GUI contains[] Error

Started by The Ender Master on Fri, 02/05/2016 - 23:51
Last seen on 23:33, 10. Sep 2016
Joined Aug 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Slot GUI contains[] Error
Fri, 02/05/2016 - 23:51

So I am working on a mod, and I decided one of my machines should get a GUI. I added a slot that tests if there is a certain block in itself. I am using Mcreator 1.5.9 (for 1.7.10.) Here is the error:

 

>Executing gradle command: build
>Microsoft Windows [Version 6.1.7601]
>Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
>C:\Pylo\MCreator159>cd forge
>C:\Pylo\MCreator159\forge>SET "JAVA_HOME=C:\Pylo\MCreator159\jdk\"
>C:\Pylo\MCreator159\forge>SET JAVA_EXE=%JAVA_HOME%\bin\java.exe
>C:\Pylo\MCreator159\forge>SET PATH=%JAVA_HOME%\bin\;%PATH%
>C:\Pylo\MCreator159\forge>gradlew build
>****************************
> Powered By MCP:            
> http://modcoderpack.com/   
> Searge, ProfMobius, Fesh0r,
> R4wk, ZeuX, IngisKahn, bspkrs
> MCP Data version : unknown
>****************************
>:compileApiJava UP-TO-DATE
>:processApiResources UP-TO-DATE
>:apiClasses UP-TO-DATE
>:sourceMainJava UP-TO-DATE
>C:\Pylo\MCreator159\forge\build\sources\java\mod\mcreator\mcreator_voidCollectorGUI.java:201: error: incomparable types: Item and BlockRefinedVoidBlock
>if(VIGUI.getStackInSlot( 04).getItem() == mcreator_refinedVoidBlock.block){
>                                       ^
>C:\Pylo\MCreator159\forge\build\sources\java\mod\mcreator\mcreator_voidCollectorGUI.java:209: error: incomparable types: Item and BlockNullBlock
>if(VIGUI.getStackInSlot( 04).getItem() == mcreator_nullBlock.block){
>                                       ^
>C:\Pylo\MCreator159\forge\build\sources\java\mod\mcreator\mcreator_voidCollectorGUI.java:221: error: incomparable types: Item and BlockAwakenedNullFrame
>if(VIGUI.getStackInSlot( 04).getItem() == mcreator_awakenedNullFrame.block){
>                                       ^
>3 errors
>:compileJava FAILED
>FAILURE: Build failed with an exception.
>* What went wrong:
>Execution failed for task ':compileJava'.
>> Compilation failed; see the compiler error output for details.
>* Try:
>Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
>BUILD FAILED
>Total time: 31.284 secs
>C:\Pylo\MCreator159\forge>
>Task completed with return code 0 in 32362 milliseconds

 

Any help would be appreciated, as this error puts a major block in my mod.

 

Last seen on 15:28, 29. Oct 2016
Joined Jul 2015
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I have exactly the same
Sat, 10/29/2016 - 13:12

I have exactly the same problem... No solutions ? Is there a solution to return true when an item is in a specific slot ?

Last seen on 11:42, 20. Oct 2018
Joined Aug 2013
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
  • wiki contributor
  • moderator
You can not compare Block and
Sat, 10/29/2016 - 13:53

You can not compare Block and Item.You are compring two different things. You must compare Item and Item or Item and ItemBlock. (Block = the placed object, ItemBlock = the instance in inventory)
You can get the ItemBlock using "Item.getItemFromBlock(YOUR_BLOCK)".
So for example from the error above it would be:
 

if(VIGUI.getStackInSlot( 04).getItem() == Item.getItemFromBlock(mcreator_awakenedNullFrame.block)){