mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
This commit is contained in:
1 parent
91ef2a5c3d
commit
0d4b50908f
909 files changed
+6234
-15623
No files matched your search
@@ -41,6 +41,7 @@ public interface IFactory {
|
||||
* Gets the recipe type this Smelting Factory currently has.
|
||||
*
|
||||
* @param itemStack - stack to check
|
||||
*
|
||||
* @return RecipeType ordinal
|
||||
*/
|
||||
int getRecipeType(ItemStack itemStack);
|
||||
@@ -49,6 +50,7 @@ public interface IFactory {
|
||||
* Gets the recipe type this Factory currently has.
|
||||
*
|
||||
* @param itemStack - stack to check
|
||||
*
|
||||
* @return RecipeType or null if it has invalid NBT
|
||||
*/
|
||||
@Nullable
|
||||
@@ -57,7 +59,7 @@ public interface IFactory {
|
||||
/**
|
||||
* Sets the recipe type of this Smelting Factory to a new value.
|
||||
*
|
||||
* @param type - RecipeType ordinal
|
||||
* @param type - RecipeType ordinal
|
||||
* @param itemStack - stack to set
|
||||
*/
|
||||
void setRecipeType(int type, ItemStack itemStack);
|
||||
@@ -70,22 +72,15 @@ public interface IFactory {
|
||||
}
|
||||
|
||||
enum RecipeType implements IStringSerializable {
|
||||
SMELTING("Smelting", "smelter", MachineType.ENERGIZED_SMELTER, MachineFuelType.BASIC, false,
|
||||
Recipe.ENERGIZED_SMELTER),
|
||||
ENRICHING("Enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER, MachineFuelType.BASIC, false,
|
||||
Recipe.ENRICHMENT_CHAMBER),
|
||||
SMELTING("Smelting", "smelter", MachineType.ENERGIZED_SMELTER, MachineFuelType.BASIC, false, Recipe.ENERGIZED_SMELTER),
|
||||
ENRICHING("Enriching", "enrichment", MachineType.ENRICHMENT_CHAMBER, MachineFuelType.BASIC, false, Recipe.ENRICHMENT_CHAMBER),
|
||||
CRUSHING("Crushing", "crusher", MachineType.CRUSHER, MachineFuelType.BASIC, false, Recipe.CRUSHER),
|
||||
COMPRESSING("Compressing", "compressor", MachineType.OSMIUM_COMPRESSOR, MachineFuelType.ADVANCED, false,
|
||||
Recipe.OSMIUM_COMPRESSOR),
|
||||
COMPRESSING("Compressing", "compressor", MachineType.OSMIUM_COMPRESSOR, MachineFuelType.ADVANCED, false, Recipe.OSMIUM_COMPRESSOR),
|
||||
COMBINING("Combining", "combiner", MachineType.COMBINER, MachineFuelType.DOUBLE, false, Recipe.COMBINER),
|
||||
PURIFYING("Purifying", "purifier", MachineType.PURIFICATION_CHAMBER, MachineFuelType.ADVANCED, true,
|
||||
Recipe.PURIFICATION_CHAMBER),
|
||||
INJECTING("Injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER, MachineFuelType.ADVANCED, true,
|
||||
Recipe.CHEMICAL_INJECTION_CHAMBER),
|
||||
INFUSING("Infusing", "metalinfuser", MachineType.METALLURGIC_INFUSER, MachineFuelType.BASIC, false,
|
||||
Recipe.METALLURGIC_INFUSER),
|
||||
SAWING("Sawing", "sawmill", MachineType.PRECISION_SAWMILL, MachineFuelType.CHANCE, false,
|
||||
Recipe.PRECISION_SAWMILL);
|
||||
PURIFYING("Purifying", "purifier", MachineType.PURIFICATION_CHAMBER, MachineFuelType.ADVANCED, true, Recipe.PURIFICATION_CHAMBER),
|
||||
INJECTING("Injecting", "injection", MachineType.CHEMICAL_INJECTION_CHAMBER, MachineFuelType.ADVANCED, true, Recipe.CHEMICAL_INJECTION_CHAMBER),
|
||||
INFUSING("Infusing", "metalinfuser", MachineType.METALLURGIC_INFUSER, MachineFuelType.BASIC, false, Recipe.METALLURGIC_INFUSER),
|
||||
SAWING("Sawing", "sawmill", MachineType.PRECISION_SAWMILL, MachineFuelType.CHANCE, false, Recipe.PRECISION_SAWMILL);
|
||||
|
||||
private String name;
|
||||
private SoundEvent sound;
|
||||
@@ -106,16 +101,13 @@ public interface IFactory {
|
||||
|
||||
public static RecipeType getFromMachine(Block block, int meta) {
|
||||
RecipeType type = null;
|
||||
|
||||
for (RecipeType iterType : RecipeType.values()) {
|
||||
ItemStack machineStack = iterType.getStack();
|
||||
|
||||
if (Block.getBlockFromItem(machineStack.getItem()) == block && machineStack.getItemDamage() == meta) {
|
||||
type = iterType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -160,8 +152,7 @@ public interface IFactory {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MachineRecipe getAnyRecipe(ItemStack slotStack, ItemStack extraStack, Gas gasType,
|
||||
InfuseStorage infuse) {
|
||||
public MachineRecipe getAnyRecipe(ItemStack slotStack, ItemStack extraStack, Gas gasType, InfuseStorage infuse) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getRecipe(slotStack, gasType);
|
||||
} else if (fuelType == MachineFuelType.DOUBLE) {
|
||||
@@ -172,15 +163,13 @@ public interface IFactory {
|
||||
if (infuse.getType() != null) {
|
||||
return RecipeHandler.getMetallurgicInfuserRecipe(new InfusionInput(infuse, slotStack));
|
||||
} else {
|
||||
for (Entry<InfusionInput, MetallurgicInfuserRecipe> entry : Recipe.METALLURGIC_INFUSER.get()
|
||||
.entrySet()) {
|
||||
for (Entry<InfusionInput, MetallurgicInfuserRecipe> entry : Recipe.METALLURGIC_INFUSER.get().entrySet()) {
|
||||
if (entry.getKey().inputStack.isItemEqual(slotStack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getRecipe(slotStack);
|
||||
}
|
||||
|
||||
@@ -189,7 +178,6 @@ public interface IFactory {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().getItemGas(itemstack);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -197,7 +185,6 @@ public interface IFactory {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().BASE_SECONDARY_ENERGY_PER_TICK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -205,7 +192,6 @@ public interface IFactory {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().canReceiveGas(side, type);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -217,7 +203,6 @@ public interface IFactory {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().isValidGas(gas);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -225,18 +210,15 @@ public interface IFactory {
|
||||
if (itemStack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Object obj : recipe.get().entrySet()) {
|
||||
if (((Map.Entry) obj).getKey() instanceof AdvancedMachineInput) {
|
||||
Map.Entry entry = (Map.Entry) obj;
|
||||
ItemStack stack = ((AdvancedMachineInput) entry.getKey()).itemStack;
|
||||
|
||||
if (StackUtils.equalsWildcard(stack, itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -244,18 +226,15 @@ public interface IFactory {
|
||||
if (extraStack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Object obj : recipe.get().entrySet()) {
|
||||
if (((Map.Entry) obj).getKey() instanceof DoubleMachineInput) {
|
||||
Map.Entry entry = (Map.Entry) obj;
|
||||
ItemStack stack = ((DoubleMachineInput) entry.getKey()).extraStack;
|
||||
|
||||
if (StackUtils.equalsWildcard(stack, extraStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -264,7 +243,6 @@ public interface IFactory {
|
||||
MachineType type = MachineType.get(getStack());
|
||||
cacheTile = (TileEntityAdvancedElectricMachine) type.create();
|
||||
}
|
||||
|
||||
return cacheTile;
|
||||
}
|
||||
|
||||
@@ -313,4 +291,4 @@ public interface IFactory {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user