Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Apply updated GT5 spotless configs
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenraven committed May 24, 2024
1 parent c86c138 commit a242a33
Show file tree
Hide file tree
Showing 122 changed files with 23,447 additions and 23,185 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
gtnh.settings.blowdryerTag = 0.2.2

# Human-readable mod name, available for mcmod.info population.
modName = TecTech - Tec Technology\!
Expand Down
36 changes: 19 additions & 17 deletions src/main/java/com/github/technus/tectech/TecTech.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
import gregtech.api.objects.XSTR;

@Mod(
modid = Reference.MODID,
name = Reference.NAME,
version = Reference.VERSION,
dependencies = "required-after:Forge@[10.13.4.1614,);" + "required-after:YAMCore@[0.5.70,);"
+ "required-after:structurelib;"
+ "after:ComputerCraft;"
+ "after:OpenComputers;"
+ "required-after:gtneioreplugin;"
+ "required-after:gregtech;"
+ "after:dreamcraft;"
+ "after:appliedenergistics2;"
+ "after:CoFHCore;"
+ "after:Thaumcraft;")
modid = Reference.MODID,
name = Reference.NAME,
version = Reference.VERSION,
dependencies = "required-after:Forge@[10.13.4.1614,);" + "required-after:YAMCore@[0.5.70,);"
+ "required-after:structurelib;"
+ "after:ComputerCraft;"
+ "after:OpenComputers;"
+ "required-after:gtneioreplugin;"
+ "required-after:gregtech;"
+ "after:dreamcraft;"
+ "after:appliedenergistics2;"
+ "after:CoFHCore;"
+ "after:Thaumcraft;")
public class TecTech {

@SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE)
Expand Down Expand Up @@ -68,9 +68,9 @@ public void PreLoad(FMLPreInitializationEvent PreEvent) {
LOGGER.setDebugOutput(true);

configTecTech = new TecTechConfig(
PreEvent.getModConfigurationDirectory(),
Reference.COLLECTIONNAME,
Reference.MODID);
PreEvent.getModConfigurationDirectory(),
Reference.COLLECTIONNAME,
Reference.MODID);

if (!configTecTech.LoadConfig()) {
LOGGER.error(Reference.MODID + " could not load its config file. Things are going to be weird!");
Expand All @@ -83,7 +83,9 @@ public void PreLoad(FMLPreInitializationEvent PreEvent) {
}

enderWorldSavedData = new EnderWorldSavedData();
FMLCommonHandler.instance().bus().register(enderWorldSavedData);
FMLCommonHandler.instance()
.bus()
.register(enderWorldSavedData);
MinecraftForge.EVENT_BUS.register(enderWorldSavedData);

TecTechRecipeMaps.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ private void computeMemory(Iterable<ItemStack> components) {

// }
}
memory = Math.min(Math.max(memory, 0), Settings.get().maxTotalRam());
memory = Math.min(
Math.max(memory, 0),
Settings.get()
.maxTotalRam());
if (memory != memSize) {}
}

@Override
public boolean initialize() {
core = new AvrCore();

computeMemory(this.machine.host().internalComponents());
computeMemory(
this.machine.host()
.internalComponents());

if (isInitialized()) {
machine.beep(".");
Expand All @@ -102,7 +107,8 @@ public ExecutionResult runThreaded(boolean isSynchronizedReturn) {
if (core.awoken) {
delay = 0;
for (int load = 0; load < 512;) {
load += core.getInstruction().getCost(core);
load += core.getInstruction()
.getCost(core);
ExecutionEvent executionEvent = core.cpuCycleForce();
if (executionEvent != null) {
if (executionEvent.throwable instanceof DelayEvent) {
Expand Down Expand Up @@ -146,14 +152,23 @@ public void load(NBTTagCompound avr) {
core.programCounter = avr.getInteger("programCounter");
InstructionRegistry registry = InstructionRegistry.REGISTRIES.get(avr.getString("instructionRegistry"));
if (registry != null) {
byte[] instructions = SaveHandler.load(avr, this.machine.node().address() + "_instructionsMemory");
byte[] param0 = SaveHandler.load(avr, this.machine.node().address() + "_param0Memory");
byte[] param1 = SaveHandler.load(avr, this.machine.node().address() + "_param1Memory");
byte[] instructions = SaveHandler.load(
avr,
this.machine.node()
.address() + "_instructionsMemory");
byte[] param0 = SaveHandler.load(
avr,
this.machine.node()
.address() + "_param0Memory");
byte[] param1 = SaveHandler.load(
avr,
this.machine.node()
.address() + "_param1Memory");
if (instructions != null && param0 != null
&& param1 != null
&& instructions.length > 0
&& param0.length > 0
&& param1.length > 0) {
&& param1 != null
&& instructions.length > 0
&& param0.length > 0
&& param1.length > 0) {
int[] instr = null, par0 = null, par1 = null;
try {
GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(instructions));
Expand All @@ -180,17 +195,20 @@ public void load(NBTTagCompound avr) {
e.printStackTrace();
}
if (instr != null && par0 != null
&& par1 != null
&& instr.length == par0.length
&& instr.length == par1.length) {
&& par1 != null
&& instr.length == par0.length
&& instr.length == par1.length) {
core.setProgramMemory(new ProgramMemory(registry, avr.getBoolean("immersive"), instr, par0, par1));
}
}
}
if (avr.hasKey("eepromSize")) {
core.restoreEepromDefinition(EepromMemory.make(avr.getInteger("eepromSize")));
}
byte[] data = SaveHandler.load(avr, this.machine.node().address() + "_dataMemory");
byte[] data = SaveHandler.load(
avr,
this.machine.node()
.address() + "_dataMemory");
if (data != null && data.length > 0) {
try {
GZIPInputStream gzis = new GZIPInputStream(new ByteArrayInputStream(data));
Expand Down Expand Up @@ -219,10 +237,11 @@ public void save(NBTTagCompound avr) {
gzos.write(Converter.writeInts(programMemory.instructions));
gzos.close();
SaveHandler.scheduleSave(
machine.host(),
avr,
machine.node().address() + "_instructionsMemory",
baos.toByteArray());
machine.host(),
avr,
machine.node()
.address() + "_instructionsMemory",
baos.toByteArray());
} catch (IOException e) {
TecTech.LOGGER.error("Failed to compress instructions memory to disk");
e.printStackTrace();
Expand All @@ -233,10 +252,11 @@ public void save(NBTTagCompound avr) {
gzos.write(Converter.writeInts(programMemory.param0));
gzos.close();
SaveHandler.scheduleSave(
machine.host(),
avr,
machine.node().address() + "_param0Memory",
baos.toByteArray());
machine.host(),
avr,
machine.node()
.address() + "_param0Memory",
baos.toByteArray());
} catch (IOException e) {
TecTech.LOGGER.error("Failed to compress param0 memory to disk");
e.printStackTrace();
Expand All @@ -247,10 +267,11 @@ public void save(NBTTagCompound avr) {
gzos.write(Converter.writeInts(programMemory.param1));
gzos.close();
SaveHandler.scheduleSave(
machine.host(),
avr,
machine.node().address() + "_param1Memory",
baos.toByteArray());
machine.host(),
avr,
machine.node()
.address() + "_param1Memory",
baos.toByteArray());
} catch (IOException e) {
TecTech.LOGGER.error("Failed to compress param1 memory to disk");
e.printStackTrace();
Expand All @@ -260,7 +281,10 @@ public void save(NBTTagCompound avr) {
}
RemovableMemory<EepromMemory> eeprom = core.getEepromMemory();
if (eeprom != null) {
avr.setInteger("eepromSize", eeprom.getDefinition().getSize());
avr.setInteger(
"eepromSize",
eeprom.getDefinition()
.getSize());
}
if (core.dataMemory != null) {
try {
Expand All @@ -269,10 +293,11 @@ public void save(NBTTagCompound avr) {
gzos.write(Converter.writeInts(core.dataMemory));
gzos.close();
SaveHandler.scheduleSave(
machine.host(),
avr,
machine.node().address() + "_dataMemory",
baos.toByteArray());
machine.host(),
avr,
machine.node()
.address() + "_dataMemory",
baos.toByteArray());
} catch (IOException e) {
TecTech.LOGGER.error("Failed to compress data memory to disk");
e.printStackTrace();
Expand Down
29 changes: 21 additions & 8 deletions src/main/java/com/github/technus/tectech/loader/MainLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public static void postLoad() {
if (NewHorizonsCoreMod.isModLoaded()) {
try {
Class<?> clazz = Class.forName("com.dreammaster.gthandler.casings.GT_Container_CasingsNH");
TT_Container_Casings.sBlockCasingsNH = (Block) clazz.getField("sBlockCasingsNH").get(null);
TT_Container_Casings.sBlockCasingsNH = (Block) clazz.getField("sBlockCasingsNH")
.get(null);

if (TT_Container_Casings.sBlockCasingsNH == null) {
throw new NullPointerException("sBlockCasingsNH Is not set at this time");
Expand Down Expand Up @@ -129,20 +130,32 @@ private static void FixBrokenFusionRecipes() {
LOGGER.info("Found Plasma of " + material.mName);
}
if (material.mElement != null && (material.mElement.mProtons >= Materials.Iron.mElement.mProtons
|| -material.mElement.mProtons >= Materials.Iron.mElement.mProtons
|| material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons
|| -material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) {
|| -material.mElement.mProtons >= Materials.Iron.mElement.mProtons
|| material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons
|| -material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) {
if (DEBUG_MODE) {
LOGGER.info("Attempting to bind " + material.mName);
}
if (material.getMolten(1) != null) {
binds.put(p.getFluid(), material.getMolten(1).getFluid());
binds.put(
p.getFluid(),
material.getMolten(1)
.getFluid());
} else if (material.getGas(1) != null) {
binds.put(p.getFluid(), material.getGas(1).getFluid());
binds.put(
p.getFluid(),
material.getGas(1)
.getFluid());
} else if (material.getFluid(1) != null) {
binds.put(p.getFluid(), material.getFluid(1).getFluid());
binds.put(
p.getFluid(),
material.getFluid(1)
.getFluid());
} else {
binds.put(p.getFluid(), Materials.Iron.getMolten(1).getFluid());
binds.put(
p.getFluid(),
Materials.Iron.getMolten(1)
.getFluid());
}
}
}
Expand Down
Loading

0 comments on commit a242a33

Please sign in to comment.