mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
* Updated for BC 6.0.x compatibility * Re-implemented the Pipes plugin * Converted to vanilla assets lang system * Converted to standard gradle file structure * General warnings cleanup
110 lines
2.7 KiB
Java
Executable File
110 lines
2.7 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.Collection;
|
|
import java.util.Stack;
|
|
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.IIcon;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import forestry.api.farming.Farmables;
|
|
import forestry.api.farming.ICrop;
|
|
import forestry.api.farming.IFarmHousing;
|
|
import forestry.api.farming.IFarmable;
|
|
import forestry.core.utils.StackUtils;
|
|
import forestry.core.utils.Vect;
|
|
|
|
public class FarmLogicSucculent extends FarmLogic {
|
|
|
|
IFarmable[] germlings;
|
|
|
|
public FarmLogicSucculent(IFarmHousing housing) {
|
|
super(housing);
|
|
germlings = Farmables.farmables.get("farmSucculentes").toArray(new IFarmable[0]);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon() {
|
|
return Items.dye.getIconFromDamage(2);
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
if (isManual)
|
|
return "Manual Succulent Farm";
|
|
else
|
|
return "Managed Succulent Farm";
|
|
}
|
|
|
|
@Override
|
|
public int getFertilizerConsumption() {
|
|
return 10;
|
|
}
|
|
|
|
@Override
|
|
public int getWaterConsumption(float hydrationModifier) {
|
|
return 1;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAcceptedResource(ItemStack itemstack) {
|
|
if (isManual)
|
|
return false;
|
|
|
|
return StackUtils.equals(Blocks.sand, itemstack);
|
|
}
|
|
|
|
@Override
|
|
public boolean isAcceptedGermling(ItemStack itemstack) {
|
|
if (isManual)
|
|
return false;
|
|
|
|
return StackUtils.equals(Blocks.cactus, itemstack);
|
|
}
|
|
|
|
@Override
|
|
public Collection<ItemStack> collect() {
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
public boolean cultivate(int x, int y, int z, ForgeDirection direction, int extent) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public Collection<ICrop> harvest(int x, int y, int z, ForgeDirection direction, int extent) {
|
|
|
|
world = housing.getWorld();
|
|
|
|
Stack<ICrop> crops = new Stack<ICrop>();
|
|
for (int i = 0; i < extent; i++) {
|
|
Vect position = translateWithOffset(x, y + 1, z, direction, i);
|
|
for (IFarmable seed : germlings) {
|
|
ICrop crop = seed.getCropAt(world, position.x, position.y, position.z);
|
|
if (crop != null)
|
|
crops.push(crop);
|
|
}
|
|
}
|
|
return crops;
|
|
}
|
|
|
|
}
|