diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-15 07:55:35 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-08-15 07:55:35 +0100 |
commit | e7ef217244340fe6984b79815d56d9d5b72582fc (patch) | |
tree | 5ba69d85189d2c6d876c95154b7524cee2859e87 /src/Java/gtPlusPlus/nei | |
parent | 9f9b49884e9496023cd9cd66b0dfe4301f8231bf (diff) | |
download | GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.tar.gz GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.tar.bz2 GT5-Unofficial-e7ef217244340fe6984b79815d56d9d5b72582fc.zip |
+ Attempted to add a buggy NEI page for decayable dusts.
+ Added a way to disable ALL GT++ logging in the ASM config file.
+ Added recipes for Ztones covers.
% Adjusted recipes for Tiered machine covers.
% Updated GT++ debug command to toggle logging if desired. (Useful in-game).
$ Fixed bug where smart covers would lose their state.
Diffstat (limited to 'src/Java/gtPlusPlus/nei')
-rw-r--r-- | src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java | 113 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/nei/NEI_GT_Config.java | 6 |
2 files changed, 117 insertions, 2 deletions
diff --git a/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java new file mode 100644 index 0000000000..6b7f24ed37 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/DecayableRecipeHandler.java @@ -0,0 +1,113 @@ +package gtPlusPlus.nei; + +import java.awt.Rectangle; +import java.util.Collection; +import java.util.List; + +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import crazypants.enderio.gui.IconEIO; +import crazypants.enderio.machine.enchanter.GuiEnchanter; +import gtPlusPlus.core.handler.Recipes.DecayableRecipe; +import gtPlusPlus.core.item.materials.DustDecayable; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +public class DecayableRecipeHandler extends TemplateRecipeHandler { + + public String getRecipeName() { + return StatCollector.translateToLocal("gtpp.nei.decayables"); + } + + public String getGuiTexture() { + return "enderio:textures/gui/enchanter.png"; + } + + public Class<? extends GuiContainer> getGuiClass() { + return GuiEnchanter.class; + } + + public String getOverlayIdentifier() { + return "GTPP_Decayables"; + } + + public void loadTransferRects() { + this.transferRects.add(new RecipeTransferRect(new Rectangle(149, -3, 16, 16), "GTPP_Decayables", new Object[0])); + } + + public void loadCraftingRecipes(ItemStack result) { + if (result == null || !DustDecayable.class.isInstance(result.getItem())) { + return; + } + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + } + } + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if (outputId.equals(getOverlayIdentifier()) && this.getClass() == DecayableRecipeHandler.class) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + this.arecipes.add(rec); + } + } + } + else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + final List<DecayableRecipe> recipes = DecayableRecipe.mRecipes; + for (final DecayableRecipe recipe : recipes) { + if (recipe.isValid()) { + final ItemStack input = recipe.mInput.copy(); + final ItemStack output = recipe.mOutput.copy(); + final DecayableRecipeNEI rec = new DecayableRecipeNEI(input, output, recipe.mTime); + if (!rec.contains((Collection)rec.input, ingredient)) { + continue; + } + rec.setIngredientPermutation((Collection) rec.input, ingredient); + this.arecipes.add(rec); + } + }} + + public void drawExtras(int recipeIndex) { + DecayableRecipeNEI recipe = (DecayableRecipeNEI) this.arecipes.get(recipeIndex); + //GuiDraw.drawStringC(recipe.getEnchantName(), 83, 10, 8421504, false); + /* + * int cost = TileEnchanter.getEnchantmentCost(recipe.recipe, 1); if (cost > 0) + * { String s = I18n.format("container.repair.cost", new Object[]{cost}); + * GuiDraw.drawStringC(s, 83, 46, 8453920); } + */ + + IconEIO.RECIPE_BUTTON.renderIcon(149.0D, -3.0D, 16.0D, 16.0D, 0.0D, true); + } + + public class DecayableRecipeNEI extends TemplateRecipeHandler.CachedRecipe + { + private PositionedStack input; + private PositionedStack output; + + public PositionedStack getResult() { + return this.output; + } + + public DecayableRecipeNEI(final ItemStack input, final ItemStack result, final int time) { + super(); + this.input = new PositionedStack(input, 22, 24); + this.output = new PositionedStack(result, 129, 24); + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index aca6dd5662..ab949bd517 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -1,10 +1,10 @@ package gtPlusPlus.nei; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; import gregtech.api.util.CustomRecipeMap; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; -import codechicken.nei.api.IConfigureNEI; - public class NEI_GT_Config implements IConfigureNEI { public static boolean sIsAdded = true; @@ -23,6 +23,8 @@ implements IConfigureNEI { } } sIsAdded = true; + API.registerRecipeHandler(new DecayableRecipeHandler()); + API.registerUsageHandler(new DecayableRecipeHandler()); } @Override |