aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java3
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java5
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java33
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java101
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java4
-rw-r--r--src/main/resources/assets/notenoughupdates/textures/icons/recipe_crafting.pngbin580 -> 0 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/textures/icons/recipe_forge.pngbin580 -> 0 bytes
-rw-r--r--src/main/resources/assets/notenoughupdates/textures/icons/recipe_trade.pngbin580 -> 0 bytes
12 files changed, 94 insertions, 67 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
index 53a7894b..27944c92 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/dev/DevTestCommand.java
@@ -1,4 +1,4 @@
-package io.github.moulberry.notenoughupdates.commands.dev;
+ package io.github.moulberry.notenoughupdates.commands.dev;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.commands.ClientCommandBase;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
index 14513dd1..e761356c 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EntityViewer.java
@@ -58,6 +58,7 @@ public class EntityViewer extends GuiScreen {
put("MagmaCube", () -> new EntityMagmaCube(null));
put("Wither", () -> new EntityWither(null));
put("Enderman", () -> new EntityEnderman(null));
+ put("Mooshroom", ()-> new EntityMooshroom(null));
put("WitherSkeleton", () -> {
EntitySkeleton skeleton = new EntitySkeleton(null);
skeleton.setSkeletonType(1);
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 f14e2e0e..3d2ed9a7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java
@@ -191,8 +191,7 @@ public class GuiItemRecipe extends GuiScreen {
0, textureOffset,
TAB_TEXTURE_SIZE_X, TAB_SIZE_Y
);
- Minecraft.getMinecraft().getTextureManager().bindTexture(recipeType.getIcon());
- drawTexturedModalRect(tabPosX + 7, tabPosY + 7, 6, 0, 16, 16);
+ Utils.drawItemStack(recipeType.getIcon(), tabPosX + 7, tabPosY + 7);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
index 79b548da..c4928605 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/Ingredient.java
@@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.recipes;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
+import io.github.moulberry.notenoughupdates.util.ItemUtils;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -75,9 +76,7 @@ public class Ingredient {
public ItemStack getItemStack() {
if (itemStack != null) return itemStack;
if (isCoins()) {
- itemStack = new ItemStack(Items.gold_nugget);
- itemStack.setStackDisplayName("\u00A7r\u00A76" + Utils.formatNumberWithDots(getCount()) + " Coins");
- return itemStack;
+ return ItemUtils.getCoinItemStack(count);
}
JsonObject itemInfo = manager.getItemInformation().get(internalItemId);
itemStack = manager.jsonToStack(itemInfo);
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 e22647cc..430fe7c1 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/MobLootRecipe.java
@@ -14,6 +14,7 @@ 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;
@@ -21,7 +22,9 @@ import java.util.ArrayList;
import java.util.Collections;
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 {
@@ -142,21 +145,31 @@ public class MobLootRecipe implements NeuRecipe {
@Override
public Set<Ingredient> getOutputs() {
- return drops.stream().map(it -> it.drop).collect(Collectors.toSet());
+ return Stream.concat(drops.stream().map(it -> it.drop), Stream.of(mobIngredient)).collect(Collectors.toSet());
}
@Override
public List<RecipeSlot> getSlots() {
List<RecipeSlot> slots = new ArrayList<>();
- for (int i = 0; i < drops.size(); i++) {
- MobDrop mobDrop = drops.get(i);
- int x = i % 5;
- int y = i / 5;
- slots.add(new RecipeSlot(
- SLOT_POS_X + x * 16,
- SLOT_POS_Y + y * 16,
- mobDrop.getItemStack()
+ BiConsumer<Integer, ItemStack> addSlot = (sl, is) -> slots.add(
+ new RecipeSlot(
+ SLOT_POS_X + (sl % 5) * 16,
+ SLOT_POS_Y + (sl / 5) * 16,
+ is
));
+ int i = 0;
+ for (; i < drops.size(); i++) {
+ MobDrop mobDrop = drops.get(i);
+ addSlot.accept(i, mobDrop.getItemStack());
+ }
+ if (coins > 0) {
+ addSlot.accept(i++, ItemUtils.getCoinItemStack(coins));
+ }
+ if (xp > 0) {
+ addSlot.accept(i++, Utils.createItemStack(Items.experience_bottle, "§a" + xp + " Experience"));
+ }
+ if (combatXp > 0) {
+ addSlot.accept(i++, Utils.createItemStack(Items.iron_sword, "§2" + combatXp + " Combat Experience"));
}
return slots;
}
@@ -211,7 +224,7 @@ public class MobLootRecipe implements NeuRecipe {
PANORAMA_HEIGHT
)) {
List<String> stuff = new ArrayList<>(extra);
- stuff.add(0, (level > 0 ? "[Lv " + level + "] " : "") + name);
+ stuff.add(0, (level > 0 ? "§8[§7Lv " + level + "§8] §c" : "§c") + name);
Utils.drawHoveringText(
stuff,
mouseX,
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 6ef319cb..67042a98 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/RecipeType.java
@@ -2,55 +2,58 @@ package io.github.moulberry.notenoughupdates.recipes;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
public enum RecipeType {
- CRAFTING("crafting", "Crafting", CraftingRecipe::parseCraftingRecipe),
- FORGE("forge", "Forge", ForgeRecipe::parseForgeRecipe),
- TRADE("trade", "Trade", VillagerTradeRecipe::parseStaticRecipe),
- MOB_LOOT("drops", "Mob Loot", MobLootRecipe::parseRecipe);
-
- private final String id;
- private final String label;
- private final RecipeFactory recipeFactory;
- private final ResourceLocation icon;
-
- RecipeType(String id, String label, RecipeFactory recipeFactory) {
- this.id = id;
- this.label = label;
- this.recipeFactory = recipeFactory;
- this.icon = new ResourceLocation("notenoughupdates", "textures/icons/recipe_" + id + ".png");
- }
-
- public String getId() {
- return id;
- }
-
- public ResourceLocation getIcon() {
- return icon;
- }
-
- public String getLabel() {
- return label;
- }
-
- public RecipeFactory getRecipeFactory() {
- return recipeFactory;
- }
-
- public NeuRecipe createRecipe(NEUManager manager, JsonObject recipe, JsonObject outputItemJson) {
- return recipeFactory.createRecipe(manager, recipe, outputItemJson);
- }
-
- public static RecipeType getRecipeTypeForId(String id) {
- for (RecipeType value : values()) {
- if (value.id.equals(id)) return value;
- }
- return null;
- }
-
- @FunctionalInterface
- interface RecipeFactory {
- NeuRecipe createRecipe(NEUManager manager, JsonObject recipe, JsonObject outputItemJson);
- }
+ CRAFTING("crafting", "Crafting", CraftingRecipe::parseCraftingRecipe, new ItemStack(Blocks.crafting_table)),
+ FORGE("forge", "Forge", ForgeRecipe::parseForgeRecipe, new ItemStack(Blocks.anvil)),
+ TRADE("trade", "Trade", VillagerTradeRecipe::parseStaticRecipe, new ItemStack(Items.emerald)),
+ MOB_LOOT("drops", "Mob Loot", MobLootRecipe::parseRecipe, new ItemStack(Items.diamond_sword));
+
+ private final String id;
+ private final String label;
+ private final RecipeFactory recipeFactory;
+ private final ItemStack icon;
+
+ RecipeType(String id, String label, RecipeFactory recipeFactory, ItemStack icon) {
+ this.id = id;
+ this.label = label;
+ this.recipeFactory = recipeFactory;
+ this.icon = icon;
+ icon.setStackDisplayName("neurecipe-" + id);
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public RecipeFactory getRecipeFactory() {
+ return recipeFactory;
+ }
+
+ public ItemStack getIcon() {
+ return icon;
+ }
+
+ public NeuRecipe createRecipe(NEUManager manager, JsonObject recipe, JsonObject outputItemJson) {
+ return recipeFactory.createRecipe(manager, recipe, outputItemJson);
+ }
+
+ public static RecipeType getRecipeTypeForId(String id) {
+ for (RecipeType value : values()) {
+ if (value.id.equals(id)) return value;
+ }
+ return null;
+ }
+
+ @FunctionalInterface
+ interface RecipeFactory {
+ NeuRecipe createRecipe(NEUManager manager, JsonObject recipe, JsonObject outputItemJson);
+ }
}
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 d09c23a9..2e53e153 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/recipes/VillagerTradeRecipe.java
@@ -110,7 +110,7 @@ public class VillagerTradeRecipe implements NeuRecipe {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;
Utils.drawStringCenteredScaledMaxWidth(
minCost + " - " + maxCost, fontRenderer,
- gui.guiLeft + 50, gui.guiTop + 85, false, 75, 0xff00ff);
+ gui.guiLeft + 50, gui.guiTop + 90, false, 75, 0xff00ff);
}
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
index bc620437..e3d90aaa 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/ItemUtils.java
@@ -1,5 +1,6 @@
package io.github.moulberry.notenoughupdates.util;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -8,9 +9,16 @@ import net.minecraft.nbt.NBTTagString;
import java.util.List;
public class ItemUtils {
+
+ public static ItemStack getCoinItemStack(int coinAmount) {
+ ItemStack itemStack = new ItemStack(Items.gold_nugget);
+ itemStack.setStackDisplayName("\u00A7r\u00A76" + Utils.formatNumberWithDots(coinAmount) + " Coins");
+ return itemStack;
+ }
+
public static void appendLore(ItemStack is, List<String> moreLore) {
NBTTagCompound tagCompound = is.getTagCompound();
- if(tagCompound == null){
+ if (tagCompound == null) {
tagCompound = new NBTTagCompound();
}
NBTTagCompound display = tagCompound.getCompoundTag("display");
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
index d6c0fb27..5fac9208 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java
@@ -9,6 +9,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking;
+import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.entity.EntityPlayerSP;
@@ -774,6 +775,9 @@ public class Utils {
public static ItemStack createItemStack(Item item, String displayname, String... lore) {
return createItemStack(item, displayname, 0, lore);
}
+ public static ItemStack createItemStack(Block item, String displayname, String... lore) {
+ return createItemStack(Item.getItemFromBlock(item), displayname, lore);
+ }
public static ItemStack createItemStack(Item item, String displayname, int damage, String... lore) {
ItemStack stack = new ItemStack(item, 1, damage);
diff --git a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_crafting.png b/src/main/resources/assets/notenoughupdates/textures/icons/recipe_crafting.png
deleted file mode 100644
index dd1bd3e1..00000000
--- a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_crafting.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_forge.png b/src/main/resources/assets/notenoughupdates/textures/icons/recipe_forge.png
deleted file mode 100644
index a9d54287..00000000
--- a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_forge.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_trade.png b/src/main/resources/assets/notenoughupdates/textures/icons/recipe_trade.png
deleted file mode 100644
index 7bbfd936..00000000
--- a/src/main/resources/assets/notenoughupdates/textures/icons/recipe_trade.png
+++ /dev/null
Binary files differ