Refined Storage

Refined Storage

77M Downloads

syncronized did not work

tomevoll opened this issue ยท 72 comments

commented

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.

commented

I don't mean like generators, but you have like items that are RF-powerable right? Like ItemEnergyContainer in the RF api.

commented

pickaxe can take RF, i dont have a slot put in yet for charging thoug

commented

other then that the furnace and pulverizer is RF and treefarm ofc

commented

Yeah, is there a machine that charges up RF powerable items?

commented

generator will, and the powercube will, but the slot is not added yet, only drawn in

commented

i guess i can add a slot to the generator quickly if you need it

commented

Don't need it right now, but I'm planning to make the wireless grid need RF.

commented

sounds like a good idea :) i was happy when i noticed the enderpearl fuel was gone :D

commented

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.

commented

ill get a slot added today or tomorrow

Just been lazy, should have been there by now :)

commented

that conduit was a pain thoug, it act as a multipart, and raytrace like a multipart but is just a normal block

commented

The conduit looks very cool :)

commented

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

commented

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?

commented

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

commented

i could do a mockup crafting, but it would need some code cleaning after, you do way cleaner code then me

commented

I have a plan for autocrafting, but it'll be for the next update ;)

commented

:)

commented

i guess my messy code is a result of being self thought and picking up loads of bad habbits :)

commented

Following a code standard and using the reformat option in your IDE already helps a lot :p

commented

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

commented

lol

commented

hehe, if that was for a assignment the teacher would kill me :O

commented

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.

45f110a

commented

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

commented

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.

commented

Yeah, I guess that would work.

commented

That is most likely the list being cleared when the network packet arrives. Your fix should fix that issue, I guess...

commented

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

commented

public List getItems() {
return items;
}

commented

I mean the getItems() in GuiGrid.

commented

hmm

maybe the itemstack in the list is null ?

commented

that would cause the trailing .getQuantity(); to fail

commented

but im not sure how a null would get in there, the code i looked at i dont see how

commented

hmm maybe try with a null check in combineItems

commented

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

commented

line 67 external storage might be the reason items.add(new StorageItem(inventory.getStackInSlot(i)));

commented

maybe try this instead "synchronized private List items = new ArrayList();" in TileController

commented

nm that, that wont work

commented

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.

commented

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

commented

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

commented

yes sure can :)

commented

Btw, does your mod work on the latest Forge already? Last time I tried, it crashed...

commented

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

commented

Great, thanks.

commented

finally got the cable switched to json

commented

Heh, also took me until 1.9 till I did that (was using the TESR hack in 1.8.9)

commented

:)

commented

world.zip

this is the worl i test in, tree farm running, routers running, and the new conduit, a lot of item swaping

commented

and refinedStorage doing the storage part ofc :D

commented

Gonna check that out RIGHT NOW :D

commented

energy cube im working on atm, need to rotate some faces

commented

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.

commented

no

commented

2 arrows, coal block, bonemeal, charcoal, a controller, a grid, disk drive, external storage, some saplings, logs, and a barrel

commented

Interesting...

commented

is a wireless grid in the player inventory

commented

but the new one not the old

commented

maybe the same crash, just u got it instant this time ?

commented

No, this is a different one. The item stack is there but there is no actual item associated to it...

commented

hmm thats weird

commented

ooops

i sent the wrong world

commented

world.zip
this one is the correct, sorry about that :)

commented

i took the world from the server with most likely do have the old items in it

commented

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

commented

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?

commented

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

commented

Also, is there a block in your mod that lets me power up items that use RF?

commented

but the 1 rf/t usage it had before was a litle low lol :D

commented

yes

the cable transfer RF, and you got the generators running there in that world to :)

commented

generators do 20 RF/t each