use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.
the class ProxyArboricultureClient method onModelBake.
@SubscribeEvent
public <T extends Block & IWoodTyped> void onModelBake(ModelBakeEvent event) {
IRegistry<ModelResourceLocation, IBakedModel> registry = event.getModelRegistry();
for (WoodModelEntry<T> entry : woodModelEntrys) {
T woodTyped = entry.woodTyped;
WoodBlockKind woodKind = woodTyped.getBlockKind();
IWoodStateMapper woodMapper = stateMappers.get(woodTyped);
for (IBlockState blockState : woodTyped.getBlockState().getValidStates()) {
IWoodType woodType;
ItemStack itemStack;
if (entry.withVariants) {
int meta = woodTyped.getMetaFromState(blockState);
woodType = woodTyped.getWoodType(meta);
itemStack = new ItemStack(woodTyped, 1, meta);
} else {
woodType = woodTyped.getWoodType(0);
itemStack = new ItemStack(woodTyped);
}
IWoodItemMeshDefinition definition = shapers.get(itemStack.getItem());
ImmutableMap<String, String> textures = WoodTextureManager.getTextures(woodType, woodKind);
if (definition != null) {
retextureItemModel(registry, textures, woodType, woodKind, itemStack, definition);
}
if (woodMapper != null) {
retexturBlockModel(registry, textures, woodType, woodKind, blockState, woodMapper);
}
}
}
}
use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.
the class ItemBlockWood method getItemStackDisplayName.
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
IWoodTyped wood = getBlock();
int meta = itemstack.getMetadata();
IWoodType woodType = wood.getWoodType(meta);
return WoodHelper.getDisplayName(wood, woodType);
}
use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.
the class ItemBlockWoodSlab method getItemStackDisplayName.
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
BlockForestrySlab<?> wood = (BlockForestrySlab) getBlock();
int meta = itemstack.getMetadata();
IWoodType woodType = wood.getWoodType(meta);
return WoodHelper.getDisplayName(wood, woodType);
}
use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.
the class WoodTypeStateMapper method getModelResourceLocation.
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
final Map<IProperty<?>, Comparable<?>> properties;
if (propertyWoodType != null) {
properties = Maps.newLinkedHashMap(state.getProperties());
properties.remove(propertyWoodType);
} else {
properties = Maps.newLinkedHashMap(state.getProperties());
}
for (IProperty property : propertiesToRemove) {
properties.remove(property);
}
Block block = state.getBlock();
int meta = block.getMetaFromState(state);
IWoodType woodType = woodTyped.getWoodType(meta);
if (woodType instanceof EnumVanillaWoodType) {
return getVanillaModelResourceLocation(block, woodType, properties);
} else {
return getModelResourceLocation(woodType, properties, block.getRegistryName().getResourceDomain());
}
}
use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.
the class WoodAccess method registerWithoutVariants.
/**
* Register wood blocks that have no variant property
*/
private <T extends Block & IWoodTyped> void registerWithoutVariants(T woodTyped, WoodBlockKind woodBlockKind) {
boolean fireproof = woodTyped.isFireproof();
IBlockState blockState = woodTyped.getDefaultState();
IWoodType woodType = woodTyped.getWoodType(0);
ItemStack itemStack = new ItemStack(woodTyped);
if (!(woodType instanceof EnumVanillaWoodType)) {
ModuleArboriculture.proxy.registerWoodModel(woodTyped, false);
}
register(woodType, woodBlockKind, fireproof, blockState, itemStack);
}
Aggregations