Search in sources :

Example 1 with BlockSoil

use of forestry.core.gadgets.BlockSoil in project ForestryMC by ForestryMC.

the class FarmLogicPeat method isAcceptedGround.

@Override
public boolean isAcceptedGround(ItemStack itemStack) {
    if (super.isAcceptedGround(itemStack)) {
        return true;
    }
    Block block = BlockSoil.getBlockFromItem(itemStack.getItem());
    if (block == null || !(block instanceof BlockSoil)) {
        return false;
    }
    BlockSoil blockSoil = (BlockSoil) block;
    BlockSoil.SoilType soilType = blockSoil.getTypeFromMeta(itemStack.getItemDamage());
    return soilType == BlockSoil.SoilType.BOG_EARTH || soilType == BlockSoil.SoilType.PEAT;
}
Also used : Block(net.minecraft.block.Block) ForestryBlock(forestry.core.config.ForestryBlock) BlockSoil(forestry.core.gadgets.BlockSoil)

Example 2 with BlockSoil

use of forestry.core.gadgets.BlockSoil in project ForestryMC by ForestryMC.

the class PluginCore method preInit.

@Override
public void preInit() {
    super.preInit();
    rootCommand.addChildCommand(new CommandVersion());
    rootCommand.addChildCommand(new CommandPlugins());
    ForestryBlock.core.registerBlock(new BlockBase(Material.iron, true), ItemForestryBlock.class, "core");
    definitionEscritoire = ((BlockBase) ForestryBlock.core.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ESCRITOIRE_META, "forestry.Escritoire", TileEscritoire.class, Proxies.render.getRenderEscritoire()));
    ForestryBlock.soil.registerBlock(new BlockSoil(), ItemTypedBlock.class, "soil");
    ForestryBlock.soil.block().setHarvestLevel("shovel", 0, 0);
    ForestryBlock.soil.block().setHarvestLevel("shovel", 0, 1);
    ForestryBlock.resources.registerBlock(new BlockResource(), ItemForestryBlock.class, "resources");
    ForestryBlock.resources.block().setHarvestLevel("pickaxe", 1);
    OreDictionary.registerOre("oreApatite", ForestryBlock.resources.getItemStack(1, 0));
    OreDictionary.registerOre("oreCopper", ForestryBlock.resources.getItemStack(1, 1));
    OreDictionary.registerOre("oreTin", ForestryBlock.resources.getItemStack(1, 2));
    ForestryBlock.resourceStorage.registerBlock(new BlockResourceStorageBlock(), ItemForestryBlock.class, "resourceStorage");
    ForestryBlock.resourceStorage.block().setHarvestLevel("pickaxe", 0);
    OreDictionary.registerOre("blockApatite", ForestryBlock.resourceStorage.getItemStack(1, 0));
    OreDictionary.registerOre("blockCopper", ForestryBlock.resourceStorage.getItemStack(1, 1));
    OreDictionary.registerOre("blockTin", ForestryBlock.resourceStorage.getItemStack(1, 2));
    OreDictionary.registerOre("blockBronze", ForestryBlock.resourceStorage.getItemStack(1, 3));
    ForestryBlock.glass.registerBlock(new BlockStainedGlass(), ItemForestryBlock.class, "stained");
}
Also used : CommandVersion(forestry.core.commands.CommandVersion) BlockStainedGlass(forestry.core.gadgets.BlockStainedGlass) BlockResource(forestry.core.gadgets.BlockResource) MachineDefinition(forestry.core.gadgets.MachineDefinition) BlockBase(forestry.core.gadgets.BlockBase) BlockResourceStorageBlock(forestry.core.gadgets.BlockResourceStorageBlock) CommandPlugins(forestry.core.commands.CommandPlugins) BlockSoil(forestry.core.gadgets.BlockSoil)

Example 3 with BlockSoil

use of forestry.core.gadgets.BlockSoil in project ForestryMC by ForestryMC.

the class FarmLogicArboreal method isAcceptedSoil.

@Override
public boolean isAcceptedSoil(ItemStack soil) {
    if (super.isAcceptedSoil(soil)) {
        return true;
    }
    Block block = BlockSoil.getBlockFromItem(soil.getItem());
    if (block == null || !(block instanceof BlockSoil)) {
        return false;
    }
    BlockSoil blockSoil = (BlockSoil) block;
    return blockSoil.getTypeFromMeta(soil.getItemDamage()) == BlockSoil.SoilType.HUMUS;
}
Also used : Block(net.minecraft.block.Block) ForestryBlock(forestry.core.config.ForestryBlock) BlockSoil(forestry.core.gadgets.BlockSoil)

Example 4 with BlockSoil

use of forestry.core.gadgets.BlockSoil in project ForestryMC by ForestryMC.

the class FarmLogicPeat method harvest.

@Override
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
    World world = getWorld();
    Stack<ICrop> crops = new Stack<ICrop>();
    for (int i = 0; i < extent; i++) {
        Vect position = translateWithOffset(x, y, z, direction, i);
        ItemStack occupant = VectUtil.getAsItemStack(world, position);
        if (occupant.getItem() == null) {
            continue;
        }
        Block block = Block.getBlockFromItem(occupant.getItem());
        if (block == null || !(block instanceof BlockSoil)) {
            continue;
        }
        BlockSoil blockSoil = (BlockSoil) block;
        BlockSoil.SoilType soilType = blockSoil.getTypeFromMeta(occupant.getItemDamage());
        if (soilType == BlockSoil.SoilType.PEAT) {
            crops.push(new CropPeat(world, position));
        }
    }
    return crops;
}
Also used : Vect(forestry.core.vect.Vect) Block(net.minecraft.block.Block) ForestryBlock(forestry.core.config.ForestryBlock) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) ICrop(forestry.api.farming.ICrop) BlockSoil(forestry.core.gadgets.BlockSoil) Stack(java.util.Stack) ItemStack(net.minecraft.item.ItemStack)

Example 5 with BlockSoil

use of forestry.core.gadgets.BlockSoil in project ForestryMC by ForestryMC.

the class CropPeat method isCrop.

@Override
protected boolean isCrop(Vect pos) {
    Block block = getBlock(pos);
    if (block == null || !(block instanceof BlockSoil)) {
        return false;
    }
    BlockSoil blockSoil = (BlockSoil) block;
    BlockSoil.SoilType soilType = blockSoil.getTypeFromMeta(getBlockMeta(pos));
    return soilType == BlockSoil.SoilType.PEAT;
}
Also used : Block(net.minecraft.block.Block) BlockSoil(forestry.core.gadgets.BlockSoil)

Aggregations

BlockSoil (forestry.core.gadgets.BlockSoil)5 Block (net.minecraft.block.Block)4 ForestryBlock (forestry.core.config.ForestryBlock)3 ICrop (forestry.api.farming.ICrop)1 CommandPlugins (forestry.core.commands.CommandPlugins)1 CommandVersion (forestry.core.commands.CommandVersion)1 BlockBase (forestry.core.gadgets.BlockBase)1 BlockResource (forestry.core.gadgets.BlockResource)1 BlockResourceStorageBlock (forestry.core.gadgets.BlockResourceStorageBlock)1 BlockStainedGlass (forestry.core.gadgets.BlockStainedGlass)1 MachineDefinition (forestry.core.gadgets.MachineDefinition)1 Vect (forestry.core.vect.Vect)1 Stack (java.util.Stack)1 ItemStack (net.minecraft.item.ItemStack)1 World (net.minecraft.world.World)1