Add config option for creeper turn explosion
This commit is contained in:
parent
f5f7ce52cc
commit
befc7cf611
9 changed files with 40 additions and 12 deletions
|
@ -1,5 +1,10 @@
|
||||||
# Upcoming changes
|
# Upcoming changes
|
||||||
|
|
||||||
|
# Version 1.15
|
||||||
|
|
||||||
|
Add server-side config option that determines on what turn a Creeper will
|
||||||
|
explode in battle.
|
||||||
|
|
||||||
# Version 1.14
|
# Version 1.14
|
||||||
|
|
||||||
Implemented support for Creepers in battle.
|
Implemented support for Creepers in battle.
|
||||||
|
|
|
@ -14,7 +14,7 @@ apply plugin: 'eclipse'
|
||||||
//apply plugin: 'maven-publish'
|
//apply plugin: 'maven-publish'
|
||||||
apply plugin: 'com.github.johnrengelman.shadow'
|
apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
version = "1.14"
|
version = "1.15"
|
||||||
group = "com.burnedkirby.TurnBasedMinecraft"
|
group = "com.burnedkirby.TurnBasedMinecraft"
|
||||||
archivesBaseName = "TurnBasedMinecraft"
|
archivesBaseName = "TurnBasedMinecraft"
|
||||||
|
|
||||||
|
|
|
@ -830,7 +830,7 @@ public class Battle
|
||||||
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
||||||
{
|
{
|
||||||
if(c.entity instanceof CreeperEntity) {
|
if(c.entity instanceof CreeperEntity) {
|
||||||
if(c.creeperTurns++ < 2) {
|
if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||||
c.decision = Decision.CREEPER_WAIT;
|
c.decision = Decision.CREEPER_WAIT;
|
||||||
} else {
|
} else {
|
||||||
c.decision = Decision.CREEPER_EXPLODE;
|
c.decision = Decision.CREEPER_EXPLODE;
|
||||||
|
@ -857,7 +857,7 @@ public class Battle
|
||||||
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
if(!(c.entity instanceof PlayerEntity) && c.decision == Decision.UNDECIDED && c.entityInfo != null)
|
||||||
{
|
{
|
||||||
if(c.entity instanceof CreeperEntity) {
|
if(c.entity instanceof CreeperEntity) {
|
||||||
if(c.creeperTurns++ < 2) {
|
if(c.creeperTurns++ < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||||
c.decision = Decision.CREEPER_WAIT;
|
c.decision = Decision.CREEPER_WAIT;
|
||||||
} else {
|
} else {
|
||||||
c.decision = Decision.CREEPER_EXPLODE;
|
c.decision = Decision.CREEPER_EXPLODE;
|
||||||
|
@ -1348,7 +1348,7 @@ public class Battle
|
||||||
break;
|
break;
|
||||||
case CREEPER_WAIT:
|
case CREEPER_WAIT:
|
||||||
debugLog += " creeper wait";
|
debugLog += " creeper wait";
|
||||||
if(next.creeperTurns < 2) {
|
if(next.creeperTurns < TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT, next.entity.getEntityId(), 0, 0);
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT, next.entity.getEntityId(), 0, 0);
|
||||||
} else {
|
} else {
|
||||||
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT_FINAL, next.entity.getEntityId(), 0, 0);
|
sendMessageToAllPlayers(PacketBattleMessage.MessageType.CREEPER_WAIT_FINAL, next.entity.getEntityId(), 0, 0);
|
||||||
|
@ -1493,7 +1493,7 @@ public class Battle
|
||||||
private void defuseCreepers() {
|
private void defuseCreepers() {
|
||||||
for(Combatant c : sideA.values()) {
|
for(Combatant c : sideA.values()) {
|
||||||
if(c.entity instanceof CreeperEntity) {
|
if(c.entity instanceof CreeperEntity) {
|
||||||
if(c.creeperTurns <= 2) {
|
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||||
((CreeperEntity)c.entity).setCreeperState(-10);
|
((CreeperEntity)c.entity).setCreeperState(-10);
|
||||||
} else {
|
} else {
|
||||||
((CreeperEntity)c.entity).setCreeperState(1000000);
|
((CreeperEntity)c.entity).setCreeperState(1000000);
|
||||||
|
@ -1502,7 +1502,7 @@ public class Battle
|
||||||
}
|
}
|
||||||
for(Combatant c : sideB.values()) {
|
for(Combatant c : sideB.values()) {
|
||||||
if(c.entity instanceof CreeperEntity) {
|
if(c.entity instanceof CreeperEntity) {
|
||||||
if(c.creeperTurns <= 2) {
|
if(c.creeperTurns <= TurnBasedMinecraftMod.proxy.getConfig().getCreeperExplodeTurn()) {
|
||||||
((CreeperEntity)c.entity).setCreeperState(-10);
|
((CreeperEntity)c.entity).setCreeperState(-10);
|
||||||
} else {
|
} else {
|
||||||
((CreeperEntity) c.entity).setCreeperState(1000000);
|
((CreeperEntity) c.entity).setCreeperState(1000000);
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class Combatant
|
||||||
decision = Battle.Decision.UNDECIDED;
|
decision = Battle.Decision.UNDECIDED;
|
||||||
recalcSpeedOnCompare = false;
|
recalcSpeedOnCompare = false;
|
||||||
remainingDefenses = 0;
|
remainingDefenses = 0;
|
||||||
creeperTurns = 0;
|
creeperTurns = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Combatant(Entity e, EntityInfo entityInfo)
|
public Combatant(Entity e, EntityInfo entityInfo)
|
||||||
|
@ -42,7 +42,7 @@ public class Combatant
|
||||||
this.entityInfo = entityInfo;
|
this.entityInfo = entityInfo;
|
||||||
recalcSpeedOnCompare = false;
|
recalcSpeedOnCompare = false;
|
||||||
remainingDefenses = 0;
|
remainingDefenses = 0;
|
||||||
creeperTurns = 0;
|
creeperTurns = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class Config
|
||||||
private boolean oldBattleBehaviorEnabled = false;
|
private boolean oldBattleBehaviorEnabled = false;
|
||||||
private int leaveBattleCooldownSeconds = 5;
|
private int leaveBattleCooldownSeconds = 5;
|
||||||
private int aggroStartBattleDistance = 8;
|
private int aggroStartBattleDistance = 8;
|
||||||
|
private int creeperExplodeTurn = 5;
|
||||||
|
|
||||||
public Config(Logger logger)
|
public Config(Logger logger)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +237,23 @@ public class Config
|
||||||
logTOMLInvalidValue("server_config.aggro_start_battle_max_distance", "8");
|
logTOMLInvalidValue("server_config.aggro_start_battle_max_distance", "8");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
OptionalInt creeper_explode_turn = conf.getOptionalInt("server_config.creeper_explode_turn");
|
||||||
|
if(creeper_explode_turn.isPresent()) {
|
||||||
|
this.creeperExplodeTurn = creeper_explode_turn.getAsInt();
|
||||||
|
if(this.creeperExplodeTurn < 1) {
|
||||||
|
logClampedValue("server_config.creeper_explode_turn", Integer.toString(this.creeperExplodeTurn), "1");
|
||||||
|
this.creeperExplodeTurn = 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.creeperExplodeTurn = 5;
|
||||||
|
logNotFound("server_config.creeper_explode_turn", "5");
|
||||||
|
}
|
||||||
|
} catch(ClassCastException e) {
|
||||||
|
this.creeperExplodeTurn = 5;
|
||||||
|
logTOMLInvalidValue("server_config.creeper_explode_turn", "5");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Boolean old_battle_behavior = conf.get("server_config.old_battle_behavior");
|
Boolean old_battle_behavior = conf.get("server_config.old_battle_behavior");
|
||||||
if(old_battle_behavior != null) {
|
if(old_battle_behavior != null) {
|
||||||
|
@ -1137,4 +1155,6 @@ public class Config
|
||||||
{
|
{
|
||||||
return aggroStartBattleDistance;
|
return aggroStartBattleDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCreeperExplodeTurn() { return creeperExplodeTurn; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class TurnBasedMinecraftMod
|
||||||
{
|
{
|
||||||
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
public static final String MODID = "com_burnedkirby_turnbasedminecraft";
|
||||||
public static final String NAME = "Turn Based Minecraft Mod";
|
public static final String NAME = "Turn Based Minecraft Mod";
|
||||||
public static final String VERSION = "1.14";
|
public static final String VERSION = "1.15";
|
||||||
public static final String CONFIG_FILENAME = "TBM_Config.toml";
|
public static final String CONFIG_FILENAME = "TBM_Config.toml";
|
||||||
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
public static final String DEFAULT_CONFIG_FILENAME = "TBM_Config_DEFAULT.toml";
|
||||||
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
public static final String CONFIG_DIRECTORY = "config/TurnBasedMinecraft/";
|
||||||
|
|
|
@ -15,7 +15,7 @@ license="MIT"
|
||||||
# The modid of the mod
|
# The modid of the mod
|
||||||
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
modId="com_burnedkirby_turnbasedminecraft" #mandatory
|
||||||
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it
|
||||||
version="1.14" #mandatory
|
version="1.15" #mandatory
|
||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="TurnBasedMinecraftMod" #mandatory
|
displayName="TurnBasedMinecraftMod" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Please do not change this option, the mod uses this to keep track of what new
|
# Please do not change this option, the mod uses this to keep track of what new
|
||||||
# changes to add to the config.
|
# changes to add to the config.
|
||||||
version = 4
|
version = 5
|
||||||
do_not_overwrite = false
|
do_not_overwrite = false
|
||||||
|
|
||||||
[client_config]
|
[client_config]
|
||||||
|
@ -69,6 +69,9 @@ minimum_hit_percentage = 4
|
||||||
# Minimum 5, maximum 60.
|
# Minimum 5, maximum 60.
|
||||||
battle_turn_time_seconds = 15
|
battle_turn_time_seconds = 15
|
||||||
|
|
||||||
|
# On what turn a Creeper will explode in battle
|
||||||
|
creeper_explode_turn = 5
|
||||||
|
|
||||||
|
|
||||||
# Each "server_config.entity" entry uses the following options:
|
# Each "server_config.entity" entry uses the following options:
|
||||||
# name: full class name of the entity, cannot also have option "custom_name"
|
# name: full class name of the entity, cannot also have option "custom_name"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"modid": "com_burnedkirby_turnbasedminecraft",
|
"modid": "com_burnedkirby_turnbasedminecraft",
|
||||||
"name": "Turn Based Minecraft",
|
"name": "Turn Based Minecraft",
|
||||||
"description": "Changes battles to be turn-based.",
|
"description": "Changes battles to be turn-based.",
|
||||||
"version": "1.14",
|
"version": "1.15",
|
||||||
"mcversion": "1.16.3",
|
"mcversion": "1.16.3",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|
Loading…
Reference in a new issue