diff --git a/TFC_Shared/src/TFC/Handlers/Client/FarmlandHighlightHandler.java b/TFC_Shared/src/TFC/Handlers/Client/FarmlandHighlightHandler.java index ad2939a26..8b7ceebbc 100644 --- a/TFC_Shared/src/TFC/Handlers/Client/FarmlandHighlightHandler.java +++ b/TFC_Shared/src/TFC/Handlers/Client/FarmlandHighlightHandler.java @@ -84,8 +84,7 @@ public void DrawBlockHighlightEvent(DrawBlockHighlightEvent evt) TileEntityFarmland te = (TileEntityFarmland) world.getBlockTileEntity(evt.target.blockX, evt.target.blockY - crop, evt.target.blockZ); te.requestNutrientData(); - float timeMultiplier = (float)TFC_Time.daysInYear / 360f; - int soilMax = (int) (25000 * timeMultiplier); + int soilMax = TileEntityFarmland.soilMax; //Setup GL for the depthbox GL11.glEnable(GL11.GL_BLEND); diff --git a/TFC_Shared/src/TFC/TFCItems.java b/TFC_Shared/src/TFC/TFCItems.java index ce4f8b81a..ffb7d3fce 100644 --- a/TFC_Shared/src/TFC/TFCItems.java +++ b/TFC_Shared/src/TFC/TFCItems.java @@ -1750,56 +1750,59 @@ private static void registerMetals() MetalRegistry.instance.addMetal(Global.HCBLUESTEEL, Alloy.EnumTier.TierV); MetalRegistry.instance.addMetal(Global.UNKNOWN, Alloy.EnumTier.TierI); + /** + * Added the +-0.01 tolerance to hopefully negate most rounding errors + */ Alloy Bronze = new Alloy(Global.BRONZE, Alloy.EnumTier.TierI); - Bronze.addIngred(Global.COPPER, 88, 92); - Bronze.addIngred(Global.TIN, 8, 12); + Bronze.addIngred(Global.COPPER, 87.99f, 92.01f); + Bronze.addIngred(Global.TIN, 7.99f, 12.01f); AlloyManager.instance.addAlloy(Bronze); Alloy Brass = new Alloy(Global.BRASS, Alloy.EnumTier.TierI); - Brass.addIngred(Global.COPPER, 88, 92); - Brass.addIngred(Global.ZINC, 8, 12); + Brass.addIngred(Global.COPPER, 87.99f, 92.01f); + Brass.addIngred(Global.ZINC, 7.99f, 12.01f); AlloyManager.instance.addAlloy(Brass); Alloy RoseGold = new Alloy(Global.ROSEGOLD, Alloy.EnumTier.TierI); - RoseGold.addIngred(Global.GOLD, 70, 85); - RoseGold.addIngred(Global.COPPER, 15, 30); + RoseGold.addIngred(Global.GOLD, 69.99f, 85.01f); + RoseGold.addIngred(Global.COPPER, 14.99f, 30.01f); AlloyManager.instance.addAlloy(RoseGold); Alloy BlackBronze = new Alloy(Global.BLACKBRONZE, Alloy.EnumTier.TierI); - BlackBronze.addIngred(Global.GOLD, 10, 25); - BlackBronze.addIngred(Global.COPPER, 50, 70); - BlackBronze.addIngred(Global.SILVER, 10, 25); + BlackBronze.addIngred(Global.GOLD, 9.99f, 25.01f); + BlackBronze.addIngred(Global.COPPER, 49.99f, 70.01f); + BlackBronze.addIngred(Global.SILVER, 9.99f, 25.01f); AlloyManager.instance.addAlloy(BlackBronze); Alloy BismuthBronze = new Alloy(Global.BISMUTHBRONZE, Alloy.EnumTier.TierI); - BismuthBronze.addIngred(Global.ZINC, 20, 30); - BismuthBronze.addIngred(Global.COPPER, 50, 70); - BismuthBronze.addIngred(Global.BISMUTH, 10, 20); + BismuthBronze.addIngred(Global.ZINC, 19.99f, 30.01f); + BismuthBronze.addIngred(Global.COPPER, 49.99f, 70.01f); + BismuthBronze.addIngred(Global.BISMUTH, 9.99f, 20.01f); AlloyManager.instance.addAlloy(BismuthBronze); Alloy SterlingSilver = new Alloy(Global.STERLINGSILVER, Alloy.EnumTier.TierI); - SterlingSilver.addIngred(Global.SILVER, 60, 80); - SterlingSilver.addIngred(Global.COPPER, 20, 40); + SterlingSilver.addIngred(Global.SILVER, 59.99f, 80.01f); + SterlingSilver.addIngred(Global.COPPER, 19.99f, 40.01f); AlloyManager.instance.addAlloy(SterlingSilver); Alloy WeakSteel = new Alloy(Global.WEAKSTEEL, Alloy.EnumTier.TierIII); - WeakSteel.addIngred(Global.STEEL, 50, 70); - WeakSteel.addIngred(Global.NICKEL, 15, 25); - WeakSteel.addIngred(Global.BLACKBRONZE, 15, 25); + WeakSteel.addIngred(Global.STEEL, 49.99f, 70.01f); + WeakSteel.addIngred(Global.NICKEL, 14.99f, 25.01f); + WeakSteel.addIngred(Global.BLACKBRONZE, 14.99f, 25.01f); AlloyManager.instance.addAlloy(WeakSteel); Alloy WeakRedSteel = new Alloy(Global.WEAKREDSTEEL, Alloy.EnumTier.TierIII); - WeakRedSteel.addIngred(Global.BLACKSTEEL, 50, 60); - WeakRedSteel.addIngred(Global.ROSEGOLD, 10, 15); - WeakRedSteel.addIngred(Global.BRASS, 10, 15); - WeakRedSteel.addIngred(Global.STEEL, 20, 25); + WeakRedSteel.addIngred(Global.BLACKSTEEL, 49.99f, 60.01f); + WeakRedSteel.addIngred(Global.ROSEGOLD, 9.99f, 15.01f); + WeakRedSteel.addIngred(Global.BRASS, 9.99f, 15.01f); + WeakRedSteel.addIngred(Global.STEEL, 19.99f, 25.01f); AlloyManager.instance.addAlloy(WeakRedSteel); Alloy WeakBlueSteel = new Alloy(Global.WEAKBLUESTEEL, Alloy.EnumTier.TierIII); - WeakBlueSteel.addIngred(Global.BLACKSTEEL, 50, 60); - WeakBlueSteel.addIngred(Global.BISMUTHBRONZE, 10, 15); - WeakBlueSteel.addIngred(Global.STERLINGSILVER, 10, 15); - WeakBlueSteel.addIngred(Global.STEEL, 20, 25); + WeakBlueSteel.addIngred(Global.BLACKSTEEL, 49.99f, 60.01f); + WeakBlueSteel.addIngred(Global.BISMUTHBRONZE, 9.99f, 15.01f); + WeakBlueSteel.addIngred(Global.STERLINGSILVER, 9.99f, 15.01f); + WeakBlueSteel.addIngred(Global.STEEL, 19.99f, 25.01f); AlloyManager.instance.addAlloy(WeakBlueSteel); } diff --git a/TFC_Shared/src/TFC/TileEntities/TileEntityCrop.java b/TFC_Shared/src/TFC/TileEntities/TileEntityCrop.java index 0e98be734..501aff9b9 100644 --- a/TFC_Shared/src/TFC/TileEntities/TileEntityCrop.java +++ b/TFC_Shared/src/TFC/TileEntities/TileEntityCrop.java @@ -39,9 +39,6 @@ public void updateEntity() Random R = new Random(); if(!worldObj.isRemote) { - float timeMultiplier = 360/TFC_Time.daysInYear; - - CropIndex crop = CropManager.getInstance().getCropFromId(cropId); long time = TFC_Time.getTotalTicks(); @@ -97,13 +94,13 @@ else if(crop.dormantInFrost && ambientTemp < crop.minAliveTemp) } int nutriType = crop.cycleType; - int nutri = tef != null ? tef.nutrients[nutriType] : 18000; - int soilMax = tef != null ? tef.getSoilMax() : 18000; - //waterBoost only helps if you are playing on a longer than default year length. - float waterBoost = TFC.Blocks.BlockFarmland.isWaterNearby(worldObj, xCoord, yCoord, zCoord) ? 0.1f : 0; - - float nutriMult = (0.2f + ((float)nutri/(float)soilMax) * 0.5f) + waterBoost; + int nutri = tef != null ? tef.nutrients[nutriType] : TileEntityFarmland.nutrientDefault; + float waterBoost = TFC.Blocks.BlockFarmland.isWaterNearby(worldObj, xCoord, yCoord - 1, zCoord) ? 0.1f : 0; + + /*Base 75 % growth + Nutrient grow boost from 0 to 35 % + 10 % boost for water*/ + float nutriMult = (0.75f + (((float)nutri / (float)TileEntityFarmland.soilMax) * 0.35f) + waterBoost); + if(tef != null) { if(tef.nutrients[nutriType] > 0) { @@ -111,12 +108,12 @@ else if(crop.dormantInFrost && ambientTemp < crop.minAliveTemp) } } - float growthRate = (((crop.numGrowthStages/(crop.growthTime*TFC_Time.timeRatio))+tempAdded)*nutriMult) * timeMultiplier; + float growthRate = (((((float)crop.numGrowthStages/(float)crop.growthTime)+tempAdded)*nutriMult)/TFC_Time.timeRatio); int oldGrowth = (int) Math.floor(growth); growth += growthRate; - + if(oldGrowth < (int) Math.floor(growth)) { this.broadcastPacketInRange(createCropUpdatePacket()); diff --git a/TFC_Shared/src/TFC/TileEntities/TileEntityFarmland.java b/TFC_Shared/src/TFC/TileEntities/TileEntityFarmland.java index 0db887eb1..2a7fb7978 100644 --- a/TFC_Shared/src/TFC/TileEntities/TileEntityFarmland.java +++ b/TFC_Shared/src/TFC/TileEntities/TileEntityFarmland.java @@ -18,9 +18,10 @@ public class TileEntityFarmland extends NetworkTileEntity { + public static int soilMax = 50000; + public static int nutrientDefault = 35000; public long nutrientTimer = -1; - public int[] nutrients = {18000,18000,18000}; - + public int[] nutrients = {nutrientDefault,nutrientDefault,nutrientDefault}; /** * Client only * */ @@ -44,8 +45,7 @@ public void updateEntity() { CropIndex crop = null; - int soilMax = getSoilMax(); - int restoreAmount = 139; + int restoreAmount = (int) (139/TFC_Time.timeRatio); if((worldObj.getBlockId(xCoord, yCoord+1, zCoord) == Block.crops.blockID)) { @@ -116,16 +116,9 @@ public void updateEntity() } } - public int getSoilMax() - { - float timeMultiplier = TFC_Time.daysInYear / 360f; - return (int) (25000 * timeMultiplier); - } - public void DrainNutrients(int type, float multiplier) { - float timeMultiplier = 360f / TFC_Time.daysInYear; - nutrients[type] -= (100*multiplier)*timeMultiplier; + nutrients[type] -= (int) (100*multiplier/TFC_Time.timeRatio); } /**