CraftTweaker

CraftTweaker

151M Downloads

Setting block harvest level doesn't properly update the block until /reload is executed on the server

Quarris opened this issue ยท 4 comments

commented

Issue description

I have a script to lower the harvest level of a block, the script appears to partially work by allowing me to break the block and get the items from it, however the break time is still really slow.
Using /reload on the server fixes this issue.

This doesn't seem to be an issue on singleplayer, just mutliplayer.

I have put all script/log files in a single gist since they are relatively small

Steps to reproduce

  1. Set up an empty instance with just CraftTweaker (I had JEI + JEITweaker in my testing).
  2. Add the script provided which changes the redstone ore harvest level to 1 (stone pickaxe level).
  3. Start up the server.
  4. Log in, attempt to break redstone ore with stone pickaxe, you should be able to, but very slowly.
  5. Execute /reload command on the server.
  6. Attempt to break another redstone ore, this time the speed is much quicker as it should.

/reload command has to be executed every time the server restarts

Script used

https://gist.github.com/Quarris/fb592a6604b2cf22a09cd2554d6cd75c

The crafttweaker.log file

https://gist.github.com/Quarris/fb592a6604b2cf22a09cd2554d6cd75c

Minecraft version

1.16

Forge version

36.2.20

CraftTweaker version

7.1.2.474

Other relevant information

The logs are all from the server files
In the CT Log section, the /reload happened from line 23

The latest.log file

https://gist.github.com/Quarris/fb592a6604b2cf22a09cd2554d6cd75c

commented

This was fixed in 0bdecba

commented

The root cause of this is that the client doesn't have information on tags when they first join the server (this could be a bug on our side, not sure if the client should have tags when it first joins).

If you did:

<block:minecraft:redstone_ore>.setHarvestLevel(1);

then it should work perfectly fine on first join.

We will need to do some research to see if a fix would be possible.

commented

Yeah doing that does fix the issue.
It would be good to be able to iterate over the tag list for that. Is there a way to delay running of the script until the tags are sent?

If there is anything I can help with let me know.

commented

Is there a way to delay running of the script until the tags are sent

From a script perspective, no.

The big issue is that the order isn't always the same.

There is a RecipesUpdatedEvent and a TagsUpdatedEvent.

When joining a server, the RecipesUpdatedEvent is fired first, so there are no tags, but when a /reload is done, the TagsUpdatedEvent is fired first, so when the RecipesUpdatedEvent comes along, it has the tags.

We just need to look at what the best way to go about dealing with it is