add growth multiplier

This commit is contained in:
okx-code
2025-08-16 04:53:07 +01:00
parent 0c1f218632
commit fe9291a333
2 changed files with 11 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -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;
}
/**