mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 19:05:31 +00:00
60 lines
2.0 KiB
Java
Executable File
60 lines
2.0 KiB
Java
Executable File
/*******************************************************************************
|
|
* Copyright (c) 2011-2014 SirSengir. All rights reserved. This program and the accompanying materials are made
|
|
* available under the terms of the GNU Lesser Public License v3 which accompanies this distribution, and is available
|
|
* at http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
*
|
|
* Various Contributors including, but not limited to: SirSengir (original work), CovertJaguar, Player, Binnie,
|
|
* MysteriousAges
|
|
******************************************************************************/
|
|
package forestry.farming.logic;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
import forestry.core.blocks.BlockSoil;
|
|
import forestry.core.proxy.Proxies;
|
|
import forestry.core.utils.vect.IVect;
|
|
import forestry.core.utils.vect.Vect;
|
|
import forestry.plugins.PluginCore;
|
|
|
|
public class CropPeat extends Crop {
|
|
|
|
public CropPeat(World world, Vect position) {
|
|
super(world, position);
|
|
}
|
|
|
|
@Override
|
|
protected boolean isCrop(IVect pos) {
|
|
Block block = getBlock(pos);
|
|
if (!(block instanceof BlockSoil)) {
|
|
return false;
|
|
}
|
|
|
|
BlockSoil blockSoil = (BlockSoil) block;
|
|
BlockSoil.SoilType soilType = blockSoil.getTypeFromMeta(getBlockMeta(pos));
|
|
return soilType == BlockSoil.SoilType.PEAT;
|
|
}
|
|
|
|
@Override
|
|
protected Collection<ItemStack> harvestBlock(IVect pos) {
|
|
List<ItemStack> drops = new ArrayList<>();
|
|
drops.add(PluginCore.items.peat.getItemStack());
|
|
|
|
Proxies.common.addBlockDestroyEffects(
|
|
world,
|
|
pos.getX(),
|
|
pos.getY(),
|
|
pos.getZ(),
|
|
world.getBlock(pos.getX(), pos.getY(), pos.getZ()),
|
|
0);
|
|
setBlock(pos, Blocks.dirt, 0);
|
|
return drops;
|
|
}
|
|
}
|