Merge pull request #14 from quiqueck/feature/specialBlocksRegistration

Added method to register special blocks to correct registries
This commit is contained in:
paulevsGitch 2021-07-19 21:33:49 +03:00 committed by GitHub
commit 6266b30088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,4 +44,25 @@ public class BaseBlockEntities {
public static Block[] getFurnaces() { public static Block[] getFurnaces() {
return BaseRegistry.getRegisteredBlocks().values().stream().filter(item -> item instanceof BlockItem && ((BlockItem) item).getBlock() instanceof BaseFurnaceBlock).map(item -> ((BlockItem) item).getBlock()).toArray(Block[]::new); return BaseRegistry.getRegisteredBlocks().values().stream().filter(item -> item instanceof BlockItem && ((BlockItem) item).getBlock() instanceof BaseFurnaceBlock).map(item -> ((BlockItem) item).getBlock()).toArray(Block[]::new);
} }
public static boolean registerSpecialBlock(Block block) {
if (block instanceof BaseChestBlock) {
BaseBlockEntities.CHEST.registerBlock(block);
return true;
}
if (block instanceof BaseSignBlock) {
BaseBlockEntities.SIGN.registerBlock(block);
return true;
}
if (block instanceof BaseBarrelBlock) {
BaseBlockEntities.BARREL.registerBlock(block);
return true;
}
if (block instanceof BaseFurnaceBlock) {
BaseBlockEntities.FURNACE.registerBlock(block);
return true;
}
return false;
}
} }