Quark Oddities

Quark Oddities

22M Downloads

r1.2-79 Pushing dropper into powered states clears its inventory

an-OK-squirrel opened this issue ยท 7 comments

commented

Before pushing the dispenser it is full of items: http://i.imgur.com/EOKTcGN.png

After pushing dispenser no items come out and is completely empty: http://i.imgur.com/2CPd0ws.png

commented

After some testing, it appears as if changing the block state after pushing removes the tile entity somehow. Only seems to happen for dispensers/droppers.

commented

Something with TileEntity.shouldRefresh? Though it should already be set up correctly for vanilla te's

commented

Some more research, and here's my theory. I can't attest for it, but I think it serves a valid explanation.

The following all happens in the same game tick:

  • The piston places the block, and sets the tile entity in the same code block
  • Tile entity setting is apparently queued in some way
  • After the block and TE are set, the piston block itself gets set, having the dispenser update its neighbours
  • As the dispenser updates neighbours, it references its current tile entity to attempt to dispense the block
  • There is no tile entity there, so the world finds the need to set the default one, overriding our request to set the tile entity with a new one

EDIT: A new TE is generated when the block state is placed, but then subsequently replaced with another one. Fun stuff. Looks like this theory is void.

commented

This is my current test setup.
2017-02-11_21 23 01

I got some prints and a debug item up to get instance references for the tile entities. Here's what I found.
Debug item, before pushing: 752c06a9
After pushing, before setting the TE back: 52861bff (expected, since a new TE is made)
After the TE is set: 752c06a9
Debug item, after pushing: 72812941
After pulling, before setting the TE back: 780b16b5 (same gist)
After the TE is set again: 72812941
Debug item, after pulling: 72812941

The tile only gets overriden if a block update happens, it seems.

commented

There's also a long running bug that duplicates tile entities when moving them around, so you might wanna dump them in the area during your different steps.

commented

I've tried fixing this in a lot of different ways but couldn't get it to work in any way that didn't involve making the piston not make any block updates at all, which isn't ideal. I'll have to keep this open and release the current update without it.

If anyone with experience in this area wants to lend a hand, please do.

commented

thanks for fixing, this will make flying machine designs really neat :)