use of org.spongepowered.api.block.trait.EnumTrait in project SpongeCommon by SpongePowered.
the class BlockTypeRegistryModule method registerBlockTrait.
private void registerBlockTrait(String id, BlockType block) {
Block nmsBlock = (Block) block;
for (IBlockState state : nmsBlock.getBlockState().getValidStates()) {
((IMixinBlockState) state).generateId(nmsBlock);
BlockStateRegistryModule.getInstance().registerBlockState((BlockState) state);
}
for (Map.Entry<BlockTrait<?>, ?> mapEntry : block.getDefaultState().getTraitMap().entrySet()) {
BlockTrait<?> property = mapEntry.getKey();
final String propertyId = BlockPropertyIdProvider.getIdAndTryRegistration((IProperty<?>) property, (Block) block, id);
if (property instanceof IMixinPropertyHolder) {
((IMixinPropertyHolder) property).setId(propertyId);
}
if (property instanceof EnumTrait) {
EnumTraitRegistryModule.getInstance().registerBlock(propertyId, block, (EnumTrait<?>) property);
} else if (property instanceof IntegerTrait) {
IntegerTraitRegistryModule.getInstance().registerBlock(propertyId, block, (IntegerTrait) property);
} else if (property instanceof BooleanTrait) {
BooleanTraitRegistryModule.getInstance().registerBlock(propertyId, block, (BooleanTrait) property);
}
}
}
Aggregations