Fixing like 10 memory leaks Fixes #4670

This commit is contained in:
nossr50
2021-12-11 22:22:02 -08:00
parent 10470dde13
commit fbe0cd1471
15 changed files with 143 additions and 43 deletions

View File

@@ -39,6 +39,19 @@ public final class BlockUtils {
blockState.setMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, new BonusDropMeta(1, 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
* @param block target block
*/
public static void cleanupBlockMetadata(Block block) {
if(block.hasMetadata(MetadataConstants.METADATA_KEY_REPLANT)) {
block.removeMetadata(MetadataConstants.METADATA_KEY_REPLANT, mcMMO.p);
}
mcMMO.getPlaceStore().setFalse(block);
}
/**
* Marks a block to drop extra copies of items
* @param blockState target blockstate