mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
add growth multiplier
This commit is contained in:
@@ -16,18 +16,21 @@ public class FarmBeaconManager {
|
||||
private final NamespacedKey farmBeaconKey;
|
||||
private final int beaconRange;
|
||||
private final double farmBeaconFertility;
|
||||
private final double farmBeaconGrowthMultiplier;
|
||||
|
||||
public FarmBeaconManager(NamespacedKey farmBeaconKey, int beaconRange, double farmBeaconFertility) {
|
||||
public FarmBeaconManager(NamespacedKey farmBeaconKey, int beaconRange, double farmBeaconFertility, double farmBeaconGrowthMultiplier) {
|
||||
this.farmBeaconKey = farmBeaconKey;
|
||||
this.beaconRange = beaconRange;
|
||||
this.farmBeaconFertility = farmBeaconFertility;
|
||||
this.farmBeaconGrowthMultiplier = farmBeaconGrowthMultiplier;
|
||||
}
|
||||
|
||||
public static FarmBeaconManager fromConfiguration(ConfigurationSection section) {
|
||||
return new FarmBeaconManager(
|
||||
NamespacedKey.fromString(section.getString("farm_beacon_key")),
|
||||
section.getInt("farm_beacon_range"),
|
||||
section.getDouble("farm_beacon_fertility")
|
||||
section.getDouble("farm_beacon_fertility"),
|
||||
section.getDouble("farm_beacon_growth_multiplier")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,6 +67,10 @@ public class FarmBeaconManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getFarmBeaconGrowthMultiplier() {
|
||||
return farmBeaconGrowthMultiplier;
|
||||
}
|
||||
|
||||
public double getFarmBeaconFertility() {
|
||||
return farmBeaconFertility;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,6 @@ public class PlantGrowthConfig extends AbstractGrowthConfig {
|
||||
public String getInfoString(Block b) {
|
||||
double soilMultiplier = 1.0 + getSoilBonus(b);
|
||||
double lightMultiplier = getLightMultiplier(b);
|
||||
double beaconMultiplier = getBeaconMultiplier(b);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(ChatColor.GOLD);
|
||||
sb.append(ItemUtils.getItemName(item));
|
||||
@@ -122,7 +121,7 @@ public class PlantGrowthConfig extends AbstractGrowthConfig {
|
||||
if (lightMultiplier != 1.0) {
|
||||
sb.append("\n" + ChatColor.GOLD + "Light multiplier: " + lightMultiplier);
|
||||
}
|
||||
if (beaconMultiplier != 1.0) {
|
||||
if (this.farmBeaconManager.isNearBeacon(b.getLocation())) {
|
||||
sb.append("\n" + ChatColor.LIGHT_PURPLE + "Farm beacon nearby");
|
||||
}
|
||||
return sb.toString();
|
||||
@@ -166,7 +165,7 @@ public class PlantGrowthConfig extends AbstractGrowthConfig {
|
||||
|
||||
// affects growth time
|
||||
private double getBeaconMultiplier(Block block) {
|
||||
return this.farmBeaconManager.isNearBeacon(block.getLocation()) ? 2.0 : 1.0;
|
||||
return this.farmBeaconManager.isNearBeacon(block.getLocation()) ? this.farmBeaconManager.getFarmBeaconGrowthMultiplier() : 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user