TrialSpawnerConfiguration does not play nicely with live blockstates
Live blockstates do not need to be applied to have their changes reflected in game. The current TrialSpawnerConfiguration however is a fully copy and does only apply when updating.
To fix this, a new implemented of the interface is needed that re-creates the internal record on every setter call and is used if the block state is not a snapshot.
I'd love to work on this if it hasn't been started by somebody else yet!
Go for it 👍
Update: I am still having technical issues with my Windows + WSL setup. If anybody is faster than me, feel free to take this one instead of me
Hi @lynxplay , I am new around here and would like to have a look into this issue if it is still open. It would be great if some more detail is provided around this issue. Thanks!
@NithinSravan Paper adds non-snapshot BlockState (or really TileState)s. Changes made can then avoid unneeded copies improving performance. But the TileSpawnerConfiguration implementation doesn’t respect this.
Some more information I got provided when I tried to take a look at it:
- The general expectation is that any form of mutation should mutate the real object in the world
- The following can be used for "replication steps". It should modify the in-game block entity, but that is currently not the case:
final BlockState state = block.getState(false);
if (state instanceof final TrialSpawner trialSpawner) {
trialSpawner.getNormalConfiguration().setBaseSpawnsBeforeCooldown(100);
}
Also the TrialSpawnerConfig mentioned by lynx refers to net.minecraft.world.level.block.entity.trialspawner.TrialSpawnerConfig.
Hope this helps at least a tiny bit @NithinSravan
Does there need to be an entire new implementation of TrialSpawnerConfiguration? Or should the existing CraftTrialSpawnerConfiguration be modified and check isSnapshot on every setter call instead?
Hi @lynxplay, I’d like to work on this issue if it’s still available. I’ve gone through the description and would be happy to start working on a fix/implementation once you confirm. Thanks!