Chisels & Bits - For Fabric

Chisels & Bits - For Fabric

2M Downloads

Overriding bits via the API results in ineffective and buggy behavior

Phylogeny opened this issue ยท 1 comments

commented

The default implementation of IAreaMutator#overrideInAreaTarget attempts to clear the target before setting it by passing BlockInformation.AIR to IAreaMutator#setInAreaTarget. This always throws a SpaceOccupiedException, so calling IAreaMutator#overrideInAreaTarget has no effect. Here is the code I used to verify that:

Override Bits

It seams clear that it should instead use IAreaMutator#clearInAreaTarget to clear the bit, but doing so has very buggy behavior. Here, I replicate the default implantation of IAreaMutator#overrideInAreaTarget using IAreaMutator#clearInAreaTarget to clear the bit:

Clear And Set Bits

If the block being set is an air block, it is converted to the appropriate chiseled block as expected, with all the bits where they should be. But if the block being overridden is anything else, the bits are set, but the chiseled block does not render them. Re-logging does not fix the issue, and instead makes it so that the still invisible bits cannot be removed with a chisel or with another bit, and the entire block must be broken. Shift + Middle Mouse yields an invisible block that disappears upon placing.

I also tried clearing all bits then setting all bits:

Clear Bits Then Set Bits

This had the exact same effect. I then tried one batch to clear the bits and another to set them:

Batch Clear Bits Then Batch Set Bits

This works when the block being overridden is anything but air, but now if the block is air, the chiseled block appears with all the bits rendering, but then immediately disappears. Re-logging does not fix the issue, as the block truly is just an air block.

Just to see, I tried just setting all unoccupied bits without clearing anything:

Set Unoccupied Bits

This works fine. Same with clearing all bits and not setting any.

C&B 1.18.2-1.2.90; Forge 40.0.46; No Optifine

commented

Fixed in 1.2.100