Integrated Tunnels

Integrated Tunnels

53M Downloads

Play Simulator cannot handle items with cooldowns

nskobelevs opened this issue ยท 1 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

Item with a cooldown can only be clicked with once as the cooldown isn't ever decreased.

Steps to reproduce the problem:

This is hard/impossible to reproduce in vanilla Minecraft due to the three items with cooldown - ender pearls, goat horns and chorus fruit - require a player for interaction. I was able to recreate this with Mystical Agriculture watering cans which is how I initially discovered the bug.

  1. Setup a Player Simulator facing a crop on farmland.
  2. Attach a chest to the network with a watering can.
  3. Place an item variable with the watering can into the "Click Item" aspect.

The watering can will be used once - which can see visually seen by non-wet farmland becoming wet - but only once.

I believe this is an issue with Integrated Tunnels and not Mystical Agriculture as its the fake player of Integrated Tunnels that's doing the clicking and hence Integrated Tunnels should also handle cooldown of its own fake players.

I believe the issue is Player#getItemCooldowns() not being ticked via ItemCooldowns#tick as this is what actually decreases the cooldowns.

I confirmed this with custom build of Mystical Agriculture.

WateringCan#doWater checks for the player's cooldown [source]

After executing once, it adds the cooldown which Integrated Tunnels never decreases, causing the item to not be usable again. I confirmed this with some logging.

Player Simulator:

# First click
WateringCanItem#doWater
Not on cooldown
Setting moisture
Drawing Particles
Random ticking blocks

# Subsequent clicks - cooldown is always 1 and never decreases
WateringCanItem#doWater
Skipping: cooldown = 1.000000

WateringCanItem#doWater
Skipping: cooldown = 1.000000

Actual Player holding down right click:

WateringCanItem#doWater
Not on cooldown
Setting moisture
Drawing Particles
Random ticking blocks

# Sometimes there is a cooldown (always less than 1) as holding right click sends more frequent inputs than the cooldown can handle.
WateringCanItem#doWater
Skipping: cooldown = 0.200000

WateringCanItem#doWater
Not on cooldown
Setting moisture
Drawing Particles
Random ticking blocks

WateringCanItem#doWater
Skipping: cooldown = 0.200000

Expected behaviour:

The item should be usable again after the cooldown has passed.


Versions:

  • This mod: 1.8.16
  • Minecraft: 1.19.2
  • Forge: 43.0.8
commented

Thanks for reporting!