mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
add set yield command + remove fishing
This commit is contained in:
@@ -14,6 +14,7 @@ import com.untamedears.realisticbiomes.model.RBDAO;
|
||||
import com.untamedears.realisticbiomes.breaker.AutoReplantListener;
|
||||
import com.untamedears.realisticbiomes.noise.MeasureCommand;
|
||||
import com.untamedears.realisticbiomes.noise.MeasureListener;
|
||||
import com.untamedears.realisticbiomes.noise.SetYieldCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import vg.civcraft.mc.civmodcore.ACivMod;
|
||||
@@ -111,6 +112,7 @@ public class RealisticBiomes extends ACivMod {
|
||||
getServer().getPluginManager().registerEvents(new TreeBlockListener(), this);
|
||||
|
||||
commandManager.registerCommand(new MeasureCommand(configManager.getBiomeConfiguration(), breakManager));
|
||||
commandManager.registerCommand(new SetYieldCommand(configManager.getBiomeConfiguration()));
|
||||
|
||||
plantLogicManager = new PlantLogicManager(plantManager, growthConfigManager);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ public class BiomeConfiguration {
|
||||
private final CropNoise noise;
|
||||
private final FarmBeaconManager farmBeaconManager;
|
||||
private final Map<Biome, Climate> biomeClimates;
|
||||
private double yieldOverride = -1;
|
||||
|
||||
private BiomeConfiguration(CropNoise noise, FarmBeaconManager farmBeaconManager, Map<Biome, Climate> biomeClimates) {
|
||||
this.noise = noise;
|
||||
@@ -64,7 +65,14 @@ public class BiomeConfiguration {
|
||||
return noise.getHumidityScale();
|
||||
}
|
||||
|
||||
public void setYieldOverride(double yieldOverride) {
|
||||
this.yieldOverride = yieldOverride;
|
||||
}
|
||||
|
||||
public double getYield(Block block, Climate climate, Material mat, int maxYield) {
|
||||
if (yieldOverride != -1) {
|
||||
return yieldOverride;
|
||||
}
|
||||
Climate biomeClimate = biomeClimates.get(block.getBiome());
|
||||
if (biomeClimate == null || biomeClimate.saline() != climate.saline() || biomeClimate.hell() != climate.hell()) {
|
||||
return 0;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.untamedears.realisticbiomes.noise;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import com.untamedears.realisticbiomes.breaker.BreakManager;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Map;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetYieldCommand extends BaseCommand {
|
||||
|
||||
private final BiomeConfiguration biomes;
|
||||
|
||||
public SetYieldCommand(BiomeConfiguration biomes) {
|
||||
this.biomes = biomes;
|
||||
}
|
||||
|
||||
@CommandAlias("rbsetyield")
|
||||
@CommandPermission("realisticbiomes.rbsetyield")
|
||||
public void measure(Player player, double yield) {
|
||||
biomes.setYieldOverride(yield);
|
||||
player.sendMessage("Set yield to " + yield);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user