Skip to content

Commit

Permalink
Add class SettingsGameDebugger and config
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Sep 17, 2024
1 parent 9bbe698 commit e2370e5
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ConfigManager
static
{
settingList.add(new SettingsLogFile("SettingsLogFile"));
settingList.add(new SettingsGameDebugger("SettingsGameDebugger"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
package org.imesense.dynamicspawncontrol.technical.configs;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import org.imesense.dynamicspawncontrol.DynamicSpawnControl;
import org.imesense.dynamicspawncontrol.technical.customlibrary.Log;
import org.imesense.dynamicspawncontrol.technical.proxy.ClientProxy;

import java.io.File;

/**
*
*/
public class SettingsGameDebugger implements IConfig
{
/**
*
*/
public static boolean DebugMonitorCache = false;

/**
*
*/
public static boolean DebugGenericPlayerTick = false;

/**
*
*/
public static boolean DebugGenericLivingDrops = false;

/**
*
*/
public static boolean DebugGenericSummonAidEvent = false;

/**
*
*/
public static boolean DebugGenericLeftClickEvent = false;

/**
*
*/
public static boolean DebugGenericPotentialSpawns = false;

/**
*
*/
public static boolean DebugGenericRightClickEvent = false;

/**
*
*/
public static boolean DebugGenericBlockBreakEvent = false;

/**
*
*/
public static boolean DebugGenericBlockPlaceEvent = false;

/**
*
*/
public static boolean DebugGenericEntitySpawnEvent = false;

/**
*
*/
public static boolean DebugGenericLivingExperienceDrop = false;

/**
*
* @param nameClass
*/
public SettingsGameDebugger(final String nameClass)
{

}

/**
*
* @param event
* @param nameClass
*/
@Override
public void init(FMLPreInitializationEvent event, final String nameClass)
{
Log.writeDataToLogFile(Log.TypeLog[0], nameClass);

ClientProxy.ConfigGameDebugger = new Configuration(new File(DynamicSpawnControl.getGlobalPathToConfigs().getPath() +
File.separator + DynamicSpawnControl.NAME_DIRECTORY + File.separator + "configs", "game_debugger" + DynamicSpawnControl.CONFIG_FILE_EXTENSION));

this.read();
}

/**
*
* @param configuration
*/
@Override
public void readProperties(Configuration configuration)
{
DebugMonitorCache =
configuration.getBoolean
("Debug info cache", "monitor_debug", DebugMonitorCache,
"Translates the cache parameters to the screen in static text");

DebugGenericPlayerTick =
configuration.getBoolean
("Debug EventEffects", "generic_maps_debug", DebugGenericPlayerTick,
"Debugging the 'EventEffects.json'");

DebugGenericLivingDrops =
configuration.getBoolean
("Debug DropAllItems", "generic_maps_debug", DebugGenericLivingDrops,
"Debugging the 'DropAllItems.json'");

DebugGenericSummonAidEvent =
configuration.getBoolean
("Debug ZombieSummonAid", "generic_maps_debug", DebugGenericSummonAidEvent,
"Debugging the 'ZombieSummonAid.json'");

DebugGenericLeftClickEvent =
configuration.getBoolean
("Debug EventLeftMouseClick", "generic_maps_debug", DebugGenericLeftClickEvent,
"Debugging the 'EventLeftMouseClick.json'");

DebugGenericPotentialSpawns =
configuration.getBoolean
("Debug MainOverrideSpawn", "generic_maps_debug", DebugGenericPotentialSpawns,
"Debugging the 'MainOverrideSpawn.json'");

DebugGenericRightClickEvent =
configuration.getBoolean
("Debug EventRightMouseClick", "generic_maps_debug", DebugGenericRightClickEvent,
"Debugging the 'EventRightMouseClick.json'");

DebugGenericBlockBreakEvent =
configuration.getBoolean
("Debug EventBlockBreak", "generic_maps_debug", DebugGenericBlockBreakEvent,
"Debugging the 'EventBlockBreak.json'");

DebugGenericBlockPlaceEvent =
configuration.getBoolean
("Debug EventBlockPlace", "generic_maps_debug", DebugGenericBlockPlaceEvent,
"Debugging the 'EventBlockPlace.json'");

DebugGenericEntitySpawnEvent =
configuration.getBoolean
("Debug SpawnConditions", "generic_maps_debug", DebugGenericEntitySpawnEvent,
"Debugging the 'SpawnConditions.json'");

DebugGenericLivingExperienceDrop =
configuration.getBoolean
("Debug DropAllExperience", "generic_maps_debug", DebugGenericLivingExperienceDrop,
"Debugging the 'DropAllExperience.json'");
}

/**
*
*/
@Override
public void read()
{
Configuration configuration = ClientProxy.ConfigGameDebugger;

try
{
configuration.load();

this.readProperties(configuration);
}
finally
{
if (configuration.hasChanged())
{
configuration.save();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public SettingsLogFile(final String nameClass)
* @param nameClass
*/
@Override
public void init(FMLPreInitializationEvent event, String nameClass)
public void init(FMLPreInitializationEvent event, final String nameClass)
{
Log.writeDataToLogFile(Log.TypeLog[0], nameClass);

ClientProxy.ConfigLogFile = new Configuration(new File(DynamicSpawnControl.getGlobalPathToConfigs().getPath() +
File.separator + DynamicSpawnControl.NAME_DIRECTORY + File.separator + "configs", "log" + DynamicSpawnControl.CONFIG_FILE_EXTENSION));

read();
this.read();
}

/**
Expand Down Expand Up @@ -67,7 +67,7 @@ public void read()
{
configuration.load();

readProperties(configuration);
this.readProperties(configuration);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,39 @@ public class AuxFunctions
*/
public enum NameSingleScript
{
/**
*
*/
SCRIPT_MOBS_LIST_SEE_SKY("action_mobs_list_see_sky.json"),

/**
*
*/
SCRIPT_ZOMBIE_SUMMON_AID("action_zombie_summon_aid.json"),

/**
*
*/
SCRIPT_CACHE_MOBS("cache_mobs.json");

/**
*
*/
private final String _keyword;

/**
*
* @param keyword
*/
NameSingleScript(String keyword)
{
this._keyword = keyword;
}

/**
*
* @return
*/
public String getKeyword()
{
return this._keyword;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public final class ClientProxy implements IProxy
*/
public static Configuration ConfigLogFile;

/**
*
*/
public static Configuration ConfigGameDebugger;

/**
* Preinitialize modification
*
Expand Down Expand Up @@ -53,6 +58,7 @@ public void init(FMLInitializationEvent event)
public void postInit(FMLPostInitializationEvent event)
{
ConfigLogFile.save();
ConfigGameDebugger.save();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.imesense.dynamicspawncontrol.technical.configs.SettingsGameDebugger;

import java.util.HashSet;

Expand Down Expand Up @@ -51,10 +52,10 @@ public synchronized void onWorldTick(TickEvent.WorldTickEvent event)
@SubscribeEvent(priority = EventPriority.NORMAL)
public synchronized void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
//if (!_debugMonitorCache)
//{
// return;
//}
if (!SettingsGameDebugger.DebugMonitorCache)
{
return;
}

if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT)
{
Expand Down

0 comments on commit e2370e5

Please sign in to comment.