DimDoors
DimDoors copied to clipboard
[Suggestion]: radial decay
This suggestion is unique
- [X] I have searched the issue tracker and did not find an issue describing my suggestion
Use the editor below to elaborate.
The applySpreadDecay method from the DetachedRiftBlockEntity class uses the raw output of the BlockPos.randomInCube method, which causes a cubic decay pattern far too regular.
A simple check comparing the radius with the distance between the rift block and the randomly selected block would suffice to fix the problem and make the decay pattern grow far better and less regular.
The code addition below would add such check
public void applySpreadDecay(ServerLevel world, BlockPos pos) {
float chance = this.size / 100.0F;
if (random.nextFloat() <= chance) {
BlockPos selected = (BlockPos)BlockPos.randomInCube(world.getRandom(), 1, pos, (int)chance).iterator().next();
++ if (pos.getCenter().distanceTo(selected.getCenter()) >= (int) chance) {return}
Decay.decayBlock(world, selected, world.getBlockState(selected), DecaySource.RIFT);
}
}
Resulting in the following effect