use of forestry.api.arboriculture.EnumVanillaWoodType 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.EnumVanillaWoodType in project ForestryMC by ForestryMC.
the class WoodAccess method registerVanilla.
private void registerVanilla() {
IBlockState defaultLogState = Blocks.LOG.getDefaultState();
List<EnumVanillaWoodType> oldLogTypes = Arrays.asList(EnumVanillaWoodType.OAK, EnumVanillaWoodType.SPRUCE, EnumVanillaWoodType.BIRCH, EnumVanillaWoodType.JUNGLE);
for (EnumVanillaWoodType woodType : oldLogTypes) {
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
ItemStack itemStack = new ItemStack(Blocks.LOG, 1, vanillaType.getMetadata());
IBlockState blockState = defaultLogState.withProperty(BlockOldLog.VARIANT, vanillaType);
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
}
IBlockState defaultLog2State = Blocks.LOG2.getDefaultState();
List<EnumVanillaWoodType> newLogTypes = Arrays.asList(EnumVanillaWoodType.ACACIA, EnumVanillaWoodType.DARK_OAK);
for (EnumVanillaWoodType woodType : newLogTypes) {
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
ItemStack itemStack = new ItemStack(Blocks.LOG2, 1, vanillaType.getMetadata() - 4);
IBlockState blockState = defaultLog2State.withProperty(BlockNewLog.VARIANT, vanillaType);
register(woodType, WoodBlockKind.LOG, false, blockState, itemStack);
}
IBlockState defaultPlanksState = Blocks.PLANKS.getDefaultState();
IBlockState defaultSlabState = Blocks.WOODEN_SLAB.getDefaultState();
for (EnumVanillaWoodType woodType : EnumVanillaWoodType.VALUES) {
BlockPlanks.EnumType vanillaType = woodType.getVanillaType();
ItemStack plankStack = new ItemStack(Blocks.PLANKS, 1, vanillaType.getMetadata());
IBlockState plankState = defaultPlanksState.withProperty(BlockPlanks.VARIANT, vanillaType);
register(woodType, WoodBlockKind.PLANKS, false, plankState, plankStack);
ItemStack slabStack = new ItemStack(Blocks.WOODEN_SLAB, 1, vanillaType.getMetadata());
IBlockState slabState = defaultSlabState.withProperty(BlockWoodSlab.VARIANT, vanillaType);
register(woodType, WoodBlockKind.SLAB, false, slabState, slabStack);
}
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE, false, Blocks.OAK_FENCE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE, false, Blocks.SPRUCE_FENCE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE, false, Blocks.BIRCH_FENCE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE, false, Blocks.JUNGLE_FENCE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE, false, Blocks.ACACIA_FENCE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE, false, Blocks.DARK_OAK_FENCE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE));
register(EnumVanillaWoodType.OAK, WoodBlockKind.FENCE_GATE, false, Blocks.OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.OAK_FENCE_GATE));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.FENCE_GATE, false, Blocks.SPRUCE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.SPRUCE_FENCE_GATE));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.FENCE_GATE, false, Blocks.BIRCH_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.BIRCH_FENCE_GATE));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.FENCE_GATE, false, Blocks.JUNGLE_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.JUNGLE_FENCE_GATE));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.FENCE_GATE, false, Blocks.ACACIA_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.ACACIA_FENCE_GATE));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.FENCE_GATE, false, Blocks.DARK_OAK_FENCE_GATE.getDefaultState(), new ItemStack(Blocks.DARK_OAK_FENCE_GATE));
register(EnumVanillaWoodType.OAK, WoodBlockKind.STAIRS, false, Blocks.OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.OAK_STAIRS));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.STAIRS, false, Blocks.SPRUCE_STAIRS.getDefaultState(), new ItemStack(Blocks.SPRUCE_STAIRS));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.STAIRS, false, Blocks.BIRCH_STAIRS.getDefaultState(), new ItemStack(Blocks.BIRCH_STAIRS));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.STAIRS, false, Blocks.JUNGLE_STAIRS.getDefaultState(), new ItemStack(Blocks.JUNGLE_STAIRS));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.STAIRS, false, Blocks.ACACIA_STAIRS.getDefaultState(), new ItemStack(Blocks.ACACIA_STAIRS));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.STAIRS, false, Blocks.DARK_OAK_STAIRS.getDefaultState(), new ItemStack(Blocks.DARK_OAK_STAIRS));
register(EnumVanillaWoodType.OAK, WoodBlockKind.DOOR, false, Blocks.OAK_DOOR.getDefaultState(), new ItemStack(Items.OAK_DOOR));
register(EnumVanillaWoodType.SPRUCE, WoodBlockKind.DOOR, false, Blocks.SPRUCE_DOOR.getDefaultState(), new ItemStack(Items.SPRUCE_DOOR));
register(EnumVanillaWoodType.BIRCH, WoodBlockKind.DOOR, false, Blocks.BIRCH_DOOR.getDefaultState(), new ItemStack(Items.BIRCH_DOOR));
register(EnumVanillaWoodType.JUNGLE, WoodBlockKind.DOOR, false, Blocks.JUNGLE_DOOR.getDefaultState(), new ItemStack(Items.JUNGLE_DOOR));
register(EnumVanillaWoodType.ACACIA, WoodBlockKind.DOOR, false, Blocks.ACACIA_DOOR.getDefaultState(), new ItemStack(Items.ACACIA_DOOR));
register(EnumVanillaWoodType.DARK_OAK, WoodBlockKind.DOOR, false, Blocks.DARK_OAK_DOOR.getDefaultState(), new ItemStack(Items.DARK_OAK_DOOR));
}
use of forestry.api.arboriculture.EnumVanillaWoodType 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);
}
use of forestry.api.arboriculture.EnumVanillaWoodType in project Binnie by ForestryMC.
the class ModuleWood method registerWithoutVariants.
private <T extends Block & IWoodTyped> void registerWithoutVariants(WoodAccess woodAccess, 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);
}
woodAccess.register(woodType, woodBlockKind, fireproof, blockState, itemStack);
}
use of forestry.api.arboriculture.EnumVanillaWoodType in project YABBA by LatvianModder.
the class ForestryIntegration method registerSkins.
@SubscribeEvent
public static void registerSkins(YabbaSkinsEvent event) {
Yabba.LOGGER.info("Loading Forestry Integration");
for (IWoodType type : TreeManager.woodAccess.getRegisteredWoodTypes()) {
if (!(type instanceof EnumVanillaWoodType)) {
try {
BarrelSkin skin = new BarrelSkin(OtherMods.FORESTRY + ":planks_" + type.getName(), TextureSet.of("all=" + type.getPlankTexture()));
try {
skin.state = TreeManager.woodAccess.getBlock(type, WoodBlockKind.PLANKS, false);
} catch (Exception ex1) {
}
skin.displayName = TreeManager.woodAccess.getStack(type, WoodBlockKind.PLANKS, false).getDisplayName();
event.addSkin(skin);
skin = new BarrelSkin(OtherMods.FORESTRY + ":log_" + type.getName(), TextureSet.of("up&down=" + type.getHeartTexture() + ",all=" + type.getBarkTexture()));
try {
skin.state = TreeManager.woodAccess.getBlock(type, WoodBlockKind.LOG, false);
} catch (Exception ex1) {
}
skin.displayName = TreeManager.woodAccess.getStack(type, WoodBlockKind.LOG, false).getDisplayName();
event.addSkin(skin);
} catch (Exception ex) {
}
}
}
}
Aggregations