Jump to content

[1.9] [Solved, solution inside] A very weird set of issues with GUI


GreatBlitz
 Share

Recommended Posts

Code:

TestBlock: http://pastebin.com/nub56uNM

GuiContainerTileEntityTestBlock: http://pastebin.com/ueL72uSc

GuiMessage: http://pastebin.com/2idHgLsk

GuiHandler: http://pastebin.com/pYC8pr4X

ContainerTileEntityTestBlock: http://pastebin.com/a3GB6rNC

GuiMessageHandler: http://pastebin.com/qzZEbKfP

TileEntityTestBlock: http://pastebin.com/Aj4gCkJa

 

Alright, I can't describe this problem very well, so here is exactly what I do:

 

1. Create a new world, place my block

Special Occurrences: Nothing

Log entry:

 

[21:02:46] [server thread/INFO]: [Player865: Set own game mode to Survival Mode]

[21:02:46] [Client thread/INFO]: [CHAT] Your game mode has been updated to Survival Mode

[21:02:53] [server thread/INFO]: [Player865: Given [Test Block] * 1 to Player865]

[21:02:53] [Client thread/INFO]: [CHAT] Given [Test Block] * 1 to Player865

entered onBlockPlacedBy

 

 

2. Place an energy source next to block and right click the block

Special occurrences: I see the RF filling up (in the form of text)

Log entry:

 

 

entered onBlockPlacedBy[21:05:47] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:69]: Hello!

[21:05:47] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:70]: Energy: 140/32000

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 140

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 140

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 140

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 160

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 160

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 160

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 180

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 180

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 180

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 200

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 200

[21:05:47] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

 

and so on

 

 

3. Break the block, place it elsewhere

Special occurrences: The block gets placed as normal.

Log entry:

 

entered onBlockPlacedBy[21:26:33] [Client thread/FATAL]: Error executing task

java.util.concurrent.ExecutionException: java.lang.NullPointerException

at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_101]

at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.util.Util.runTask(Util.java:26) [util.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1109) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:404) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

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_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.NullPointerException

at net.minecraft.client.network.NetHandlerPlayClient.handleUpdateTileEntity(NetHandlerPlayClient.java:1303) ~[NetHandlerPlayClient.class:?]

at net.minecraft.network.play.server.SPacketUpdateTileEntity.processPacket(SPacketUpdateTileEntity.java:55) ~[sPacketUpdateTileEntity.class:?]

at net.minecraft.network.play.server.SPacketUpdateTileEntity.processPacket(SPacketUpdateTileEntity.java:12) ~[sPacketUpdateTileEntity.class:?]

at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:15) ~[PacketThreadUtil$1.class:?]

at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_101]

at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.util.Util.runTask(Util.java:25) ~[util.class:?]

... 15 more

 

 

Note about the log: Where is this NPE coming from?

 

4. Right-click the block

Special occurrences: RF appears as 0.

Log entry:

 

[21:29:04] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:69]: Hello!

[21:29:04] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:70]: Energy: 3460/32000

[21:29:04] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:04] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:29:05] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

 

 

Note about the log: It's weird, that the block shows that there is RF, but the GUI itself and the GUI prints display as 0.

 

5. Exit, re-enter world, right click block

Special occurrences: RF is still 0.

Log entry:

 

[21:32:42] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:69]: Hello!

[21:32:42] [server thread/INFO] [sTDOUT]: [greatblitz.testmod.blocks.TestBlock:onBlockActivated:70]: Energy: 0/32000

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:45]: printing from drawscreen

false

[21:32:42] [Client thread/INFO] [sTDOUT]: [greatblitz.testmod.client.gui.GuiContainerTileEntityTestBlock:drawScreen:47]: rf: 0

 

Note about the log: It's even weirder, that although the GUI prints continue to display RF as 0, this time the block itself displays RF as 0 (didn't happen in step 5, read note).

 

Tell me if you need more files/logs.

 

Appreciate all the help I can get.

 

Regards,

GreatBlitz.

Link to comment
Share on other sites

Hi

 

Although I don't really understand what problems you're having, the general symptoms make me think you are probably messing up the client-server synchronisation.

 

If you need an example of working containers and/or tile entity synchronisation, this tutorial project might help

https://github.com/TheGreyGhost/MinecraftByExample

(mbe20, mbe30, mbe31 in particular)

 

-TGG

Link to comment
Share on other sites

Hi

 

Although I don't really understand what problems you're having, the general symptoms make me think you are probably messing up the client-server synchronisation.

 

If you need an example of working containers and/or tile entity synchronisation, this tutorial project might help

https://github.com/TheGreyGhost/MinecraftByExample

(mbe20, mbe30, mbe31 in particular)

 

-TGG

 

But if you look at my tile entity (TileEntityTestBlock: http://pastebin.com/Aj4gCkJa), my getUpdatePacket(), getUpdateTag(), onDataPacket(), handleUpdateTag(), readFromNBT(), writeToNBT() methods seem fine...?

Link to comment
Share on other sites

then the problem most likely isn't your tile entity. your tile entity looks really fine.

 

i'm going to read trough the classes now.

 

look 1: you most likely would want to do world.notifyblock as well when you are placing the block

-2 most certainly after calling the readNbt to copy over the itemstack data.

also, why are you reading the entire itemstack data ? I might be wrong here, but wouldn't it be better to append a tag to the stack tag so you write your entire TE to a nbttagcompound that you append to the stack tag compound ?

if other mods, or even vanilla?, write data to the itemstack, stuff might get funky.

 

short conclusion : you will want to call world.blocknotify whenever you make a change to the TE. you will want to do this server side.

-when placing a block next to it

-when changing RF by use of items

-when sending a packet to the server

 

(most of these are already done. just verify)

 

the biggest problem about breaking block and re-placing it is most likely reading the nbt from the stack, and writing it to the stack. double check on those.

 

do not know where the NPE is comming from, but you can trace it down with a break point on NPE exceptions (yes, that does exist). it is most likely comming from a packet error and something that has to do with threads ?

"java.util.concurrent.ExecutionException,

handleUpdateTileEntity,

SPacketUpdateTileEntity.processPacket"

 

 

unrelated :

-you might want to rename some of your classes.

Gui's start with the Gui prefix, so GuiMessageHandler would be inapropriate.

PacketSyncServerTestBlock and PacketSyncServertestBlockHandler would be more appropriate.

-BlockPos can be written to long, which can be written by ByteBufers, and BlockPos.fromLong(long) is also a thing. no need to explicetly write the coords out to the packet.

Link to comment
Share on other sites

Marking as solved. The helpful people at IRC told me to use BlockEntityTag instead, this is what my code in getDrops becomes, for anyone curious:

List<ItemStack> drops = Lists.newArrayList();
TileEntityTestBlock te = (TileEntityTestBlock) world.getTileEntity(pos);
if (te != null && te instanceof TileEntityTestBlock) {
     	ItemStack i = new ItemStack(ModBlocks.testblock);
       	NBTTagCompound compound = new NBTTagCompound();
       	te.writeToNBT(compound);
       	compound.removeTag("x");
       	compound.removeTag("y");
       	compound.removeTag("z");
       	NBTTagCompound stackTag = new NBTTagCompound();
        stackTag.setTag("BlockEntityTag", compound);
        i.setTagCompound(stackTag);drops.add(i);
   }

   return drops;
}

 

Then I removed the onBlockPlacedBy method, as BlockEntityTag loads it on its own.

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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello I'm working on playing mods with friends but forge is giving me the exit code 1. I have tried using the curseforge to run it but same outcome. I've uninstalled minecraft and java. I looked online for any solutions and I've tried different versions of 1.19.2, nothing made a difference. There are currently no mods just forge. Log: https://gist.github.com/ExpiredPoptarts/19d7ff941fc62c9dc0b3b87ef3f65dc8
    • Custom lamp problem 1.12.2 is a problem that can occur when using the custom lamps mod in version 1.12.2 of Minecraft. The issue is caused when two or more custom lamps are placed in close proximity to each other, causing them to conflict with each other and malfunction. This can result in a variety of issues such as the lamps not lighting up, flickering, or not responding to game commands. The problem can be resolved by ensuring that custom lamps are placed far enough away from each other that they do not conflict.
    • look inside the model json file. move all cubes upward.
    • I made a huge forge 1.7.10 mod pack but whenever I try to create a singleplayer world I get the error saying "A fatal error has occurred, this connection is terminated." Does anyone know what the issue could be?  Here is my fml-client-latest.log from when it crashes: https://paste.ubuntu.com/p/3rKSJSqnrX/ and here is the list of mods: https://imgur.com/a/AZifMbg    
    • Im trying to host a minecraft server using the curseforge serverpack from FTB Direwolf20 and when I try to start the server I run into an error The Error: Starting server A problem occurred running the Server launcher.java.lang.reflect.InvocationTargetException         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 cpw.mods.fml.relauncher.ServerLaunchWrapper.run(ServerLaunchWrapper.java:43)         at cpw.mods.fml.relauncher.ServerLaunchWrapper.main(ServerLaunchWrapper.java:12) Caused by: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Level         at net.minecraft.launchwrapper.Launch.launch(Launch.java:94)         at net.minecraft.launchwrapper.Launch.main(Launch.java:28)         ... 6 more Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.Level         at java.net.URLClassLoader$1.run(Unknown Source)         at java.net.URLClassLoader$1.run(Unknown Source)         at java.security.AccessController.doPrivileged(Native Method)         at java.net.URLClassLoader.findClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)         at java.lang.ClassLoader.loadClass(Unknown Source)         ... 8 more   I'have tried deleting and downloading the newset version of java wich didnt work and now im using an older version which is the 1.7.0_80 Here is what my Server folder looks like: https://ibb.co/jkbfRY7 Here is what the ServerStart.bat file looks like: @if NOT "%FTB_VERBOSE%"=="yes" ( @echo off ) call settings.bat if NOT EXIST minecraft_server.1.7.10.jar ( goto install ) if NOT EXIST libraries\%LAUNCHWRAPPER% ( goto install ) goto skipinstall :install echo running install script! call FTBInstall.bat :skipinstall REM Check if java in path REM TODO: use %JAVACMD% where java > NUL 2>&1 if %ERRORLEVEL% NEQ 0 ( echo No java binary in path. Can't run server, exiting... pause exit /B ) REM Test JVM REM e.g. 32-bit JVM does not have server\jvm.dll library java -server -version > java-test.log 2>&1 if %ERRORLEVEL% NEQ 0 ( echo Detected following JVM error: echo ======================================= more java-test.log echo ======================================= echo JVM test failed. Can't run server, Exiting... pause exit /B ) if not exist eula.txt ( echo Missing eula.txt. Startup will fail and eula.txt will be created echo Make sure to read eula.txt before playing! goto startserver ) find "eula=false" eula.txt 1 > NUL 2>&1 if %ERRORLEVEL% EQU 0 ( echo Make sure to read eula.txt before playing! Exiting. pause exit /B ) del /f /q autostart.stamp > nul 2>1 :startserver echo Starting server java -server -Xms512M -Xmx2048M -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1558.jar nogui :server_loop if exist autostart.stamp ( del /f /q autostart.stamp > nul 2>1 echo If you want to completely stop the server process now, press Ctrl+C before the time is up! for /l %%i in (5,-1,1) do ( echo Restarting server in %%i choice /t 1 /d y > nul ) echo Starting server now java -server -Xms512M -Xmx2048M -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1558.jar nogui echo Server process finished goto :server_loop ) echo Exiting... pause  
  • Topics

×
×
  • Create New...

Important Information

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