Basic reformat, hit once, hope never again
This commit is contained in:
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,6 +47,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@@ -56,28 +58,16 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shaped" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (this.getClass() == NEIAEShapedRecipeHandler.class) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapedRecipeHandler.class ) )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -93,14 +83,14 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -111,19 +101,19 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapedRecipe) )
|
||||
if( ( recipe instanceof ShapedRecipe ) )
|
||||
{
|
||||
CachedShapedRecipe cachedRecipe = new CachedShapedRecipe( (ShapedRecipe) recipe );
|
||||
|
||||
if ( ((ShapedRecipe) recipe).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
if( ( (ShapedRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -146,67 +136,80 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((this.isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for (PositionedStack stack : this.getIngredientStacks( recipe ))
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shaped" );
|
||||
}
|
||||
|
||||
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedShapedRecipe(ShapedRecipe recipe) {
|
||||
public CachedShapedRecipe( ShapedRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
this.setIngredients( recipe.getWidth(), recipe.getHeight(), recipe.getIngredients() );
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
public void setIngredients( int width, int height, Object[] items )
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < width; x++)
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
if ( items[(y * width + x)] != null )
|
||||
if( items[( y * width + x )] != null )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[(y * width + x)];
|
||||
IIngredient ing = (IIngredient) items[( y * width + x )];
|
||||
|
||||
try
|
||||
{
|
||||
@@ -215,35 +218,34 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapedRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
+79
-78
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,6 +47,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@@ -56,28 +58,16 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (this.getClass() == NEIAEShapelessRecipeHandler.class) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIAEShapelessRecipeHandler.class ) )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -93,14 +83,14 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( recipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -111,19 +101,19 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe recipe : recipes)
|
||||
for( IRecipe recipe : recipes )
|
||||
{
|
||||
if ( (recipe instanceof ShapelessRecipe) )
|
||||
if( ( recipe instanceof ShapelessRecipe ) )
|
||||
{
|
||||
CachedShapelessRecipe cachedRecipe = new CachedShapelessRecipe( (ShapelessRecipe) recipe );
|
||||
|
||||
if ( ((ShapelessRecipe) recipe).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
if( ( (ShapelessRecipe) recipe ).isEnabled() && cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -146,105 +136,116 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((this.isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return ( super.hasOverlay( gui, container, recipe ) ) || ( ( this.isRecipe2x2( recipe ) ) && ( RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for (PositionedStack stack : this.getIngredientStacks( recipe ))
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless" );
|
||||
}
|
||||
|
||||
public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedShapelessRecipe(ShapelessRecipe recipe) {
|
||||
public CachedShapelessRecipe( ShapelessRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getRecipeOutput(), 119, 24 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
this.setIngredients( recipe.getInput().toArray() );
|
||||
}
|
||||
|
||||
public void setIngredients(Object[] items)
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
if ( items.length > (y * 3 + x) )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[(y * 3 + x)];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18,
|
||||
6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError ignored)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIAEShapelessRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void setIngredients( Object[] items )
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for( int x = 0; x < 3; x++ )
|
||||
{
|
||||
for( int y = 0; y < 3; y++ )
|
||||
{
|
||||
if( items.length > ( y * 3 + x ) )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[( y * 3 + x )];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : ing.getItemStackSet(), 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch( RegistrationError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
catch( MissingIngredientError ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
p.generatePermutations();
|
||||
|
||||
this.result.generatePermutations();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -39,61 +40,62 @@ import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
|
||||
public NEICraftingHandler(int x, int y)
|
||||
final int offsetX;
|
||||
final int offsetY;
|
||||
|
||||
public NEICraftingHandler( int x, int y )
|
||||
{
|
||||
this.offsetX = x;
|
||||
this.offsetY = y;
|
||||
}
|
||||
|
||||
final int offsetX;
|
||||
final int offsetY;
|
||||
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift)
|
||||
public void overlayRecipe( GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift )
|
||||
{
|
||||
try
|
||||
{
|
||||
List ingredients = recipe.getIngredientStacks( recipeIndex );
|
||||
this.overlayRecipe( gui, ingredients, shift );
|
||||
}
|
||||
catch (Exception ignored)
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
catch (Error ignored)
|
||||
catch( Error ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void overlayRecipe(GuiContainer gui, List<PositionedStack> ingredients, boolean shift)
|
||||
public void overlayRecipe( GuiContainer gui, List<PositionedStack> ingredients, boolean shift )
|
||||
{
|
||||
try
|
||||
{
|
||||
NBTTagCompound recipe = new NBTTagCompound();
|
||||
|
||||
if ( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
if( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
{
|
||||
for (PositionedStack positionedStack : ingredients)
|
||||
for( PositionedStack positionedStack : ingredients )
|
||||
{
|
||||
int col = (positionedStack.relx - 25) / 18;
|
||||
int row = (positionedStack.rely - 6) / 18;
|
||||
if ( positionedStack.items != null && positionedStack.items.length > 0 )
|
||||
int col = ( positionedStack.relx - 25 ) / 18;
|
||||
int row = ( positionedStack.rely - 6 ) / 18;
|
||||
if( positionedStack.items != null && positionedStack.items.length > 0 )
|
||||
{
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots)
|
||||
for( Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots )
|
||||
{
|
||||
if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
if( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
if ( slot.getSlotIndex() == col + row * 3 )
|
||||
if( slot.getSlotIndex() == col + row * 3 )
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
List<ItemStack> list = new LinkedList<ItemStack>();
|
||||
|
||||
// prefer pure crystals.
|
||||
for (int x = 0; x < positionedStack.items.length; x++)
|
||||
for( int x = 0; x < positionedStack.items.length; x++ )
|
||||
{
|
||||
if ( Platform.isRecipePrioritized( positionedStack.items[x] ) )
|
||||
if( Platform.isRecipePrioritized( positionedStack.items[x] ) )
|
||||
{
|
||||
list.add( 0, positionedStack.items[x] );
|
||||
}
|
||||
@@ -103,7 +105,7 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack is : list)
|
||||
for( ItemStack is : list )
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
is.writeToNBT( tag );
|
||||
@@ -121,10 +123,10 @@ public class NEICraftingHandler implements IOverlayHandler
|
||||
NetworkHandler.instance.sendToServer( new PacketNEIRecipe( recipe ) );
|
||||
}
|
||||
}
|
||||
catch (Exception ignored)
|
||||
catch( Exception ignored )
|
||||
{
|
||||
}
|
||||
catch (Error ignored)
|
||||
catch( Error ignored )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
@Override
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
if ( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
|
||||
if( ( outputId.equals( "crafting" ) ) && ( this.getClass() == NEIFacadeRecipeHandler.class ) )
|
||||
{
|
||||
final List<ItemStack> facades = this.facade.getFacades();
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for ( ItemStack is : facades )
|
||||
for( ItemStack is : facades )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
|
||||
recipe.computeVisuals();
|
||||
@@ -88,9 +88,9 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
@Override
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
if ( result.getItem() == this.facade )
|
||||
if( result.getItem() == this.facade )
|
||||
{
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, result );
|
||||
recipe.computeVisuals();
|
||||
@@ -103,16 +103,16 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
List<ItemStack> facades = this.facade.getFacades();
|
||||
for ( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
for( ItemStack anchorStack : this.anchorDefinition.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
for ( ItemStack is : facades )
|
||||
for( ItemStack is : facades )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( this.facade, anchorStack, is );
|
||||
|
||||
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
if( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
if( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
this.arecipes.add( recipe );
|
||||
@@ -150,11 +150,11 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
if( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
if( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( this.getIngredientStacks( recipe ), positioner );
|
||||
@@ -164,7 +164,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
if( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
@@ -172,9 +172,9 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public boolean isRecipe2x2( int recipe )
|
||||
{
|
||||
for ( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
for( PositionedStack stack : this.getIngredientStacks( recipe ) )
|
||||
{
|
||||
if ( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
if( ( stack.relx > 43 ) || ( stack.rely > 24 ) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -202,11 +202,11 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public void setIngredients( int width, int height, Object[] items )
|
||||
{
|
||||
for ( int x = 0; x < width; x++ )
|
||||
for( int x = 0; x < width; x++ )
|
||||
{
|
||||
for ( int y = 0; y < height; y++ )
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
if ( items[( y * width + x )] != null )
|
||||
if( items[( y * width + x )] != null )
|
||||
{
|
||||
ItemStack is = (ItemStack) items[( y * width + x )];
|
||||
PositionedStack stack = new PositionedStack( is, 25 + x * 18, 6 + y * 18, false );
|
||||
@@ -231,7 +231,7 @@ public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for ( PositionedStack p : this.ingredients )
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -45,43 +43,13 @@ import appeng.api.features.IGrinderEntry;
|
||||
import appeng.client.gui.implementations.GuiGrinder;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
|
||||
public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 40, 10, 75, 16 + 10, 90, 66 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe)
|
||||
{
|
||||
super.drawForeground( recipe );
|
||||
if ( this.arecipes.size() > recipe )
|
||||
{
|
||||
CachedRecipe cr = this.arecipes.get( recipe );
|
||||
if ( cr instanceof CachedGrindStoneRecipe )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = (CachedGrindStoneRecipe) cr;
|
||||
if ( cachedRecipe.hasOptional )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( cachedRecipe.Chance );
|
||||
fr.drawString( cachedRecipe.Chance, (168 - width) / 2, 5, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( GuiText.NoSecondOutput.getLocal() );
|
||||
fr.drawString( GuiText.NoSecondOutput.getLocal(), (168 - width) / 2, 5, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
@@ -89,23 +57,11 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiGrinder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.GrindStone.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "grindstone" )) && (this.getClass() == NEIGrinderRecipeHandler.class) )
|
||||
if( ( outputId.equals( "grindstone" ) ) && ( this.getClass() == NEIGrinderRecipeHandler.class ) )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -119,11 +75,11 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.getOutput(), result ) )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -133,16 +89,16 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
for (IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
for( IGrinderEntry recipe : AEApi.instance().registries().grinder().getRecipes() )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = new CachedGrindStoneRecipe( recipe );
|
||||
|
||||
if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
|
||||
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -165,62 +121,108 @@ public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiGrinder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 40, 10, 75, 16 + 10, 90, 66 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground( int recipe )
|
||||
{
|
||||
super.drawForeground( recipe );
|
||||
if( this.arecipes.size() > recipe )
|
||||
{
|
||||
CachedRecipe cr = this.arecipes.get( recipe );
|
||||
if( cr instanceof CachedGrindStoneRecipe )
|
||||
{
|
||||
CachedGrindStoneRecipe cachedRecipe = (CachedGrindStoneRecipe) cr;
|
||||
if( cachedRecipe.hasOptional )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( cachedRecipe.Chance );
|
||||
fr.drawString( cachedRecipe.Chance, ( 168 - width ) / 2, 5, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( GuiText.NoSecondOutput.getLocal() );
|
||||
fr.drawString( GuiText.NoSecondOutput.getLocal(), ( 168 - width ) / 2, 5, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.GrindStone.getLocal();
|
||||
}
|
||||
|
||||
public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
boolean hasOptional = false;
|
||||
public String Chance;
|
||||
boolean hasOptional = false;
|
||||
|
||||
public CachedGrindStoneRecipe(IGrinderEntry recipe) {
|
||||
public CachedGrindStoneRecipe( IGrinderEntry recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.getOutput(), -30 + 107, 47 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( recipe.getOptionalOutput() != null )
|
||||
if( recipe.getOptionalOutput() != null )
|
||||
{
|
||||
this.hasOptional = true;
|
||||
this.Chance = ((int) (recipe.getOptionalChance() * 100)) + GuiText.OfSecondOutput.getLocal();
|
||||
this.Chance = ( (int) ( recipe.getOptionalChance() * 100 ) ) + GuiText.OfSecondOutput.getLocal();
|
||||
this.ingredients.add( new PositionedStack( recipe.getOptionalOutput(), -30 + 107 + 18, 47 ) );
|
||||
}
|
||||
|
||||
if ( recipe.getInput() != null )
|
||||
if( recipe.getInput() != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.getInput(), 45, 24 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIGrinderRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
+50
-47
@@ -18,10 +18,8 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -43,17 +41,13 @@ import appeng.core.localization.GuiText;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
|
||||
public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects()
|
||||
{
|
||||
@@ -61,23 +55,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
public void loadCraftingRecipes( String outputId, Object... results )
|
||||
{
|
||||
return GuiInscriber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.Inscriber.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "inscriber" )) && (this.getClass() == NEIInscriberRecipeHandler.class) )
|
||||
if( ( outputId.equals( "inscriber" ) ) && ( this.getClass() == NEIInscriberRecipeHandler.class ) )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -91,11 +73,11 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
public void loadCraftingRecipes( ItemStack result )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( recipe.output, result ) )
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( recipe.output, result ) )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
cachedRecipe.computeVisuals();
|
||||
@@ -105,16 +87,16 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
public void loadUsageRecipes( ItemStack ingredient )
|
||||
{
|
||||
for (InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
for( InscriberRecipe recipe : Inscribe.RECIPES )
|
||||
{
|
||||
CachedInscriberRecipe cachedRecipe = new CachedInscriberRecipe( recipe );
|
||||
|
||||
if ( (cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() )) )
|
||||
if( ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient.getItem() ) ) )
|
||||
{
|
||||
cachedRecipe.computeVisuals();
|
||||
if ( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
if( cachedRecipe.contains( cachedRecipe.ingredients, ingredient ) )
|
||||
{
|
||||
cachedRecipe.setIngredientPermutation( cachedRecipe.ingredients, ingredient );
|
||||
this.arecipes.add( cachedRecipe );
|
||||
@@ -137,58 +119,79 @@ public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiInscriber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( this.getGuiTexture() );
|
||||
drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.Inscriber.getLocal();
|
||||
}
|
||||
|
||||
public class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public final ArrayList<PositionedStack> ingredients;
|
||||
public final PositionedStack result;
|
||||
|
||||
public CachedInscriberRecipe(InscriberRecipe recipe) {
|
||||
public CachedInscriberRecipe( InscriberRecipe recipe )
|
||||
{
|
||||
this.result = new PositionedStack( recipe.output, 108, 29 );
|
||||
this.ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( recipe.plateA != null )
|
||||
if( recipe.plateA != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.plateA, 40, 5 ) );
|
||||
|
||||
if ( recipe.imprintable != null )
|
||||
if( recipe.imprintable != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.imprintable, 40 + 18, 28 ) );
|
||||
|
||||
if ( recipe.plateB != null )
|
||||
if( recipe.plateB != null )
|
||||
this.ingredients.add( new PositionedStack( recipe.plateB, 40, 51 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return this.getCycledIngredients( NEIInscriberRecipeHandler.this.cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
for( PositionedStack p : this.ingredients )
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -48,6 +49,7 @@ import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
|
||||
public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
{
|
||||
|
||||
@@ -57,61 +59,6 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
|
||||
private ItemStack target;
|
||||
|
||||
private void addRecipe(IItemDefinition def, String msg)
|
||||
{
|
||||
for ( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
|
||||
{
|
||||
this.offsets.add( def );
|
||||
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
|
||||
this.details.put( def, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipes()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
final String message;
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
||||
{
|
||||
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
message = GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
|
||||
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||
{
|
||||
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
{
|
||||
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
{
|
||||
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
{
|
||||
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
|
||||
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
|
||||
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
@@ -125,15 +72,15 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe)
|
||||
public void drawBackground( int recipe )
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );// nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe)
|
||||
public void drawForeground( int recipe )
|
||||
{
|
||||
if ( this.outputs.size() > recipe )
|
||||
if( this.outputs.size() > recipe )
|
||||
{
|
||||
// PositionedStack cr = this.outputs.get( recipe );
|
||||
String details = this.details.get( this.offsets.get( recipe ) );
|
||||
@@ -144,19 +91,19 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredientStacks(int recipeIndex)
|
||||
public List<PositionedStack> getIngredientStacks( int recipeIndex )
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks(int recipeIndex)
|
||||
public List<PositionedStack> getOtherStacks( int recipeIndex )
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResultStack(int recipe)
|
||||
public PositionedStack getResultStack( int recipe )
|
||||
{
|
||||
return this.outputs.get( recipe );
|
||||
}
|
||||
@@ -168,19 +115,19 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
public boolean hasOverlay( GuiContainer gui, Container container, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
public IRecipeOverlayRenderer getOverlayRenderer( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
public IOverlayHandler getOverlayHandler( GuiContainer gui, int recipe )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -192,52 +139,40 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currentToolTip, int recipe)
|
||||
public List<String> handleTooltip( GuiRecipe gui, List<String> currentToolTip, int recipe )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack stack, List<String> currentToolTip, int recipe)
|
||||
public List<String> handleItemTooltip( GuiRecipe gui, ItemStack stack, List<String> currentToolTip, int recipe )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
|
||||
public boolean keyTyped( GuiRecipe gui, char keyChar, int keyCode, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe)
|
||||
public boolean mouseClicked( GuiRecipe gui, int button, int recipe )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public NEIWorldCraftingHandler newInstance()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getClass().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUsageHandler getUsageHandler(String inputId, Object... ingredients)
|
||||
public IUsageHandler getUsageHandler( String inputId, Object... ingredients )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingHandler getRecipeHandler(String outputId, Object... results)
|
||||
public ICraftingHandler getRecipeHandler( String outputId, Object... results )
|
||||
{
|
||||
NEIWorldCraftingHandler g = this.newInstance();
|
||||
if ( results.length > 0 && results[0] instanceof ItemStack )
|
||||
if( results.length > 0 && results[0] instanceof ItemStack )
|
||||
{
|
||||
g.target = (ItemStack) results[0];
|
||||
g.addRecipes();
|
||||
@@ -246,4 +181,70 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
return this;
|
||||
}
|
||||
|
||||
public NEIWorldCraftingHandler newInstance()
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.getClass().newInstance();
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipes()
|
||||
{
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
final IMaterials materials = definitions.materials();
|
||||
|
||||
final String message;
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
||||
{
|
||||
message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
message = GuiText.ChargedQuartzFind.getLocal();
|
||||
}
|
||||
|
||||
this.addRecipe( materials.certusQuartzCrystalCharged(), message );
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||
{
|
||||
this.addRecipe( materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
this.addRecipe( materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
{
|
||||
this.addRecipe( materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
{
|
||||
this.addRecipe( materials.qESingularity(), GuiText.inWorldSingularity.getLocal() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
{
|
||||
this.addRecipe( materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() );
|
||||
this.addRecipe( materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() );
|
||||
this.addRecipe( materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipe( IItemDefinition def, String msg )
|
||||
{
|
||||
for( ItemStack definitionStack : def.maybeStack( 1 ).asSet() )
|
||||
{
|
||||
if( NEIServerUtils.areStacksSameTypeCrafting( definitionStack, this.target ) )
|
||||
{
|
||||
this.offsets.add( def );
|
||||
this.outputs.add( new PositionedStack( definitionStack, 75, 4 ) );
|
||||
this.details.put( def, msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -25,19 +26,19 @@ import codechicken.nei.api.IStackPositioner;
|
||||
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
|
||||
|
||||
public class TerminalCraftingSlotFinder implements IStackPositioner
|
||||
{
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> positionStacks(ArrayList<PositionedStack> a)
|
||||
public ArrayList<PositionedStack> positionStacks( ArrayList<PositionedStack> a )
|
||||
{
|
||||
for (PositionedStack ps : a)
|
||||
if ( ps != null )
|
||||
for( PositionedStack ps : a )
|
||||
if( ps != null )
|
||||
{
|
||||
ps.relx += GuiMEMonitorable.CraftingGridOffsetX;
|
||||
ps.rely += GuiMEMonitorable.CraftingGridOffsetY;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user