Some spring cleaning

This commit is contained in:
Vincent Lee committed 2020-01-19 18:10:48 -06:00
1 parent d00f0e14e8
commit edf40208bf
6 files changed
+8 -64

No files matched your search

@@ -20,8 +20,11 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModContainer;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.server.ServerLifecycleHooks;
import net.minecraftforge.forgespi.language.IModInfo;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
@@ -42,9 +45,11 @@ public final class DebugHandler {
World world = Minecraft.getInstance().world;
if(ConfigHandler.CLIENT.debugInfo.get() && Minecraft.getInstance().gameSettings.showDebugInfo) {
event.getLeft().add("");
String version = LibMisc.VERSION;
if(version.contains("GRADLE"))
version = "N/A";
String version = ModList.get().getModContainerById(LibMisc.MOD_ID)
.map(ModContainer::getModInfo)
.map(IModInfo::getVersion)
.map(Object::toString)
.orElse("N/A");
event.getLeft().add(PREFIX + "(CLIENT) netColl: " + ManaNetworkHandler.instance.getAllCollectorsInWorld(world).size() + ", netPool: " + ManaNetworkHandler.instance.getAllPoolsInWorld(world).size() + ", rv: " + version);
@@ -24,31 +24,16 @@ public final class PersistentVariableHelper {
private static final String TAG_FIRST_LOAD = "firstLoad";
private static final String TAG_DOG = "dog";
private static final String TAG_LEXICON_NOTES = "lexiconNotes";
private static final String TAG_LAST_BOTANIA_VERSION = "lastBotaniaVersion";
private static File cacheFile;
public static boolean firstLoad = true;
public static boolean dog = true;
public static String lastBotaniaVersion = "";
public static void save() throws IOException {
CompoundNBT cmp = new CompoundNBT();
/*
CompoundNBT notesCmp = new CompoundNBT();
for(String s : GuiLexicon.notes.keySet()) {
String note = GuiLexicon.notes.get(s);
if(note != null && !note.trim().isEmpty())
notesCmp.putString(s, note);
}
cmp.put(TAG_LEXICON_NOTES, notesCmp);
*/
cmp.putBoolean(TAG_FIRST_LOAD, firstLoad);
cmp.putBoolean(TAG_DOG, dog);
cmp.putString(TAG_LAST_BOTANIA_VERSION, lastBotaniaVersion);
injectNBTToFile(cmp, getCacheFile());
}
@@ -56,31 +41,10 @@ public final class PersistentVariableHelper {
public static void load() throws IOException {
CompoundNBT cmp = getCacheCompound();
if(cmp.contains(TAG_LEXICON_NOTES)) {
CompoundNBT notesCmp = cmp.getCompound(TAG_LEXICON_NOTES);
Set<String> keys = notesCmp.keySet();
// GuiLexicon.notes.clear();
for(String key : keys)
;// GuiLexicon.notes.put(key, notesCmp.getString(key));
}
lastBotaniaVersion = cmp.contains(TAG_LAST_BOTANIA_VERSION) ? cmp.getString(TAG_LAST_BOTANIA_VERSION) : "(N/A)";
firstLoad = cmp.contains(TAG_FIRST_LOAD) ? cmp.getBoolean(TAG_FIRST_LOAD) : firstLoad;
if(firstLoad)
lastBotaniaVersion = LibMisc.VERSION;
dog = cmp.getBoolean(TAG_DOG);
}
public static void saveSafe() {
try {
save();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void setCacheFile(File f) {
cacheFile = f;
}
@@ -150,19 +150,6 @@ public class ClientProxy implements IProxy {
return ItemMonocle.hasMonocle(Minecraft.getInstance().player);
}
@Override
public String getLastVersion() {
String s = PersistentVariableHelper.lastBotaniaVersion;
if(s == null)
return "N/A";
if(s.indexOf("-") > 0)
return s.split("-")[1];
return s;
}
@Override
public long getWorldElapsedTicks() {
return ClientTickHandler.ticksInGame;
@@ -19,8 +19,6 @@ public interface IProxy {
boolean isClientPlayerWearingMonocle();
String getLastVersion();
long getWorldElapsedTicks();
default void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, int colorOuter, int colorInner) {
@@ -35,11 +35,6 @@ public class ServerProxy implements IProxy {
return false;
}
@Override
public String getLastVersion() {
return LibMisc.BUILD;
}
@Override
public long getWorldElapsedTicks() {
return ServerLifecycleHooks.getCurrentServer().getWorld(DimensionType.OVERWORLD).getGameTime();