Relocate Source to proper directory.
This commit is contained in:
@@ -0,0 +1,227 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
|
||||
}
|
||||
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shaped", new Object[0] );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (getClass() == NEIAEShapedRecipeHandler.class) )
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapedRecipe) )
|
||||
{
|
||||
if ( ((ShapedRecipe) irecipe).isEnabled() )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe );
|
||||
recipe.computeVisuals();
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapedRecipe) )
|
||||
{
|
||||
if ( ((ShapedRecipe) irecipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( irecipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe );
|
||||
recipe.computeVisuals();
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapedRecipe) )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe );
|
||||
|
||||
if ( ((ShapedRecipe) irecipe).isEnabled() && recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
{
|
||||
for (PositionedStack stack : getIngredientStacks( recipe ))
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
public PositionedStack result;
|
||||
|
||||
public CachedShapedRecipe(ShapedRecipe irecipe) {
|
||||
result = new PositionedStack( irecipe.getRecipeOutput(), 119, 24 );
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
setIngredients( irecipe.getWidth(), irecipe.getHeight(), irecipe.getIngredients() );
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
if ( items[(y * width + x)] != null )
|
||||
{
|
||||
IIngredient ing = (IIngredient) items[(y * width + x)];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPreferred( is ) : is, 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError e)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients( cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
|
||||
}
|
||||
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return NEIClientUtils.translate( "recipe.shapeless", new Object[0] );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (getClass() == NEIAEShapelessRecipeHandler.class) )
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapelessRecipe) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) irecipe).isEnabled() )
|
||||
{
|
||||
CachedShapelessRecipe recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe );
|
||||
recipe.computeVisuals();
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapelessRecipe) )
|
||||
{
|
||||
if ( ((ShapelessRecipe) irecipe).isEnabled() && NEIServerUtils.areStacksSameTypeCrafting( irecipe.getRecipeOutput(), result ) )
|
||||
{
|
||||
CachedShapelessRecipe recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe );
|
||||
recipe.computeVisuals();
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (IRecipe irecipe : allrecipes)
|
||||
{
|
||||
if ( (irecipe instanceof ShapelessRecipe) )
|
||||
{
|
||||
CachedShapelessRecipe recipe = new CachedShapelessRecipe( (ShapelessRecipe) irecipe );
|
||||
|
||||
if ( ((ShapelessRecipe) irecipe).isEnabled() && recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
{
|
||||
for (PositionedStack stack : getIngredientStacks( recipe ))
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public class CachedShapelessRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
public PositionedStack result;
|
||||
|
||||
public CachedShapelessRecipe(ShapelessRecipe irecipe) {
|
||||
result = new PositionedStack( irecipe.getRecipeOutput(), 119, 24 );
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
setIngredients( irecipe.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 e)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients( cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
p.generatePermutations();
|
||||
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public class NEICraftingHandler implements IOverlayHandler
|
||||
{
|
||||
|
||||
public NEICraftingHandler(int x, int y)
|
||||
{
|
||||
offsetx = x;
|
||||
offsety = y;
|
||||
}
|
||||
|
||||
int offsetx;
|
||||
int offsety;
|
||||
|
||||
@Override
|
||||
public void overlayRecipe(GuiContainer gui, IRecipeHandler recipe, int recipeIndex, boolean shift)
|
||||
{
|
||||
try
|
||||
{
|
||||
List ingredients = recipe.getIngredientStacks( recipeIndex );
|
||||
overlayRecipe( gui, ingredients, shift );
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
catch (Error err)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void overlayRecipe(GuiContainer gui, List<PositionedStack> ingredients, boolean shift)
|
||||
{
|
||||
try
|
||||
{
|
||||
NBTTagCompound recipe = new NBTTagCompound();
|
||||
|
||||
if ( gui instanceof GuiCraftingTerm || gui instanceof GuiPatternTerm )
|
||||
{
|
||||
for (int i = 0; i < ingredients.size(); i++)// identify slots
|
||||
{
|
||||
PositionedStack pstack = ingredients.get( i );
|
||||
int col = (pstack.relx - 25) / 18;
|
||||
int row = (pstack.rely - 6) / 18;
|
||||
if ( pstack.items != null && pstack.items.length > 0 )
|
||||
{
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots)
|
||||
{
|
||||
if ( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
Slot ctSlot = (Slot) slot;
|
||||
if ( ctSlot.getSlotIndex() == col + row * 3 )
|
||||
{
|
||||
NBTTagList ilist = new NBTTagList();
|
||||
List<ItemStack> list = new LinkedList();
|
||||
|
||||
// prefer pure crystals.
|
||||
for (int x = 0; x < pstack.items.length; x++)
|
||||
{
|
||||
if ( Platform.isRecipePrioritized( pstack.items[x] ) )
|
||||
list.add( 0, pstack.items[x] );
|
||||
else
|
||||
list.add( pstack.items[x] );
|
||||
}
|
||||
|
||||
for (ItemStack is : list)
|
||||
{
|
||||
NBTTagCompound inbt = new NBTTagCompound();
|
||||
is.writeToNBT( inbt );
|
||||
ilist.appendTag( inbt );
|
||||
}
|
||||
|
||||
recipe.setTag( "#" + ctSlot.getSlotIndex(), ilist );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NetworkHandler.instance.sendToServer( new PacketNEIRecipe( recipe ) );
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
}
|
||||
catch (Error err)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIFacadeRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
final ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item();
|
||||
final ItemStack cable_anchor = AEApi.instance().parts().partCableAnchor.stack( 1 );
|
||||
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "crafting", new Object[0] ) );
|
||||
}
|
||||
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiCrafting.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.FacadeCrafting.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "crafting" )) && (getClass() == NEIFacadeRecipeHandler.class) )
|
||||
{
|
||||
ItemFacade ifa = (ItemFacade) AEApi.instance().items().itemFacade.item();
|
||||
List<ItemStack> facades = ifa.getFacades();
|
||||
for (ItemStack is : facades)
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( is );
|
||||
recipe.computeVisuals();
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
if ( result.getItem() == ifa )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( result );
|
||||
recipe.computeVisuals();
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
List<ItemStack> facades = ifa.getFacades();
|
||||
for (ItemStack is : facades)
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( is );
|
||||
|
||||
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuiTexture()
|
||||
{
|
||||
return "textures/gui/container/crafting_table.png";
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "crafting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return (super.hasOverlay( gui, container, recipe )) || ((isRecipe2x2( recipe )) && (RecipeInfo.hasDefaultOverlay( gui, "crafting2x2" )));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
return renderer;
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
return null;
|
||||
|
||||
return new DefaultOverlayRenderer( getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
return handler;
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
public boolean isRecipe2x2(int recipe)
|
||||
{
|
||||
for (PositionedStack stack : getIngredientStacks( recipe ))
|
||||
{
|
||||
if ( (stack.relx > 43) || (stack.rely > 24) )
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public class CachedShapedRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
public PositionedStack result;
|
||||
|
||||
public CachedShapedRecipe(ItemStack output) {
|
||||
output.stackSize = 4;
|
||||
result = new PositionedStack( output, 119, 24 );
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
ItemStack in = ifa.getTextureItem( output );
|
||||
setIngredients( 3, 3, new Object[] { null, cable_anchor, null, cable_anchor, in, cable_anchor, null, cable_anchor, null } );
|
||||
}
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
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 );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients( cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.client.gui.implementations.GuiGrinder;
|
||||
import appeng.core.localization.GuiText;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIGrinderRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( 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 cgsr = (CachedGrindStoneRecipe) cr;
|
||||
if ( cgsr.hasOptional )
|
||||
{
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
int width = fr.getStringWidth( cgsr.Chance );
|
||||
fr.drawString( cgsr.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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "grindstone", new Object[0] ) );
|
||||
}
|
||||
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiGrinder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.GrindStone.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "grindstone" )) && (getClass() == NEIGrinderRecipeHandler.class) )
|
||||
{
|
||||
for (IGrinderEntry irecipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
{
|
||||
CachedGrindStoneRecipe recipe = new CachedGrindStoneRecipe( irecipe );
|
||||
if ( recipe != null )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (IGrinderEntry irecipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( irecipe.getOutput(), result ) )
|
||||
{
|
||||
CachedGrindStoneRecipe recipe = new CachedGrindStoneRecipe( irecipe );
|
||||
recipe.computeVisuals();
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (IGrinderEntry irecipe : AEApi.instance().registries().grinder().getRecipes())
|
||||
{
|
||||
CachedGrindStoneRecipe recipe = new CachedGrindStoneRecipe( irecipe );
|
||||
|
||||
if ( (recipe != null) && (recipe.contains( recipe.ingredients, ingredient.getItem() )) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuiTexture()
|
||||
{
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/grinder.png" );
|
||||
String f = loc.toString();
|
||||
return f;
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "grindstone";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public class CachedGrindStoneRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
public PositionedStack result;
|
||||
|
||||
boolean hasOptional = false;
|
||||
public String Chance;
|
||||
|
||||
public CachedGrindStoneRecipe(IGrinderEntry irecipe) {
|
||||
result = new PositionedStack( irecipe.getOutput(), -30 + 107, 47 );
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( irecipe.getOptionalOutput() != null )
|
||||
{
|
||||
hasOptional = true;
|
||||
Chance = ((int) (irecipe.getOptionalChance() * 100)) + GuiText.OfSecondOutput.getLocal();
|
||||
ingredients.add( new PositionedStack( irecipe.getOptionalOutput(), -30 + 107 + 18, 47 ) );
|
||||
}
|
||||
|
||||
if ( irecipe.getInput() != null )
|
||||
ingredients.add( new PositionedStack( irecipe.getInput(), 45, 24 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients( cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
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.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInscriber;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Inscribe.InscriberRecipe;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public class NEIInscriberRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );
|
||||
changeTexture( getGuiTexture() );
|
||||
drawTexturedModalRect( 0, 0, 5, 11, 166, 75 );
|
||||
}
|
||||
|
||||
public void loadTransferRects()
|
||||
{
|
||||
this.transferRects.add( new TemplateRecipeHandler.RecipeTransferRect( new Rectangle( 84, 23, 24, 18 ), "inscriber", new Object[0] ) );
|
||||
}
|
||||
|
||||
public Class<? extends GuiContainer> getGuiClass()
|
||||
{
|
||||
return GuiInscriber.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.Inscriber.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results)
|
||||
{
|
||||
if ( (outputId.equals( "inscriber" )) && (getClass() == NEIInscriberRecipeHandler.class) )
|
||||
{
|
||||
for (InscriberRecipe irecipe : Inscribe.recipes)
|
||||
{
|
||||
CachedInscriberRecipe recipe = new CachedInscriberRecipe( irecipe );
|
||||
if ( recipe != null )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.loadCraftingRecipes( outputId, results );
|
||||
}
|
||||
}
|
||||
|
||||
public void loadCraftingRecipes(ItemStack result)
|
||||
{
|
||||
for (InscriberRecipe irecipe : Inscribe.recipes)
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( irecipe.output, result ) )
|
||||
{
|
||||
CachedInscriberRecipe recipe = new CachedInscriberRecipe( irecipe );
|
||||
recipe.computeVisuals();
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient)
|
||||
{
|
||||
for (InscriberRecipe irecipe : Inscribe.recipes)
|
||||
{
|
||||
CachedInscriberRecipe recipe = new CachedInscriberRecipe( irecipe );
|
||||
|
||||
if ( (recipe != null) && (recipe.contains( recipe.ingredients, ingredient.getItem() )) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
if ( recipe.contains( recipe.ingredients, ingredient ) )
|
||||
{
|
||||
recipe.setIngredientPermutation( recipe.ingredients, ingredient );
|
||||
this.arecipes.add( recipe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getGuiTexture()
|
||||
{
|
||||
ResourceLocation loc = new ResourceLocation( "appliedenergistics2", "textures/guis/inscriber.png" );
|
||||
String f = loc.toString();
|
||||
return f;
|
||||
}
|
||||
|
||||
public String getOverlayIdentifier()
|
||||
{
|
||||
return "inscriber";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public class CachedInscriberRecipe extends TemplateRecipeHandler.CachedRecipe
|
||||
{
|
||||
|
||||
public ArrayList<PositionedStack> ingredients;
|
||||
public PositionedStack result;
|
||||
|
||||
public CachedInscriberRecipe(InscriberRecipe irecipe) {
|
||||
result = new PositionedStack( irecipe.output, 108, 29 );
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
|
||||
if ( irecipe.plateA != null )
|
||||
ingredients.add( new PositionedStack( irecipe.plateA, 40, 5 ) );
|
||||
|
||||
if ( irecipe.imprintable != null )
|
||||
ingredients.add( new PositionedStack( irecipe.imprintable, 40 + 18, 28 ) );
|
||||
|
||||
if ( irecipe.plateB != null )
|
||||
ingredients.add( new PositionedStack( irecipe.plateB, 40, 51 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients()
|
||||
{
|
||||
return getCycledIngredients( cycleticks / 20, this.ingredients );
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult()
|
||||
{
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public void computeVisuals()
|
||||
{
|
||||
for (PositionedStack p : this.ingredients)
|
||||
{
|
||||
p.generatePermutations();
|
||||
}
|
||||
this.result.generatePermutations();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.IUsageHandler;
|
||||
|
||||
public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
||||
{
|
||||
|
||||
HashMap<AEItemDefinition, String> details = new HashMap<AEItemDefinition, String>();
|
||||
List<AEItemDefinition> offsets = new LinkedList();
|
||||
List<PositionedStack> outputs = new LinkedList();
|
||||
|
||||
ItemStack target;
|
||||
|
||||
private void addRecipe(AEItemDefinition def, String msg)
|
||||
{
|
||||
if ( NEIServerUtils.areStacksSameTypeCrafting( def.stack( 1 ), target ) )
|
||||
{
|
||||
offsets.add( def );
|
||||
outputs.add( new PositionedStack( def.stack( 1 ), 75, 4 ) );
|
||||
details.put( def, msg );
|
||||
}
|
||||
}
|
||||
|
||||
private void addRecipes()
|
||||
{
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.CertusQuartzWorldGen ) )
|
||||
addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged,
|
||||
GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal() );
|
||||
else
|
||||
addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged, GuiText.ChargedQuartzFind.getLocal() );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.MeteoriteWorldGen ) )
|
||||
{
|
||||
addRecipe( AEApi.instance().materials().materialLogicProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
|
||||
addRecipe( AEApi.instance().materials().materialCalcProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
|
||||
addRecipe( AEApi.instance().materials().materialEngProcessorPress, GuiText.inWorldCraftingPresses.getLocal() );
|
||||
}
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldFluix ) )
|
||||
addRecipe( AEApi.instance().materials().materialFluixCrystal, GuiText.inWorldFluix.getLocal() );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldSingularity ) )
|
||||
addRecipe( AEApi.instance().materials().materialQESingularity, GuiText.inWorldSingularity.getLocal() );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.inWorldPurification ) )
|
||||
{
|
||||
addRecipe( AEApi.instance().materials().materialPurifiedCertusQuartzCrystal, GuiText.inWorldPurificationCertus.getLocal() );
|
||||
addRecipe( AEApi.instance().materials().materialPurifiedNetherQuartzCrystal, GuiText.inWorldPurificationNether.getLocal() );
|
||||
addRecipe( AEApi.instance().materials().materialPurifiedFluixCrystal, GuiText.inWorldPurificationFluix.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName()
|
||||
{
|
||||
return GuiText.InWorldCrafting.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int numRecipes()
|
||||
{
|
||||
return offsets.size();
|
||||
}
|
||||
|
||||
public void drawBackground(int recipe)
|
||||
{
|
||||
GL11.glColor4f( 1, 1, 1, 1 );// nothing.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe)
|
||||
{
|
||||
if ( this.outputs.size() > recipe )
|
||||
{
|
||||
// PositionedStack cr = this.outputs.get( recipe );
|
||||
String details = this.details.get( this.offsets.get( recipe ) );
|
||||
|
||||
FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
|
||||
fr.drawSplitString( details, 10, 25, 150, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredientStacks(int recipe)
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks(int recipetype)
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResultStack(int recipe)
|
||||
{
|
||||
return outputs.get( recipe );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe)
|
||||
{
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiRecipe gui, ItemStack stack, List<String> currenttip, int recipe)
|
||||
{
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public NEIWorldCraftingHandler newInstance()
|
||||
{
|
||||
try
|
||||
{
|
||||
return getClass().newInstance();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUsageHandler getUsageHandler(String inputId, Object... ingredients)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingHandler getRecipeHandler(String outputId, Object... results)
|
||||
{
|
||||
NEIWorldCraftingHandler g = newInstance();
|
||||
if ( results.length > 0 && results[0] instanceof ItemStack )
|
||||
{
|
||||
g.target = (ItemStack) results[0];
|
||||
g.addRecipes();
|
||||
return g;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package appeng.integration.modules.NEIHelpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
|
||||
public class TerminalCraftingSlotFinder implements IStackPositioner
|
||||
{
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> positionStacks(ArrayList<PositionedStack> a)
|
||||
{
|
||||
for (PositionedStack ps : a)
|
||||
if ( ps != null )
|
||||
{
|
||||
ps.relx += GuiMEMonitorable.CraftingGridOffsetX;
|
||||
ps.rely += GuiMEMonitorable.CraftingGridOffsetY;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user