Skip to content

Commit

Permalink
Code adjustments and simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
OldSerpskiStalker committed Oct 1, 2024
1 parent c8a89a2 commit ff07fa6
Show file tree
Hide file tree
Showing 24 changed files with 143 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ public static final class STRUCT_FILES_DIRS
*/
public static final class STRUCT_FILES_EXTENSION
{
/**
*
*/
public static final String CONFIG_FILE_EXTENSION = ".cfg";

/**
*
*/
Expand All @@ -125,26 +120,11 @@ public static final class STRUCT_FILES_EXTENSION
@Mod.Instance
public static DynamicSpawnControl Instance;

/**
*
*/
static CheckDebugger checkDebugger;

/**
*
*/
private static File globalDirectory = null;

/**
*
*/
static Cache cache = null;

/**
*
*/
static CacheStorage cacheStorage = null;

/**
*
* @return
Expand Down Expand Up @@ -187,14 +167,14 @@ public DynamicSpawnControl()
public synchronized void preInit(FMLPreInitializationEvent event)
{
//
checkDebugger = new CheckDebugger();
CheckDebugger.instance = new CheckDebugger();

//
globalDirectory = event.getModConfigurationDirectory();

//
Log.createLogFile(globalDirectory.getPath() + File.separator + STRUCT_FILES_DIRS.NAME_DIRECTORY, checkDebugger.IsRunDebugger);
Log.writeDataToLogFile(1, "Debugger is running: " + (checkDebugger.IsRunDebugger ? "true" : "false"));
Log.createLogFile(globalDirectory.getPath() + File.separator + STRUCT_FILES_DIRS.NAME_DIRECTORY, CheckDebugger.instance.IsRunDebugger);
Log.writeDataToLogFile(1, "Debugger is running: " + (CheckDebugger.instance.IsRunDebugger ? "true" : "false"));

//
MessageHandler.init();
Expand All @@ -206,10 +186,10 @@ public synchronized void preInit(FMLPreInitializationEvent event)
generalStorageData = new GeneralStorageData();

//
cacheStorage = new CacheStorage();
CacheStorage.instance = new CacheStorage();

//
cache = new Cache();
Cache.instance = new Cache();

//
ParserGenericJsonScripts.setRulePath(event.getModConfigurationDirectory());
Expand Down Expand Up @@ -284,8 +264,8 @@ public synchronized void serverLoad(FMLServerStartingEvent event)
@EventHandler
public synchronized void serverStopped(FMLServerStoppedEvent event)
{
cache.cleanActualCache();
cache.cleanBufferCache();
Cache.instance.cleanActualCache();
Cache.instance.cleanBufferCache();

Structures.STRUCTURES_CACHE.clean();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public final class CheckDebugger
/**
*
*/
private static CheckDebugger instance = null;
public static CheckDebugger instance;

/**
*
Expand All @@ -24,15 +24,6 @@ public CheckDebugger()
IsRunDebugger = run();
}

/**
*
* @return
*/
public static CheckDebugger getInstance()
{
return instance;
}

/**
*
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static void onUpdateLightmap(EntityRenderer renderer, float partialTicks)

boolean lightmapUpdateNeededValue;
{
lightmapUpdateNeededField = rendererClass.getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "lightmapUpdateNeeded" : "field_78536_aa");
lightmapUpdateNeededField = rendererClass.getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "lightmapUpdateNeeded" : "field_78536_aa");
lightmapUpdateNeededField.setAccessible(true);
lightmapUpdateNeededValue = lightmapUpdateNeededField.getBoolean(renderer);
}
Expand All @@ -82,7 +82,7 @@ public static void onUpdateLightmap(EntityRenderer renderer, float partialTicks)

Minecraft mc;
{
mcField = rendererClass.getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "mc" : "field_78531_r");
mcField = rendererClass.getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "mc" : "field_78531_r");
mcField.setAccessible(true);
mc = (Minecraft) mcField.get(renderer);
}
Expand Down Expand Up @@ -303,54 +303,54 @@ private static void updateLuminance(EntityRenderer renderer, float partialTicks,
float bossColorModifier;
{
bossColorModifierField =
renderer.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "bossColorModifier" : "field_82831_U");
renderer.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "bossColorModifier" : "field_82831_U");
bossColorModifierField.setAccessible(true);
bossColorModifier = bossColorModifierField.getFloat(renderer);
}

float bossColorModifierPrev;
{
bossColorModifierPrevField =
renderer.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "bossColorModifierPrev" : "field_82832_V");
renderer.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "bossColorModifierPrev" : "field_82832_V");
bossColorModifierPrevField.setAccessible(true);
bossColorModifierPrev = bossColorModifierPrevField.getFloat(renderer);
}

float torchFlickerX;
{
torchFlickerXField =
renderer.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "torchFlickerX" : "field_78514_e");
renderer.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "torchFlickerX" : "field_78514_e");
torchFlickerXField.setAccessible(true);
torchFlickerX = torchFlickerXField.getFloat(renderer);
}

Object mcObject;
{
mcField =
renderer.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "mc" : "field_78531_r");
renderer.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "mc" : "field_78531_r");
mcField.setAccessible(true);
mcObject = mcField.get(renderer);
}

Object gameSettingsObject;
{
gameSettingsField =
mcObject.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "gameSettings" : "field_71474_y");
mcObject.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "gameSettings" : "field_71474_y");
gameSettingsField.setAccessible(true);
gameSettingsObject = gameSettingsField.get(mcObject);
}

float gammaSetting;
{
gammaSettingField =
gameSettingsObject.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "gammaSetting" : "field_74333_Y");
gameSettingsObject.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "gammaSetting" : "field_74333_Y");
gammaSettingField.setAccessible(true);
gammaSetting = gammaSettingField.getFloat(gameSettingsObject);
}

int[] lightmapColors;
{
lightmapColorsField = renderer.getClass().getDeclaredField(CheckDebugger.getInstance().IsRunDebugger ? "lightmapColors" : "field_78504_Q");
lightmapColorsField = renderer.getClass().getDeclaredField(CheckDebugger.instance.IsRunDebugger ? "lightmapColors" : "field_78504_Q");
lightmapColorsField.setAccessible(true);
lightmapColors = (int[]) lightmapColorsField.get(renderer);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
*
*/
public class DataBlockWorldGenerator
public final class DataBlockWorldGenerator
{
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
*
*/
public class DataCacheWorldGame
public final class DataCacheWorldGame
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

import javax.annotation.Nonnull;

public class DataGameDebugger
/**
*
*/
public final class DataGameDebugger
{
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
*
*/
public class DataPluginWorldTime
public final class DataPluginWorldTime
{
/**
*
Expand Down Expand Up @@ -66,7 +66,7 @@ public worldTime(@Nonnull final String category)
*/
public Integer getDayLengthMinutes()
{
return dayLengthMinutes;
return this.dayLengthMinutes;
}

/**
Expand All @@ -75,7 +75,7 @@ public Integer getDayLengthMinutes()
*/
public Integer getNightLengthMinutes()
{
return nightLengthMinutes;
return this.nightLengthMinutes;
}

/**
Expand All @@ -84,7 +84,7 @@ public Integer getNightLengthMinutes()
*/
public Integer getSyncToSystemTimeRate()
{
return syncToSystemTimeRate;
return this.syncToSystemTimeRate;
}

/**
Expand All @@ -93,7 +93,7 @@ public Integer getSyncToSystemTimeRate()
*/
public Boolean getTimeControlDebug()
{
return timeControlDebug;
return this.timeControlDebug;
}

/**
Expand All @@ -102,7 +102,7 @@ public Boolean getTimeControlDebug()
*/
public Boolean getSyncToSystemTime()
{
return syncToSystemTime;
return this.syncToSystemTime;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
*
*/
public class DataLogFile
public final class DataLogFile
{
/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
*
*/
public class DataPlayer
public final class DataPlayer
{
/**
*
Expand Down
Loading

0 comments on commit ff07fa6

Please sign in to comment.