Integrated Dynamics

Integrated Dynamics

63M Downloads

Squeezer's "onPlace" copies items.

JakobYde opened this issue ยท 6 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

This happens in direwolf20 1.18 and might not be relevant, but as I expect it to be a general bug, I'll still post it here.

When placing an item in the squeezer, picking it up with shift+right click and placing it again, it drops the item, even though the item is still in the squeezer.

It seems to be happening in BlockSqueezer.java --> InventoryHelpers.dropItems(world, tile.getInventory(), blockPos);

@Override
public void onPlace(BlockState oldState, Level world, BlockPos blockPos, BlockState newState, boolean isMoving) {
    if (oldState.getBlock() != newState.getBlock()) {
        BlockEntityHelpers.get(world, blockPos, BlockEntitySqueezer.class)
                .ifPresent(tile -> {
                    InventoryHelpers.dropItems(world, tile.getInventory(), blockPos);
                    world.updateNeighbourForOutputSignal(blockPos, oldState.getBlock());
                });
        super.onPlace(oldState, world, blockPos, newState, isMoving);
    }
}

Besides this, the energy battery starts with MAX_INT instead of 0 RF.

Should I post this on the direwolf20's page too?

Steps to reproduce the problem:

  1. Place item in squeezer
  2. Pickup squeezer
  3. Place squeezer

Expected behaviour:

I would expect it to simply keep the item.


Versions:

  • Modpack: FTB Presents Direwolf20 1.18
  • This mod: 1.18.2-1.11.0
  • Minecraft: 1.18
  • Forge: not sure

Log file:

commented

Just pushed a change that should fix the problem (new update coming soon).

If the problem still occurs, then I would suggest opening an issue on CarryOn's issue tracker, as there's not much more I can change on my end unfortunately. (now the squeezer does the same thing as the vanilla chest)

commented

picking it up with shift+right click

Is this through a certain mod? Because that doesn't sound like vanilla behaviour.

The squeezer should drop any stored items when breaking through normal methods.

commented

Thanks for reporting!

commented

Oh wow, that was a fast response! Awesome!
I am currently looking into which mod enables this, but so far without success, I will update you when (if) I find something!

And while I'm here, may I just say, that I love your mod, it makes automation much more useful and fun and I hope it can help peak new players' interest in programming :)

Also, as I just added to the top: The energy battery starts with MAX_INT instead of 0 RF.

commented

Also, as I just added to the top: The energy battery starts with MAX_INT instead of 0 RF.

Is this when placing it in the squeezer?
If unrelated, could you create a separate issue for it? (make sure to check if you can reproduce it first without any other mods installed)

commented

Okay, so I got some more info for ya..
The mod that enables pickup is CarryOn. I think the reason is, that deserializes the entity's nbt and adds this to a new entity (don't know why), so when you check if the state is the same, it isn't. This is of course just me guessing xD
You can take a closer look at
https://github.com/Tschipp/CarryOn/blob/cc70ed906bffdd222ed152b7ffc75cb5b0f4b717/src/main/java/tschipp/carryon/common/item/ItemCarryonEntity.java

The issue with the battery is unrelated and happens when it is crafted. It also happens with only integrated dynamics installed, but I will make another issue for it.

If you can post your fix, I would appreciate it :)

GitHub
Carry On mod for Minecraft. Contribute to Tschipp/CarryOn development by creating an account on GitHub.