diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicBerryCrop.java index 655437d..387b9ce 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicBerryCrop.java @@ -36,11 +36,6 @@ public int stat(int n) { } } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - @Override public List getCropInformation() { return Arrays.asList( diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicCrop.java index d7a8856..22a0486 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicCrop.java @@ -28,6 +28,16 @@ public void registerSprites(IIconRegister iconRegister) { } } + // be DRY, not WET + @Override + public boolean canGrow(ICropTile crop) { + return this.canGrowBase(crop); + } + + protected boolean canGrowBase(ICropTile crop) { + return crop.getSize() < this.maxSize(); + } + @Override public float dropGainChance() { return (float) ((Math.pow(0.95, (float) tier())) * ConfigValues.BerryGain); diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicFoodCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicFoodCrop.java index 32b2e27..94823f1 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicFoodCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicFoodCrop.java @@ -50,7 +50,7 @@ public int maxSize() { @Override public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize() && crop.getLightLevel() >= 9; + return super.canGrow(crop) && crop.getLightLevel() >= 9; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicNetherBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicNetherBerryCrop.java index b3ea013..9874c02 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicNetherBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicNetherBerryCrop.java @@ -36,11 +36,6 @@ public int stat(int n) { } } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - @Override public List getCropInformation() { return Arrays diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicTinkerBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicTinkerBerryCrop.java index 4b58112..02f2eca 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicTinkerBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/abstracts/BasicTinkerBerryCrop.java @@ -54,16 +54,15 @@ public int stat(int n) { @Override public boolean canGrow(ICropTile crop) { - if (crop.getSize() >= this.maxSize()) return false; - else if (ConfigValues.debug || crop.getSize() < 1) return true; - else if (crop.getSize() < this.maxSize() - 1) return crop.getLightLevel() <= 10; - else if (crop.getSize() == this.maxSize() - 1) return crop.isBlockBelow(hasBlock()); - return false; + if (!canGrowBase(crop)) return false; + else if (ConfigValues.debug) return true; + else if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow(hasBlock()); + return crop.getLightLevel() <= 10; } @Override public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() >= 3; + return crop.getSize() >= this.maxSize() - 1; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/croploader/CropLoader.java b/src/main/java/com/github/bartimaeusnek/cropspp/croploader/CropLoader.java index 77e0ab8..63d7b31 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/croploader/CropLoader.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/croploader/CropLoader.java @@ -218,7 +218,7 @@ public static void register() { if (bHasCropObj.get(i) && cropObjs().get(i) != null) Crops.instance.registerCrop(cropObjs().get(i)); } if (bHasCropObj.get(bHasCropObj.size() - 1)) { - Bonsais.registerAllBonais(); + Bonsais.registerAllBonsais(); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/Bamboo.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/Bamboo.java index d8cf00f..15e0d51 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/Bamboo.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/Bamboo.java @@ -11,24 +11,28 @@ public class Bamboo extends BasicCrop { + @Override + public int tier() { + return 2; + } + + @Override public String name() { return "Bamboo"; } + @Override public String discoveredBy() { return "Minepolz320"; } - public int tier() { - return 2; - } - @Override public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { // no documentation on the intended effect, so i'm leaving it as is return (int) ((double) humidity * 1.3D + (double) nutrients * 1.2D + (double) air * 0.8D); } + @Override public int stat(int n) { switch (n) { case 0: @@ -46,30 +50,32 @@ public int stat(int n) { } } + @Override public String[] attributes() { return new String[] { "Green", "Pointed", "Edgy" }; } + @Override public int maxSize() { return 3; } - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - + @Override public boolean canBeHarvested(ICropTile crop) { return crop.getSize() > 1; } + @Override public int getOptimalHavestSize(ICropTile crop) { return this.maxSize(); } + @Override public ItemStack getGain(ICropTile crop) { return crop.getSize() > 1 ? new ItemStack(BOPCBlocks.bamboo, crop.getSize() - 1) : null; } + @Override public int growthDuration(ICropTile crop) { // If raining = fast grow @@ -79,6 +85,7 @@ public int growthDuration(ICropTile crop) { return 150; } + @Override public boolean onEntityCollision(ICropTile crop, Entity entity) { if (!entity.isSneaking()) { CCropUtility.damageEntity(entity, 1); diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/EyebulbCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/EyebulbCrop.java index ed78cdf..063a7e8 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/EyebulbCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/EyebulbCrop.java @@ -12,7 +12,7 @@ public class EyebulbCrop extends BasicDecorationCrop { public EyebulbCrop() { super(); - OreDict.BSget("crop" + name(), this); + OreDict.BSget("cropEyebulb", this); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/FloweringVinesCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/FloweringVinesCrop.java index bbe1327..a8fe4bb 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/FloweringVinesCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/FloweringVinesCrop.java @@ -19,16 +19,6 @@ public int tier() { return 3; } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - - @Override - public int maxSize() { - return 4; - } - @Override public String name() { return "Flowering Vines"; @@ -44,6 +34,11 @@ public String[] attributes() { return new String[] { "Green", "Tendrilly", "Flower" }; } + @Override + public int maxSize() { + return 4; + } + @Override public boolean canBeHarvested(ICropTile crop) { return crop.getSize() >= this.maxSize() - 1; @@ -53,8 +48,9 @@ public boolean canBeHarvested(ICropTile crop) { public ItemStack getGain(ICropTile crop) { // id 106 = vines if (crop.getSize() >= this.maxSize()) return new ItemStack(BOPCBlocks.flowerVine, 2, 0); - else if (crop.getSize() == this.maxSize() - 1) return new ItemStack(Item.getItemById(106), 2, 0); - else return null; + // there was a null return if the max side was under maxSize - 1 + // in normal operation that doesn't happen, so I removed it + return new ItemStack(Item.getItemById(106), 2, 0); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowflowerCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowflowerCrop.java index 98dc58e..ca30d86 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowflowerCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowflowerCrop.java @@ -17,11 +17,6 @@ public GlowflowerCrop() { super(); } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(BOPCBlocks.flowers, 1, 3); - } - @Override public int tier() { return super.tier() + 2; @@ -37,25 +32,25 @@ public String[] attributes() { return new String[] { "Nether", "Light", "Shiny" }; } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - @Override public int getEmittedLight(ICropTile crop) { if (crop.getSize() >= this.maxSize()) return 7; else return 0; } + @Override + public ItemStack getGain(ICropTile crop) { + // glow stone below doubles the yield + return new ItemStack(BOPCBlocks.flowers, crop.isBlockBelow(Blocks.glowstone) ? 2 : 1, 3); + } + @Override public List getCropInformation() { - return Arrays.asList("Needs a block of Glowstone below to incrase yield", "Emits light when fully grown."); + return Arrays.asList("Needs a block of Glowstone below to increase yield", "Emits light when fully grown."); } @Override - public ItemStack getGain(ICropTile crop) { - // glow stone below doubles the yield - return new ItemStack(BOPCBlocks.flowers, crop.isBlockBelow(Blocks.glowstone) ? 2 : 1, 3); + public ItemStack getDisplayItem() { + return new ItemStack(BOPCBlocks.flowers, 1, 3); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowingCoralCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowingCoralCrop.java index be95dca..bac365c 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowingCoralCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/GlowingCoralCrop.java @@ -18,8 +18,8 @@ public GlowingCoralCrop() { } @Override - public ItemStack getDisplayItem() { - return new ItemStack(BOPCBlocks.coral1, 1, 15); + public int tier() { + return super.tier() + 4; } @Override @@ -27,34 +27,29 @@ public String name() { return "Glowing Earth Coral"; } - @Override - public int tier() { - return super.tier() + 4; - } - @Override public String[] attributes() { return new String[] { "Water", "Light", "Shiny" }; } @Override - public List getCropInformation() { - return Arrays.asList("Needs a block of Glowstone below to incrase yield", "Emits light."); + public int getEmittedLight(ICropTile crop) { + return 7; } @Override - public int getEmittedLight(ICropTile crop) { - return 7; + public ItemStack getGain(ICropTile crop) { + // glow stone below doubles the yield + return new ItemStack(BOPCBlocks.coral1, crop.isBlockBelow(Blocks.glowstone) ? 2 : 1, 15); } @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); + public List getCropInformation() { + return Arrays.asList("Needs a block of Glowstone below to increase yield", "Emits light."); } @Override - public ItemStack getGain(ICropTile crop) { - // glow stone below doubles the yield - return new ItemStack(BOPCBlocks.coral1, crop.isBlockBelow(Blocks.glowstone) ? 2 : 1, 15); + public ItemStack getDisplayItem() { + return new ItemStack(BOPCBlocks.coral1, 1, 15); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/IvyCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/IvyCrop.java index 7ba52a6..3eda8a5 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/IvyCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/IvyCrop.java @@ -19,18 +19,13 @@ public int tier() { } @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < 3; - } - - @Override - public int maxSize() { - return 3; + public String name() { + return "Ivy"; } @Override - public String name() { - return "Ivy"; + public String[] attributes() { + return new String[] { "Green", "Tendrilly", "Flower", "Bad", "Poison" }; } @Override @@ -39,13 +34,13 @@ public String discoveredBy() { } @Override - public String[] attributes() { - return new String[] { "Green", "Tendrilly", "Flower", "Bad", "Poison" }; + public int maxSize() { + return 3; } @Override public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == this.maxSize(); + return crop.getSize() >= this.maxSize(); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/TurnipCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/TurnipCrop.java index 21e32c6..63db2da 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/TurnipCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/TurnipCrop.java @@ -14,10 +14,12 @@ public class TurnipCrop extends BasicFoodCrop { + private static final String cropOreName = "cropTurnip"; + public TurnipCrop() { super(); - OreDict.BSget("crop" + this.name(), this); - OreDict.BSget("seed" + this.name(), this); + // this used to register both crop and seed, but it was redundant thanks to the crop loader core code + OreDict.BSget(cropOreName, this); } @Override @@ -26,13 +28,13 @@ public String name() { } @Override - public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("cropTurnip"); + public String[] attributes() { + return new String[] { "Food", "Purple", "Carrots" }; } @Override - public String[] attributes() { - return new String[] { "Food", "Purple", "Carrots" }; + public ItemStack getGain(ICropTile crop) { + return CCropUtility.getCopiedOreStack(cropOreName); } @SideOnly(Side.CLIENT) @@ -48,6 +50,6 @@ public void registerSprites(IIconRegister iconRegister) { @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/WildCarrotsCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/WildCarrotsCrop.java index 434ced3..bd9c86d 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/WildCarrotsCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/BoP/WildCarrotsCrop.java @@ -14,10 +14,12 @@ public class WildCarrotsCrop extends BasicFoodCrop { + private static final String cropOreName = "cropWildcarrots"; + public WildCarrotsCrop() { super(); - OreDict.BSget("cropWildcarrots", this); - OreDict.BSget("seedWildcarrots", this); + // this used to register both crop and seed, but it was redundant thanks to the crop loader core code + OreDict.BSget(cropOreName, this); } @Override @@ -25,9 +27,14 @@ public String name() { return "Wild Carrots"; } + @Override + public String[] attributes() { + return new String[] { "Food", "White", "Carrots" }; + } + @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("cropWildcarrots"); + return CCropUtility.getCopiedOreStack(cropOreName); } @SideOnly(Side.CLIENT) @@ -41,13 +48,8 @@ public void registerSprites(IIconRegister iconRegister) { textures[2] = iconRegister.registerIcon("bpp:crop/blockCrop.Wild Carrots.3"); } - @Override - public String[] attributes() { - return new String[] { "Food", "White", "Carrots" }; - } - @Override public ItemStack getDisplayItem() { - return OreDict.ISget("cropWildcarrots"); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/BasicManaBeanCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/BasicManaBeanCrop.java index 1c69329..46f6bb7 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/BasicManaBeanCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/BasicManaBeanCrop.java @@ -10,10 +10,10 @@ import net.minecraft.world.World; import com.github.bartimaeusnek.croploadcore.BlockGetterTC; -import com.github.bartimaeusnek.croploadcore.OreDict; import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicThaumcraftCrop; +import ic2.api.crops.Crops; import ic2.api.crops.ICropTile; import thaumcraft.api.ItemApi; import thaumcraft.api.aspects.Aspect; @@ -28,7 +28,23 @@ public class BasicManaBeanCrop extends BasicThaumcraftCrop { public BasicManaBeanCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + // it used to use a method that actually do nothing, at least this works + Crops.instance.registerBaseSeed(thaumcraft.api.ItemApi.getItem("itemManaBean", 0), this, 1, 1, 1, 1); + } + + @Override + public String name() { + return "Mana Bean"; + } + + @Override + public String discoveredBy() { + return "kuba6000"; + } + + @Override + public String[] attributes() { + return new String[] { "Berry", "Bean", "Magic", "Colorful" }; } @Override @@ -49,9 +65,16 @@ public int stat(int n) { } } + @Override + public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { + // Requires no humidity but nutrients. + // Doc seems incorrect, but anyhow i've inverted it for safety sake + return (int) ((double) humidity / 1.3D + (double) nutrients + (double) air * 0.7); + } + @Override public boolean canGrow(ICropTile crop) { - // crystal block exists? no growing + // crystal cluster doesn't exist? no growing if (crop.getSize() >= maxSize()) return false; else if (blockCrystal == null && (blockCrystal = BlockGetterTC.getBlock_asBlock("blockCrystal", 0)) == null) return false; @@ -59,29 +82,12 @@ else if (blockCrystal == null && (blockCrystal = BlockGetterTC.getBlock_asBlock( return true; } - @Override - public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { - // Requires no humidity but nutrients. - // Doc seems incorrect, but anyhow i've inverted it for safety sake - return (int) ((double) humidity / 1.3D + (double) nutrients + (double) air * 0.7); - } - @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; return crop.getSize() >= this.maxSize() - 1 ? 1200 : 800; } - @Override - public String[] attributes() { - return new String[] { "Berry", "Bean", "Magic", "Colorful" }; - } - - @Override - public String name() { - return "Mana Bean"; - } - @Override public ItemStack getGain(ICropTile crop) { ItemStack bean = this.getDisplayItem().copy(); @@ -104,6 +110,11 @@ public ItemStack getGain(ICropTile crop) { return bean; } + @Override + public List getCropInformation() { + return Collections.singletonList("Needs a Crystal Cluster below to fully mature."); + } + @Override public ItemStack getDisplayItem() { if (manaBean == null) { @@ -119,13 +130,4 @@ public ItemStack getDisplayItem() { return manaBean; } - @Override - public String discoveredBy() { - return "kuba6000"; - } - - @Override - public List getCropInformation() { - return Collections.singletonList("Needs a Crystal Cluster below to fully mature."); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/CinderpearlCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/CinderpearlCrop.java index d259760..11aeb74 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/CinderpearlCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/CinderpearlCrop.java @@ -17,7 +17,7 @@ public class CinderpearlCrop extends BasicThaumcraftCrop { public CinderpearlCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget("cropCinderpearl", this); } @Override @@ -25,25 +25,19 @@ public String name() { return "Cinderpearl"; } - @Override - public String[] attributes() { - return new String[] { "Magic", "Blaze", "Nether" }; - } - @Override public String discoveredBy() { return "bartimaeusnek and mitchej123"; } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() == 1 ? 2250 : 1750; + public String[] attributes() { + return new String[] { "Magic", "Blaze", "Nether" }; } @Override public boolean canGrow(ICropTile crop) { - if (crop.getSize() >= this.maxSize()) return false; + if (!super.canGrow(crop)) return false; if (ConfigValues.debug) return true; if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow("blockBlaze") || !OreDictionary.doesOreNameExist("blockBlaze"); @@ -51,8 +45,10 @@ public boolean canGrow(ICropTile crop) { } @Override - public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + public int growthDuration(ICropTile crop) { + if (ConfigValues.debug) return 1; + // first stage is longer + return crop.getSize() <= 1 ? 2250 : 1750; } @Override @@ -64,4 +60,9 @@ public ItemStack getGain(ICropTile crop) { public List getCropInformation() { return Collections.singletonList("Needs a block of Blaze below to fully mature."); } + + @Override + public ItemStack getDisplayItem() { + return OreDict.ISget("crop" + this.name()); + } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/MagicMetalBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/MagicMetalBerryCrop.java index 561b75a..92a4f52 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/MagicMetalBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/MagicMetalBerryCrop.java @@ -3,7 +3,6 @@ import java.util.Arrays; import java.util.List; -import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import com.github.bartimaeusnek.cropspp.CCropUtility; @@ -18,14 +17,19 @@ public MagicMetalBerryCrop() { super(); } + @Override + public int tier() { + return 7; + } + @Override public String name() { return "Magic Metal Berry"; } @Override - public int tier() { - return 7; + public String[] attributes() { + return new String[] { "OreBerry", "Magic", "Metal", "Thaumium", "Void" }; } @Override @@ -38,7 +42,7 @@ public boolean canGrow(ICropTile crop) { boolean r; if (crop.getSize() >= this.maxSize()) return false; if (ConfigValues.debug) return true; - if (crop.getSize() <= this.maxSize() - 1) + if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow("blockThaumium") || crop.isBlockBelow("blockThauminite") || crop.isBlockBelow("blockIron") || crop.isBlockBelow("blockVoid"); @@ -47,9 +51,25 @@ public boolean canGrow(ICropTile crop) { } + @Override + public int growthDuration(ICropTile crop) { + if (ConfigValues.debug) return 1; + + // This used to check for all types of block but i removed that in favor of only thaumium check since thaumium + // is the only one that is supposed to make it grow faster, and it requires a block to grow to maturity. + + // Doing this also technically introduces an exploit where you can make a crop grow faster if you swap the block + // at the end. The effort to do this at a large scale is very stupid, it's at least note-worthy. + + // A solution to this would be to introduce a tick function like how netherwart and terrawart do it + else if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow("blockThaumium") ? 1800 : 3300; + else if (crop.getSize() >= this.maxSize() - 2) return 1200; + return 500; + } + @Override public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == 4; + return crop.getSize() >= this.maxSize(); } @Override @@ -72,33 +92,6 @@ public List getCropInformation() { "Needs a light level below or equal to 10 to fully mature." }); } - @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - - // This used to check for all types of block but i removed that in favor of only thaumium check since thaumium - // is the only one that is supposed to make it grow faster, and it requires a block to grow to maturity. - - // Doing this also technically introduces an exploit where you can make a crop grow faster if you swap the block - // at the end. The effort to do this at a large scale is very stupid, it's at least note-worthy. - - // A solution to this would be to introduce a tick function like how netherwart and terrawart do it - else if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow("blockThaumium") ? 1800 : 3300; - else if (crop.getSize() >= this.maxSize() - 2) return 1200; - return 500; - } - - @Override - public String[] attributes() { - return new String[] { "OreBerry", "Magic", "Metal", "Thaumium", "Void" }; - } - - @Override - public boolean onEntityCollision(ICropTile crop, Entity entity) { - CCropUtility.damageEntity(entity, 1); - return super.onEntityCollision(crop, entity); - } - @Override public ItemStack getDisplayItem() { return thaumcraft.api.ItemApi.getItem("itemResource", 17); diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/PrimordialPearlBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/PrimordialPearlBerryCrop.java index 085f0e3..7684018 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/PrimordialPearlBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/PrimordialPearlBerryCrop.java @@ -16,14 +16,29 @@ public PrimordialPearlBerryCrop() { super(); } + @Override + public int tier() { + return 16; + } + @Override public String name() { return "Primordial Berry"; } @Override - public int tier() { - return 16; + public String discoveredBy() { + return "bartimaeusnek and ForTheHorde01"; + } + + @Override + public String[] attributes() { + return new String[] { "Berry", "Primordial", "Magic", "Unique" }; + } + + @Override + public boolean canCross(ICropTile crop) { + return false; } @Override @@ -44,16 +59,6 @@ public int stat(int n) { } } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); - } - - @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() >= this.maxSize(); - } - @Override public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { // Requires Tons of everything @@ -63,34 +68,19 @@ public int weightInfluences(ICropTile crop, float humidity, float nutrients, flo return (int) ((double) humidity / 2 + (double) nutrients / 2 + (double) air / 2); } - @Override - public int growthDuration(ICropTile crop) { - return ConfigValues.debug ? 1 : ConfigValues.PrimordialBerryGroth; - } - - @Override - public float dropGainChance() { - return ConfigValues.PrimordialBerryGain; - } - - @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 1; - } - @Override public int maxSize() { return 4; } @Override - public boolean canCross(ICropTile crop) { - return false; + public int growthDuration(ICropTile crop) { + return ConfigValues.debug ? 1 : ConfigValues.PrimordialBerryGroth; } @Override - public ItemStack getSeeds(ICropTile crop) { - return crop.generateSeeds(crop.getCrop(), (byte) 1, (byte) 1, (byte) 1, crop.getScanLevel()); + public float dropGainChance() { + return ConfigValues.PrimordialBerryGain; } @Override @@ -102,13 +92,13 @@ public ItemStack getGain(ICropTile crop) { } @Override - public String[] attributes() { - return new String[] { "Berry", "Primordial", "Magic", "Unique" }; + public ItemStack getSeeds(ICropTile crop) { + return crop.generateSeeds(crop.getCrop(), (byte) 1, (byte) 1, (byte) 1, crop.getScanLevel()); } @Override - public String discoveredBy() { - return "bartimaeusnek and ForTheHorde01"; + public List getCropInformation() { + return Collections.singletonList("Can not Cross, takes a long time to mature."); } @Override @@ -116,8 +106,4 @@ public ItemStack getDisplayItem() { return thaumcraft.api.ItemApi.getItem("itemEldritchObject", 3); } - @Override - public List getCropInformation() { - return Collections.singletonList("Can not Cross, takes a long time to mature."); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/ShimmerleafCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/ShimmerleafCrop.java index 9d41351..438f2fe 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/ShimmerleafCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TC/ShimmerleafCrop.java @@ -17,7 +17,7 @@ public class ShimmerleafCrop extends BasicThaumcraftCrop { public ShimmerleafCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget("cropShimmerleaf", this); } @Override @@ -25,6 +25,11 @@ public String name() { return "Shimmerleaf"; } + @Override + public String discoveredBy() { + return "bartimaeusnek and DreamMasterXXL"; + } + @Override public String[] attributes() { return new String[] { "Magic", "Silver", "Toxic" }; @@ -33,12 +38,8 @@ public String[] attributes() { @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; - return crop.getSize() == 1 ? 2250 : 1750; - } - - @Override - public String discoveredBy() { - return "bartimaeusnek and DreamMasterXXL"; + // first stage is longer + return crop.getSize() <= 1 ? 2250 : 1750; } @Override @@ -50,11 +51,6 @@ else if (crop.getSize() >= this.maxSize() - 1) return true; } - @Override - public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); - } - @Override public ItemStack getGain(ICropTile crop) { return CCropUtility.getCopiedOreStack("crop" + this.name()); @@ -64,4 +60,9 @@ public ItemStack getGain(ICropTile crop) { public List getCropInformation() { return Collections.singletonList("Needs a block of Quicksilver below to fully mature."); } + + @Override + public ItemStack getDisplayItem() { + return OreDict.ISget("crop" + this.name()); + } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/AluminiumOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/AluminiumOreBerryCrop.java index 4c68372..bf935b8 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/AluminiumOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/AluminiumOreBerryCrop.java @@ -2,13 +2,11 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; -import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class AluminiumOreBerryCrop extends BasicTinkerBerryCrop { +public class AluminiumOreBerryCrop extends BasicTConstructOreBerryCrop { public AluminiumOreBerryCrop() { super(); @@ -20,30 +18,18 @@ public String name() { } @Override - protected String hasBlock() { - return "blockAluminium"; - } - - @Override - public ItemStack getGain(ICropTile crop) { - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("blockAluminium")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 4); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 4); + public String[] attributes() { + return new String[] { "OreBerry", "Aluminium", "Metal", "Aluminum" }; } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + protected String hasBlock() { + return "blockAluminium"; } @Override - public String[] attributes() { - return new String[] { "OreBerry", "Aluminium", "Metal", "Aluminum" }; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 4); } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 4); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java new file mode 100644 index 0000000..a1dc601 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/BasicTConstructOreBerryCrop.java @@ -0,0 +1,34 @@ +package com.github.bartimaeusnek.cropspp.crops.TConstruct; + +import net.minecraft.item.ItemStack; + +import com.github.bartimaeusnek.cropspp.ConfigValues; +import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; + +import ic2.api.crops.ICropTile; + +public abstract class BasicTConstructOreBerryCrop extends BasicTinkerBerryCrop { + + public BasicTConstructOreBerryCrop() { + super(); + } + + public abstract ItemStack getDropItem(int count); + + @Override + public int growthDuration(ICropTile crop) { + if (ConfigValues.debug) return 1; + return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + } + + @Override + public ItemStack getGain(ICropTile crop) { + return getDropItem(crop.getSize() >= this.maxSize() && crop.isBlockBelow(hasBlock()) ? 6 : 2); + } + + @Override + public ItemStack getDisplayItem() { + return getDropItem(6); + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/CopperOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/CopperOreBerryCrop.java index 69e769b..8094a35 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/CopperOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/CopperOreBerryCrop.java @@ -2,13 +2,11 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; -import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class CopperOreBerryCrop extends BasicTinkerBerryCrop { +public class CopperOreBerryCrop extends BasicTConstructOreBerryCrop { public CopperOreBerryCrop() { super(); @@ -20,10 +18,8 @@ public String name() { } @Override - public ItemStack getGain(ICropTile crop) { - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("blockCopper")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 2); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 2); + public String[] attributes() { + return new String[] { "OreBerry", "Copper", "Metal", "Shiny" }; } @Override @@ -32,18 +28,8 @@ protected String hasBlock() { } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 2); } - @Override - public String[] attributes() { - return new String[] { "OreBerry", "Copper", "Metal", "Shiny" }; - } - - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 2); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java index 4631ac3..1ae924d 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/EssenceOreBerryCrop.java @@ -2,13 +2,10 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; -import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; - import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class EssenceOreBerryCrop extends BasicTinkerBerryCrop { +public class EssenceOreBerryCrop extends BasicTConstructOreBerryCrop { public EssenceOreBerryCrop() { super(); @@ -20,11 +17,8 @@ public String name() { } @Override - public ItemStack getGain(ICropTile crop) { - - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("itemSkull")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 5); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 5); + public String[] attributes() { + return new String[] { "OreBerry", "Essence", "Undead" }; } @Override @@ -32,24 +26,14 @@ protected String hasBlock() { return "itemSkull"; } - @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; - } - @Override public boolean canGrow(ICropTile crop) { - return crop.getSize() < 4; + return super.canGrowBase(crop); } @Override - public String[] attributes() { - return new String[] { "OreBerry", "Essence", "Undead" }; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 5); } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 5); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/GoldOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/GoldOreBerryCrop.java index c4037b2..ec406d8 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/GoldOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/GoldOreBerryCrop.java @@ -2,13 +2,11 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; -import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class GoldOreBerryCrop extends BasicTinkerBerryCrop { +public class GoldOreBerryCrop extends BasicTConstructOreBerryCrop { public GoldOreBerryCrop() { super(); @@ -20,10 +18,8 @@ public String name() { } @Override - public ItemStack getGain(ICropTile crop) { - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("blockGold")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 1); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 1); + public String[] attributes() { + return new String[] { "OreBerry", "Gold", "Metal" }; } @Override @@ -32,18 +28,8 @@ protected String hasBlock() { } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 1); } - @Override - public String[] attributes() { - return new String[] { "OreBerry", "Gold", "Metal" }; - } - - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 1); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/IronOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/IronOreBerryCrop.java index b966b80..aad24df 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/IronOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/IronOreBerryCrop.java @@ -2,13 +2,11 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; -import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class IronOreBerryCrop extends BasicTinkerBerryCrop { +public class IronOreBerryCrop extends BasicTConstructOreBerryCrop { public IronOreBerryCrop() { super(); @@ -20,10 +18,8 @@ public String name() { } @Override - public ItemStack getGain(ICropTile crop) { - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("blockIron")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 0); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 0); + public String[] attributes() { + return new String[] { "OreBerry", "Gray", "Metal" }; } @Override @@ -32,18 +28,8 @@ protected String hasBlock() { } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 0); } - @Override - public String[] attributes() { - return new String[] { "OreBerry", "Gray", "Metal" }; - } - - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 0); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/TinOreBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/TinOreBerryCrop.java index 09a39ff..4ffdce4 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/TinOreBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TConstruct/TinOreBerryCrop.java @@ -2,53 +2,39 @@ import net.minecraft.item.ItemStack; -import com.github.bartimaeusnek.cropspp.ConfigValues; import com.github.bartimaeusnek.cropspp.abstracts.BasicTinkerBerryCrop; -import ic2.api.crops.ICropTile; import tconstruct.world.TinkerWorld; -public class TinOreBerryCrop extends BasicTinkerBerryCrop { +public class TinOreBerryCrop extends BasicTConstructOreBerryCrop { public TinOreBerryCrop() { super(); } - @Override - public String name() { - return "Tin " + BasicTinkerBerryCrop.OBname(); - } - @Override public int tier() { return 4; } @Override - public ItemStack getGain(ICropTile crop) { - if (crop.getSize() >= this.maxSize() && crop.isBlockBelow("blockTin")) { - return new ItemStack(TinkerWorld.oreBerries, 6, 3); - } else return new ItemStack(TinkerWorld.oreBerries, 2, 3); + public String name() { + return "Tin " + BasicTinkerBerryCrop.OBname(); } @Override - protected String hasBlock() { - return "blockTin"; + public String[] attributes() { + return new String[] { "OreBerry", "Tin", "Metal", "Shiny" }; } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; + protected String hasBlock() { + return "blockTin"; } @Override - public String[] attributes() { - return new String[] { "OreBerry", "Tin", "Metal", "Shiny" }; + public ItemStack getDropItem(int amount) { + return new ItemStack(TinkerWorld.oreBerries, amount, 3); } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(TinkerWorld.oreBerries, 6, 3); - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/KnighmetalCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/KnighmetalCrop.java index 9335f72..a7fc19e 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/KnighmetalCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/KnighmetalCrop.java @@ -19,11 +19,6 @@ public int tier() { return 8; } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(twilightforest.item.TFItems.armorShard); - } - @Override public String name() { return "Knightly " + BasicTinkerBerryCrop.OBname(); @@ -42,15 +37,20 @@ protected String hasBlock() { @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; - return crop.getSize() >= 2 ? 4500 : 1000; + return crop.getSize() >= this.maxSize() - 1 ? 4500 : 1000; } @Override public ItemStack getGain(ICropTile crop) { if (crop.getSize() < this.maxSize() - || !((crop.isBlockBelow("blockKnightmetal") || !OreDictionary.doesOreNameExist("blockKnightmetal")))) { + || !((crop.isBlockBelow(this.hasBlock()) || !OreDictionary.doesOreNameExist(this.hasBlock())))) { return new ItemStack(twilightforest.item.TFItems.armorShard, 1); } return new ItemStack(twilightforest.item.TFItems.armorShard, 4); } + + @Override + public ItemStack getDisplayItem() { + return new ItemStack(twilightforest.item.TFItems.armorShard); + } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/MossCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/MossCrop.java index 76e1310..ac38346 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/MossCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/MossCrop.java @@ -16,13 +16,13 @@ public class MossCrop extends BasicDecorationCrop { @Override - public String name() { - return "Moss"; + public int tier() { + return 4; } @Override - public int tier() { - return 4; + public String name() { + return "Moss"; } @Override @@ -32,12 +32,10 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - byte r = (byte) MyRandom.intrandom(0, 100); - if (r < 5) { - return new ItemStack(TFBlocks.plant, 1, 3); - } else if (r > 5 && r < 35) { - return new ItemStack(BOPCBlocks.moss, 1, 0); - } else return new ItemStack(BOPCBlocks.treeMoss, 1, 0); + int r = MyRandom.intrandom(0, 100); + if (r < 5) return new ItemStack(TFBlocks.plant, 1, 3); + else if (r > 5 && r < 35) return new ItemStack(BOPCBlocks.moss, 1, 0); + else return new ItemStack(BOPCBlocks.treeMoss, 1, 0); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/TorchberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/TorchberryCrop.java index a9ec4cb..0ced6dc 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/TorchberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/TF/TorchberryCrop.java @@ -14,23 +14,26 @@ public TorchberryCrop() { } @Override - public byte getSizeAfterHarvest(ICropTile crop) { + public int tier() { return 2; } - public String discoveredBy() { - return "Minepolz320"; - } - + @Override public String name() { return "Torchberry"; } @Override - public int tier() { - return 2; + public String discoveredBy() { + return "Minepolz320"; } + @Override + public String[] attributes() { + return new String[] { "Berry", "Glow", "Shimmer" }; + } + + @Override public int stat(int n) { switch (n) { case 0: @@ -48,6 +51,7 @@ public int stat(int n) { } } + @Override public int getEmittedLight(ICropTile crop) { switch (crop.getSize()) { case 1: @@ -65,22 +69,29 @@ public int maxSize() { } @Override - public boolean canGrow(ICropTile crop) { - // do the static check before the world check please - return crop.getSize() < maxSize() && crop.getLightLevel() <= 10; + public byte getSizeAfterHarvest(ICropTile crop) { + return 2; } @Override - public String[] attributes() { - return new String[] { "Berry", "Glow", "Shimmer" }; + public int growthDuration(ICropTile crop) { + return crop.getSize() == 1 ? 100 : 150; } @Override - public int growthDuration(ICropTile crop) { - return crop.getSize() == 1 ? 100 : 150; + public boolean canGrow(ICropTile crop) { + // do the static check before the world check please + return super.canGrow(crop) && crop.getLightLevel() <= 10; } + @Override public ItemStack getGain(ICropTile crop) { return new ItemStack(TFItems.torchberries, 1); } + + @Override + public ItemStack getDisplayItem() { + return new ItemStack(TFItems.torchberries, 1); + } + } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/ArditeBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/ArditeBerryCrop.java index e3fd4d7..6f35ff3 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/ArditeBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/ArditeBerryCrop.java @@ -15,35 +15,35 @@ public ArditeBerryCrop() { super(); } - @Override - public String name() { - return "Ardite Berry"; - } - @Override public int tier() { return 7; } @Override - protected String hasBlock() { - return "blockArdite"; + public String name() { + return "Ardite Berry"; } @Override - public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("nuggetArdite"); + public String[] attributes() { + return new String[] { "OreBerry", "Ardite", "Metal", "Orange" }; } @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; - return crop.getSize() >= 2 ? 3000 : 500; + return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; } @Override - public String[] attributes() { - return new String[] { "OreBerry", "Ardite", "Metal", "Orange" }; + protected String hasBlock() { + return "blockArdite"; + } + + @Override + public ItemStack getGain(ICropTile crop) { + return CCropUtility.getCopiedOreStack("nuggetArdite"); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/Bonsais.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/Bonsais.java index 4d6de7a..da937c3 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/Bonsais.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/Bonsais.java @@ -74,7 +74,7 @@ public ItemStack getSeed() { load = modID == null || Loader.isModLoaded(modID); } - public static void registerAllBonais() { + public static void registerAllBonsais() { for (Bonsais bonsai : Bonsais.values()) { if (bonsai.load) { Crops.instance.registerCrop(bonsai.getBonsais()); @@ -95,6 +95,7 @@ static class InternalVanillaBonsais extends BasicCrop { String[] additionalDescription; int[] chances; String[] pathToSprites; + final int maxChance; public InternalVanillaBonsais(String name, int tier, String[] attributes, String discoveredBy, ItemStack[] gain, int[] chances, String[] pathToSprites, String[] additionalDescription) { @@ -106,11 +107,13 @@ public InternalVanillaBonsais(String name, int tier, String[] attributes, String this.additionalDescription = additionalDescription; this.chances = chances; this.pathToSprites = pathToSprites; + this.maxChance = maxChance(chances); } - @Override - public String name() { - return name + " Bonsai"; + private static int maxChance(int[] chances) { + int max = 0; + for (int chance : chances) max = Math.max(max, chance); + return max; } @Override @@ -118,6 +121,11 @@ public int tier() { return tier; } + @Override + public String name() { + return name + " Bonsai"; + } + @Override public int stat(int i) { return i == 3 ? 1 : 0; @@ -129,38 +137,29 @@ public String[] attributes() { } @Override - public int maxSize() { - return 3; + public String discoveredBy() { + return discoveredBy; } @Override - public String discoveredBy() { - return discoveredBy; + public int maxSize() { + return 3; } @Override - public boolean canGrow(ICropTile iCropTile) { - return iCropTile.getSize() < maxSize(); + public int growthDuration(ICropTile crop) { + return ConfigValues.debug ? 1 : super.growthDuration(crop) * 3; } @Override - public ItemStack getGain(ICropTile iCropTile) { - int max = 0; - for (int chanch : chances) { - max = Math.max(chanch, max); - } + public ItemStack getGain(ICropTile crop) { XSTR rand = new XSTR(); - int roll = rand.nextInt(max); + int roll = rand.nextInt(maxChance); for (int i = chances.length - 1; i >= 0; i--) { if (chances[i] >= roll) { ItemStack ret = gain[i].copy(); - int moreorless = rand.nextInt(4); - if (rand.nextBoolean()) ret.stackSize += moreorless; - else { - if (rand.nextBoolean()) ret.stackSize -= moreorless; - if (ret.stackSize < 0) ret = null; - } - return ret; + ret.stackSize += rand.nextInt(7) - 3; + return ret.stackSize <= 0 ? null : ret; } } return null; @@ -181,11 +180,6 @@ public void registerSprites(IIconRegister iconRegister) { } } - @Override - public int growthDuration(ICropTile crop) { - return ConfigValues.debug ? 1 : super.growthDuration(crop) * 3; - } - @Override public List getCropInformation() { return additionalDescription != null ? Arrays.asList(additionalDescription) : null; diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CactiCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CactiCrop.java index 7f8feff..e5f52c9 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CactiCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CactiCrop.java @@ -43,15 +43,27 @@ public String[] attributes() { return new String[] { "Green", "Cactus" }; } + @Override + public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { + // Requires more humidity than nutrients or air, but not much more + return (int) ((double) humidity / 0.5 + (double) nutrients / 1.25D + (double) air / 1.25D); + } + @Override public ItemStack getGain(ICropTile crop) { - if ((ModsLoaded.BoP && crop.getSize() == 2)) return new ItemStack(BOPCBlocks.plants, 1, 12); + if (ModsLoaded.BoP && crop.getSize() >= this.maxSize() - 1) return new ItemStack(BOPCBlocks.plants, 1, 12); else return new ItemStack(Item.getItemById(81), 1, 0); } @Override public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() >= 2; + return crop.getSize() >= this.maxSize() - 1; + } + + @Override + public boolean onEntityCollision(ICropTile crop, Entity entity) { + if (!entity.isSneaking()) CCropUtility.damageEntity(entity, 1); + return super.onEntityCollision(crop, entity); } @Override @@ -62,21 +74,6 @@ public List getCropInformation() { "Hurt Player on collision"); } - @Override - public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { - // Requires more humidity than nutrients or air, but not much more - return (int) ((double) humidity / 0.5 + (double) nutrients / 1.25D + (double) air / 1.25D); - } - - @Override - public boolean onEntityCollision(ICropTile crop, Entity entity) { - - if (!entity.isSneaking()) { - CCropUtility.damageEntity(entity, 1); - } - return super.onEntityCollision(crop, entity); - } - @Override public ItemStack getDisplayItem() { return new ItemStack(Item.getItemById(81), 1, 0); diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CobaltBerryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CobaltBerryCrop.java index 68c89c0..554b94f 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CobaltBerryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/CobaltBerryCrop.java @@ -15,14 +15,19 @@ public CobaltBerryCrop() { super(); } + @Override + public int tier() { + return 7; + } + @Override public String name() { return "Cobalt Berry"; } @Override - public int tier() { - return 7; + public String[] attributes() { + return new String[] { "OreBerry", "Cobalt", "Metal", "Blue" }; } @Override @@ -30,20 +35,15 @@ protected String hasBlock() { return "blockCobalt"; } - @Override - public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("nuggetArdite"); - } - @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; - return crop.getSize() >= 2 ? 3000 : 500; + return crop.getSize() >= this.maxSize() - 2 ? 3000 : 500; } @Override - public String[] attributes() { - return new String[] { "OreBerry", "Cobalt", "Metal", "Blue" }; + public ItemStack getGain(ICropTile crop) { + return CCropUtility.getCopiedOreStack("nuggetArdite"); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GoldfishCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GoldfishCrop.java index fae9d90..a8d9fe5 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GoldfishCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GoldfishCrop.java @@ -17,6 +17,23 @@ public class GoldfishCrop extends BasicDecorationCrop { + // be DRY, not WET + private static final String screamSoundId = "mob.ghast.scream"; + + private boolean ShouldInteract(ICropTile crop, EntityPlayer player) { + if (!ConfigValues.ILoveScreaming) return true; + player.playSound(screamSoundId, getScreamVolume(crop), getScreamPitch(crop)); + return true; + } + + private float getScreamVolume(ICropTile crop) { + return crop.getSize() >= this.maxSize() ? 5.0f : crop.getSize(); + } + + private float getScreamPitch(ICropTile crop) { + return crop.getSize() >= this.maxSize() ? 0.5f : (this.maxSize() + 1) + (-1) * crop.getSize(); + } + public GoldfishCrop() { super(); } @@ -26,11 +43,6 @@ public int tier() { return 4; } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(CppItems.Goldfisch); - } - @Override public String name() { return "Goldfish Plant"; @@ -46,34 +58,34 @@ public int growthDuration(ICropTile crop) { return ConfigValues.debug ? 1 : 225; } + @Override + public ItemStack getGain(ICropTile crop) { + return new ItemStack(CppItems.Goldfisch); + } + + @Override + public void tick(ICropTile crop) { + if (ConfigValues.ILoveScreaming) { + if (MyRandom.intrandom(512, 0) == 42) { + crop.getWorld().playSoundEffect( + crop.getLocation().posX, + crop.getLocation().posY, + crop.getLocation().posZ, + screamSoundId, + this.getScreamVolume(crop), + this.getScreamPitch(crop)); + } + } + } + @Override public boolean rightclick(ICropTile crop, EntityPlayer player) { - if (!ConfigValues.ILoveScreaming) return crop.harvest(true); - - boolean ret; - if (((int) crop.getSize()) != this.maxSize()) { - player.playSound("mob.ghast.scream", crop.getSize(), (maxSize() + 1) + (-1) * crop.getSize()); - ret = crop.harvest(true); - } else if (((int) crop.getSize()) == this.maxSize()) { - player.playSound("mob.ghast.scream", 5, (float) 0.5); - ret = crop.harvest(true); - } else ret = false; - return ret; + return ShouldInteract(crop, player) && crop.harvest(true); } @Override public boolean leftclick(ICropTile crop, EntityPlayer player) { - if (!ConfigValues.ILoveScreaming) return crop.pick(true); - - boolean ret; - if (((int) crop.getSize()) != this.maxSize()) { - player.playSound("mob.ghast.scream", crop.getSize(), (maxSize() + 1) + (-1) * crop.getSize()); - ret = crop.pick(true); - } else if (((int) crop.getSize()) == this.maxSize()) { - player.playSound("mob.ghast.scream", 5, (float) 0.5); - ret = crop.pick(true); - } else ret = false; - return ret; + return ShouldInteract(crop, player) && crop.pick(true); } @Override @@ -82,44 +94,21 @@ public boolean onEntityCollision(ICropTile crop, Entity entity) { if (entity instanceof EntityLivingBase) { if (entity instanceof EntityPlayer) { - if (((int) crop.getSize()) != this.maxSize()) - entity.playSound("mob.ghast.scream", crop.getSize(), (maxSize() + 1) + (-1) * crop.getSize()); - else if (((int) crop.getSize()) == this.maxSize()) entity.playSound("mob.ghast.scream", 5, (float) 0.5); + entity.playSound(screamSoundId, this.getScreamVolume(crop), this.getScreamPitch(crop)); } - return ((EntityLivingBase) entity).isSprinting(); + return entity.isSprinting(); } return false; } - @Override - public ItemStack getGain(ICropTile crop) { - return new ItemStack(CppItems.Goldfisch); - } - @Override public List getCropInformation() { return Collections.singletonList("Screams."); } @Override - public void tick(ICropTile crop) { - if (ConfigValues.ILoveScreaming) { - if (MyRandom.intrandom(512, 0) == 42) { - if (crop.getSize() != this.maxSize()) crop.getWorld().playSoundEffect( - crop.getLocation().posX, - crop.getLocation().posY, - crop.getLocation().posZ, - "mob.ghast.scream", - crop.getSize(), - (maxSize() + 1) + (-1) * crop.getSize()); - else if (crop.getSize() == this.maxSize()) crop.getWorld().playSoundEffect( - crop.getLocation().posX, - crop.getLocation().posY, - crop.getLocation().posZ, - "mob.ghast.scream", - crop.getSize(), - (maxSize() + 1) + (-1) * crop.getSize()); - } - } + public ItemStack getDisplayItem() { + return new ItemStack(CppItems.Goldfisch); } + } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GrassCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GrassCrop.java index fe03a88..1fdaa69 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GrassCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/GrassCrop.java @@ -27,6 +27,21 @@ public int tier() { return 0; } + @Override + public String name() { + return "Grass"; + } + + @Override + public String[] attributes() { + return new String[] { "Green", "Bad" }; + } + + @Override + public boolean isWeed(ICropTile crop) { + return true; + } + @Override public int stat(int n) { switch (n) { @@ -46,8 +61,8 @@ public int stat(int n) { } @Override - public String name() { - return "Grass"; + public int maxSize() { + return 4; } @Override @@ -56,31 +71,8 @@ public int getOptimalHavestSize(ICropTile crop) { } @Override - public boolean isWeed(ICropTile crop) { - return true; - } - - @Override - public boolean onEntityCollision(ICropTile crop, Entity entity) { - if (crop.getSize() == 4) { - CCropUtility.damageEntity(entity, 1); - } - return false; - } - - @Override - public boolean leftclick(ICropTile crop, EntityPlayer player) { - return false; - } - - @Override - public float dropGainChance() { - return (float) 1; - } - - @Override - public int maxSize() { - return 4; + public byte getSizeAfterHarvest(ICropTile crop) { + return (byte) ((int) crop.getSize() - 1); } @Override @@ -89,15 +81,15 @@ public boolean canBeHarvested(ICropTile crop) { } @Override - public String[] attributes() { - return new String[] { "Green", "Bad" }; + public float dropGainChance() { + return (float) 1; } @Override public ItemStack getGain(ICropTile crop) { // 32 = dead bush - if (crop.getSize() == 4) return new ItemStack(Item.getItemById(32), 1, 0); - if (crop.getSize() == 3) { + if (crop.getSize() >= this.maxSize()) return new ItemStack(Item.getItemById(32), 1, 0); + if (crop.getSize() == this.maxSize() - 1) { // 175:3 = large fern // 31:2 = Tall Grass (Fern) return MyRandom.intrandom(0, 10) == 9 ? new ItemStack(Item.getItemById(175), 1, 3) @@ -110,13 +102,16 @@ public ItemStack getGain(ICropTile crop) { } @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); + public boolean onEntityCollision(ICropTile crop, Entity entity) { + if (crop.getSize() == 4) { + CCropUtility.damageEntity(entity, 1); + } + return false; } @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return (byte) ((int) crop.getSize() - 1); + public boolean leftclick(ICropTile crop, EntityPlayer player) { + return false; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/HuckleberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/HuckleberryCrop.java index 2230c1d..c2ce941 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/HuckleberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/HuckleberryCrop.java @@ -10,30 +10,35 @@ public class HuckleberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropHuckleberry"; + public HuckleberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); } + @Override public String name() { return "Huckleberry"; } - public String[] attributes() { - return new String[] { "Berry", "Food", "Purple", "Leaves" }; // Purple like CropVenomilia, Leaves like CropFerru - } - + @Override public String discoveredBy() { return "Ancient cultures"; } + @Override + public String[] attributes() { + return new String[] { "Berry", "Food", "Purple", "Leaves" }; // Purple like CropVenomilia, Leaves like CropFerru + } + @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + this.name()); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/MagicModifierCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/MagicModifierCrop.java index 0d21751..392048a 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/MagicModifierCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/MagicModifierCrop.java @@ -18,14 +18,30 @@ public MagicModifierCrop() { super(); } + @Override + public int tier() { + return 13; + } + @Override public String name() { return "Magical Nightshade"; } @Override - public int tier() { - return 13; + public String discoveredBy() { + return "bartimaeusnek"; + } + + @Override + public int getEmittedLight(ICropTile crop) { + if (crop.getSize() == this.maxSize()) return 4; + else return 0; + } + + @Override + public byte getSizeAfterHarvest(ICropTile crop) { + return 1; } @Override @@ -44,8 +60,12 @@ public ItemStack getSeeds(ICropTile crop) { } @Override - public List getCropInformation() { - return Collections.singletonList("Needs a block of Ichorium below to fully mature."); + public boolean canGrow(ICropTile crop) { + if (!this.canGrowBase(crop)) return false; + else if (ConfigValues.debug) return true; + else if (crop.getSize() >= this.maxSize() - 1) + return crop.isBlockBelow("blockIchorium") || !OreDictionary.doesOreNameExist("blockIchorium"); + else return true; } @Override @@ -60,38 +80,17 @@ public float dropGainChance() { } @Override - public int getEmittedLight(ICropTile crop) { - if (crop.getSize() == this.maxSize()) return 4; - else return 0; - } - - @Override - public boolean canGrow(ICropTile crop) { - boolean ret = false; - if (crop.getSize() >= this.maxSize()) return false; - else if (ConfigValues.debug) return true; - else if (crop.getSize() >= this.maxSize() - 1) - return crop.isBlockBelow("blockIchorium") || !OreDictionary.doesOreNameExist("blockIchorium"); - else return true; + public ItemStack getGain(ICropTile crop) { + return new ItemStack(CppItems.Modifier, 1, 1); } @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 1; + public List getCropInformation() { + return Collections.singletonList("Needs a block of Ichorium below to fully mature."); } @Override public ItemStack getDisplayItem() { return new ItemStack(CppItems.Modifier, 1, 1); } - - @Override - public ItemStack getGain(ICropTile crop) { - return new ItemStack(CppItems.Modifier, 1, 1); - } - - @Override - public String discoveredBy() { - return "bartimaeusnek"; - } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/PapyrusCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/PapyrusCrop.java index 508f400..955ccc6 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/PapyrusCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/PapyrusCrop.java @@ -18,11 +18,6 @@ public int tier() { return 5; } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(Items.paper, 1, 0); - } - @Override public String name() { return "Papyrus"; @@ -37,4 +32,9 @@ public String[] attributes() { public ItemStack getGain(ICropTile crop) { return new ItemStack(Items.paper, 1, 0); } + + @Override + public ItemStack getDisplayItem() { + return new ItemStack(Items.paper, 1, 0); + } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SpacePlantCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SpacePlantCrop.java index 24ff921..3a9f23d 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SpacePlantCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SpacePlantCrop.java @@ -19,13 +19,8 @@ public SpacePlantCrop() { } @Override - public ItemStack getDisplayItem() { - return new ItemStack(CppItems.Modifier, 1, 0); - } - - @Override - public int growthDuration(ICropTile crop) { - return ConfigValues.debug ? 1 : 5000; + public int tier() { + return 13; } @Override @@ -33,11 +28,6 @@ public String name() { return "Space Plant"; } - @Override - public int tier() { - return 13; - } - @Override public int stat(int n) { switch (n) { @@ -66,28 +56,39 @@ public int maxSize() { return 4; } + @Override + public int growthDuration(ICropTile crop) { + return ConfigValues.debug ? 1 : 5000; + } + + @Override + public boolean canBeHarvested(ICropTile crop) { + return crop.getSize() >= this.maxSize(); + } + @Override public boolean canGrow(ICropTile crop) { if (crop.getSize() >= this.maxSize()) return false; else if (ConfigValues.debug) return true; - // this also includes the GC ores from the moon - // in nh we have an ore dict for "rockMoon", should probably use that instead + // This also includes the GC ores from the moon + // in nh we have an ore dict for "rockMoon", we could use that instead but, + // that ore dict name doesn't exist by default, let's net do that else if (crop.getSize() >= this.maxSize() - 1) return crop.isBlockBelow(GCBlocks.blockMoon); else return true; } @Override - public List getCropInformation() { - return Collections.singletonList("Needs a block from the moon below to fully mature."); + public ItemStack getGain(ICropTile crop) { + return new ItemStack(CppItems.Modifier, 1, 0); } @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == this.maxSize(); + public List getCropInformation() { + return Collections.singletonList("Needs a block from the moon below to fully mature."); } @Override - public ItemStack getGain(ICropTile crop) { + public ItemStack getDisplayItem() { return new ItemStack(CppItems.Modifier, 1, 0); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/StrawberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/StrawberryCrop.java index 404c547..032717c 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/StrawberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/StrawberryCrop.java @@ -10,30 +10,35 @@ public class StrawberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropStrawberry"; + public StrawberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); } + @Override public String name() { return "Strawberry"; } - public String[] attributes() { - return new String[] { "Berry", "Food", "Red" }; // Red like CropRedWheat, CropNetherWart - } - + @Override public String discoveredBy() { return "Ancient cultures"; } + @Override + public String[] attributes() { + return new String[] { "Berry", "Food", "Red" }; // Red like CropRedWheat, CropNetherWart + } + @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + this.name()); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SugarBeetCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SugarBeetCrop.java index e9eb83c..27dbdfb 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SugarBeetCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/SugarBeetCrop.java @@ -22,11 +22,6 @@ public int tier() { return 4; } - @Override - public ItemStack getDisplayItem() { - return new ItemStack(CppItems.CppBerries, 1, 1); - } - @Override public String name() { return "Sugar Beet"; @@ -37,6 +32,11 @@ public String[] attributes() { return new String[] { "Food", "White", "Ingredient" }; } + @Override + public ItemStack getGain(ICropTile var1) { + return new ItemStack(CppItems.CppBerries, 1, 1); + } + @SideOnly(Side.CLIENT) public void registerSprites(IIconRegister iconRegister) { textures = new IIcon[maxSize()]; @@ -49,7 +49,7 @@ public void registerSprites(IIconRegister iconRegister) { } @Override - public ItemStack getGain(ICropTile var1) { + public ItemStack getDisplayItem() { return new ItemStack(CppItems.CppBerries, 1, 1); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/WaterlillyCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/WaterlillyCrop.java index 5304875..41c4918 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/WaterlillyCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/cpp/WaterlillyCrop.java @@ -29,14 +29,14 @@ public String discoveredBy() { } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.isBlockBelow(Blocks.water) || crop.isBlockBelow(Blocks.flowing_water) ? 225 : 550; + public String[] attributes() { + return new String[] { "Blue", "Water", "Green" }; } @Override - public String[] attributes() { - return new String[] { "Blue", "Water", "Green" }; + public int growthDuration(ICropTile crop) { + if (ConfigValues.debug) return 1; + return crop.isBlockBelow(Blocks.water) || crop.isBlockBelow(Blocks.flowing_water) ? 225 : 550; } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/GarnydniaCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/GarnydniaCrop.java index 0ee3deb..2e2941a 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/GarnydniaCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/GarnydniaCrop.java @@ -26,20 +26,24 @@ public GarnydniaCrop() { super(); } + @Override + public int tier() { + return 7; + } + @Override public String name() { return "Garnydinia"; } @Override - public int tier() { - return 7; + public String discoveredBy() { + return "moronwmachinegun"; } @Override - public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { - // no documentation so i'm leaving it alone instead of inverting the effect - return (int) Math.floor((double) humidity * 0.5 + (double) nutrients * 2.0 + (double) air * 0.5); + public String[] attributes() { + return new String[] { "Shiny", "Crystal", "Red", "Yellow", "Metal" }; } @Override @@ -61,8 +65,9 @@ public int stat(int n) { } @Override - public String[] attributes() { - return new String[] { "Shiny", "Crystal", "Red", "Yellow", "Metal" }; + public int weightInfluences(ICropTile crop, float humidity, float nutrients, float air) { + // no documentation so i'm leaving it alone instead of inverting the effect + return (int) Math.floor((double) humidity * 0.5 + (double) nutrients * 2.0 + (double) air * 0.5); } @Override @@ -71,19 +76,22 @@ public int maxSize() { } @Override - public boolean canGrow(ICropTile iCropTile) { - return iCropTile.getSize() < 2 || iCropTile.getSize() == 2 && isBlockBelow(iCropTile); + public byte getSizeAfterHarvest(ICropTile crop) { + return 1; } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - if (crop.getSize() == 0) return 3300; - return crop.getSize() == this.maxSize() - 1 ? 550 : 300; + public boolean canGrow(ICropTile crop) { + if (!super.canGrow(crop)) return false; + if (crop.getSize() >= this.maxSize() - 1) return isBlockBelow(crop); + return true; } - public List getCropInformation() { - return Collections.singletonList("Needs a block or ore of Yellow or Red Garnet below to fully mature."); + @Override + public int growthDuration(ICropTile crop) { + if (ConfigValues.debug) return 1; + // this used to have a stage 0 of 3300 ticks, but stage 0 is never a thing sadly. + return crop.getSize() >= this.maxSize() - 1 ? 550 : 300; } /** @@ -136,11 +144,6 @@ public boolean isBlockBelow(ICropTile aCrop) { } } - @Override - public String discoveredBy() { - return "moronwmachinegun"; - } - @Override public boolean canBeHarvested(ICropTile iCropTile) { return iCropTile.getSize() >= this.maxSize(); @@ -165,8 +168,8 @@ public ItemStack getGain(ICropTile iCropTile) { } @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 1; + public List getCropInformation() { + return Collections.singletonList("Needs a block or ore of Yellow or Red Garnet below to fully mature."); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/StonelillyCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/StonelillyCrop.java index 04ac84e..8e14565 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/StonelillyCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/gregtechCrops/StonelillyCrop.java @@ -15,7 +15,7 @@ public class StonelillyCrop extends BasicDecorationCrop { - private String color; + private final String color; public StonelillyCrop(String color) { super(); @@ -55,14 +55,22 @@ public String name() { @Override public int growthDuration(ICropTile crop) { if (ConfigValues.debug) return 1; - return crop.getSize() == (this.maxSize() - 1) && crop.isBlockBelow(Blocks.end_stone) ? 550 : 300; + // this used to check if the crop was on final stage with end stone + // I added a check to only do this check when it's yellow stone lily + // since it's the only one that can even use it to grow. + if (this.color.equals("Yellow") && crop.getSize() >= this.maxSize() - 1 && crop.isBlockBelow(Blocks.end_stone)) + return 550; + return 300; } @Override public boolean canGrow(ICropTile crop) { + if (!super.canGrow(crop)) return false; // debug Override - if (crop.getSize() >= this.maxSize()) return false; - if (ConfigValues.debug || crop.getSize() < this.maxSize() - 1) return true; + if (ConfigValues.debug) return true; + // if crop is not on last stage, it can grow anyway + if (crop.getSize() < this.maxSize() - 1) return true; + // if crop is on last stage, it needs the block switch (color) { case "Red": return crop.isBlockBelow("stoneGraniteRed") || crop.isBlockBelow("blockGranite"); @@ -180,6 +188,7 @@ public ItemStack getGain(ICropTile crop) { break; } } + // this is user error if this executes, not a UB return null; } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BarleyCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BarleyCrop.java index 6fc7900..467387e 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BarleyCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BarleyCrop.java @@ -10,19 +10,21 @@ public class BarleyCrop extends BasicFoodCrop { + private static final String cropOreName = "cropBarley"; + public BarleyCrop() { super(); - OreDict.BSget("crop" + this.name().replaceAll(" ", ""), this); + OreDict.BSget(cropOreName, this); } @Override - public String name() { - return "Barley"; + public int tier() { + return 2; } @Override - public int tier() { - return 2; + public String name() { + return "Barley"; } @Override @@ -35,23 +37,19 @@ public int maxSize() { return 4; } - @Override - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize() && crop.getLightLevel() >= 9; - } - @Override public boolean canBeHarvested(ICropTile crop) { return crop.getSize() >= this.maxSize(); } @Override - public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + public ItemStack getGain(ICropTile crop) { + return CCropUtility.getCopiedOreStack(cropOreName); } @Override - public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + this.name()); + public ItemStack getDisplayItem() { + return OreDict.ISget(cropOreName); } + } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlackberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlackberryCrop.java index f96dc3f..3daee3d 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlackberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlackberryCrop.java @@ -12,32 +12,37 @@ public class BlackberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropBlackberry"; + public BlackberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); } + @Override public String name() { return "Blackberry"; } - public String[] attributes() { - return new String[] { "Berry", "Food", "Black" }; // purple like CropVenomilia - } - + @Override public String discoveredBy() { return "Ancient cultures"; } + @Override + public String[] attributes() { + return new String[] { "Berry", "Food", "Black" }; // purple like CropVenomilia + } + @Override public ItemStack getGain(ICropTile crop) { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 2); - else return CCropUtility.getCopiedOreStack("crop" + this.name()); + else return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 2); - else return OreDict.ISget("crop" + this.name()); + else return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlueberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlueberryCrop.java index 16b5f61..2b2bfdf 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlueberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/BlueberryCrop.java @@ -12,32 +12,37 @@ public class BlueberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropCotton"; + public BlueberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); } + @Override public String name() { return "Blueberry"; } - public String[] attributes() { - return new String[] { "Berry", "Food", "Blue" }; // Blue like CropTerraWart - } - + @Override public String discoveredBy() { return "Ancient cultures"; } + @Override + public String[] attributes() { + return new String[] { "Berry", "Food", "Blue" }; // Blue like CropTerraWart + } + @Override public ItemStack getGain(ICropTile crop) { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 1); - else return CCropUtility.getCopiedOreStack("crop" + this.name()); + else return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 1); - else return OreDict.ISget("crop" + this.name()); + else return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/CottonCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/CottonCrop.java index e5c5e95..b2097a0 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/CottonCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/CottonCrop.java @@ -12,9 +12,16 @@ public class CottonCrop extends BasicDecorationCrop { + private static final String cropOreName = "cropCotton"; + public CottonCrop() { super(); - OreDict.BSget("crop" + name().replaceAll(" ", ""), this); + OreDict.BSget(cropOreName, this); + } + + @Override + public int tier() { + return 3; } @Override @@ -23,8 +30,8 @@ public String name() { } @Override - public int tier() { - return 3; + public String[] attributes() { + return new String[] { "White", "Cotton" }; } @Override @@ -49,11 +56,6 @@ public int stat(int n) { return 0; } - @Override - public String[] attributes() { - return new String[] { "White", "Cotton" }; - } - @Override public int maxSize() { return 5; @@ -61,22 +63,17 @@ public int maxSize() { @Override public boolean canGrow(ICropTile crop) { - return crop.getSize() < 5 && crop.getLightLevel() >= 9; + return super.canGrow(crop) && crop.getLightLevel() >= 9; } @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == 5; + public ItemStack getGain(ICropTile crop) { + if (!ModsLoaded.Natura) return CCropUtility.getCopiedOreStack(cropOreName); + else return new ItemStack(NContent.plantItem, 1, 3); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); - } - - @Override - public ItemStack getGain(ICropTile crop) { - if (!ModsLoaded.Natura) return CCropUtility.getCopiedOreStack("crop" + this.name()); - else return new ItemStack(NContent.plantItem, 1, 3); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/MaloberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/MaloberryCrop.java index 6542609..5cab3f6 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/MaloberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/MaloberryCrop.java @@ -12,9 +12,11 @@ public class MaloberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropMaloberry"; + public MaloberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); OreDict.BSget("cropGooseberry", this); } @@ -29,12 +31,12 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 3); - else return CCropUtility.getCopiedOreStack("crop" + this.name()); + else return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 3); - else return OreDict.ISget("crop" + this.name()); + else return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/RaspberryCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/RaspberryCrop.java index 5857bb4..ed6fe3c 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/RaspberryCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/RaspberryCrop.java @@ -12,32 +12,34 @@ public class RaspberryCrop extends BasicBerryCrop { + private static final String cropOreName = "cropRaspberry"; + public RaspberryCrop() { super(); - OreDict.BSget("crop" + this.name(), this); + OreDict.BSget(cropOreName, this); } public String name() { return "Raspberry"; } - public String[] attributes() { - return new String[] { "Berry", "Food", "Red" }; // Red like CropRedWheat, CropNetherWart - } - public String discoveredBy() { return "Ancient cultures"; } + public String[] attributes() { + return new String[] { "Berry", "Food", "Red" }; // Red like CropRedWheat, CropNetherWart + } + @Override public ItemStack getGain(ICropTile crop) { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 0); - else return CCropUtility.getCopiedOreStack("crop" + this.name()); + else return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { if (ModsLoaded.Natura) return new ItemStack(NContent.berryItem, 3, 0); - else return OreDict.ISget("crop" + this.name()); + else return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/SaguaroCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/SaguaroCrop.java index 61ec997..c764695 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/SaguaroCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/SaguaroCrop.java @@ -32,30 +32,31 @@ public String[] attributes() { } @Override - public ItemStack getGain(ICropTile crop) { - if (ModsLoaded.Natura) { - if (crop.getSize() == 2) return new ItemStack(NContent.saguaro, 2, 0); - else return new ItemStack(NContent.seedFood, 3, 0); - } else { - return new ItemStack(CppItems.BerryItems, 1, 4); - } + public byte getSizeAfterHarvest(ICropTile crop) { + if (crop.getSize() >= this.maxSize() - 1) return 1; + else return 2; } @Override - public int growthDuration(ICropTile crop) { - if (ConfigValues.debug) return 1; - return crop.getSize() > 2 ? 450 : 225; + public boolean canBeHarvested(ICropTile crop) { + return crop.getSize() >= this.maxSize() - 1; } @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() >= 2; + public int growthDuration(ICropTile crop) { + // used to have a 450 growth time for stage > 2 + // but that was impossible to reach since the crop reaches maturity at 3 + return ConfigValues.debug ? 1 : 225; } @Override - public byte getSizeAfterHarvest(ICropTile crop) { - if (crop.getSize() == 2) return 1; - else return 2; + public ItemStack getGain(ICropTile crop) { + if (ModsLoaded.Natura) { + if (crop.getSize() == this.maxSize() - 1) return new ItemStack(NContent.saguaro, 2, 0); + else return new ItemStack(NContent.seedFood, 3, 0); + } else { + return new ItemStack(CppItems.BerryItems, 1, 4); + } } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/BasicNetherShroomCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/BasicNetherShroomCrop.java index 53a7dab..040aea8 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/BasicNetherShroomCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/BasicNetherShroomCrop.java @@ -33,14 +33,19 @@ public BasicNetherShroomCrop(String color) { else this.shroomType = ShroomType.Other; } + @Override + public int tier() { + return 3; + } + @Override public String name() { return name; } @Override - public int tier() { - return 3; + public String[] attributes() { + return new String[] { "Food", "Mushroom", "Ingredient", "Nether" }; } @Override @@ -62,29 +67,28 @@ public int stat(int n) { } @Override - public int growthDuration(ICropTile crop) { - return ConfigValues.debug ? 1 : 600; + public int maxSize() { + return 2; } @Override - public boolean canBeHarvested(ICropTile crop) { - return crop.getSize() == 2; + public byte getSizeAfterHarvest(ICropTile crop) { + return 1; } - public boolean canGrow(ICropTile crop) { - return crop.getSize() < this.maxSize(); + @Override + public boolean canBeHarvested(ICropTile crop) { + return crop.getSize() >= this.maxSize(); } @Override - public int maxSize() { - return 2; + public int growthDuration(ICropTile crop) { + return ConfigValues.debug ? 1 : 600; } @Override - public String[] attributes() { - String[] r; - r = new String[] { "Food", "Mushroom", "Ingredient", "Nether" }; - return r; + public boolean canGrow(ICropTile crop) { + return crop.getSize() < this.maxSize(); } @Override @@ -101,11 +105,6 @@ public ItemStack getGain(ICropTile crop) { } } - @Override - public byte getSizeAfterHarvest(ICropTile crop) { - return 1; - } - @Override public ItemStack getDisplayItem() { switch (this.shroomType) { diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/Thornvines.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/Thornvines.java index 6b64229..e90a6ed 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/Thornvines.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/natura/nether/Thornvines.java @@ -31,13 +31,13 @@ public String discoveredBy() { } @Override - public ItemStack getGain(ICropTile crop) { - return new ItemStack(NContent.thornVines, 2); + public String[] attributes() { + return new String[] { "Nether", "Climbable", "Bad" }; } @Override - public String[] attributes() { - return new String[] { "Nether", "Climbable", "Bad" }; + public ItemStack getGain(ICropTile crop) { + return new ItemStack(NContent.thornVines, 2); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/BelladonnaCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/BelladonnaCrop.java index b510203..46c6694 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/BelladonnaCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/BelladonnaCrop.java @@ -10,9 +10,12 @@ public class BelladonnaCrop extends BasicWitcheryCrop { + private static final String seedOreName = "seedBelladonna"; + private static final String cropOreName = "itemBelladonna"; + public BelladonnaCrop() { super(); - OreDict.BSget("seed" + name(), this); + OreDict.BSget(seedOreName, this); } @Override @@ -27,11 +30,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("item" + name()); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("item" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/EmberMossCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/EmberMossCrop.java index 9df80f4..dc9da22 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/EmberMossCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/EmberMossCrop.java @@ -10,19 +10,21 @@ public class EmberMossCrop extends BasicWitcheryCrop { + private static final String cropOreName = "cropEmberMoss"; + public EmberMossCrop() { super(); - OreDict.BSget("crop" + name().replaceAll(" ", ""), this); + OreDict.BSget(cropOreName, this); } @Override - public String name() { - return "Ember Moss"; + public int tier() { + return 7; } @Override - public int tier() { - return 7; + public String name() { + return "Ember Moss"; } @Override @@ -32,11 +34,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + name().replaceAll(" ", "")); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name().replaceAll(" ", "")); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GarlicCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GarlicCrop.java index 7c5588b..045a5c4 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GarlicCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GarlicCrop.java @@ -10,19 +10,21 @@ public class GarlicCrop extends BasicDecorationCrop { + private static final String cropOreName = "cropGarlic"; + public GarlicCrop() { super(); - OreDict.BSget("crop" + name(), this); + OreDict.BSget(cropOreName, this); } @Override - public String name() { - return "Garlic"; + public int tier() { + return super.tier() + 2; } @Override - public int tier() { - return super.tier() + 2; + public String name() { + return "Garlic"; } @Override @@ -32,11 +34,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + name()); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GlintWeedCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GlintWeedCrop.java index 1a354a9..62e79fa 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GlintWeedCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/GlintWeedCrop.java @@ -10,9 +10,11 @@ public class GlintWeedCrop extends BasicWitcheryCrop { + private static final String cropOreName = "cropGlintWeed"; + public GlintWeedCrop() { super(); - OreDict.BSget("crop" + name().replaceAll(" ", ""), this); + OreDict.BSget(cropOreName, this); } @Override @@ -27,11 +29,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + name().replaceAll(" ", "")); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name().replaceAll(" ", "")); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/MandragoraCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/MandragoraCrop.java index d3f362e..64dd0c8 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/MandragoraCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/MandragoraCrop.java @@ -11,9 +11,12 @@ public class MandragoraCrop extends BasicWitcheryCrop { + private static final String seedOreName = "seedMandrake"; + private static final String cropOreName = "itemMandrake"; + public MandragoraCrop() { super(); - OreDict.BSget("seedMandrake", this); + OreDict.BSget(seedOreName, this); } @Override @@ -27,17 +30,17 @@ public String[] attributes() { } @Override - public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("itemMandrake"); + public float dropGainChance() { + return (float) (((Math.pow(0.95, (float) tier())) * ConfigValues.BerryGain) * 0.5); } @Override - public float dropGainChance() { - return (float) (((Math.pow(0.95, (float) tier())) * ConfigValues.BerryGain) * 0.5); + public ItemStack getGain(ICropTile crop) { + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("itemMandrake"); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SnowbellCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SnowbellCrop.java index fa17f9d..7a025e0 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SnowbellCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SnowbellCrop.java @@ -10,9 +10,12 @@ public class SnowbellCrop extends BasicWitcheryCrop { + private static final String seedOreName = "seedSnowbell"; + private static final String cropOreName = "cropSnowbell"; + public SnowbellCrop() { super(); - OreDict.BSget("seed" + name(), this); + OreDict.BSget(seedOreName, this); } @Override @@ -27,11 +30,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("item" + name()); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("item" + this.name()); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SpanishMossCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SpanishMossCrop.java index 9a40a87..ed0499d 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SpanishMossCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/SpanishMossCrop.java @@ -10,19 +10,21 @@ public class SpanishMossCrop extends FloweringVinesCrop { + private static final String cropOreName = "cropSpanishMoss"; + public SpanishMossCrop() { super(); - OreDict.BSget("crop" + name().replaceAll(" ", ""), this); + OreDict.BSget(cropOreName, this); } @Override - public String name() { - return "Spanish Moss"; + public int tier() { + return 7; } @Override - public int tier() { - return 7; + public String name() { + return "Spanish Moss"; } @Override @@ -32,11 +34,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("crop" + name().replaceAll(" ", "")); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("crop" + this.name().replaceAll(" ", "")); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WaterArtichokeCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WaterArtichokeCrop.java index bddaf12..b1acde3 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WaterArtichokeCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WaterArtichokeCrop.java @@ -10,9 +10,11 @@ public class WaterArtichokeCrop extends BasicWitcheryCrop { + private static final String cropOreName = "cropArtichoke"; + public WaterArtichokeCrop() { super(); - OreDict.BSget("cropArtichoke", this); + OreDict.BSget(cropOreName, this); } @Override @@ -27,11 +29,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("cropArtichoke"); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("cropArtichoke"); + return OreDict.ISget(cropOreName); } } diff --git a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WolfsBaneCrop.java b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WolfsBaneCrop.java index 3eac268..5d4ff59 100644 --- a/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WolfsBaneCrop.java +++ b/src/main/java/com/github/bartimaeusnek/cropspp/crops/witchery/WolfsBaneCrop.java @@ -10,9 +10,12 @@ public class WolfsBaneCrop extends BasicWitcheryCrop { + private final static String seedOreName = "seedWolfsBane"; + private static final String cropOreName = "itemWolfsBane"; + public WolfsBaneCrop() { super(); - OreDict.BSget("seedWolfsBane", this); + OreDict.BSget(seedOreName, this); } @Override @@ -27,11 +30,11 @@ public String[] attributes() { @Override public ItemStack getGain(ICropTile crop) { - return CCropUtility.getCopiedOreStack("itemWolfsBane"); + return CCropUtility.getCopiedOreStack(cropOreName); } @Override public ItemStack getDisplayItem() { - return OreDict.ISget("itemWolfsBane"); + return OreDict.ISget(cropOreName); } }