Brewing stands duplicate their contents when they fall or are pushed by a piston #831

Closed
opened 2020-09-08 17:46:31 +02:00 by anon5 · 14 comments

A copy of their contents falls out.

A copy of their contents falls out.
Contributor

Awesome bug! :))

Awesome bug! :))
Wuzzy added the
items
#P3: elevated
bug
labels 2020-09-09 15:49:49 +02:00
Member

I've been out of the MCL2 loop for a little while - taking a break. Noticed this little gem. There was an issue with early versions of the brewing stand, but I believed it to be fixed.

Brewing stands only have one call to distribute items on destruct, so this shouldn't happen...

I've been out of the MCL2 loop for a little while - taking a break. Noticed this little gem. There was an issue with early versions of the brewing stand, but I believed it to be fixed. Brewing stands only have one call to distribute items on destruct, so this shouldn't happen...
Contributor

Very challenging and maybe needs more time for exploring (half an hour wasn't enough for me).

Just my notices for now:

  1. It can duplucate almost everything because I don't see any limitations for items you can load into the stand :)

  2. Probably not as difficult would be to disable dropping, it calls from the destructor (on_destruct) when you push it by the piston or dig a block below it.

  3. But on_construct skips further :)))) So IDK where to clear the inventory, maybe besides delayed execution from the destructor...

Very challenging and maybe needs more time for exploring (half an hour wasn't enough for me). Just my notices for now: 1. It can duplucate almost everything because I don't see any limitations for items you can load into the stand :) 2. Probably not as difficult would be to disable dropping, it calls from the destructor (```on_destruct```) when you push it by the piston or dig a block below it. 3. But ```on_construct``` skips further :)))) So IDK where to clear the inventory, maybe besides delayed execution from the destructor...
Contributor

I was wrong about the constructor. It fires. Seems meta content is kept by an outer mod (?) Disabling the item dropout is still the best I would do for now

I was wrong about the constructor. It fires. Seems meta content is kept by an outer mod (?) Disabling the item dropout is still the best I would do for now
Author

I think this is because pushing with a piston or falling counts as destruct.

I think this is because pushing with a piston or falling counts as destruct.
Contributor

The drop is implemented in brewing which runs through destructor which fires by on_destruct events redefined at lines 414, 486, 559, 628, 707, 782, 857 and 939. There is also after_dig definition but it isn't attached and maybe not used.

When item moves by falling and/or by the piston it actually just changes its position in the world but destruct and construct events still fire in this case. So at the first glance we would can just clear stand's content in the cunstructor. But it doesn't work :) That's why I suspect the action of some outer mod, eg falling handler where definitely meta manipulations used, but I have to explore it more carefully :( hope maybe @bzoss can fix it faster than me - it would really nice

The drop is implemented in [brewing](https://git.minetest.land/Wuzzy/MineClone2/src/branch/master/mods/ITEMS/mcl_brewing/init.lua#L280) which runs through [destructor](https://git.minetest.land/Wuzzy/MineClone2/src/branch/master/mods/ITEMS/mcl_brewing/init.lua#L358) which fires by [on_destruct](https://git.minetest.land/Wuzzy/MineClone2/src/branch/master/mods/ITEMS/mcl_brewing/init.lua#L414) events redefined at lines 414, 486, 559, 628, 707, 782, 857 and 939. There is also [after_dig](https://git.minetest.land/Wuzzy/MineClone2/src/branch/master/mods/ITEMS/mcl_brewing/init.lua#L414) definition but it isn't attached and maybe not used. When item moves by falling and/or by the piston it actually just changes its position in the world but destruct and construct events still fire in this case. So at the first glance we would can just clear stand's content in the cunstructor. But it doesn't work :) That's why I suspect the action of some outer mod, eg falling handler where definitely meta manipulations used, but I have to explore it more carefully :( hope maybe @bzoss can fix it faster than me - it would really nice
Contributor

mcl_falling_nodes mod really keeps meta data of falling objects.

mesecons_mvps preserves it for object moving by the piston.

```mcl_falling_nodes``` mod really keeps meta data of falling objects. ```mesecons_mvps``` preserves it for object moving by the piston.
Contributor

By the way, I'm checking its behavior in MC 1.16.2:

  1. I can't put random items into stand's inventory, eg. bed or flint and steel and even experience bottle.

  2. Stand produces some black particles.

  3. When I dig the block under the stand it doesn't fall :):):)
    image

  4. The pistons can't push the stand.

So... as the mods I mentioned above work really good and help the stand to keep its inventory, and as it still very very not as in MC, I don't see the reason for dropping its content anymore.

I can fix it now by removing the drop if @bzoss won't mind. I'd prefer to get confirmation from the authors of the brewing and don't touch anything without having it.

By the way, I'm checking its behavior in MC 1.16.2: 1. I can't put random items into stand's inventory, eg. bed or flint and steel and even experience bottle. 2. Stand produces some black particles. 3. When I dig the block under the stand it doesn't fall :):):) ![image](/attachments/f9765d1d-173e-4971-8cab-434a92368241) 4. The pistons can't push the stand. So... as the mods I mentioned above work really good and help the stand to keep its inventory, and as it still very very not as in MC, I don't see the reason for dropping its content anymore. I can fix it now by removing the drop if @bzoss won't mind. I'd prefer to get confirmation from the authors of the brewing and don't touch anything without having it.
197 KiB
Author

Rather than not dropping contents can't you disable falling/pushing?

Rather than not dropping contents can't you disable falling/pushing?
Author

There is also after_dig definition but it isn't attached and maybe not used.

That is unused, the reference to it in the nodedef was removed.

> There is also [after_dig](https://git.minetest.land/Wuzzy/MineClone2/src/branch/master/mods/ITEMS/mcl_brewing/init.lua#L414) definition but it isn't attached and maybe not used. That is unused, the reference to it in the nodedef was removed.
Contributor

Rather than not dropping contents can't you disable falling/pushing?

I think yes. The falling can be prevented just by removing the corresponding group, the pushing - I'm not 100% sure for now but we may try. I remember, you like to copy Minecraft behavior. But what's the profit for doing that? 100% copying isn't the goal... I thought it's good that the piston works with it in MineClone 2. You don't think so? Could you please explain why?

> Rather than not dropping contents can't you disable falling/pushing? I think yes. The falling can be prevented just by removing the corresponding group, the pushing - I'm not 100% sure for now but we may try. I remember, you like to copy Minecraft behavior. But what's the profit for doing that? 100% copying isn't the goal... I thought it's good that the piston works with it in MineClone 2. You don't think so? Could you please explain why?
Author

Well one reason it that it duplicates the content.

Well one reason it that it duplicates the content.
Author

I think they should drop the contents when they are broken or blow up, along with all other item containers (currently some don't e.g. dispensers), disabling dropping could make players lose valuable items, but disabling pushing wouldn't cause many problems. Or you could just fix it properly and do what chests do.

I think they should drop the contents when they are broken or blow up, along with all other item containers (currently some don't e.g. dispensers), disabling dropping could make players lose valuable items, but disabling pushing wouldn't cause many problems. Or you could just fix it properly and do what chests do.
Contributor

@anon5 Thank you for reporting and for the opinion.

I'm fixing it as you prefer. It's really easy.

Hope @Wuzzy and @bzoss won't blame me for that. I shouldn't touch their code when they maybe work on it but we still need to fix the bug so let's try:

7678bf9b9f

We may revert this if I did something wrong.

@anon5 Thank you for reporting and for the opinion. I'm fixing it as you prefer. It's really easy. Hope @Wuzzy and @bzoss won't blame me for that. I shouldn't touch their code when they maybe work on it but we still need to fix the bug so let's try: https://git.minetest.land/Wuzzy/MineClone2/commit/7678bf9b9f1b0f60da229755c73c16c5aa55ed9b We may revert this if I did something wrong.
kay27 closed this issue 2020-09-19 22:42:41 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#831
No description provided.