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

Cleanup #354

Merged
merged 44 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
219d2fb
Fix most `@SuppressWarnings`
glowredman Aug 25, 2023
ceb7b4e
Update buildscript
glowredman Aug 25, 2023
3dd66e8
Remove dead code
glowredman Aug 25, 2023
743837c
Add missing `@Override` annotations
glowredman Aug 25, 2023
49f1faf
Deobfuscate parameters
glowredman Aug 25, 2023
d5d5a82
Collapse switch statements
glowredman Aug 25, 2023
80ed6c6
Fix
glowredman Aug 25, 2023
aeb92ff
Combine nested if statements in else block to else if
glowredman Aug 26, 2023
8e608bd
Reduce indentation when possible
glowredman Aug 26, 2023
a8c15c6
Convert to switch when reasonable
glowredman Aug 26, 2023
0445eec
Extract increment/decrement from statement
glowredman Aug 26, 2023
f2b5129
Pull up assignment
glowredman Aug 26, 2023
35e42a5
Simplify lambda expression and method reference syntax
glowredman Aug 26, 2023
74ba71f
Deduplicate code
glowredman Aug 26, 2023
5a2a5e0
Use pattern matching for instanceof
glowredman Aug 26, 2023
1ca82b1
Convert String concatenation to Text Block
glowredman Aug 26, 2023
52cadeb
Convert to switch expression where possible
glowredman Aug 26, 2023
18677a1
Use diamond operator
glowredman Aug 26, 2023
696bff7
Convert to enhanced 'for' loops
glowredman Aug 26, 2023
aea1eaa
Always use 'this' qualifier
glowredman Aug 26, 2023
9e84543
Convert fields into local variables if the use is only local
glowredman Aug 26, 2023
bbe7024
Use String.replace() instead of String.replaceAll() when possible
glowredman Aug 26, 2023
a3763a1
Avoid Object.equals() or String.equalsIgnoreCase() on null objects
glowredman Aug 26, 2023
1d4c10b
Remove unnecessary casts
glowredman Aug 26, 2023
80c9748
Push down negation
glowredman Aug 26, 2023
edc39bd
Remove redundant super() call in constructor
glowredman Aug 26, 2023
eabb4df
Remove overridden assignment
glowredman Aug 26, 2023
87a3b91
Remove redundant modifiers
glowredman Aug 26, 2023
25dc179
Raise embedded if into parent if
glowredman Aug 26, 2023
5a0486b
Create array with curly brrackets when possible
glowredman Aug 26, 2023
2873097
Remove variable assignment before return
glowredman Aug 26, 2023
7f545b5
Remove unnecessary parentheses
glowredman Aug 26, 2023
e19b603
spotlessApply (#355)
github-actions[bot] Aug 26, 2023
34da269
Merge branch 'master' into cleanup
glowredman Sep 6, 2023
28c5b59
Merge branch 'master' into cleanup
glowredman Sep 6, 2023
3005651
Update dependencies.gradle
Dream-Master Sep 6, 2023
ac366f9
Update dependencies.gradle
Dream-Master Sep 6, 2023
840b4a3
Update dependencies.gradle
Dream-Master Sep 6, 2023
4818a3a
sa+deps
Dream-Master Sep 6, 2023
c7fca10
add back GG mod in dep file
Dream-Master Sep 6, 2023
924d742
Merge branch 'master' into cleanup
Dream-Master Sep 10, 2023
9ae924c
Merge branch 'master' into cleanup
Dream-Master Sep 22, 2023
75496bd
Make requested changes
glowredman Sep 23, 2023
1997b21
Merge branch 'master' into cleanup
glowredman Sep 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions addon.gradle

This file was deleted.

1 change: 0 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ dependencies {

compileOnly("com.github.GTNewHorizons:TinkersGregworks:GTNH-1.0.24-pre:dev") {transitive = false}
compileOnly("com.github.GTNewHorizons:OpenComputers:1.9.17-GTNH:api") {transitive = false}

}
89 changes: 86 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,27 @@ autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614

# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
channel = stable
mappingsVersion = 12

# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer

# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience
# Turns most publicly visible List, Map, etc. into proper List<Type>, Map<K, V> types
enableGenericInjection = true

# Generate a class with String fields for the mod id, name, version and group name named with the fields below
generateGradleTokenClass = com.github.bartimaeusnek.bartworks.API.API_REFERENCE
gradleTokenModId =
Expand All @@ -40,12 +55,15 @@ replaceGradleTokenInFile =
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =

# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,nei_at.cfg
accessTransformersFile =

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Adds some debug arguments like verbose output and export
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
Expand All @@ -61,6 +79,71 @@ containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = true

# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true

# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true

# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USERNAME and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# mavenPublishUrl = http://jenkins.usrv.eu:8081/nexus/content/repositories/releases

# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.

# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish on Modrinth.
modrinthProjectId =

# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =


# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.

# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =

# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
curseForgeRelations =


# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =

# Optional parameter to prevent the source code from being published
# noPublishedSources =

# Uncomment this to disable spotless checks
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true

# Override the IDEA build type. Valid value is "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be always native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes;
import static gregtech.api.util.GT_RecipeBuilder.SECONDS;

import java.awt.*;
import java.awt.Color;

import net.minecraft.item.EnumRarity;
import net.minecraftforge.fluids.FluidRegistry;
Expand All @@ -28,13 +28,13 @@
import com.github.bartimaeusnek.bartworks.util.BioData;
import com.github.bartimaeusnek.bartworks.util.BioPlasmid;

import gregtech.api.enums.FluidState;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
import gregtech.api.enums.TierEU;
import gregtech.api.objects.GT_Fluid;
import gregtech.api.fluid.GT_FluidFactory;
import gregtech.api.util.GT_Utility;

@SuppressWarnings("ALL")
public final class BioObjectAdder {

/**
Expand All @@ -50,7 +50,7 @@ public static BioCulture createAndRegisterBioCulture(Color color, String name, B
EnumRarity rarity, boolean breedable) {
if (BioCulture.BIO_CULTURE_ARRAY_LIST.size() > 1)
return BioCulture.createAndRegisterBioCulture(color, name, plasmid, dna, rarity, breedable);
else new Exception(
new Exception(
"Too Early to register a BioCulture! You MUST run this either after:bartworks OR in the init Phase!")
.printStackTrace();
return null;
Expand All @@ -70,7 +70,7 @@ public static BioCulture createAndRegisterBioCulture(Color color, String name, B
boolean breedable) {
if (BioCulture.BIO_CULTURE_ARRAY_LIST.size() > 1)
return BioCulture.createAndRegisterBioCulture(color, name, plasmid, dna, breedable);
else new Exception(
new Exception(
"Too Early to register a BioCulture! You MUST run this either after:bartworks OR in the init Phase!")
.printStackTrace();
return null;
Expand Down Expand Up @@ -168,15 +168,12 @@ public static void regenerateBioFluids() {
for (BioCulture B : BioCulture.BIO_CULTURE_ARRAY_LIST) {
if (B.getFluidNotSet()) {
B.setFluid(
new GT_Fluid(
B.getName().replaceAll(" ", "").toLowerCase() + "fluid",
"molten.autogenerated",
new short[] { (short) B.getColor().getRed(), (short) B.getColor().getBlue(),
(short) B.getColor().getGreen() }));

if (!FluidRegistry.registerFluid(B.getFluid())) {
new Exception("FAILED TO REGISTER FLUID FOR: " + B.getName()).printStackTrace();
}
GT_FluidFactory.builder(B.getName().replace(" ", "").toLowerCase() + "fluid")
.withTextureName("molten.autogenerated")
.withColorRGBA(
new short[] { (short) B.getColor().getRed(), (short) B.getColor().getBlue(),
(short) B.getColor().getGreen() })
.withStateAndTemperature(FluidState.LIQUID, 300).buildAndRegister().asFluid());

GT_Values.RA.stdBuilder().itemInputs(GT_Utility.getIntegratedCircuit(10))
.fluidInputs(new FluidStack(B.getFluid(), 1000)).fluidOutputs(dnaFluid).duration(25 * SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.github.bartimaeusnek.bartworks.util.BioData;
import com.github.bartimaeusnek.bartworks.util.BioPlasmid;

@SuppressWarnings("ALL")
public final class BioObjectGetter {

public static BioCulture getBioCulture(String aName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import gregtech.api.enums.Materials;

@SuppressWarnings("ALL")
public final class BioRecipeAdder {

public static final int STANDART = 0;
Expand Down Expand Up @@ -108,6 +107,7 @@ public static boolean addBacterialVatRecipe(ItemStack[] aInputs, @Nonnull BioCul
* @param exactSv if the recipe needs EXACTLY the Sv or can use less...
* @return
*/
@Deprecated
public static boolean addBacterialVatRecipe(ItemStack[] aInputs, @Nonnull BioCulture aCulture,
@Nonnull FluidStack[] aFluidInputs, @Nonnull FluidStack[] aFluidOutputs, @Nonnegative int aDuration,
@Nonnegative int aEUt, Materials material, @Nonnegative int glasTier, int aSpecialValue, boolean exactSv) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_ModHandler;

@SuppressWarnings("ALL")
public final class BioVatLogicAdder {

public static class RadioHatch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ default IIcon getTextureForSide(ForgeDirection side, int meta) {

@SideOnly(Side.CLIENT)
default IIcon getTextureForSide(int side, int meta) {
return getTextureForSide(ForgeDirection.values()[side], meta);
return this.getTextureForSide(ForgeDirection.values()[side], meta);
}

@SideOnly(Side.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;

@SuppressWarnings("ALL")
public class BWCore extends DummyModContainer {

public static final String BWCORE_NAME = "BartWorks ASM Core";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public static void clearRecentlyUsedRecipes() {
RECENTLYUSEDRECIPES = ThreadLocal.withInitial(AccessPriorityList::new);
}

@SuppressWarnings("ALL")
public static ItemStack findCachedMatchingRecipe(InventoryCrafting inventoryCrafting, World world) {
int i = 0;
ItemStack itemstack = null;
Expand Down Expand Up @@ -72,45 +71,40 @@ public static ItemStack findCachedMatchingRecipe(InventoryCrafting inventoryCraf

return new ItemStack(itemstack.getItem(), 1, i1);

} else {

IRecipe iPossibleRecipe = null;
AccessPriorityList<IRecipe> cache = RECENTLYUSEDRECIPES.get();
Iterator<AccessPriorityListNode<IRecipe>> it = cache.nodeIterator();

while (it.hasNext()) {
AccessPriorityListNode<IRecipe> recipeNode = it.next();
iPossibleRecipe = recipeNode.getELEMENT();
}
IRecipe iPossibleRecipe = null;
AccessPriorityList<IRecipe> cache = RECENTLYUSEDRECIPES.get();
Iterator<AccessPriorityListNode<IRecipe>> it = cache.nodeIterator();

if (!iPossibleRecipe.matches(inventoryCrafting, world)) continue;
while (it.hasNext()) {
AccessPriorityListNode<IRecipe> recipeNode = it.next();
iPossibleRecipe = recipeNode.getELEMENT();

cache.addPrioToNode(recipeNode);
return iPossibleRecipe.getCraftingResult(inventoryCrafting);
}
if (!iPossibleRecipe.matches(inventoryCrafting, world)) continue;

ItemStack stack = null;
cache.addPrioToNode(recipeNode);
return iPossibleRecipe.getCraftingResult(inventoryCrafting);
}

HashSet<IRecipe> recipeSet = new NonNullWrappedHashSet<>();
List recipeList = CraftingManager.getInstance().getRecipeList();
HashSet<IRecipe> recipeSet = new NonNullWrappedHashSet<>();
List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();

for (int k = 0; k < recipeList.size(); k++) {
IRecipe r = (IRecipe) recipeList.get(k);
if (r.matches(inventoryCrafting, world)) recipeSet.add(r);
}
for (IRecipe r : recipeList) {
if (r.matches(inventoryCrafting, world)) recipeSet.add(r);
}

Object[] arr = recipeSet.toArray();
Object[] arr = recipeSet.toArray();

if (arr.length == 0) return null;
if (arr.length == 0) return null;

IRecipe recipe = (IRecipe) arr[0];
stack = recipe.getCraftingResult(inventoryCrafting);
IRecipe recipe = (IRecipe) arr[0];
ItemStack stack = recipe.getCraftingResult(inventoryCrafting);

if (arr.length != 1) return stack;
if (arr.length != 1) return stack;

if (stack != null) cache.addLast(recipe);
if (stack != null) cache.addLast(recipe);

return stack;
}
return stack;
}

private BWCoreStaticReplacementMethodes() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static MethodNode transformThaumcraftWandPedestal(MethodNode method) {
nu.add(instruction);
if (instruction.getOpcode() == INVOKEVIRTUAL) {
MethodInsnNode invokevirtual = (MethodInsnNode) instruction;
if (invokevirtual.name.equals("addVis")) {
if ("addVis".equals(invokevirtual.name)) {
AbstractInsnNode beginning = method.instructions.get(j - 7);
LabelNode label = new LabelNode();
nu.insertBefore(beginning, new VarInsnNode(ALOAD, 0));
Expand Down Expand Up @@ -133,7 +133,6 @@ public static byte[] transform(int id, byte[] basicClass) {
String name_deObfs = "canDoRainSnowIce";

String dsc_deObfs = "(Lnet/minecraft/world/chunk/Chunk;)Z";
String dsc_Obfs = "(Lapx;)Z";
for (int i = 0; i < methods.size(); i++) {
if (methods.get(i).name.equalsIgnoreCase(name_deObfs)) {
BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Removing!");
Expand All @@ -142,12 +141,7 @@ public static byte[] transform(int id, byte[] basicClass) {
}
}
BWCore.BWCORE_LOG.info("Creating new " + name_deObfs + "!");
MethodNode nu = new MethodNode(
ACC_PUBLIC,
name_deObfs,
/* obfs ? dsc_Obfs : */ dsc_deObfs,
null,
new String[0]);
MethodNode nu = new MethodNode(ACC_PUBLIC, name_deObfs, dsc_deObfs, null, new String[0]);
InsnList insnList = new InsnList();
insnList.add(new InsnNode(ICONST_0));
insnList.add(new InsnNode(IRETURN));
Expand All @@ -168,7 +162,7 @@ public static byte[] transform(int id, byte[] basicClass) {
for (int i = 0; i < methods.size(); i++) {
if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src)
&& ASMUtils.isCorrectMethod(methods.get(i), dsc_deObfs, dsc_Obfs)) {
BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!");
BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Patching!");
MethodNode toPatch = methods.get(i);
InsnList insnList = new InsnList();
insnList.add(new InsnNode(ACONST_NULL));
Expand All @@ -192,7 +186,7 @@ public static byte[] transform(int id, byte[] basicClass) {
for (MethodNode toPatch : methods) {
if (ASMUtils.isCorrectMethod(toPatch, name_deObfs, name_Obfs, name_src)
&& ASMUtils.isCorrectMethod(toPatch, dsc_universal)) {
BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!");
BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Patching!");
InsnList nu = new InsnList();
LabelNode[] LabelNodes = { new LabelNode(), new LabelNode() };

Expand Down Expand Up @@ -311,7 +305,7 @@ public static byte[] transform(int id, byte[] basicClass) {
for (int i = 0; i < methods.size(); i++) {
if (ASMUtils.isCorrectMethod(methods.get(i), name_deObfs, name_Obfs, name_src)
&& ASMUtils.isCorrectMethod(methods.get(i), dsc_universal, dsc_universal)) {
BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!");
BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Patching!");
methods.set(i, BWCoreTransformer.transformThaumcraftWandPedestal(methods.get(i)));
break scase;
}
Expand All @@ -325,7 +319,7 @@ public static byte[] transform(int id, byte[] basicClass) {
String name_deObfs = "getNewNoise";
for (MethodNode toPatch : methods) {
if (ASMUtils.isCorrectMethod(toPatch, name_deObfs)) {
BWCore.BWCORE_LOG.info("Found " + (name_deObfs) + "! Patching!");
BWCore.BWCORE_LOG.info("Found " + name_deObfs + "! Patching!");
LabelNode[] LabelNodes = { new LabelNode(), new LabelNode() };
InsnList nu = new InsnList();
// if (x < -28675) x %= -28675;
Expand Down
Loading