solderer NEI integration
This commit is contained in:
@@ -26,7 +26,16 @@ minecraft {
|
|||||||
runDir = "eclipse"
|
runDir = "eclipse"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name 'CB Repo'
|
||||||
|
url "http://chickenbones.net/maven/"
|
||||||
|
}
|
||||||
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
|
||||||
|
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
|
||||||
|
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.118:dev"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
@@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import storagecraft.item.ItemStorageCell;
|
import storagecraft.item.ItemStorageCell;
|
||||||
import storagecraft.proxy.CommonProxy;
|
import storagecraft.proxy.CommonProxy;
|
||||||
|
|
||||||
@Mod(modid = StorageCraft.ID, version = StorageCraft.VERSION)
|
@Mod(modid = StorageCraft.ID, version = StorageCraft.VERSION, dependencies = StorageCraft.DEPENDENCIES)
|
||||||
public class StorageCraft
|
public class StorageCraft
|
||||||
{
|
{
|
||||||
public static final class GUI
|
public static final class GUI
|
||||||
@@ -32,6 +32,7 @@ public class StorageCraft
|
|||||||
|
|
||||||
public static final String ID = "storagecraft";
|
public static final String ID = "storagecraft";
|
||||||
public static final String VERSION = "1.0";
|
public static final String VERSION = "1.0";
|
||||||
|
public static final String DEPENDENCIES = "after:NotEnoughItems";
|
||||||
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
public static final SimpleNetworkWrapper NETWORK = NetworkRegistry.INSTANCE.newSimpleChannel(ID);
|
||||||
public static final CreativeTabs TAB = new CreativeTabs(ID)
|
public static final CreativeTabs TAB = new CreativeTabs(ID)
|
||||||
{
|
{
|
||||||
|
82
src/main/java/storagecraft/nei/CraftingHandlerSolderer.java
Normal file
82
src/main/java/storagecraft/nei/CraftingHandlerSolderer.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package storagecraft.nei;
|
||||||
|
|
||||||
|
import codechicken.nei.PositionedStack;
|
||||||
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.StatCollector;
|
||||||
|
import storagecraft.StorageCraft;
|
||||||
|
import storagecraft.gui.GuiSolderer;
|
||||||
|
import storagecraft.tile.solderer.ISoldererRecipe;
|
||||||
|
import storagecraft.tile.solderer.SoldererRegistry;
|
||||||
|
|
||||||
|
public class CraftingHandlerSolderer extends TemplateRecipeHandler
|
||||||
|
{
|
||||||
|
public class SoldererRecipe extends CachedRecipe
|
||||||
|
{
|
||||||
|
private ArrayList<PositionedStack> ingredients = new ArrayList<PositionedStack>();
|
||||||
|
private PositionedStack result;
|
||||||
|
|
||||||
|
public SoldererRecipe(ISoldererRecipe recipe)
|
||||||
|
{
|
||||||
|
int x = 44 - 5;
|
||||||
|
int y = 20 - 11;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
if (recipe.getRow(i) != null)
|
||||||
|
{
|
||||||
|
this.ingredients.add(new PositionedStack(recipe.getRow(i), x, y));
|
||||||
|
}
|
||||||
|
|
||||||
|
y += 18;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.result = new PositionedStack(recipe.getResult(), 134 - 5, 38 - 11);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PositionedStack getResult()
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PositionedStack> getIngredients()
|
||||||
|
{
|
||||||
|
return ingredients;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGuiTexture()
|
||||||
|
{
|
||||||
|
return new ResourceLocation(StorageCraft.ID, "textures/gui/solderer.png").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRecipeName()
|
||||||
|
{
|
||||||
|
return StatCollector.translateToLocal("gui." + StorageCraft.ID + ":solderer");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiContainer> getGuiClass()
|
||||||
|
{
|
||||||
|
return GuiSolderer.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadCraftingRecipes(ItemStack result)
|
||||||
|
{
|
||||||
|
ISoldererRecipe recipe = SoldererRegistry.getRecipe(result);
|
||||||
|
|
||||||
|
if (recipe != null)
|
||||||
|
{
|
||||||
|
arecipes.add(new SoldererRecipe(recipe));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
28
src/main/java/storagecraft/nei/NEIConfig.java
Normal file
28
src/main/java/storagecraft/nei/NEIConfig.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package storagecraft.nei;
|
||||||
|
|
||||||
|
import codechicken.nei.api.API;
|
||||||
|
import codechicken.nei.api.IConfigureNEI;
|
||||||
|
import storagecraft.StorageCraft;
|
||||||
|
|
||||||
|
public class NEIConfig implements IConfigureNEI
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void loadConfig()
|
||||||
|
{
|
||||||
|
API.registerRecipeHandler(new CraftingHandlerSolderer());
|
||||||
|
API.registerUsageHandler(new CraftingHandlerSolderer());
|
||||||
|
// API.setGuiOffset(GuiSolderer.class, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "StorageCraft Plugin";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion()
|
||||||
|
{
|
||||||
|
return StorageCraft.VERSION;
|
||||||
|
}
|
||||||
|
}
|
@@ -3,6 +3,7 @@ package storagecraft.tile.solderer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import storagecraft.util.InventoryUtils;
|
import storagecraft.util.InventoryUtils;
|
||||||
|
|
||||||
public class SoldererRegistry
|
public class SoldererRegistry
|
||||||
@@ -44,4 +45,17 @@ public class SoldererRegistry
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ISoldererRecipe getRecipe(ItemStack result)
|
||||||
|
{
|
||||||
|
for (ISoldererRecipe recipe : recipes)
|
||||||
|
{
|
||||||
|
if (InventoryUtils.compareStack(result, recipe.getResult()))
|
||||||
|
{
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user