DimDoors icon indicating copy to clipboard operation
DimDoors copied to clipboard

[Suggestion]: radial decay

Open LizzieSpace opened this issue 5 months ago • 1 comments

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.

image

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

Screenshot 2024-09-18 185201

LizzieSpace avatar Sep 18 '24 22:09 LizzieSpace