Fixed text display in BattleGUI not displaying properly.
Updated TBM_Config.toml with new vanilla mobs.
Fixed parsing of version of TBM_Config.toml.
This commit is contained in:
Stephen Seo 2020-11-13 11:27:57 +09:00
parent 3f331ccbf9
commit c7aefaa7c2
6 changed files with 121 additions and 16 deletions

View file

@ -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.10" version = "1.11"
group = "com.burnedkirby.TurnBasedMinecraft" group = "com.burnedkirby.TurnBasedMinecraft"
archivesBaseName = "TurnBasedMinecraft" archivesBaseName = "TurnBasedMinecraft"

View file

@ -235,7 +235,7 @@ public class BattleGui extends Screen {
public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { public void func_230430_a_(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) { if (TurnBasedMinecraftMod.proxy.getLocalBattle() == null) {
// drawHoveringText("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2); // drawHoveringText("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2);
drawString("Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2, 0xFFFFFFFF); drawString(matrixStack, "Waiting...", field_230708_k_ / 2 - 50, field_230709_l_ / 2, 0xFFFFFFFF);
return; return;
} }
if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION if (TurnBasedMinecraftMod.proxy.getLocalBattle().getState() == Battle.State.DECISION
@ -266,10 +266,10 @@ public class BattleGui extends Screen {
int stringWidth = field_230712_o_.getStringWidth(timeRemainingString); int stringWidth = field_230712_o_.getStringWidth(timeRemainingString);
// func_238467_a_ is probably fill // func_238467_a_ is probably fill
func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 5, field_230708_k_ / 2 + stringWidth / 2, 15, 0x70000000); func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 5, field_230708_k_ / 2 + stringWidth / 2, 15, 0x70000000);
drawString(timeRemainingString, field_230708_k_ / 2 - stringWidth / 2, 5, 0xFFFFFFFF); drawString(matrixStack, timeRemainingString, field_230708_k_ / 2 - stringWidth / 2, 5, 0xFFFFFFFF);
stringWidth = field_230712_o_.getStringWidth(info); stringWidth = field_230712_o_.getStringWidth(info);
func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 20, field_230708_k_ / 2 + stringWidth / 2, 30, 0x70000000); func_238467_a_(matrixStack, field_230708_k_ / 2 - stringWidth / 2, 20, field_230708_k_ / 2 + stringWidth / 2, 30, 0x70000000);
drawString(info, field_230708_k_ / 2 - stringWidth / 2, 20, 0xFFFFFFFF); drawString(matrixStack, info, field_230708_k_ / 2 - stringWidth / 2, 20, 0xFFFFFFFF);
} }
protected void buttonActionEvent(Button button, ButtonAction action) { protected void buttonActionEvent(Button button, ButtonAction action) {
@ -358,9 +358,7 @@ public class BattleGui extends Screen {
timeRemaining.set(remaining); timeRemaining.set(remaining);
} }
private void drawString(String string, int x, int y, int color) { private void drawString(MatrixStack matrixStack, String string, int x, int y, int color) {
IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer()); field_230712_o_.func_238405_a_(matrixStack, string, x, y, color);
field_230712_o_.renderString(string, x, y, color, true, identity, irendertypebuffer$impl, true, 0x7F000000, 15728880);
irendertypebuffer$impl.finish();
} }
} }

View file

@ -4,10 +4,9 @@ import java.io.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.electronwill.nightconfig.core.file.CommentedFileConfig; import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.toml.TomlFormat;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.electronwill.nightconfig.core.file.FileConfig; import com.electronwill.nightconfig.core.file.FileConfig;
@ -73,6 +72,7 @@ public class Config
if(internalVersion == 0) { if(internalVersion == 0) {
logger.error("Failed to check version of internal config file"); logger.error("Failed to check version of internal config file");
logger.error("Tried path \"" + TurnBasedMinecraftMod.DEFAULT_CONFIG_FILE_PATH + "\"");
} else { } else {
configVersion = internalVersion; configVersion = internalVersion;
} }
@ -996,7 +996,8 @@ public class Config
{ {
int version = 0; int version = 0;
FileConfig conf = FileConfig.of(configFile); FileConfig conf = FileConfig.of(configFile, TomlFormat.instance());
conf.load();
version = conf.getIntOrElse("version", 0); version = conf.getIntOrElse("version", 0);
conf.close(); conf.close();

View file

@ -9,6 +9,7 @@ import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.client.Minecraft;
import net.minecraft.command.Commands; import net.minecraft.command.Commands;
import net.minecraft.command.arguments.EntityArgument; import net.minecraft.command.arguments.EntityArgument;
import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity;
@ -35,7 +36,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.10"; public static final String VERSION = "1.11";
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/";

View file

@ -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.10" #mandatory version="1.11" #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>

View file

@ -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 = 2 version = 3
[client_config] [client_config]
@ -220,6 +220,18 @@ decision_attack_probability = 80
decision_defend_probability = 20 decision_defend_probability = 20
decision_flee_probability = 0 decision_flee_probability = 0
[[server_config.entity]]
name = "net.minecraft.entity.monster.HoglinEntity"
attack_power = 6
attack_variance = 2
attack_probability = 60
evasion = 20
category = "monster"
speed = 40
decision_attack_probability = 100
decision_defend_probability = 0
decision_flee_probability = 0
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.monster.HuskEntity" name = "net.minecraft.entity.monster.HuskEntity"
attack_power = 3 attack_power = 3
@ -246,7 +258,7 @@ decision_defend_probability = 0
decision_flee_probability = 0 decision_flee_probability = 0
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.monster.IronGolemEntity" name = "net.minecraft.entity.passive.IronGolemEntity"
attack_power = 14 attack_power = 14
attack_probability = 85 attack_probability = 85
attack_variance = 7 attack_variance = 7
@ -268,6 +280,30 @@ decision_attack_probability = 100
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 0 decision_flee_probability = 0
[[server_config.entity]]
name = "net.minecraft.entity.monster.piglin.PiglinEntity"
attack_power = 5
attack_variance = 2
attack_probability = 70
evasion = 20
category = "monster"
speed = 25
decision_attack_probability = 100
decision_defend_probability = 0
decision_flee_probability = 0
[[server_config.entity]]
name = "net.minecraft.entity.monster.piglin.PiglinBruteEntity"
attack_power = 10
attack_variance = 2
attack_probability = 75
evasion = 20
category = "monster"
speed = 28
decision_attack_probability = 100
decision_defend_probability = 0
decision_flee_probability = 0
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.monster.PhantomEntity" name = "net.minecraft.entity.monster.PhantomEntity"
attack_power = 2 attack_power = 2
@ -421,6 +457,18 @@ decision_attack_probability = 100
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 0 decision_flee_probability = 0
[[server_config.entity]]
name = "net.minecraft.entity.monster.ZoglinEntity"
attack_power = 6
attack_variance = 2
attack_probability = 60
evasion = 20
category = "monster"
speed = 40
decision_attack_probability = 100
decision_defend_probability = 0
decision_flee_probability = 0
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.monster.ZombieEntity" name = "net.minecraft.entity.monster.ZombieEntity"
attack_power = 3 attack_power = 3
@ -433,7 +481,7 @@ decision_defend_probability = 0
decision_flee_probability = 0 decision_flee_probability = 0
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.monster.ZombiePigmanEntity" name = "net.minecraft.entity.monster.ZombifiedPiglinEntity"
attack_power = 8 attack_power = 8
attack_probability = 70 attack_probability = 70
evasion = 10 evasion = 10
@ -465,6 +513,19 @@ decision_attack_probability = 0
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 90 decision_flee_probability = 90
[[server_config.entity]]
name = "net.minecraft.entity.passive.BeeEntity"
attack_power = 2
attack_probability = 65
evasion = 30
category = "animal"
speed = 20
decision_attack_probability = 90
decision_defend_probability = 0
decision_flee_probability = 0
attack_effect = "poison"
attack_effect_probability = 50
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.passive.ChickenEntity" name = "net.minecraft.entity.passive.ChickenEntity"
attack_power = 0 attack_power = 0
@ -499,6 +560,17 @@ decision_attack_probability = 70
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 30 decision_flee_probability = 30
[[server_config.entity]]
name = "net.minecraft.entity.passive.FoxEntity"
attack_power = 2
attack_probability = 70
evasion = 65
category = "animal"
speed = 65
decision_attack_probability = 70
decision_defend_probability = 0
decision_flee_probability = 25
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.passive.horse.DonkeyEntity" name = "net.minecraft.entity.passive.horse.DonkeyEntity"
attack_power = 0 attack_power = 0
@ -744,6 +816,17 @@ decision_attack_probability = 25
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 75 decision_flee_probability = 75
[[server_config.entity]]
name = "net.minecraft.entity.passive.StriderEntity"
attack_power = 0
attack_probability = 50
evasion = 35
category = "passive"
speed = 45
decision_attack_probability = 0
decision_defend_probability = 10
decision_flee_probability = 90
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.passive.fish.TropicalFishEntity" name = "net.minecraft.entity.passive.fish.TropicalFishEntity"
attack_power = 0 attack_power = 0
@ -755,6 +838,28 @@ decision_attack_probability = 25
decision_defend_probability = 0 decision_defend_probability = 0
decision_flee_probability = 75 decision_flee_probability = 75
[[server_config.entity]]
name = "net.minecraft.entity.passive.TurtleEntity"
attack_power = 0
attack_probability = 20
evasion = 35
category = "passive"
speed = 50
decision_attack_probability = 0
decision_defend_probability = 40
decision_flee_probability = 60
[[server_config.entity]]
name = "net.minecraft.entity.merchant.villager.WanderingTraderEntity"
attack_power = 0
attack_probability = 70
evasion = 5
category = "passive"
speed = 35
decision_attack_probability = 0
decision_defend_probability = 10
decision_flee_probability = 80
[[server_config.entity]] [[server_config.entity]]
name = "net.minecraft.entity.boss.dragon.EnderDragonEntity" name = "net.minecraft.entity.boss.dragon.EnderDragonEntity"
attack_power = 10 attack_power = 10