Skip to content

Commit

Permalink
2.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Seosean committed Jun 21, 2024
1 parent 85df16f commit 82f84f2
Show file tree
Hide file tree
Showing 14 changed files with 229 additions and 121 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ plugins {
id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "2.0.8"
version = "2.0.9"
group= "com.seosean.showspawntime" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ShowSpawnTime"

Expand Down Expand Up @@ -71,7 +71,7 @@ dependencies {
annotationProcessor('org.spongepowered:mixin:0.7.11-SNAPSHOT')
// you may put jars on which you depend on in ./libs
// or you may define them like so..
compile files('lib/ZombiesAutoSplits-1.2.jar')
compile files('lib/ZombiesAutoSplits-1.3.jar')
//compile "some.group:artifact:version"

// real examples
Expand Down Expand Up @@ -142,7 +142,7 @@ shadowJar {
exclude 'commons-io-2.4.jar'
exclude 'dummyThing'
exclude 'LICENSE.txt'
exclude 'ZombiesAutoSplits-1.2.jar'
exclude 'ZombiesAutoSplits-1.3.jar'
}
finalizedBy 'reobfJar'
}
Expand Down
Binary file added lib/Orange's Simple Mods-1.2-deobf.jar
Binary file not shown.
Binary file added lib/ZombiesAutoSplits-1.3.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions src/main/java/com/seosean/showspawntime/ShowSpawnTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
public class ShowSpawnTime
{
public static final String MODID = "showspawntime";
public static final String VERSION = "2.0.8";
public static final String VERSION = "2.0.9";
public static final String EMOJI_REGEX = "(?:[\uD83C\uDF00-\uD83D\uDDFF]|[\uD83E\uDD00-\uD83E\uDDFF]|[\uD83D\uDE00-\uD83D\uDE4F]|[\uD83D\uDE80-\uD83D\uDEFF]|[\u2600-\u26FF]\uFE0F?|[\u2700-\u27BF]\uFE0F?|\u24C2\uFE0F?|[\uD83C\uDDE6-\uD83C\uDDFF]{1,2}|[\uD83C\uDD70\uD83C\uDD71\uD83C\uDD7E\uD83C\uDD7F\uD83C\uDD8E\uD83C\uDD91-\uD83C\uDD9A]\uFE0F?|[\u0023\u002A\u0030-\u0039]\uFE0F?\u20E3|[\u2194-\u2199\u21A9-\u21AA]\uFE0F?|[\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55]\uFE0F?|[\u2934\u2935]\uFE0F?|[\u3030\u303D]\uFE0F?|[\u3297\u3299]\uFE0F?|[\uD83C\uDE01\uD83C\uDE02\uD83C\uDE1A\uD83C\uDE2F\uD83C\uDE32-\uD83C\uDE3A\uD83C\uDE50\uD83C\uDE51]\uFE0F?|[\u203C\u2049]\uFE0F?|[\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE]\uFE0F?|[\u00A9\u00AE]\uFE0F?|[\u2122\u2139]\uFE0F?|\uD83C\uDC04\uFE0F?|\uD83C\uDCCF\uFE0F?|[\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA]\uFE0F?)";
public static final String COLOR_REGEX = "§[a-zA-Z0-9]";
public static boolean isAutoSplitsLoaded;
Expand Down Expand Up @@ -99,6 +99,7 @@ public void preinit(FMLPreInitializationEvent event){

LanguageConfiguration.load();


MAIN_CONFIGURATION = new MainConfiguration(CONFIGURATION, LOGGER);
}

Expand Down Expand Up @@ -145,7 +146,7 @@ public void init(FMLInitializationEvent event)

for (ModContainer mod : mods) {
try {
if ("zombiesautosplits".equals(mod.getModId()) && Double.parseDouble(mod.getVersion().replace("1.", "")) >= 2) {
if ("zombiesautosplits".equals(mod.getModId()) && Double.parseDouble(mod.getVersion().replace("1.", "")) >= 3) {
return true;
}
} catch (Exception e) {
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/seosean/showspawntime/commands/CommandDebug.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
import com.seosean.showspawntime.utils.GameUtils;
import com.seosean.showspawntime.utils.LanguageUtils;
import com.seosean.showspawntime.utils.PlayerUtils;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;

public class CommandDebug extends CommandBase {
public CommandDebug() {
Expand Down Expand Up @@ -69,6 +73,15 @@ public void processCommand(ICommandSender sender, String[] args) {
type = Integer.parseInt(args[1]);
break;
}
case "block": {
double x = Double.parseDouble(args[1]);
double y = Double.parseDouble(args[2]);
double z = Double.parseDouble(args[3]);
BlockPos blockPos = new BlockPos(x, y, z);
IBlockState blockState = sender.getEntityWorld().getBlockState(blockPos);
DebugUtils.sendMessage(blockState.getBlock().getUnlocalizedName());
break;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.seosean.showspawntime.config.hud.ConfigGui;
import com.seosean.showspawntime.utils.DelayedTask;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
Expand All @@ -20,6 +21,7 @@ public String getCommandUsage(ICommandSender sender) {
}

public void processCommand(ICommandSender sender, String[] args) throws CommandException {
GuiScreen parentScreen = Minecraft.getMinecraft().currentScreen;
new DelayedTask(){
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.seosean.showspawntime.ShowSpawnTime;
import com.seosean.showspawntime.config.gui.ShowSpawnTimeGuiConfig;
import com.seosean.showspawntime.features.frcooldown.FastReviveCoolDown;
import com.seosean.showspawntime.utils.DebugUtils;
import com.seosean.showspawntime.utils.DelayedTask;
import com.seosean.showspawntime.utils.PlayerUtils;
import net.minecraft.client.Minecraft;
Expand All @@ -21,6 +22,14 @@
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Keyboard;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;

public class MainConfiguration {
Expand All @@ -29,6 +38,7 @@ public MainConfiguration(Configuration config, Logger logger) {
MainConfiguration.config = config;
MainConfiguration.logger = logger;
MainConfiguration.minecraft = Minecraft.getMinecraft();
this.check();
this.ConfigLoad();
cacheCriticalTextFix = CriticalTextFix;
}
Expand Down Expand Up @@ -75,19 +85,61 @@ public MainConfiguration(Configuration config, Logger logger) {
public static LinkedHashMap<String, IConfigElement> powerupRelated = new LinkedHashMap<>();
public static LinkedHashMap<String, IConfigElement> qolRelated = new LinkedHashMap<>();

public static LinkedHashMap<String, IConfigElement> guiRelated = new LinkedHashMap<>();

public void check() {
File file = config.getConfigFile();
boolean changed = false;
StringBuilder content = new StringBuilder();
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("I:X")) {
line = line.replace("I:X", "D:X");
changed = true;
} else if (line.contains("I:Y")) {
line = line.replace("I:Y", "D:Y");
changed = true;
}
content.append(line).append(System.lineSeparator());
}

if (changed) {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
writer.write(content.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}

public void ConfigLoad(){
config.load();
logger.info("Started loading config. ");

XSpawnTime = config.get(Configuration.CATEGORY_CLIENT, "XSpawnTime", -1, "X").getDouble();
YSpawnTime = config.get(Configuration.CATEGORY_CLIENT, "YSpawnTime", -1, "Y").getDouble();

XPowerup = config.get(Configuration.CATEGORY_CLIENT, "XPowerup", -1, "X").getDouble();
YPowerup = config.get(Configuration.CATEGORY_CLIENT, "YPowerup", -1, "Y").getDouble();

XDPSCounter = config.get(Configuration.CATEGORY_CLIENT, "XDPSCounter", -1, "X").getDouble();
YDPSCounter = config.get(Configuration.CATEGORY_CLIENT, "YDPSCounter", -1, "Y").getDouble();
Property propertyXSpawnTime = config.get(Configuration.CATEGORY_CLIENT, "XSpawnTime", -1.0, "X");
Property propertyYSpawnTime = config.get(Configuration.CATEGORY_CLIENT, "YSpawnTime", -1.0, "Y");
XSpawnTime = propertyXSpawnTime.getDouble();
YSpawnTime = propertyYSpawnTime.getDouble();
guiRelated.put("XSpawnTime", new ConfigElement(propertyXSpawnTime));
guiRelated.put("YSpawnTime", new ConfigElement(propertyYSpawnTime));

Property propertyXPowerup = config.get(Configuration.CATEGORY_CLIENT, "XPowerup", -1.0, "X");
Property propertyYPowerup = config.get(Configuration.CATEGORY_CLIENT, "YPowerup", -1.0, "Y");
XPowerup = propertyXPowerup.getDouble();
YPowerup = propertyYPowerup.getDouble();
guiRelated.put("XPowerup", new ConfigElement(propertyXPowerup));
guiRelated.put("YPowerup", new ConfigElement(propertyYPowerup));

Property propertyXDPSCounter = config.get(Configuration.CATEGORY_CLIENT, "XDPSCounter", -1.0, "X");
Property propertyYDPSCounter = config.get(Configuration.CATEGORY_CLIENT, "YDPSCounter", -1.0, "Y");
XDPSCounter = propertyXDPSCounter.getDouble();
YDPSCounter = propertyYDPSCounter.getDouble();
guiRelated.put("XDPSCounter", new ConfigElement(propertyXDPSCounter));
guiRelated.put("YDPSCounter", new ConfigElement(propertyYDPSCounter));

String comment;
String commentPlaySound;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,28 @@ else if (button.id == 2002)
this.entryList.undoAllChanges(this.chkApplyGlobally.isChecked());
}

try {
if ((this.entryList.hasChangedEntry(true))) {
boolean requiresMcRestart = this.entryList.saveConfigElements();

if (Loader.isModLoaded(modID)) {
ConfigChangedEvent event = new ConfigChangedEvent.OnConfigChangedEvent(modID, configID, isWorldRunning, requiresMcRestart);
MinecraftForge.EVENT_BUS.post(event);

if (!event.getResult().equals(Event.Result.DENY)) {
MinecraftForge.EVENT_BUS.post(new ConfigChangedEvent.PostConfigChangedEvent(modID, configID, isWorldRunning, requiresMcRestart));
}
}
}
} catch (Throwable e) {
e.printStackTrace();
}

this.save();
}

@Override
public void onGuiClosed()
{
this.save();
super.onGuiClosed();
}


private static List<IConfigElement> getElements() {
List<IConfigElement> list = new ArrayList<>();

list.add(new DummyConfigElement.DummyCategoryElement("SST Related", "", new ArrayList<>(MainConfiguration.sstRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("Record Related", "", new ArrayList<>(MainConfiguration.recordRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("Powerup Related", "", new ArrayList<>(MainConfiguration.powerupRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("QoL Related", "", new ArrayList<>(MainConfiguration.qolRelated.values())));
return list;
}

protected void save() {
try {
if ((this.entryList.hasChangedEntry(true))) {
boolean requiresMcRestart = this.entryList.saveConfigElements();
Expand All @@ -79,18 +79,5 @@ public void onGuiClosed()
} catch (Throwable e) {
e.printStackTrace();
}

super.onGuiClosed();
}


private static List<IConfigElement> getElements() {
List<IConfigElement> list = new ArrayList<>();

list.add(new DummyConfigElement.DummyCategoryElement("SST Related", "", new ArrayList<>(MainConfiguration.sstRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("Record Related", "", new ArrayList<>(MainConfiguration.recordRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("Powerup Related", "", new ArrayList<>(MainConfiguration.powerupRelated.values())));
list.add(new DummyConfigElement.DummyCategoryElement("QoL Related", "", new ArrayList<>(MainConfiguration.qolRelated.values())));
return list;
}
}
Loading

0 comments on commit 82f84f2

Please sign in to comment.