Jump to content

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


GreatBlitz

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Keep this post up just in case but I'm using the curseforge launcher and it's working  IM SOO HAPPY
    • Post logs as per https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/ They may have information that will answer these questions.
    • I was left reeling when a glitch on a cryptocurrency exchange caused me to lose $166,000 worth of my hard-earned savings. It felt like my entire world had crumbled in the blink of an eye, leaving me with a sense of hopelessness. Determined not to give up, I delved into research on recovery options, unsure of what to expect. That's when I stumbled upon I was left reeling when a glitch on a cryptocurrency exchange caused me to lose $166,000 worth of my hard-earned savings. It felt like my entire world had crumbled in the blink of an eye, leaving me with a sense of hopelessness. Determined not to give up, I delved into research on recovery options, unsure of what to expect. That's when I stumbled upon DIGITAL HACK RECOVERY, a beacon of hope in my darkest hour. Despite my initial doubts, I decided to take a leap of faith and give them a shot as a final lifeline. The experts at DIGITAL HACK RECOVERY proved to be masters of their craft, guiding me through their exclusive process with precision and expertise. Utilizing cutting-edge blockchain analysis methods, they were able to track down the elusive trail of my missing funds and identify the exact point of failure. Their forensic talents were unparalleled as they tirelessly combed through the intricate web of blockchain data to locate my cryptocurrency. With each step they took, they kept me informed of their progress, never wavering in their belief that my funds could be rescued. After several painstaking weeks, DIGITAL HACK RECOVERY finally located and restored my $166,000 worth of cryptocurrency. I was awestruck that they were able to salvage what I had thought was lost forever. The whole experience restored my faith in the crypto space and proved that even in the worst situations, recovery is possible with the right experts on your side. I will be forever grateful to DIGITAL HACK RECOVERY for giving me back my life savings when I needed it most. Their tireless efforts and technical mastery turned what could have been a devastating loss into an uplifting success story. Book a time with DIGITAL HACK RECOVERY through: digital hack recovery @ techie . com &  +12018871705
    • public class ParticleReboundRecipe implements Recipe<CraftingContainer> { private List<ParticleReboundIngredient> inputs; private ParticleReboundFuel fuel; private ItemStack output; public ParticleReboundRecipe(List<ParticleReboundIngredient> inputs, ParticleReboundFuel fuel, ItemStack output) { this.inputs = inputs; this.fuel = fuel; this.output = output; } // TODO: Implement interface ... // TODO: Move to separate file if desired public record ParticleReboundIngredient(Ingredient ingredient, int count) { public static final Codec<ParticleReboundIngredient> CODEC = RecordCodecBuilder.create( builder -> builder.group( Ingredient.CODEC.fieldOf("ingredient").forGetter((i) -> i.ingredient), Codec.INT.fieldOf("count").forGetter(i -> i.count) ).apply(builder, ParticleReboundIngredient::new) ); } // TODO: Move to separate file if desired public record ParticleReboundFuel(String tag) { public static final Codec<ParticleReboundFuel> CODEC = RecordCodecBuilder.create( builder -> builder.group(Codec.STRING.fieldOf("tag").forGetter(f -> f.tag)).apply(builder, ParticleReboundFuel::new) ); public boolean isFuel(ItemStack stack) { // TODO: Check if fuel item matches the tag } } public class Serializer implements RecipeSerializer<ParticleReboundRecipe> { public static final Codec<ParticleReboundRecipe> CODEC = RecordCodecBuilder.create( builder -> builder.group( ParticleReboundIngredient.CODEC.listOf().fieldOf("inputs").forGetter(r -> r.inputs), ParticleReboundFuel.CODEC.fieldOf("fuel").forGetter(r -> r.fuel), ItemStack.CODEC.fieldOf("output").forGetter(r -> r.output) ).apply(builder, ParticleReboundRecipe::new) ); @Override public @NotNull Codec<ParticleReboundRecipe> codec() { return CODEC; } // TODO: The rest ... } }   ?
  • Topics

×
×
  • Create New...

Important Information

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