Crops now stop growing when inv full

This commit is contained in:
Brianna O'Keefe 2018-06-03 22:28:56 -04:00
parent 2cac6b991b
commit d8de248fe5
3 changed files with 6 additions and 4 deletions

View File

@ -46,6 +46,7 @@ public class FarmingHandler {
|| !crop.getState().equals(CropState.RIPE)
|| !doDrop(farm, block.getType())) continue;
if (farm.getLevel().isAutoReplant()) {
BlockState cropState = block.getState();
Crops cropData = (Crops) cropState.getData();
@ -134,7 +135,8 @@ public class FarmingHandler {
for (int fz = -radius; fz <= radius; fz++) {
Block b2 = block.getWorld().getBlockAt(bx + fx, by + fy, bz + fz);
if (!(b2.getState().getData() instanceof Crops)) continue;
if (!(b2.getState().getData() instanceof Crops) && !b2.getType().name().toLowerCase().contains("melon")) continue;
if (add)
crops.add(b2);
else {
@ -152,7 +154,7 @@ public class FarmingHandler {
if (inventory.firstEmpty() != -1) return true;
for (ItemStack stack : inventory.getContents()) {
if (stack.isSimilar(item) && stack.getAmount() <= stack.getMaxStackSize()) {
if (stack.isSimilar(item) && stack.getAmount() < stack.getMaxStackSize()) {
return true;
}
}

View File

@ -28,7 +28,7 @@ public class GrowthHandler {
for (Crop crop : liveCrops.values()) {
if (!(crop.getLocation().getBlock().getState().getData() instanceof Crops)) continue;
if (!(crop.getLocation().getBlock().getState().getData() instanceof Crops) && !crop.getLocation().getBlock().getType().name().toLowerCase().contains("melon")) continue;
//ToDO: This should be in config.
int cap = (int)Math.ceil(60 / crop.getFarm().getLevel().getSpeedMultiplier()) - crop.getTicksLived();

View File

@ -31,7 +31,7 @@ public class CropType {
if (crops.size() < 1) {
crops.add(new CropTypeData("Wheat", Material.CROPS, Material.WHEAT, Material.SEEDS));
crops.add(new CropTypeData("Carrot", Material.CARROT, Material.CARROT_ITEM, Material.CARROT_ITEM));
crops.add(new CropTypeData("Potato", Material.POTATO, Material.CARROT_ITEM, Material.POTATO_ITEM));
crops.add(new CropTypeData("Potato", Material.POTATO, Material.POTATO_ITEM, Material.POTATO_ITEM));
crops.add(new CropTypeData("Watermelon", Material.MELON_STEM, Material.MELON, Material.MELON_SEEDS));
crops.add(new CropTypeData("Pumpkin", Material.PUMPKIN_STEM, Material.PUMPKIN, Material.PUMPKIN_SEEDS));
crops.add(new CropTypeData("Melon", Material.MELON_STEM, Material.MELON, Material.MELON_SEEDS));