Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.integration.abstraction.IRC;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Crusher implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,16 +61,16 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RC ) )
if( AppEng.instance.isIntegrationEnabled( IntegrationType.RC ) )
{
IRC rc = (IRC) AppEng.instance.getIntegration( IntegrationType.RC );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
rc.rockCrusher( is, this.pro_output[0].getItemStack() );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "RC not happy - " + err.getMessage() );
}
@@ -77,15 +79,14 @@ public class Crusher implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -32,6 +32,7 @@ import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Grind implements ICraftHandler, IWebsiteSerializer
{
@@ -39,12 +40,12 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -57,20 +58,21 @@ public class Grind implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
AEApi.instance().registries().grinder().addRecipe( is, this.pro_output[0].getItemStack(), 8 );
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError {
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(),output );
public String getPattern( RecipeHandler h )
{
return "grind\n" +
h.getName( this.pro_input ) + '\n' +
h.getName( this.pro_output[0] );
}
@Override
public String getPattern( RecipeHandler h ) {
return "grind\n"+
h.getName(this.pro_input)+ '\n' +
h.getName(this.pro_output[0]);
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.integration.abstraction.IFZ;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class GrindFZ implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class GrindFZ implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,16 +61,16 @@ public class GrindFZ implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FZ ) )
if( AppEng.instance.isIntegrationEnabled( IntegrationType.FZ ) )
{
IFZ fz = (IFZ) AppEng.instance.getIntegration( IntegrationType.FZ );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
fz.grinderRecipe( is, this.pro_output[0].getItemStack() );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "FZ not happy - " + err.getMessage() );
}
@@ -77,15 +79,14 @@ public class GrindFZ implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.core.AELog;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class HCCrusher implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,7 +61,7 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
for (ItemStack beginStack : this.pro_input.getItemStackSet())
for( ItemStack beginStack : this.pro_input.getItemStackSet() )
{
try
{
@@ -71,15 +73,15 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
NBTTagCompound itemTo = new NBTTagCompound();
beginStack.writeToNBT( itemFrom );
endStack.writeToNBT(itemTo);
endStack.writeToNBT( itemTo );
toRegister.setTag("itemFrom", itemFrom);
toRegister.setTag("itemTo", itemTo);
toRegister.setFloat("pressureRatio", 1.0F);
toRegister.setTag( "itemFrom", itemFrom );
toRegister.setTag( "itemTo", itemTo );
toRegister.setFloat( "pressureRatio", 1.0F );
FMLInterModComms.sendMessage("HydCraft", "registerCrushingRecipe", toRegister);
FMLInterModComms.sendMessage( "HydCraft", "registerCrushingRecipe", toRegister );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "Hydraulicraft not happy - " + err.getMessage() );
}
@@ -87,15 +89,14 @@ public class HCCrusher implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,17 +18,18 @@
package appeng.recipes.handlers;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
import appeng.recipes.RecipeHandler;
public interface IWebsiteSerializer
{
String getPattern(RecipeHandler han);
boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError;
String getPattern( RecipeHandler han );
boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError;
}
@@ -34,54 +34,31 @@ import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Inscribe implements ICraftHandler, IWebsiteSerializer
{
public static class InscriberRecipe
{
public InscriberRecipe(ItemStack[] imprintable, ItemStack plateA, ItemStack plateB, ItemStack out, boolean usePlates) {
this.imprintable = imprintable;
this.usePlates = usePlates;
this.plateA = plateA;
this.plateB = plateB;
this.output = out;
}
final public boolean usePlates;
final public ItemStack plateA;
final public ItemStack[] imprintable;
final public ItemStack plateB;
final public ItemStack output;
}
public boolean usePlates = false;
public static final HashSet<ItemStack> PLATES = new HashSet<ItemStack>();
public static final HashSet<ItemStack> INPUTS = new HashSet<ItemStack>();
public static final LinkedList<InscriberRecipe> RECIPES = new LinkedList<InscriberRecipe>();
public boolean usePlates = false;
IIngredient imprintable;
IIngredient plateA;
IIngredient plateB;
IIngredient output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( output.size() == 1 && output.get( 0 ).size() == 1 )
if( output.size() == 1 && output.get( 0 ).size() == 1 )
{
if ( input.size() == 1 && input.get( 0 ).size() > 1 )
if( input.size() == 1 && input.get( 0 ).size() > 1 )
{
this.imprintable = input.get( 0 ).get( 0 );
this.plateA = input.get( 0 ).get( 1 );
if ( input.get( 0 ).size() > 2 )
if( input.get( 0 ).size() > 2 )
this.plateB = input.get( 0 ).get( 2 );
this.output = output.get( 0 ).get( 0 );
@@ -96,42 +73,59 @@ public class Inscribe implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.imprintable != null )
if( this.imprintable != null )
Collections.addAll( INPUTS, this.imprintable.getItemStackSet() );
if ( this.plateA != null )
if( this.plateA != null )
Collections.addAll( PLATES, this.plateA.getItemStackSet() );
if ( this.plateB != null )
if( this.plateB != null )
Collections.addAll( PLATES, this.plateB.getItemStackSet() );
InscriberRecipe ir = new InscriberRecipe( this.imprintable.getItemStackSet(), this.plateA == null ? null : this.plateA.getItemStack(), this.plateB == null ? null
: this.plateB.getItemStack(), this.output.getItemStack(), this.usePlates );
InscriberRecipe ir = new InscriberRecipe( this.imprintable.getItemStackSet(), this.plateA == null ? null : this.plateA.getItemStack(), this.plateB == null ? null : this.plateB.getItemStack(), this.output.getItemStack(), this.usePlates );
RECIPES.add( ir );
}
@Override
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
String o = "inscriber " + this.output.getQty() + '\n';
o += h.getName( this.output ) + '\n';
if ( this.plateA != null )
o += h.getName( this.plateA )+ '\n';
if( this.plateA != null )
o += h.getName( this.plateA ) + '\n';
o += h.getName(this.imprintable);
o += h.getName( this.imprintable );
if ( this.plateB != null )
o += '\n' +h.getName( this.plateB );
if( this.plateB != null )
o += '\n' + h.getName( this.plateB );
return o;
}
@Override
public boolean canCraft( ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
public static class InscriberRecipe
{
final public boolean usePlates;
final public ItemStack plateA;
final public ItemStack[] imprintable;
final public ItemStack plateB;
final public ItemStack output;
public InscriberRecipe( ItemStack[] imprintable, ItemStack plateA, ItemStack plateB, ItemStack out, boolean usePlates )
{
this.imprintable = imprintable;
this.usePlates = usePlates;
this.plateA = plateA;
this.plateB = plateB;
this.output = out;
}
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.integration.abstraction.IIC2;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Macerator implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,16 +61,16 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
if( AppEng.instance.isIntegrationEnabled( IntegrationType.IC2 ) )
{
IIC2 ic2 = (IIC2) AppEng.instance.getIntegration( IntegrationType.IC2 );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
ic2.maceratorRecipe( is, this.pro_output[0].getItemStack() );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "IC2 not happy - " + err.getMessage() );
}
@@ -77,15 +79,14 @@ public class Macerator implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.integration.abstraction.IMekanism;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class MekCrusher implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,16 +61,16 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
if( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
{
IMekanism rc = (IMekanism) AppEng.instance.getIntegration( IntegrationType.Mekanism );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
rc.addCrusherRecipe( is, this.pro_output[0].getItemStack() );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "Mekanism not happy - " + err.getMessage() );
}
@@ -77,15 +79,14 @@ public class MekCrusher implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -34,6 +35,7 @@ import appeng.integration.abstraction.IMekanism;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
{
@@ -41,12 +43,12 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -59,16 +61,16 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
if( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
{
IMekanism rc = (IMekanism) AppEng.instance.getIntegration( IntegrationType.Mekanism );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
try
{
rc.addEnrichmentChamberRecipe( is, this.pro_output[0].getItemStack() );
}
catch (java.lang.RuntimeException err)
catch( java.lang.RuntimeException err )
{
AELog.info( "Mekanism not happy - " + err.getMessage() );
}
@@ -77,15 +79,14 @@ public class MekEnrichment implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -29,33 +30,34 @@ import appeng.api.exceptions.RegistrationError;
import appeng.api.recipes.ICraftHandler;
import appeng.api.recipes.IIngredient;
public class OreRegistration implements ICraftHandler
{
final List<IIngredient> inputs;
final String name;
public OreRegistration(List<IIngredient> in, String out) {
public OreRegistration( List<IIngredient> in, String out )
{
this.inputs = in;
this.name = out;
}
@Override
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
}
@Override
public void register() throws RegistrationError, MissingIngredientError
{
for (IIngredient i : this.inputs)
for( IIngredient i : this.inputs )
{
for (ItemStack is : i.getItemStackSet())
for( ItemStack is : i.getItemStackSet() )
{
OreDictionary.registerOre( this.name, is );
}
}
}
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
{
}
}
@@ -18,11 +18,12 @@
package appeng.recipes.handlers;
public class Press extends Inscribe
{
public Press() {
public Press()
{
this.usePlates = true;
}
}
@@ -18,6 +18,7 @@
package appeng.recipes.handlers;
import java.util.List;
import net.minecraft.item.ItemStack;
@@ -33,6 +34,7 @@ import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Pulverizer implements ICraftHandler, IWebsiteSerializer
{
@@ -40,12 +42,12 @@ public class Pulverizer implements ICraftHandler, IWebsiteSerializer
IIngredient[] pro_output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
int outs = output.get( 0 ).size();
if ( input.get( 0 ).size() == 1 && outs == 1 )
if( input.get( 0 ).size() == 1 && outs == 1 )
{
this.pro_input = input.get( 0 ).get( 0 );
this.pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
@@ -64,7 +66,7 @@ public class Pulverizer implements ICraftHandler, IWebsiteSerializer
this.pro_output[0].getItemStack().writeToNBT( toSend.getCompoundTag( "primaryOutput" ) );
for (ItemStack is : this.pro_input.getItemStackSet())
for( ItemStack is : this.pro_input.getItemStackSet() )
{
toSend.setTag( "input", new NBTTagCompound() );
is.writeToNBT( toSend.getCompoundTag( "input" ) );
@@ -73,15 +75,14 @@ public class Pulverizer implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
return null;
}
@Override
public boolean canCraft( ItemStack output ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.pro_output[0].getItemStack(), output );
}
}
@@ -36,29 +36,29 @@ import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapedRecipe;
import appeng.util.Platform;
public class Shaped implements ICraftHandler, IWebsiteSerializer
{
List<List<IIngredient>> inputs;
IIngredient output;
private int rows;
private int cols;
List<List<IIngredient>> inputs;
IIngredient output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( output.size() == 1 && output.get( 0 ).size() == 1 )
if( output.size() == 1 && output.get( 0 ).size() == 1 )
{
this.rows = input.size();
if ( this.rows > 0 && input.size() <= 3 )
if( this.rows > 0 && input.size() <= 3 )
{
this.cols = input.get( 0 ).size();
if ( this.cols <= 3 && this.cols >= 1 )
if( this.cols <= 3 && this.cols >= 1 )
{
for (List<IIngredient> anInput : input)
for( List<IIngredient> anInput : input )
{
if ( anInput.size() != this.cols )
if( anInput.size() != this.cols )
{
throw new RecipeError( "all rows in a shaped crafting recipe must contain the same number of ingredients." );
}
@@ -83,12 +83,12 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
char first = 'A';
List<Object> args = new ArrayList<Object>();
for (int y = 0; y < this.rows; y++)
for( int y = 0; y < this.rows; y++ )
{
StringBuilder row = new StringBuilder();
for (int x = 0; x < this.cols; x++)
for( int x = 0; x < this.cols; x++ )
{
if ( this.inputs.get( y ).get( x ).isAir() )
if( this.inputs.get( y ).get( x ).isAir() )
row.append( ' ' );
else
{
@@ -108,7 +108,7 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
{
GameRegistry.addRecipe( new ShapedRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
}
catch (Throwable e)
catch( Throwable e )
{
AELog.error( e );
throw new RegistrationError( "Error while adding shaped recipe." );
@@ -116,18 +116,39 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError
public String getPattern( RecipeHandler h )
{
for (int y = 0; y < this.rows; y++)
for (int x = 0; x < this.cols; x++)
String o = "shaped " + this.output.getQty() + ' ' + this.cols + 'x' + this.rows + '\n';
o += h.getName( this.output ) + '\n';
for( int y = 0; y < this.rows; y++ )
for( int x = 0; x < this.cols; x++ )
{
IIngredient i = this.inputs.get( y ).get( x );
if ( !i.isAir() )
if( i.isAir() )
o += "air" + ( x + 1 == this.cols ? "\n" : " " );
else
o += h.getName( i ) + ( x + 1 == this.cols ? "\n" : " " );
}
return o.trim();
}
@Override
public boolean canCraft( ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
{
for( int y = 0; y < this.rows; y++ )
for( int x = 0; x < this.cols; x++ )
{
IIngredient i = this.inputs.get( y ).get( x );
if( !i.isAir() )
{
for ( ItemStack r : i.getItemStackSet() )
for( ItemStack r : i.getItemStackSet() )
{
if ( Platform.isSameItemPrecise( r, reqOutput) )
if( Platform.isSameItemPrecise( r, reqOutput ) )
return false;
}
}
@@ -135,25 +156,4 @@ public class Shaped implements ICraftHandler, IWebsiteSerializer
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
@Override
public String getPattern(RecipeHandler h)
{
String o = "shaped " + this.output.getQty() + ' ' + this.cols + 'x' + this.rows + '\n';
o += h.getName( this.output ) + '\n';
for (int y = 0; y < this.rows; y++)
for (int x = 0; x < this.cols; x++)
{
IIngredient i = this.inputs.get( y ).get( x );
if ( i.isAir() )
o += "air" + (x + 1 == this.cols ? "\n" : " ");
else
o += h.getName( i ) + (x + 1 == this.cols ? "\n" : " ");
}
return o.trim();
}
}
@@ -36,6 +36,7 @@ import appeng.recipes.RecipeHandler;
import appeng.recipes.game.ShapelessRecipe;
import appeng.util.Platform;
public class Shapeless implements ICraftHandler, IWebsiteSerializer
{
@@ -43,11 +44,11 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
IIngredient output;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( output.size() == 1 && output.get( 0 ).size() == 1 )
if( output.size() == 1 && output.get( 0 ).size() == 1 )
{
if ( input.size() == 1 )
if( input.size() == 1 )
{
this.inputs = input.get( 0 );
this.output = output.get( 0 ).get( 0 );
@@ -63,7 +64,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
public void register() throws RegistrationError, MissingIngredientError
{
List<Object> args = new ArrayList<Object>();
for (IIngredient i : this.inputs)
for( IIngredient i : this.inputs )
args.add( i );
ItemStack outIS = this.output.getItemStack();
@@ -72,7 +73,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
{
GameRegistry.addRecipe( new ShapelessRecipe( outIS, args.toArray( new Object[args.size()] ) ) );
}
catch (Throwable e)
catch( Throwable e )
{
AELog.error( e );
throw new RegistrationError( "Error while adding shapeless recipe." );
@@ -80,38 +81,17 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
}
@Override
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError
{
for (IIngredient i : this.inputs)
{
if ( !i.isAir() )
{
for (ItemStack r : i.getItemStackSet())
{
if ( Platform.isSameItemPrecise( r, reqOutput ) )
{
return false;
}
}
}
}
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
@Override
public String getPattern(RecipeHandler h)
public String getPattern( RecipeHandler h )
{
StringBuilder o = new StringBuilder( "shapeless " + this.output.getQty() + '\n' );
o.append( h.getName( this.output ) ).append( '\n' );
for (int y = 0; y < this.inputs.size(); y++)
for( int y = 0; y < this.inputs.size(); y++ )
{
IIngredient i = this.inputs.get( y );
if ( i.isAir() )
if( i.isAir() )
{
o.append( "air" );
}
@@ -120,7 +100,7 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
o.append( h.getName( i ) );
}
if ( y + 1 == this.inputs.size() )
if( y + 1 == this.inputs.size() )
{
o.append( '\n' );
}
@@ -133,4 +113,24 @@ public class Shapeless implements ICraftHandler, IWebsiteSerializer
return o.toString().trim();
}
@Override
public boolean canCraft( ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
{
for( IIngredient i : this.inputs )
{
if( !i.isAir() )
{
for( ItemStack r : i.getItemStackSet() )
{
if( Platform.isSameItemPrecise( r, reqOutput ) )
{
return false;
}
}
}
}
return Platform.isSameItemPrecise( this.output.getItemStack(), reqOutput );
}
}
@@ -33,6 +33,7 @@ import appeng.api.recipes.IIngredient;
import appeng.recipes.RecipeHandler;
import appeng.util.Platform;
public class Smelt implements ICraftHandler, IWebsiteSerializer
{
@@ -40,13 +41,13 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
IIngredient out;
@Override
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
public void setup( List<List<IIngredient>> input, List<List<IIngredient>> output ) throws RecipeError
{
if ( input.size() == 1 && output.size() == 1 )
if( input.size() == 1 && output.size() == 1 )
{
List<IIngredient> inputList = input.get( 0 );
List<IIngredient> outputList = output.get( 0 );
if ( inputList.size() == 1 && outputList.size() == 1 )
if( inputList.size() == 1 && outputList.size() == 1 )
{
this.in = inputList.get( 0 );
this.out = outputList.get( 0 );
@@ -59,24 +60,26 @@ public class Smelt implements ICraftHandler, IWebsiteSerializer
@Override
public void register() throws RegistrationError, MissingIngredientError
{
if ( this.in.getItemStack().getItem() == null )
if( this.in.getItemStack().getItem() == null )
throw new RegistrationError( this.in.toString() + ": Smelting Input is not a valid item." );
if ( this.out.getItemStack().getItem() == null )
if( this.out.getItemStack().getItem() == null )
throw new RegistrationError( this.out.toString() + ": Smelting Output is not a valid item." );
GameRegistry.addSmelting( this.in.getItemStack(), this.out.getItemStack(), 0 );
}
@Override
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError {
return Platform.isSameItemPrecise( this.out.getItemStack(),reqOutput );
public String getPattern( RecipeHandler h )
{
return "smelt " + this.out.getQty() + '\n' +
h.getName( this.out ) + '\n' +
h.getName( this.in );
}
@Override
public String getPattern( RecipeHandler h ) {
return "smelt "+this.out.getQty()+ '\n' +
h.getName(this.out)+ '\n' +
h.getName(this.in);
public boolean canCraft( ItemStack reqOutput ) throws RegistrationError, MissingIngredientError
{
return Platform.isSameItemPrecise( this.out.getItemStack(), reqOutput );
}
}