mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Made items be able to be MoreInformationKey'd at even if they have metadata
This commit is contained in:
parent
9ad7a6e572
commit
7145c273f1
4 changed files with 10 additions and 7 deletions
|
@ -26,6 +26,7 @@ import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||||
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
||||||
|
import ellpeck.actuallyadditions.util.Util;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ public class InitBooklet{
|
||||||
}
|
}
|
||||||
new BookletChapter("aiots", entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()]));
|
new BookletChapter("aiots", entryItemsNonRF, new ItemStack(InitItems.emeraldPaxel), aiotPages.toArray(new BookletPage[aiotPages.size()]));
|
||||||
|
|
||||||
new BookletChapter("jams", entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams)));
|
new BookletChapter("jams", entryItemsNonRF, new ItemStack(InitItems.itemJams), new PageTextOnly(1).setStack(new ItemStack(InitItems.itemJams, 1, Util.WILDCARD)));
|
||||||
|
|
||||||
ArrayList<BookletPage> potionRingPages = new ArrayList<BookletPage>();
|
ArrayList<BookletPage> potionRingPages = new ArrayList<BookletPage>();
|
||||||
potionRingPages.add(new PageTextOnly(potionRingPages.size()+1));
|
potionRingPages.add(new PageTextOnly(potionRingPages.size()+1));
|
||||||
|
|
|
@ -13,6 +13,7 @@ package ellpeck.actuallyadditions.booklet.page;
|
||||||
import ellpeck.actuallyadditions.booklet.BookletChapter;
|
import ellpeck.actuallyadditions.booklet.BookletChapter;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||||
|
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -107,7 +108,7 @@ public class BookletPage{
|
||||||
|
|
||||||
if(checkAndTransfer){
|
if(checkAndTransfer){
|
||||||
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
||||||
if(page.getItemStackForPage() != null && page.getItemStackForPage().isItemEqual(stack)){
|
if(ItemUtil.areItemsEqual(page.getItemStackForPage(), stack, true)){
|
||||||
list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"));
|
list.add(EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"));
|
||||||
|
|
||||||
if(mouseClick){
|
if(mouseClick){
|
||||||
|
|
|
@ -17,10 +17,7 @@ import ellpeck.actuallyadditions.booklet.InitBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
import ellpeck.actuallyadditions.booklet.page.BookletPage;
|
||||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||||
import ellpeck.actuallyadditions.items.InitItems;
|
import ellpeck.actuallyadditions.items.InitItems;
|
||||||
import ellpeck.actuallyadditions.util.KeyBinds;
|
import ellpeck.actuallyadditions.util.*;
|
||||||
import ellpeck.actuallyadditions.util.KeyUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
@ -60,7 +57,7 @@ public class TooltipEvent{
|
||||||
ItemStack stack = slot.getStack();
|
ItemStack stack = slot.getStack();
|
||||||
if(stack != null){
|
if(stack != null){
|
||||||
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
for(BookletPage page : InitBooklet.pagesWithItemStackData){
|
||||||
if(page.getItemStackForPage() != null && page.getItemStackForPage().isItemEqual(stack)){
|
if(ItemUtil.areItemsEqual(stack, page.getItemStackForPage(), true)){
|
||||||
int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode();
|
int keyCode = KeyBinds.keybindOpenBooklet.getKeyCode();
|
||||||
if(!ConfigBoolValues.NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled() || Minecraft.getMinecraft().thePlayer.inventory.hasItem(InitItems.itemLexicon)){
|
if(!ConfigBoolValues.NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled() || Minecraft.getMinecraft().thePlayer.inventory.hasItem(InitItems.itemLexicon)){
|
||||||
if(ConfigBoolValues.SHOW_NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled()){
|
if(ConfigBoolValues.SHOW_NEED_BOOKLET_FOR_KEYBIND_INFO.isEnabled()){
|
||||||
|
|
|
@ -74,4 +74,8 @@ public class ItemUtil{
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean areItemsEqual(ItemStack stack1, ItemStack stack2, boolean checkWildcard){
|
||||||
|
return stack1 != null && stack2 != null && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue