Added fail safes against bonus drop meta not being cleaned up

This commit is contained in:
nossr50
2023-05-29 14:34:47 -07:00
parent 44ab8d93ab
commit e9a020565f
6 changed files with 28 additions and 14 deletions

View File

@ -38,6 +38,18 @@ public final class BlockUtils {
blockState.setMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, new BonusDropMeta(1, mcMMO.p));
}
/**
* Set up the state for a block to be seen as unnatural and cleanup any unwanted metadata from the block
* @param block target block
*/
public static void setUnnaturalBlock(@NotNull Block block) {
mcMMO.getPlaceStore().setTrue(block);
// Failsafe against lingering metadata
if(block.hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
block.removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, mcMMO.p);
}
/**
* Cleans up some block metadata when a block breaks and the metadata is no longer needed
* This also sets the blocks coords to false in our chunk store