mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-24 22:14:29 +00:00
Unified build script (#175)
* Update build script * Update build script to import fix for shadow in dev and sources artifacts * Update fixed build script to shadow csv dependency in dev jar as well * Moved jitpack * Move new files
This commit is contained in:
1 parent
43b71b1de6
commit
a7ca6c8527
188 files changed
+646
-968
No files matched your search
@@ -0,0 +1,134 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiFurnace;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
public class SmeltingPair extends CachedRecipe
|
||||
{
|
||||
public SmeltingPair(ItemStack ingred, ItemStack result) {
|
||||
ingred.stackSize = 1;
|
||||
this.ingred = new PositionedStack(ingred, 51, 6);
|
||||
this.result = new PositionedStack(result, 111, 24);
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public PositionedStack getOtherStack() {
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
final PositionedStack ingred;
|
||||
final PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair {
|
||||
public FuelPair(ItemStack ingred, int burnTime) {
|
||||
this.stack = new PositionedStack(ingred, 51, 42, false);
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public final PositionedStack stack;
|
||||
public final int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(50, 23, 18, 18), "fuel"));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 24, 18), "smelting"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass() {
|
||||
return GuiFurnace.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return NEIClientUtils.translate("recipe.furnace");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
// Use the non parallel version since we might already be using the forkJoinPool and might have no threads available
|
||||
// This will ideally have been pre-cached elsewhere and will be a NOOP
|
||||
findFuelsOnce();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
if (outputId.equals("smelting") && getClass() == FurnaceRecipeHandler.class) {//don't want subclasses getting a hold of this
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.smelting().getSmeltingList();
|
||||
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue()));
|
||||
} else
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.smelting().getSmeltingList();
|
||||
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if (NEIServerUtils.areStacksSameType(recipe.getValue(), result))
|
||||
arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
if (inputId.equals("fuel") && getClass() == FurnaceRecipeHandler.class)//don't want subclasses getting a hold of this
|
||||
loadCraftingRecipes("smelting");
|
||||
else
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.smelting().getSmeltingList();
|
||||
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) {
|
||||
SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Collections.singletonList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return "textures/gui/container/furnace.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
drawProgressBar(51, 25, 176, 0, 14, 14, 48, 7);
|
||||
drawProgressBar(74, 23, 176, 14, 24, 16, 48, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier() {
|
||||
return "smelting";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user