syncronized did not work
tomevoll opened this issue ยท 72 comments
java.lang.NullPointerException: Rendering screen
at refinedstorage.gui.GuiGrid.drawForeground(GuiGrid.java:147)
at refinedstorage.gui.GuiBase.drawGuiContainerForegroundLayer(GuiBase.java:91)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:136)
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:313)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1147)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1135)
at net.minecraft.client.Minecraft.run(Minecraft.java:401)
at net.minecraft.client.main.Main.main(Main.java:118)
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 net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
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 net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)
Looks like it didnt fix it, i ran it for hours after adding it no issues, then suddenly now it happend again.
I don't mean like generators, but you have like items that are RF-powerable right? Like ItemEnergyContainer in the RF api.
generator will, and the powercube will, but the slot is not added yet, only drawn in
sounds like a good idea :) i was happy when i noticed the enderpearl fuel was gone :D
Yeah, the whole wireless grid plate crap and the difference between a wireless crafting grid and a normal wireless grid was just a pain and needlessly complex.
ill get a slot added today or tomorrow
Just been lazy, should have been there by now :)
that conduit was a pain thoug, it act as a multipart, and raytrace like a multipart but is just a normal block
Thnx :) was worried it was getting to mutch like enderIO's conduit, wasnt copying or anything but i liked the design with the thin cable :D
i was thinking about the autocrafting, i think storing a recipe in a items NBT would be fine, 9 stacks + 3 outputs, and a boolean maybe to say if its a normal recipe or a machine recipe with could have mroe then 1 output, and when you request a crafting, u check each item u need, if u miss one u check if u can craft it, if u got a recipe for it push that recipe onto a stack, then continue same order for next recipe until u reach the end then as u craft items one by one u just pop them off the stack, last in first out, think that should work
If you hit a item needed while pushing to the stack that is not in storage and not craftable, cancel the craft or tell the controller what item your waiting for, maybe have a status tab?
if you want to know how the crafting itself works i got a few examples i can show you that i use in my Special Chest on the packager upgrade
i could do a mockup crafting, but it would need some code cleaning after, you do way cleaner code then me
i guess my messy code is a result of being self thought and picking up loads of bad habbits :)
Following a code standard and using the reformat option in your IDE already helps a lot :p
ya true, i still need to split my code into smaller peaces, the router tile alone is 2235 lines lol, and im sure 60% could have been in a utility class
It's most likely caused by me, I moved the synchronized stmt to getItems() because when opening the grid GUI when it was not connected to a controller, it would crash, as grid.getController() would be null.
one solution i guess would be when a packet arrives, add it to a temporary list if on the client, then in render foreground pull the temporary list in to the main list before the rendering. so the network packet dont modify the list while you read it
there are some weird flickering of the gui to i noticed, like the whole gui vanish for 1/10 of a seccond, never seen that before.
That is most likely the list being cleared when the network packet arrives. Your fix should fix that issue, I guess...
That shouldn't be the issue, getItems() creates a new list every call, so the list in TileController is not changed...
hmm, didnt getItems() just return this.items
but im not sure how a null would get in there, the code i looked at i dont see how
i guess its possible if items have a ref to a tile, and the stacks is gotten from there, unless the stacks in items is a copy() it will reflect the changes in that inventory, so if a stack was pulled out and slot was set to null, the list would contain that null if between refreshing, cant really see how null would end up in that list in any other way
line 67 external storage might be the reason items.add(new StorageItem(inventory.getStackInSlot(i)));
maybe try this instead "synchronized private List items = new ArrayList();" in TileController
This issue is purely client side, there can't be any null items serverside as that would fail while sending the items.
I have a fix in my head I'll now try to do.
hmm acually looking at the fromBytes, its not possible any entries are null it would have crashed there with index out of bounds if it was, and the list itself cant be null ether i think or items.size() would have crashed
I was calling getItems() throughout the place, and when something changed item-wise the result of one call to getItems() wouldn't match the result of another call to getItems().
I've removed that and just made the items update every GUI update. This should also get rid of the flickering. Could you test this?
Its implement in the latest commit: 861517c
Btw, does your mod work on the latest Forge already? Last time I tried, it crashed...
it does now if latest is 12.16.0.1811-1.9
RouterReborn-1.9-4.0.1.7b_universal-dev.zip
rename to .jar
Heh, also took me until 1.9 till I did that (was using the TESR hack in 1.8.9)
this is the worl i test in, tree farm running, routers running, and the new conduit, a lot of item swaping
When trying to open the grid in your world it crashed... apperently there is some ItemStack with a null Item... is there a wireless grid plate or something in the storage system, because I deleted that in the latest commits.
2 arrows, coal block, bonemeal, charcoal, a controller, a grid, disk drive, external storage, some saplings, logs, and a barrel
No, this is a different one. The item stack is there but there is no actual item associated to it...
world.zip
this one is the correct, sorry about that :)
cube is on temp textures so wont look like that when done, just had to test with something :D
Cable can be wrenched on connector to change mode, or on the cable to disconnect/connect
Love it :) Having very low fps in that world, you too? Or is that just my PC :p.
Btw, what do you think of the current RF/t usage for machines? Is it good, should it be more / less?
looks ok i think, i know some mods that come to 1.9 sooner or later will produce a lot of rf so i don't think its to much, atm its fine, we don't have to much rf available yet
yes
the cable transfer RF, and you got the generators running there in that world to :)