Search in sources :

Example 6 with IWoodType

use of forestry.api.arboriculture.IWoodType 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);
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) IBlockState(net.minecraft.block.state.IBlockState) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) ItemStack(net.minecraft.item.ItemStack)

Example 7 with IWoodType

use of forestry.api.arboriculture.IWoodType in project Binnie by ForestryMC.

the class ItemBlockETWood method getItemStackDisplayName.

@Override
public String getItemStackDisplayName(ItemStack itemstack) {
    IWoodTyped wood = getBlock();
    int meta = itemstack.getMetadata();
    IWoodType woodType = wood.getWoodType(meta);
    return WoodManager.getDisplayName(wood, woodType);
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) IWoodTyped(forestry.arboriculture.IWoodTyped)

Example 8 with IWoodType

use of forestry.api.arboriculture.IWoodType 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) {
            }
        }
    }
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) BarrelSkin(com.latmod.yabba.api.BarrelSkin) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 9 with IWoodType

use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.

the class WoodAccess method registerWithVariants.

private <T extends Block & IWoodTyped, V extends Enum<V> & IWoodType> void registerWithVariants(T woodTyped, WoodBlockKind woodBlockKind, PropertyWoodType<V> property) {
    boolean fireproof = woodTyped.isFireproof();
    for (V value : property.getAllowedValues()) {
        IBlockState blockState = woodTyped.getDefaultState().withProperty(property, value);
        int meta = woodTyped.getMetaFromState(blockState);
        IWoodType woodType = woodTyped.getWoodType(meta);
        ItemStack itemStack = new ItemStack(woodTyped, 1, meta);
        if (!(woodType instanceof EnumVanillaWoodType)) {
            ModuleArboriculture.proxy.registerWoodModel(woodTyped, true);
        }
        register(woodType, woodBlockKind, fireproof, blockState, itemStack);
    }
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) IBlockState(net.minecraft.block.state.IBlockState) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) ItemStack(net.minecraft.item.ItemStack)

Example 10 with IWoodType

use of forestry.api.arboriculture.IWoodType in project ForestryMC by ForestryMC.

the class WoodHelper method getResourceLocations.

public static ResourceLocation[] getResourceLocations(IWoodTyped typed) {
    List<ResourceLocation> resourceLocations = new ArrayList<>();
    WoodBlockKind blockKind = typed.getBlockKind();
    for (IWoodType woodType : typed.getWoodTypes()) {
        if (woodType instanceof EnumVanillaWoodType) {
            resourceLocations.add(new ResourceLocation("minecraft", woodType + "_" + blockKind));
        } else {
            resourceLocations.add(new ResourceLocation(Constants.MOD_ID, blockKind + "/" + woodType));
        }
    }
    return resourceLocations.toArray(new ResourceLocation[resourceLocations.size()]);
}
Also used : IWoodType(forestry.api.arboriculture.IWoodType) WoodBlockKind(forestry.api.arboriculture.WoodBlockKind) EnumVanillaWoodType(forestry.api.arboriculture.EnumVanillaWoodType) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList)

Aggregations

IWoodType (forestry.api.arboriculture.IWoodType)14 EnumVanillaWoodType (forestry.api.arboriculture.EnumVanillaWoodType)6 ItemStack (net.minecraft.item.ItemStack)5 IBlockState (net.minecraft.block.state.IBlockState)4 WoodBlockKind (forestry.api.arboriculture.WoodBlockKind)3 ArrayList (java.util.ArrayList)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 IWoodTyped (forestry.arboriculture.IWoodTyped)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 BarrelSkin (com.latmod.yabba.api.BarrelSkin)1 EnumForestryWoodType (forestry.api.arboriculture.EnumForestryWoodType)1 IAlleleFruit (forestry.api.arboriculture.IAlleleFruit)1 IWoodItemMeshDefinition (forestry.api.arboriculture.IWoodItemMeshDefinition)1 IWoodStateMapper (forestry.api.arboriculture.IWoodStateMapper)1 BlockArbLog (forestry.arboriculture.blocks.BlockArbLog)1 BlockForestrySlab (forestry.arboriculture.blocks.BlockForestrySlab)1 BlockRegistryArboriculture (forestry.arboriculture.blocks.BlockRegistryArboriculture)1 ItemRegistryArboriculture (forestry.arboriculture.items.ItemRegistryArboriculture)1 ItemRegistryCore (forestry.core.items.ItemRegistryCore)1