TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Deployers shouldn't try to Drink

Gaelmare opened this issue · 4 comments

commented

Not sure of the configuration of the Create gantry, but a deployer on it apparently got through to the check drinkable event handler, which gets playerdata before checking if a fluid is present.

final InteractionResult result = Drinkable.attemptDrink(level, event.getEntity(), true);

https://mclo.gs/7u2QxP2

This has occurred a few times on the LithicTFC server. No idea why ATMG2 or other 1.20 packs with Create haven't seen this as much?

commented

2024-05-08_20 33 39

This setup is enough to reproduce a create deployer triggering a drink event handler, which should be perfectly legal. Player data is setup during AttachCapabilitiesEvent<Entity> which is part of the Entity constructor, which is invoked as part of the DeployerFakePlayer constructor that is ran in my testing. It then rejects drinking (because we have vanilla food data, and that indicates max thirst). Nothing here is problematic, but I'm more concerned with why in this case, we are missing player data. That seems to point at a larger issue, because fake player interaction does seem to work - again, in my testing.

We could bandaid this, but without a real way to test it I'd rather try and root cause this to find out why there's missing player data. Potentially another mod interaction.

I also tested with a deployer on a gantry, no difference.

commented
commented

That's entirely irrelevant. This setup works equally fine without a fluid block there, as we already have a check that the drinkable is not null. It does not need to check if a fluid is present, and changing the order of these checks would just appear to hide the issue behind a more specific situation.

commented

Closing as unreproducible.