Compiles for 1.9! Very buggy, some things are missing.

This commit is contained in:
mezz committed 2016-05-05 01:11:21 -07:00
1 parent 5d74c1254b
commit 7bf554b024
135 files changed
+1710 -1919

No files matched your search

@@ -1,82 +1,68 @@
package forestry.farming.logic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
// TODO: IC2 for 1.9
public class FarmableBasicIC2Crop {//implements IFarmable {
import net.minecraftforge.fml.common.Optional;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
import forestry.core.utils.vect.Vect;
import forestry.plugins.compat.PluginIC2;
import ic2.api.crops.ICropTile;
public class FarmableBasicIC2Crop implements IFarmable {
/**
* Perform some of the actions of the crop-matron.
*/
@Optional.Method(modid = PluginIC2.modId)
public static void babysitCrop(TileEntity tileEntity) {
if (CropBasicIC2Crop.isIC2Crop(tileEntity)) {
ICropTile crop = (ICropTile) tileEntity;
/*
This part might be unbalanced until a custom farm logic is added and makes use of weed-ex.
if (crop.getCrop() != null) {
if (crop.getCrop().isWeed(crop)) {
crop.reset();
}
}*/
if (crop.getStorageWater() <= 200) {
crop.setStorageWater(200);
}
if (crop.getStorageNutrient() <= 100) {
crop.setStorageNutrient(crop.getStorageNutrient() + 100);
}
}
}
@Override
public boolean isSaplingAt(World world, BlockPos pos) {
TileEntity crop = world.getTileEntity(pos);
if (CropBasicIC2Crop.isIC2Crop(crop)) {
babysitCrop(crop);
return true;
}
return false;
}
@Override
public ICrop getCropAt(World world, BlockPos pos) {
TileEntity crop = world.getTileEntity(pos);
if (crop == null) {
return null;
}
if (!CropBasicIC2Crop.isIC2Crop(crop)) {
return null;
}
if (!CropBasicIC2Crop.canHarvestCrop(crop)) {
return null;
}
return new CropBasicIC2Crop(world, crop, new Vect(pos));
}
@Override
public boolean isGermling(ItemStack itemstack) {
return false;
}
@Override
public boolean isWindfall(ItemStack itemstack) {
return false;
}
@Override
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
return false;
}
// /**
// * Perform some of the actions of the crop-matron.
// */
// @Optional.Method(modid = PluginIC2.modId)
// public static void babysitCrop(TileEntity tileEntity) {
// if (CropBasicIC2Crop.isIC2Crop(tileEntity)) {
// ICropTile crop = (ICropTile) tileEntity;
// /*
// This part might be unbalanced until a custom farm logic is added and makes use of weed-ex.
// if (crop.getCrop() != null) {
// if (crop.getCrop().isWeed(crop)) {
// crop.reset();
// }
// }*/
// if (crop.getStorageWater() <= 200) {
// crop.setStorageWater(200);
// }
// if (crop.getStorageNutrient() <= 100) {
// crop.setStorageNutrient(crop.getStorageNutrient() + 100);
// }
// }
// }
//
// @Override
// public boolean isSaplingAt(World world, BlockPos pos) {
// TileEntity crop = world.getTileEntity(pos);
// if (CropBasicIC2Crop.isIC2Crop(crop)) {
// babysitCrop(crop);
// return true;
// }
// return false;
// }
//
// @Override
// public ICrop getCropAt(World world, BlockPos pos) {
// TileEntity crop = world.getTileEntity(pos);
// if (crop == null) {
// return null;
// }
// if (!CropBasicIC2Crop.isIC2Crop(crop)) {
// return null;
// }
// if (!CropBasicIC2Crop.canHarvestCrop(crop)) {
// return null;
// }
// return new CropBasicIC2Crop(world, crop, new Vect(pos));
// }
//
// @Override
// public boolean isGermling(ItemStack itemstack) {
// return false;
// }
//
// @Override
// public boolean isWindfall(ItemStack itemstack) {
// return false;
// }
//
// @Override
// public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
// return false;
// }
}