aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java18
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java88
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java40
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java165
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java13
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java2
-rw-r--r--src/main/resources/assets/notenoughupdates/textures/gui/item_shop_recipe.pngbin0 -> 9371 bytes
11 files changed, 328 insertions, 18 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
index 6572431b..733a34ec 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java
@@ -436,6 +436,10 @@ public class NEUManager {
for (Ingredient input : recipe.getIngredients()) {
usagesMap.computeIfAbsent(input.getInternalItemId(), ignored -> new HashSet<>()).add(recipe);
}
+ for (Ingredient catalystItem : recipe.getCatalystItems()) {
+ recipesMap.computeIfAbsent(catalystItem.getInternalItemId(), ignored -> new HashSet<>()).add(recipe);
+ usagesMap.computeIfAbsent(catalystItem.getInternalItemId(), ignored -> new HashSet<>()).add(recipe);
+ }
}
public Set<NeuRecipe> getRecipesFor(String internalName) {
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 6b2fd09e..312158d5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -25,6 +25,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns;
import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager;
import io.github.moulberry.notenoughupdates.miscfeatures.MiningStuff;
import io.github.moulberry.notenoughupdates.miscfeatures.NPCRetexturing;
+import io.github.moulberry.notenoughupdates.miscfeatures.Navigation;
import io.github.moulberry.notenoughupdates.miscfeatures.NullzeeSphere;
import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
@@ -138,6 +139,7 @@ public class NotEnoughUpdates {
public NEUManager manager;
public NEUOverlay overlay;
public NEUConfig config;
+ public Navigation navigation = new Navigation(this);
public GuiScreen openGui = null;
public long lastOpenedGui = 0;
public Commands commands;
@@ -236,6 +238,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(new ItemTooltipListener(this));
MinecraftForge.EVENT_BUS.register(new RenderListener(this));
MinecraftForge.EVENT_BUS.register(new OldAnimationChecker());
+ MinecraftForge.EVENT_BUS.register(navigation);
if (Minecraft.getMinecraft().getResourceManager() instanceof IReloadableResourceManager) {
IReloadableResourceManager manager = (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager();
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
index 0392c32f..9f256d65 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/itemeditor/NEUItemEditor.java
@@ -14,7 +14,11 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.*;
+import net.minecraft.nbt.JsonToNBT;
+import net.minecraft.nbt.NBTException;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -27,7 +31,11 @@ import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
-import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.*;
+import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.COLOUR;
+import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.FORCE_CAPS;
+import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.MULTILINE;
+import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.NO_SPACE;
+import static io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField.NUM_ONLY;
public class NEUItemEditor extends GuiScreen {
private final NEUManager manager;
@@ -52,6 +60,7 @@ public class NEUItemEditor extends GuiScreen {
private final Supplier<String> clickcommand;
private final Supplier<String> damage;
private NBTTagCompound nbttag;
+ private boolean hasChanges = false;
public NEUItemEditor(NEUManager manager, String internalname, JsonObject item) {
this.manager = manager;
@@ -295,6 +304,11 @@ public class NEUItemEditor extends GuiScreen {
@Override
protected void keyTyped(char typedChar, int keyCode) {
+ if (keyCode == Keyboard.KEY_ESCAPE && !hasChanges) {
+ Minecraft.getMinecraft().displayGuiScreen(null);
+ return;
+ }
+
for (GuiElement gui : options) {
gui.keyTyped(typedChar, keyCode);
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
new file mode 100644
index 00000000..86b129c7
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/Navigation.java
@@ -0,0 +1,88 @@
+package io.github.moulberry.notenoughupdates.miscfeatures;
+
+import com.google.gson.JsonObject;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+
+public class Navigation {
+
+ private NotEnoughUpdates neu;
+
+ public Navigation(NotEnoughUpdates notEnoughUpdates) {
+ neu = notEnoughUpdates;
+ }
+
+ /* JsonObject (x,y,z,island,displayname) */
+ private JsonObject currentlyTrackedWaypoint = null;
+ private BlockPos position = null;
+ private String island = null;
+ private String displayName = null;
+
+ public void trackWaypoint(JsonObject trackNow) {
+ if (trackNow != null && (
+ !trackNow.has("x")
+ || !trackNow.has("y")
+ || !trackNow.has("z")
+ || !trackNow.has("island")
+ || !trackNow.has("displayname"))) {
+ showError("Could not track waypoint. This is likely due to an outdated or broken repository.");
+ return;
+ }
+ currentlyTrackedWaypoint = trackNow;
+ updateData();
+ }
+
+ public void untrackWaypoint() {
+ trackWaypoint(null);
+ }
+
+ public JsonObject getTrackedWaypoint() {
+ return currentlyTrackedWaypoint;
+ }
+
+ public String getIsland() {
+ return island;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public BlockPos getPosition() {
+ return position;
+ }
+
+ private void updateData() {
+ if (currentlyTrackedWaypoint == null) {
+ position = null;
+ island = null;
+ displayName = null;
+ }
+ position = new BlockPos(
+ currentlyTrackedWaypoint.get("x").getAsDouble(),
+ currentlyTrackedWaypoint.get("y").getAsDouble(),
+ currentlyTrackedWaypoint.get("z").getAsDouble()
+ );
+ island = currentlyTrackedWaypoint.get("island").getAsString();
+ displayName = currentlyTrackedWaypoint.get("displayname").getAsString();
+ }
+
+ private void showError(String message) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(EnumChatFormatting.DARK_RED +
+ "[NEU-Waypoint] " + message);
+ new RuntimeException("[NEU-Waypoint] " + message).printStackTrace();
+ }
+
+ @SubscribeEvent
+ public void onRenderLast(RenderWorldLastEvent event) {
+ if (currentlyTrackedWaypoint != null && island.equals(SBInfo.getInstance().mode)) {
+ RenderUtils.renderWayPoint(displayName, position, event.partialTicks);
+ }
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
index be9ce6c7..7487ad61 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -8,6 +8,7 @@ import io.github.moulberry.notenoughupdates.recipes.RecipeType;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
@@ -22,8 +23,11 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
-import java.util.*;
+import java.util.Map;
public class GuiItemRecipe extends GuiScreen {
public static final ResourceLocation resourcePacksTexture = new ResourceLocation("textures/gui/resource_packs.png");
@@ -68,6 +72,13 @@ public class GuiItemRecipe extends GuiScreen {
}
}
+ @Override
+ public void initGui() {
+ this.guiLeft = (width - this.xSize) / 2;
+ this.guiTop = (height - this.ySize) / 2;
+ changeRecipe(0, 0);
+ }
+
public NeuRecipe getCurrentRecipe() {
List<NeuRecipe> currentRecipes = getCurrentRecipeList();
currentIndex = MathHelper.clamp_int(currentIndex, 0, currentRecipes.size() - 1);
@@ -84,8 +95,8 @@ public class GuiItemRecipe extends GuiScreen {
}
public boolean isWithinRect(int x, int y, int topLeftX, int topLeftY, int width, int height) {
- return topLeftX <= x && x <= topLeftX + width
- && topLeftY <= y && y <= topLeftY + height;
+ return topLeftX <= x && x < topLeftX + width
+ && topLeftY <= y && y < topLeftY + height;
}
private ImmutableList<RecipeSlot> getAllRenderedSlots() {
@@ -99,9 +110,6 @@ public class GuiItemRecipe extends GuiScreen {
drawDefaultBackground();
FontRenderer fontRendererObj = Minecraft.getMinecraft().fontRendererObj;
- this.guiLeft = (width - this.xSize) / 2;
- this.guiTop = (height - this.ySize) / 2;
-
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
NeuRecipe currentRecipe = getCurrentRecipe();
@@ -131,7 +139,7 @@ public class GuiItemRecipe extends GuiScreen {
);
currentRecipe.drawExtraInfo(this, mouseX, mouseY);
-
+ super.drawScreen(mouseX, mouseY, partialTicks);
for (RecipeSlot slot : slots) {
if (isWithinRect(mouseX, mouseY, slot.getX(this), slot.getY(this), SLOT_SIZE, SLOT_SIZE)) {
if (slot.getItemStack() == null) continue;
@@ -292,6 +300,18 @@ public class GuiItemRecipe extends GuiScreen {
}
}
+ public void changeRecipe(int tabIndex, int recipeIndex) {
+ buttonList.removeAll(getCurrentRecipe().getExtraButtons(this));
+ currentTab = tabIndex;
+ currentIndex = recipeIndex;
+ buttonList.addAll(getCurrentRecipe().getExtraButtons(this));
+ }
+
+ @Override
+ protected void actionPerformed(GuiButton p_actionPerformed_1_) throws IOException {
+ getCurrentRecipe().actionPerformed(p_actionPerformed_1_);
+ }
+
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
@@ -310,7 +330,7 @@ public class GuiItemRecipe extends GuiScreen {
BUTTON_HEIGHT
) &&
currentIndex > 0) {
- currentIndex = currentIndex - 1;
+ changeRecipe(currentTab, currentIndex - 1);
Utils.playPressSound();
return;
}
@@ -324,7 +344,7 @@ public class GuiItemRecipe extends GuiScreen {
BUTTON_HEIGHT
) &&
currentIndex < getCurrentRecipeList().size()) {
- currentIndex = currentIndex + 1;
+ changeRecipe(currentTab, currentIndex + 1);
Utils.playPressSound();
return;
}
@@ -338,7 +358,7 @@ public class GuiItemRecipe extends GuiScreen {
TAB_SIZE_X,
TAB_SIZE_Y
)) {
- currentTab = i;
+ changeRecipe(i, currentIndex);
Utils.playPressSound();
return;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java
new file mode 100644
index 00000000..ab497f72
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/ItemShopRecipe.java
@@ -0,0 +1,165 @@
+package io.github.moulberry.notenoughupdates.recipes;
+
+import com.google.common.collect.Sets;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
+import io.github.moulberry.notenoughupdates.util.JsonUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import scala.actors.threadpool.Arrays;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class ItemShopRecipe implements NeuRecipe {
+ public static ResourceLocation BACKGROUND = new ResourceLocation(
+ "notenoughupdates",
+ "textures/gui/item_shop_recipe.png"
+ );
+
+ private static final int SLOT_IMAGE_U = 176;
+ private static final int SLOT_IMAGE_V = 0;
+ private static final int SLOT_IMAGE_SIZE = 18;
+ public static final int RESULT_SLOT_Y = 66;
+ public static final int RESULT_SLOT_X = 124;
+
+ public static final int BUTTON_X = 20;
+ public static final int BUTTON_Y = 100;
+ private final List<Ingredient> cost;
+ private final Ingredient result;
+
+ private final Ingredient npcIngredient;
+ private final JsonObject npcObject;
+ private final GuiButton trackButton = new GuiButton(0, 80, 36, 65, 15, "Uninitialized");
+
+ public ItemShopRecipe(Ingredient npcIngredient, List<Ingredient> cost, Ingredient result, JsonObject npcObject) {
+ this.npcIngredient = npcIngredient;
+ this.cost = cost;
+ this.result = result;
+ this.npcObject = npcObject;
+ }
+
+ @Override
+ public Set<Ingredient> getCatalystItems() {
+ return Sets.newHashSet(npcIngredient);
+ }
+
+ @Override
+ public Set<Ingredient> getIngredients() {
+ return new HashSet<>(cost);
+ }
+
+ @Override
+ public Set<Ingredient> getOutputs() {
+ return Sets.newHashSet(result);
+ }
+
+ @Override
+ public List<RecipeSlot> getSlots() {
+ List<RecipeSlot> slots = new ArrayList<>();
+ int rowCount = cost.size() / 3;
+ int startX = 36;
+ int startY = 66 - rowCount * 8;
+ int i = 0;
+ for (Ingredient ingredient : cost) {
+ int x = i % 3;
+ int y = i / 3;
+ slots.add(new RecipeSlot(startX + x * 18, startY + y * 18, ingredient.getItemStack()));
+ i++;
+ }
+ slots.add(new RecipeSlot(RESULT_SLOT_X, RESULT_SLOT_Y, result.getItemStack()));
+ return slots;
+ }
+
+ public GuiButton getAndUpdateTrackButton() {
+ if (NotEnoughUpdates.INSTANCE.navigation.getTrackedWaypoint() == npcObject) {
+ trackButton.displayString = EnumChatFormatting.GREEN + "NPC Tracked";
+ trackButton.enabled = false;
+ } else {
+ trackButton.displayString = "Track NPC";
+ trackButton.enabled = true;
+ }
+ return trackButton;
+ }
+
+ @Override
+ public List<GuiButton> getExtraButtons(GuiItemRecipe guiItemRecipe) {
+ trackButton.xPosition = BUTTON_X + guiItemRecipe.guiLeft;
+ trackButton.yPosition = BUTTON_Y + guiItemRecipe.guiTop;
+ return Arrays.asList(new GuiButton[]{getAndUpdateTrackButton()});
+ }
+
+ @Override
+ public void actionPerformed(GuiButton button) {
+ if (button == trackButton) {
+ NotEnoughUpdates.INSTANCE.navigation.trackWaypoint(npcObject);
+ getAndUpdateTrackButton();
+ }
+ }
+
+ @Override
+ public void drawExtraBackground(GuiItemRecipe gui, int mouseX, int mouseY) {
+ Minecraft.getMinecraft().getTextureManager().bindTexture(BACKGROUND);
+ int rowCount = cost.size() / 3;
+ int startX = 36 - 1;
+ int startY = 66 - rowCount * 8 - 1;
+ for (int i = 0; i < cost.size(); i++) {
+ int x = i % 3;
+ int y = i / 3;
+
+ gui.drawTexturedModalRect(
+ gui.guiLeft + startX + x * 18,
+ gui.guiTop + startY + y * 18,
+ SLOT_IMAGE_U, SLOT_IMAGE_V,
+ SLOT_IMAGE_SIZE, SLOT_IMAGE_SIZE
+ );
+ }
+
+ }
+
+ @Override
+ public RecipeType getType() {
+ return RecipeType.NPC_SHOP;
+ }
+
+ @Override
+ public boolean hasVariableCost() {
+ return false;
+ }
+
+ @Override
+ public JsonObject serialize() {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("type", "npc_shop");
+ jsonObject.addProperty("result", result.serialize());
+ jsonObject.add(
+ "cost",
+ JsonUtils.transformListToJsonArray(cost, costItem -> new JsonPrimitive(costItem.serialize()))
+ );
+ return jsonObject;
+ }
+
+ @Override
+ public ResourceLocation getBackground() {
+ return BACKGROUND;
+ }
+
+ public static NeuRecipe parseItemRecipe(NEUManager neuManager, JsonObject recipe, JsonObject outputItemJson) {
+ return new ItemShopRecipe(
+ new Ingredient(neuManager, outputItemJson.get("internalname").getAsString()),
+ JsonUtils.transformJsonArrayToList(
+ recipe.getAsJsonArray("cost"),
+ it -> new Ingredient(neuManager, it.getAsString())
+ ),
+ new Ingredient(neuManager, recipe.get("result").getAsString()),
+ outputItemJson
+ );
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
index dcbf71da..b98fbe10 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
@@ -1,7 +1,6 @@
package io.github.moulberry.notenoughupdates.recipes;
import com.google.common.collect.Sets;
-import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
@@ -14,7 +13,6 @@ import io.github.moulberry.notenoughupdates.util.JsonUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@@ -24,7 +22,6 @@ import java.util.List;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;
-import java.util.stream.Stream;
public class MobLootRecipe implements NeuRecipe {
@@ -144,8 +141,13 @@ public class MobLootRecipe implements NeuRecipe {
}
@Override
+ public Set<Ingredient> getCatalystItems() {
+ return Sets.newHashSet(mobIngredient);
+ }
+
+ @Override
public Set<Ingredient> getOutputs() {
- return Stream.concat(drops.stream().map(it -> it.drop), Stream.of(mobIngredient)).collect(Collectors.toSet());
+ return drops.stream().map(it -> it.drop).collect(Collectors.toSet());
}
@Override
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java
index 8202bb48..fbe264e8 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/NeuRecipe.java
@@ -3,8 +3,11 @@ package io.github.moulberry.notenoughupdates.recipes;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -30,10 +33,18 @@ public interface NeuRecipe {
default void drawHoverInformation(GuiItemRecipe gui, int mouseX, int mouseY) {
}
+ default Set<Ingredient> getCatalystItems() {
+ return Collections.emptySet();
+ }
+
boolean hasVariableCost();
JsonObject serialize();
+ default List<GuiButton> getExtraButtons(GuiItemRecipe guiItemRecipe) {
+ return new ArrayList<>();
+ }
+
ResourceLocation getBackground();
static NeuRecipe parseRecipe(NEUManager manager, JsonObject recipe, JsonObject output) {
@@ -59,4 +70,6 @@ public interface NeuRecipe {
default int[] getPageFlipPositionLeftTopCorner() {
return new int[]{110, 90};
}
+
+ default void actionPerformed(GuiButton button) {}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java
index cc8b50be..023b20eb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java
@@ -10,7 +10,8 @@ public enum RecipeType {
CRAFTING("crafting", "Crafting", CraftingRecipe::parseCraftingRecipe, new ItemStack(Blocks.crafting_table)),
FORGE("forge", "Forging", ForgeRecipe::parseForgeRecipe, new ItemStack(Blocks.anvil)),
TRADE("trade", "Trading", VillagerTradeRecipe::parseStaticRecipe, new ItemStack(Items.emerald)),
- MOB_LOOT("drops", "Mob Loot", MobLootRecipe::parseRecipe, new ItemStack(Items.diamond_sword));
+ MOB_LOOT("drops", "Mob Loot", MobLootRecipe::parseRecipe, new ItemStack(Items.diamond_sword)),
+ NPC_SHOP("npc_shop", "NPC Item Shop", ItemShopRecipe::parseItemRecipe, new ItemStack(Items.wheat_seeds));
private final String id;
private final String label;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
index 2e53e153..10eb96a5 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
@@ -125,7 +125,7 @@ public class VillagerTradeRecipe implements NeuRecipe {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("type", "trade");
jsonObject.addProperty("result", result.serialize());
- jsonObject.addProperty("cost", cost.getInternalItemId());
+ jsonObject.addProperty("cost", cost.serialize());
if (minCost > 0)
jsonObject.addProperty("min", minCost);
if (maxCost > 0)
diff --git a/src/main/resources/assets/notenoughupdates/textures/gui/item_shop_recipe.png b/src/main/resources/assets/notenoughupdates/textures/gui/item_shop_recipe.png
new file mode 100644
index 00000000..4cd47d7f
--- /dev/null
+++ b/src/main/resources/assets/notenoughupdates/textures/gui/item_shop_recipe.png
Binary files differ