增加了区分危险度刷新

This commit is contained in:
yuyu 2024-04-13 21:29:52 +08:00
parent f41a8511dd
commit 29da41875e
5 changed files with 40 additions and 6 deletions

View File

@ -55,7 +55,10 @@ public class BiomeEntityRefreshSettings {
int nums = config.getInt(biomeName+"."+entityName+".nums");
int yMax = config.getInt(biomeName+"."+entityName+".yMax");
int yMin = config.getInt(biomeName+"."+entityName+".yMin");
EntityCondition entityCondition = new EntityCondition(entityName, biomeName, spawnEntityType,entitySite, light, stime,etime, nums, yMax, yMin);
int riskMax = config.getInt(biomeName+"."+entityName+".riskMax");
int riskMin = config.getInt(biomeName+"."+entityName+".riskMin");
EntityCondition entityCondition = new EntityCondition(entityName, biomeName,
spawnEntityType,entitySite, light, stime,etime, nums, yMax, yMin,riskMax,riskMin);
plugin.getLogger().info(ChatColor.AQUA+entityCondition.toString());

View File

@ -20,8 +20,10 @@ public class EntityCondition {
private final int nums;//刷新的数量
private final int yMax;
private final int yMin;
private final int riskMax;
private final int riskMin;
public EntityCondition(String entityName, String biome, SpawnEntityType spawnEntityType, EntitySite entitySite, int light, long startTiming, long endTiming, int nums, int yMax, int yMin) {
public EntityCondition(String entityName, String biome, SpawnEntityType spawnEntityType, EntitySite entitySite, int light, long startTiming, long endTiming, int nums, int yMax, int yMin,int riskMax,int riskMin) {
this.entityName = entityName;
this.biome = biome;
this.spawnEntityType = spawnEntityType;
@ -32,6 +34,20 @@ public class EntityCondition {
this.nums = nums;
this.yMax = yMax;
this.yMin = yMin;
this.riskMax = riskMax;
this.riskMin = riskMin;
}
public SpawnEntityType getSpawnEntityType() {
return spawnEntityType;
}
public int getRiskMax() {
return riskMax;
}
public int getRiskMin() {
return riskMin;
}
public SpawnEntityType getEntityType() {
@ -87,6 +103,8 @@ public class EntityCondition {
", nums=" + nums +
", yMax=" + yMax +
", yMin=" + yMin +
", riskMax=" + riskMax +
", riskMin=" + riskMin +
'}';
}
}

View File

@ -27,7 +27,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
@ -322,7 +321,6 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
//TODO(危险度提示,后续需要使用这个变量去控制怪物的参数等级`)
logger.info(ChatColor.GREEN + "危险度为:" + level);
Location playerlocation = player.getLocation();
//获取玩家位置信息
@ -348,6 +346,15 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
//获取entity配置
EntityCondition entityCondition = entityConditionHashMap.get(entityName);
//危险度验证通过才能刷新
int riskMax = entityCondition.getRiskMax();
int riskMin = entityCondition.getRiskMin();
if (level >= riskMax || level < riskMin){
//不在范围内则跳过
continue;
}
int yMin = entityCondition.getyMin();
int yMax = entityCondition.getyMax();
@ -383,7 +390,7 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
}else {
//刷新MM怪物
try {
entity = mythicMobs.getAPIHelper().spawnMythicMob(entityName, location);
entity = mythicMobs.getAPIHelper().spawnMythicMob(entityName, location,level);
} catch (InvalidMobTypeException e) {
throw new RuntimeException(e);
}

View File

@ -1,3 +1,3 @@
RefreshTime: 10 #刷新时间单位为s
total: 12 #每个玩家每次刷新的实体数量
num: 4 #单次刷新的数量每RefreshTime秒刷新的数量
num: 4 #单次刷新的最大数量每RefreshTime秒刷新的数量

View File

@ -8,6 +8,8 @@ DESERT:
nums: 2 #entity的刷新数量注意这里的数量会和通群系中其他entity相关总数不会超过config.yml中的定义
yMax: 150 #极限刷新高度
yMin: 60 #最小刷新高度
riskMax: 10 #刷新危险度的范围
riskMin: 0 #条件是小于等于riskMin大于riskMax即riskMin<= risklevel < riskMax 才会刷新
ROOFED_FOREST:
ZOMBIE: #指出entity在该群系的刷新条件
type: 0 #0表示生成mc原生实体1表示生成MM怪物2表示生成萌芽怪物
@ -18,6 +20,8 @@ ROOFED_FOREST:
nums: 2 #entity的刷新数量注意这里的数量会和通群系中其他entity相关总数不会超过config.yml中的定义
yMax: 150 #极限刷新高度
yMin: 60 #最小刷新高度
riskMax: 10 #刷新危险度的范围
riskMin: 0
PIG_ZOMBIE: #指出entity在该群系的刷新条件
type: 0 #0表示生成mc原生实体1表示生成MM怪物2表示生成萌芽怪物
@ -28,3 +32,5 @@ ROOFED_FOREST:
nums: 2 #entity的刷新数量注意这里的数量会和通群系中其他entity相关总数不会超过config.yml中的定义
yMax: 150 #极限刷新高度
yMin: 60 #最小刷新高度
riskMax: 10 #刷新危险度的范围
riskMin: 0