mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
The Great Reformat; moving to google-java-style w/ 4 space indent and 120 column line wrap
This commit is contained in:
1 parent
c632cc6af9
commit
e0b7ea62a4
933 files changed
+95734
-108818
No files matched your search
@@ -2,7 +2,6 @@ package mekanism.common.base;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.common.InfuseStorage;
|
||||
@@ -30,309 +29,263 @@ import net.minecraft.util.SoundEvent;
|
||||
|
||||
/**
|
||||
* Internal interface for managing various Factory types.
|
||||
* @author AidanBrady
|
||||
*
|
||||
* @author AidanBrady
|
||||
*/
|
||||
public interface IFactory
|
||||
{
|
||||
/**
|
||||
* Gets the recipe type this Smelting Factory currently has.
|
||||
* @param itemStack - stack to check
|
||||
* @return RecipeType ordinal
|
||||
*/
|
||||
public interface IFactory {
|
||||
|
||||
/**
|
||||
* Gets the recipe type this Smelting Factory currently has.
|
||||
*
|
||||
* @param itemStack - stack to check
|
||||
* @return RecipeType ordinal
|
||||
*/
|
||||
int getRecipeType(ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Sets the recipe type of this Smelting Factory to a new value.
|
||||
* @param type - RecipeType ordinal
|
||||
* @param itemStack - stack to set
|
||||
*/
|
||||
/**
|
||||
* Sets the recipe type of this Smelting Factory to a new value.
|
||||
*
|
||||
* @param type - RecipeType ordinal
|
||||
* @param itemStack - stack to set
|
||||
*/
|
||||
void setRecipeType(int type, ItemStack itemStack);
|
||||
|
||||
enum MachineFuelType {
|
||||
BASIC,
|
||||
ADVANCED,
|
||||
DOUBLE
|
||||
}
|
||||
enum MachineFuelType {
|
||||
BASIC,
|
||||
ADVANCED,
|
||||
DOUBLE
|
||||
}
|
||||
|
||||
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),
|
||||
CRUSHING("Crushing", "crusher", MachineType.CRUSHER, MachineFuelType.BASIC, false, Recipe.CRUSHER),
|
||||
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);
|
||||
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),
|
||||
CRUSHING("Crushing", "crusher", MachineType.CRUSHER, MachineFuelType.BASIC, false, Recipe.CRUSHER),
|
||||
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);
|
||||
|
||||
private String name;
|
||||
private SoundEvent sound;
|
||||
private MachineType type;
|
||||
private MachineFuelType fuelType;
|
||||
private boolean fuelSpeed;
|
||||
private Recipe recipe;
|
||||
private TileEntityAdvancedElectricMachine cacheTile;
|
||||
private String name;
|
||||
private SoundEvent sound;
|
||||
private MachineType type;
|
||||
private MachineFuelType fuelType;
|
||||
private boolean fuelSpeed;
|
||||
private Recipe recipe;
|
||||
private TileEntityAdvancedElectricMachine cacheTile;
|
||||
|
||||
public BasicMachineRecipe getRecipe(ItemStackInput input)
|
||||
{
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
RecipeType(String s, String s1, MachineType t, MachineFuelType ft, boolean b1, Recipe r) {
|
||||
name = s;
|
||||
sound = new SoundEvent(new ResourceLocation("mekanism", "tile.machine." + s1));
|
||||
type = t;
|
||||
fuelType = ft;
|
||||
fuelSpeed = b1;
|
||||
recipe = r;
|
||||
}
|
||||
|
||||
public BasicMachineRecipe getRecipe(ItemStack input)
|
||||
{
|
||||
return getRecipe(new ItemStackInput(input));
|
||||
}
|
||||
public static RecipeType getFromMachine(Block block, int meta) {
|
||||
RecipeType type = null;
|
||||
|
||||
public AdvancedMachineRecipe getRecipe(AdvancedMachineInput input)
|
||||
{
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
for (RecipeType iterType : RecipeType.values()) {
|
||||
ItemStack machineStack = iterType.getStack();
|
||||
|
||||
public AdvancedMachineRecipe getRecipe(ItemStack input, Gas gas)
|
||||
{
|
||||
return getRecipe(new AdvancedMachineInput(input, gas));
|
||||
}
|
||||
if (Block.getBlockFromItem(machineStack.getItem()) == block && machineStack.getItemDamage() == meta) {
|
||||
type = iterType;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public DoubleMachineRecipe getRecipe(DoubleMachineInput input)
|
||||
{
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public DoubleMachineRecipe getRecipe(ItemStack input, ItemStack extra)
|
||||
{
|
||||
return getRecipe(new DoubleMachineInput(input, extra));
|
||||
}
|
||||
public BasicMachineRecipe getRecipe(ItemStackInput input) {
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
|
||||
public MetallurgicInfuserRecipe getRecipe(InfusionInput input)
|
||||
{
|
||||
return RecipeHandler.getMetallurgicInfuserRecipe(input);
|
||||
}
|
||||
|
||||
public MetallurgicInfuserRecipe getRecipe(ItemStack input, InfuseStorage storage)
|
||||
{
|
||||
return getRecipe(new InfusionInput(storage, input));
|
||||
}
|
||||
public BasicMachineRecipe getRecipe(ItemStack input) {
|
||||
return getRecipe(new ItemStackInput(input));
|
||||
}
|
||||
|
||||
public MachineRecipe getAnyRecipe(ItemStack slotStack, ItemStack extraStack, Gas gasType, InfuseStorage infuse)
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getRecipe(slotStack, gasType);
|
||||
}
|
||||
else if(fuelType == MachineFuelType.DOUBLE)
|
||||
{
|
||||
return getRecipe(slotStack, extraStack);
|
||||
}
|
||||
else if(this == INFUSING)
|
||||
{
|
||||
if(infuse.type != null)
|
||||
{
|
||||
return RecipeHandler.getMetallurgicInfuserRecipe(new InfusionInput(infuse, slotStack));
|
||||
}
|
||||
else {
|
||||
for(Object obj : Recipe.METALLURGIC_INFUSER.get().entrySet())
|
||||
{
|
||||
Map.Entry entry = (Map.Entry)obj;
|
||||
InfusionInput input = (InfusionInput)entry.getKey();
|
||||
|
||||
if(input.inputStack.isItemEqual(slotStack))
|
||||
{
|
||||
return (MetallurgicInfuserRecipe)entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getRecipe(slotStack);
|
||||
}
|
||||
public AdvancedMachineRecipe getRecipe(AdvancedMachineInput input) {
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
|
||||
public GasStack getItemGas(ItemStack itemstack)
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getTile().getItemGas(itemstack);
|
||||
}
|
||||
public AdvancedMachineRecipe getRecipe(ItemStack input, Gas gas) {
|
||||
return getRecipe(new AdvancedMachineInput(input, gas));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public DoubleMachineRecipe getRecipe(DoubleMachineInput input) {
|
||||
return RecipeHandler.getRecipe(input, recipe.get());
|
||||
}
|
||||
|
||||
public int getSecondaryEnergyPerTick()
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getTile().BASE_SECONDARY_ENERGY_PER_TICK;
|
||||
}
|
||||
public DoubleMachineRecipe getRecipe(ItemStack input, ItemStack extra) {
|
||||
return getRecipe(new DoubleMachineInput(input, extra));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public MetallurgicInfuserRecipe getRecipe(InfusionInput input) {
|
||||
return RecipeHandler.getMetallurgicInfuserRecipe(input);
|
||||
}
|
||||
|
||||
public boolean canReceiveGas(EnumFacing side, Gas type)
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getTile().canReceiveGas(side, type);
|
||||
}
|
||||
public MetallurgicInfuserRecipe getRecipe(ItemStack input, InfuseStorage storage) {
|
||||
return getRecipe(new InfusionInput(storage, input));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public MachineRecipe getAnyRecipe(ItemStack slotStack, ItemStack extraStack, Gas gasType,
|
||||
InfuseStorage infuse) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getRecipe(slotStack, gasType);
|
||||
} else if (fuelType == MachineFuelType.DOUBLE) {
|
||||
return getRecipe(slotStack, extraStack);
|
||||
} else if (this == INFUSING) {
|
||||
if (infuse.type != null) {
|
||||
return RecipeHandler.getMetallurgicInfuserRecipe(new InfusionInput(infuse, slotStack));
|
||||
} else {
|
||||
for (Object obj : Recipe.METALLURGIC_INFUSER.get().entrySet()) {
|
||||
Map.Entry entry = (Map.Entry) obj;
|
||||
InfusionInput input = (InfusionInput) entry.getKey();
|
||||
|
||||
public boolean canTubeConnect(EnumFacing side)
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getTile().canTubeConnect(side);
|
||||
}
|
||||
if (input.inputStack.isItemEqual(slotStack)) {
|
||||
return (MetallurgicInfuserRecipe) entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return getRecipe(slotStack);
|
||||
}
|
||||
|
||||
public boolean isValidGas(Gas gas)
|
||||
{
|
||||
if(fuelType == MachineFuelType.ADVANCED)
|
||||
{
|
||||
return getTile().isValidGas(gas);
|
||||
}
|
||||
public GasStack getItemGas(ItemStack itemstack) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().getItemGas(itemstack);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasRecipe(ItemStack itemStack)
|
||||
{
|
||||
if(itemStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public int getSecondaryEnergyPerTick() {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().BASE_SECONDARY_ENERGY_PER_TICK;
|
||||
}
|
||||
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(StackUtils.equalsWildcard(stack, itemStack))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean canReceiveGas(EnumFacing side, Gas type) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().canReceiveGas(side, type);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasRecipeForExtra(ItemStack extraStack)
|
||||
{
|
||||
if(extraStack.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public boolean canTubeConnect(EnumFacing side) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().canTubeConnect(side);
|
||||
}
|
||||
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(StackUtils.equalsWildcard(stack, extraStack))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public boolean isValidGas(Gas gas) {
|
||||
if (fuelType == MachineFuelType.ADVANCED) {
|
||||
return getTile().isValidGas(gas);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileEntityAdvancedElectricMachine getTile()
|
||||
{
|
||||
if(cacheTile == null)
|
||||
{
|
||||
MachineType type = MachineType.get(getStack());
|
||||
cacheTile = (TileEntityAdvancedElectricMachine)type.create();
|
||||
}
|
||||
public boolean hasRecipe(ItemStack itemStack) {
|
||||
if (itemStack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cacheTile;
|
||||
}
|
||||
|
||||
public double getEnergyUsage()
|
||||
{
|
||||
return type.getUsage();
|
||||
}
|
||||
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;
|
||||
|
||||
public int getMaxSecondaryEnergy()
|
||||
{
|
||||
return 200;
|
||||
}
|
||||
if (StackUtils.equalsWildcard(stack, itemStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return type.getStack();
|
||||
}
|
||||
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getLocalizedName()
|
||||
{
|
||||
return LangUtils.localize("gui.factory." + name);
|
||||
}
|
||||
public boolean hasRecipeForExtra(ItemStack extraStack) {
|
||||
if (extraStack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public SoundEvent getSound()
|
||||
{
|
||||
return sound;
|
||||
}
|
||||
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;
|
||||
|
||||
public MachineFuelType getFuelType()
|
||||
{
|
||||
return fuelType;
|
||||
}
|
||||
|
||||
public boolean fuelEnergyUpgrades()
|
||||
{
|
||||
return fuelSpeed;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
if (StackUtils.equalsWildcard(stack, extraStack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RecipeType(String s, String s1, MachineType t, MachineFuelType ft, boolean b1, Recipe r)
|
||||
{
|
||||
name = s;
|
||||
sound = new SoundEvent(new ResourceLocation("mekanism", "tile.machine." + s1));
|
||||
type = t;
|
||||
fuelType = ft;
|
||||
fuelSpeed = b1;
|
||||
recipe = r;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public MachineType getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
public TileEntityAdvancedElectricMachine getTile() {
|
||||
if (cacheTile == null) {
|
||||
MachineType type = MachineType.get(getStack());
|
||||
cacheTile = (TileEntityAdvancedElectricMachine) type.create();
|
||||
}
|
||||
|
||||
return cacheTile;
|
||||
}
|
||||
|
||||
public double getEnergyUsage() {
|
||||
return type.getUsage();
|
||||
}
|
||||
|
||||
public int getMaxSecondaryEnergy() {
|
||||
return 200;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return type.getStack();
|
||||
}
|
||||
|
||||
public String getTranslationKey() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return LangUtils.localize("gui.factory." + name);
|
||||
}
|
||||
|
||||
public SoundEvent getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
public MachineFuelType getFuelType() {
|
||||
return fuelType;
|
||||
}
|
||||
|
||||
public boolean fuelEnergyUpgrades() {
|
||||
return fuelSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public MachineType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user