Added Facade Crafting to NEI.
Also added some helpful text to charged quartz, and meteorite presses.
This commit is contained in:
parent
35fc4a7ef2
commit
e3c5c9545a
5 changed files with 220 additions and 2 deletions
|
@ -48,7 +48,7 @@ public enum GuiText
|
|||
|
||||
InterfaceTerminalHint, Range, TransparentFacades, TransparentFacadesHint,
|
||||
|
||||
NoCraftingJobs, CPUs;
|
||||
NoCraftingJobs, CPUs, FacadeCrafting, inWorldCraftingPresses, ChargedQuartzFind;
|
||||
|
||||
String root;
|
||||
|
||||
|
|
|
@ -14,12 +14,15 @@ import net.minecraft.item.ItemStack;
|
|||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.INEI;
|
||||
import appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEICraftingHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler;
|
||||
import appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler;
|
||||
|
@ -64,6 +67,9 @@ public class NEI extends BaseModule implements IIntegrationModule, INEI, IContai
|
|||
registerRecipeHandler( new NEIWorldCraftingHandler() );
|
||||
registerRecipeHandler( new NEIGrinderRecipeHandler() );
|
||||
|
||||
if ( AEConfig.instance.isFeatureEnabled( AEFeature.Facades ) && AEConfig.instance.isFeatureEnabled( AEFeature.enableFacadeCrafting ) )
|
||||
registerRecipeHandler( new NEIFacadeRecipeHandler() );
|
||||
|
||||
// large stack tooltips
|
||||
GuiContainerManager.addTooltipHandler( this );
|
||||
|
||||
|
|
194
integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java
Normal file
194
integration/modules/NEIHelpers/NEIFacadeRecipeHandler.java
Normal file
|
@ -0,0 +1,194 @@
|
|||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,19 @@ public class NEIWorldCraftingHandler implements ICraftingHandler, IUsageHandler
|
|||
|
||||
private void addRecipes()
|
||||
{
|
||||
addRecipe( AEApi.instance().materials().materialCertusQuartzCrystalCharged, GuiText.ChargedQuartz.getLocal() );
|
||||
|
||||
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() );
|
||||
|
|
|
@ -67,6 +67,12 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||
|
||||
List<ItemStack> subTypes = null;
|
||||
|
||||
public List<ItemStack> getFacades()
|
||||
{
|
||||
calculateSubTypes();
|
||||
return subTypes;
|
||||
}
|
||||
|
||||
public ItemStack getCreativeTabIcon()
|
||||
{
|
||||
calculateSubTypes();
|
||||
|
|
Loading…
Reference in a new issue