Skip to content

Commit

Permalink
Merge branch '1.10' into 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Nov 26, 2016
2 parents 860f919 + 3352279 commit 8bd041d
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 21 deletions.
7 changes: 6 additions & 1 deletion src/main/java/mezz/jei/SubtypeRegistry.java
Expand Up @@ -22,12 +22,17 @@ public class SubtypeRegistry implements ISubtypeRegistry {
@Override
public void useNbtForSubtypes(Item... items) {
for (Item item : items) {
registerNbtInterpreter(item, AllNbt.INSTANCE);
registerSubtypeInterpreter(item, AllNbt.INSTANCE);
}
}

@Override
public void registerNbtInterpreter(@Nullable Item item, @Nullable ISubtypeInterpreter interpreter) {
registerSubtypeInterpreter(item, interpreter);
}

@Override
public void registerSubtypeInterpreter(@Nullable Item item, @Nullable ISubtypeInterpreter interpreter) {
if (item == null) {
Log.error("Null item", new NullPointerException());
return;
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/mezz/jei/api/ISubtypeRegistry.java
Expand Up @@ -29,9 +29,21 @@ public interface ISubtypeRegistry {
*
* @param item the item that has subtypes.
* @param interpreter the interpreter for the item.
* @deprecated since JEI 3.13.5. This is being renamed to {@link #registerSubtypeInterpreter(Item, ISubtypeInterpreter)}
*/
@Deprecated
void registerNbtInterpreter(Item item, ISubtypeInterpreter interpreter);

/**
* Add an interpreter to compare item subtypes.
* This interpreter should account for meta, nbt, and anything else that's relevant to differentiating the item's subtypes.
*
* @param item the item that has subtypes.
* @param interpreter the interpreter for the item.
* @since JEI 3.13.5
*/
void registerSubtypeInterpreter(Item item, ISubtypeInterpreter interpreter);

/**
* Get the data from an itemStack that is relevant to comparing and telling subtypes apart.
* Returns null if the itemStack has no information used for subtypes.
Expand All @@ -42,6 +54,7 @@ public interface ISubtypeRegistry {
interface ISubtypeInterpreter {
/**
* Get the data from an itemStack that is relevant to telling subtypes apart.
* This should account for meta, nbt, and anything else that's relevant.
* Returns null if there is no data used for subtypes.
*/
@Nullable
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/mezz/jei/api/recipe/IStackHelper.java
Expand Up @@ -4,6 +4,7 @@
import java.util.List;

import mezz.jei.api.IJeiHelpers;
import mezz.jei.api.ISubtypeRegistry;
import net.minecraft.item.ItemStack;

/**
Expand Down Expand Up @@ -32,4 +33,17 @@ public interface IStackHelper {
* Expands wildcard ItemStacks into their subtypes.
*/
List<List<ItemStack>> expandRecipeItemStackInputs(@Nullable List inputs);

/**
* Returns an ItemStack from 'stacks' that matches any of the ItemStacks in 'contains'.
* Returns null if there is no match.
* @since JEI 3.13.4
*/
@Nullable
ItemStack containsAnyStack(Iterable<ItemStack> stacks, Iterable<ItemStack> contains);

/**
* Similar to ItemStack.areItemStacksEqual but ignores NBT on items without subtypes, and uses the {@link ISubtypeRegistry}
*/
boolean isEquivalent(@Nullable ItemStack lhs, @Nullable ItemStack rhs);
}
Expand Up @@ -5,6 +5,7 @@
import mezz.jei.api.IModRegistry;
import mezz.jei.api.ingredients.IIngredientRegistry;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
Expand All @@ -31,7 +32,10 @@ private VanillaRecipeCategoryUid() {
* <p>
* Automatically includes all {@link ShapedRecipes}, {@link ShapelessRecipes}, {@link ShapedOreRecipe}, and {@link ShapelessOreRecipe}.
* <p>
* To add your recipe wrapper to this category, it must implement either {@link ICraftingRecipeWrapper} or {@link IShapedCraftingRecipeWrapper}.
* To add your recipe wrapper to this category, it must implement one of the following:
* {@link ICraftingRecipeWrapper}
* {@link IShapedCraftingRecipeWrapper},
* {@link ICustomCraftingRecipeWrapper}
*/
public static final String CRAFTING = "minecraft.crafting";

Expand Down
Expand Up @@ -8,6 +8,7 @@
* {@link VanillaRecipeCategoryUid#CRAFTING} recipe category as a shapeless recipe.
* <p>
* For shaped recipes, use {@link IShapedCraftingRecipeWrapper}.
* To override the category's behavior and set the recipe layout yourself, use {@link ICustomCraftingRecipeWrapper}.
*/
public interface ICraftingRecipeWrapper extends IRecipeWrapper {

Expand Down
@@ -0,0 +1,30 @@
package mezz.jei.api.recipe.wrapper;

import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;

/**
* This interface allows recipes to override the default behavior in the
* {@link VanillaRecipeCategoryUid#CRAFTING} recipe category.
*
* @since JEI 3.13.5
*/
public interface ICustomCraftingRecipeWrapper extends ICraftingRecipeWrapper {
/**
* This is called to override the vanilla crafting category's
* {@link IRecipeCategory#setRecipe(IRecipeLayout, IRecipeWrapper, IIngredients)}
*
* Note that when this is called, the {@link IGuiItemStackGroup} has already been init with the crafting grid layout for convenience.
*
* Set the {@link IRecipeLayout} properties from this {@link IRecipeWrapper} and {@link IIngredients}.
*
* @param recipeLayout the layout that needs its properties set.
* @param ingredients the ingredients, already set by the recipeWrapper
* @since JEI 3.13.5
*/
void setRecipe(IRecipeLayout recipeLayout, IIngredients ingredients);
}
12 changes: 6 additions & 6 deletions src/main/java/mezz/jei/plugins/vanilla/VanillaPlugin.java
Expand Up @@ -64,19 +64,19 @@ public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
Items.ENCHANTED_BOOK
);

subtypeRegistry.registerNbtInterpreter(Items.TIPPED_ARROW, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(Items.POTIONITEM, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(Items.SPLASH_POTION, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(Items.LINGERING_POTION, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerNbtInterpreter(Items.BANNER, new ISubtypeRegistry.ISubtypeInterpreter() {
subtypeRegistry.registerSubtypeInterpreter(Items.TIPPED_ARROW, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerSubtypeInterpreter(Items.POTIONITEM, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerSubtypeInterpreter(Items.SPLASH_POTION, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerSubtypeInterpreter(Items.LINGERING_POTION, PotionSubtypeInterpreter.INSTANCE);
subtypeRegistry.registerSubtypeInterpreter(Items.BANNER, new ISubtypeRegistry.ISubtypeInterpreter() {
@Nullable
@Override
public String getSubtypeInfo(ItemStack itemStack) {
EnumDyeColor baseColor = ItemBanner.getBaseColor(itemStack);
return baseColor.toString();
}
});
subtypeRegistry.registerNbtInterpreter(Items.SPAWN_EGG, new ISubtypeRegistry.ISubtypeInterpreter() {
subtypeRegistry.registerSubtypeInterpreter(Items.SPAWN_EGG, new ISubtypeRegistry.ISubtypeInterpreter() {
@Nullable
@Override
public String getSubtypeInfo(ItemStack itemStack) {
Expand Down
Expand Up @@ -11,6 +11,7 @@
import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.ICustomCraftingRecipeWrapper;
import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper;
import mezz.jei.util.Translator;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -63,6 +64,12 @@ public void setRecipe(IRecipeLayout recipeLayout, ICraftingRecipeWrapper recipeW
}
}

if (recipeWrapper instanceof ICustomCraftingRecipeWrapper) {
ICustomCraftingRecipeWrapper customWrapper = (ICustomCraftingRecipeWrapper) recipeWrapper;
customWrapper.setRecipe(recipeLayout, ingredients);
return;
}

List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);

Expand Down
24 changes: 15 additions & 9 deletions src/main/java/mezz/jei/util/StackHelper.java
Expand Up @@ -132,20 +132,29 @@ public <R> boolean containsSameStacks(Iterable<ItemStackMatchable<R>> stacks, It
}

@Nullable
public Integer containsAnyStackIndexed(@Nullable Map<Integer, ItemStack> stacks, @Nullable Iterable<ItemStack> contains) {
public Integer containsAnyStackIndexed(Map<Integer, ItemStack> stacks, Iterable<ItemStack> contains) {
MatchingIndexed matchingStacks = new MatchingIndexed(stacks);
MatchingIterable matchingContains = new MatchingIterable(contains);
return containsStackMatchable(matchingStacks, matchingContains);
}

@Nullable
public ItemStack containsStack(@Nullable Iterable<ItemStack> stacks, @Nullable ItemStack contains) {
List<ItemStack> containsList = contains == null ? null : Collections.singletonList(contains);
public ItemStack containsStack(Iterable<ItemStack> stacks, ItemStack contains) {
List<ItemStack> containsList = Collections.singletonList(contains);
return containsAnyStack(stacks, containsList);
}

@Override
@Nullable
public ItemStack containsAnyStack(@Nullable Iterable<ItemStack> stacks, @Nullable Iterable<ItemStack> contains) {
if (stacks == null) {
Log.error("Null stacks", new NullPointerException());
return null;
}
if (contains == null) {
Log.error("Null contains", new NullPointerException());
return null;
}
MatchingIterable matchingStacks = new MatchingIterable(stacks);
MatchingIterable matchingContains = new MatchingIterable(contains);
return containsStackMatchable(matchingStacks, matchingContains);
Expand Down Expand Up @@ -178,6 +187,7 @@ public <R> R containsStack(Iterable<ItemStackMatchable<R>> stacks, ItemStackMatc
/**
* Similar to ItemStack.areItemStacksEqual but ignores NBT on items without subtypes, and uses the {@link ISubtypeRegistry}
*/
@Override
public boolean isEquivalent(@Nullable ItemStack lhs, @Nullable ItemStack rhs) {
if (lhs == rhs) {
return true;
Expand Down Expand Up @@ -449,12 +459,8 @@ private static class MatchingIterable implements Iterable<ItemStackMatchable<Ite
@Nonnull
private final Iterable<ItemStack> list;

public MatchingIterable(@Nullable Iterable<ItemStack> list) {
if (list == null) {
this.list = Collections.emptyList();
} else {
this.list = list;
}
public MatchingIterable(Iterable<ItemStack> list) {
this.list = list;
}

@Nonnull
Expand Down
101 changes: 101 additions & 0 deletions src/main/resources/assets/jei/lang/lt_LT.lang
@@ -0,0 +1,101 @@
# Tooltips
jei.tooltip.config=konfigūracija
jei.tooltip.show.recipes=Rodyti receptus
jei.tooltip.show.all.recipes=Rodyti visus receptus
jei.tooltip.delete.item=Spustelėti norint ištrinti
jei.tooltip.liquid.amount.with.capacity=%,d / %,d mB
jei.tooltip.liquid.amount=%,d mB
jei.tooltip.transfer=Perkelti daiktus
jei.tooltip.recipe.ore.dict=Priima bet ką: %s
jei.tooltip.item.colors=Spalvos: %s
jei.tooltip.shapeless.recipe=Beformis receptas
jei.tooltip.cheat.mode=Cheat rėžimas

# Error Tooltips
jei.tooltip.error.recipe.transfer.missing=Trūkstami daiktai
jei.tooltip.error.recipe.transfer.inventory.full=Inventorius per pilnas

# Error Messages
jei.chat.error.command.too.long=JEI must be on the server to handle this Chat Command, it is too long for Minecraft to send.

# Key Bindings
key.jei.toggleOverlay=Toggle Item List Overlay
key.jei.focusSearch=Pasirinkti paieškos juostą
key.jei.showRecipe=Rodyti daikto receptą
key.jei.showUses=Rodyti daikto panaudojimus
key.jei.recipeBack=Rodyti buvusio recepto puslapį

# Config
config.jei.default=Numatytoji
config.jei.valid=Teisinga

config.jei.title=%MODNAME konfigūracija

config.jei.mode=Rėžimas
config.jei.mode.comment=Change the mode that JEI is operating in.
config.jei.mode.cheatItemsEnabled=Item Cheating Mode
config.jei.mode.cheatItemsEnabled.comment=Give items instead of showing the recipe.
config.jei.mode.editEnabled=Item Hiding Mode
config.jei.mode.editEnabled.comment=Hide and unhide items by clicking them in the item list.

config.jei.interface=Interface
config.jei.interface.comment=Options relating to the User Interface.
config.jei.interface.overlayEnabled=Item List Enabled
config.jei.interface.overlayEnabled.comment=Show the list of items next to open guis.
config.jei.interface.recipeAnimationsEnabled=Recipe Animations
config.jei.interface.recipeAnimationsEnabled.comment=Show recipe animations (furnace fire, progress bars, etc)

config.jei.search=Paieškos nustatymai
config.jei.search.comment=Nustatymai, susiję su paieškos juosta.
config.jei.search.atPrefixRequiredForModName=Require @ for Mod Name
config.jei.search.atPrefixRequiredForModName.comment=Require "@" in front of a word to search by mod name.
config.jei.search.prefixRequiredForTooltipSearch=Require # for Tooltip
config.jei.search.prefixRequiredForTooltipSearch.comment=Require "#" in front of a word to search tooltips.
config.jei.search.prefixRequiredForOreDictSearch=Require $ for Ore Dictionary
config.jei.search.prefixRequiredForOreDictSearch.comment=Require "$" in front of a word to search ore dictionary names.
config.jei.search.prefixRequiredForCreativeTabSearch=Require %% for Creative Tab Name
config.jei.search.prefixRequiredForCreativeTabSearch.comment=Require "%" in front of a word to search creative tab names.
config.jei.search.prefixRequiredForColorSearch=Require ^ for Colors
config.jei.search.prefixRequiredForColorSearch.comment=Require "^" in front of a word to search item colors.

config.jei.advanced=Išsamiau
config.jei.advanced.comment=Advanced config options to change the way JEI functions.
config.jei.advanced.itemBlacklist=Item Blacklist
config.jei.advanced.itemBlacklist.comment=List of items that should not be displayed in the item list. Format: modId[:name[:meta]]. Edit Mode will automatically add or remove entries here.
config.jei.advanced.hideMissingModelsEnabled=Hide Items with Missing Models
config.jei.advanced.hideMissingModelsEnabled.comment=Items with missing models will be hidden from the item list.
config.jei.advanced.hideLaggyModelsEnabled=Hide Items with Laggy Models
config.jei.advanced.hideLaggyModelsEnabled.comment=Items with models that cause a long delay will be hidden from the item list.
config.jei.advanced.colorSearchEnabled=Enable Color Search
config.jei.advanced.colorSearchEnabled.comment=Search items by color and show the searchable item colors on tooltips in the item list.
config.jei.advanced.debugModeEnabled=Debug Mode
config.jei.advanced.debugModeEnabled.comment=Only useful for JEI developers, adds thousands of test items and some debug recipes.
config.jei.advanced.deleteItemsInCheatModeEnabled=Delete Items in Cheat Mode
config.jei.advanced.deleteItemsInCheatModeEnabled.comment=In cheat mode, drag an ItemStack over the item list and click to delete it. (requires JEI on server)

config.jei.addons=Priedai
config.jei.addons.comment=Category for JEI addon config options.

# Edit Mode
gui.jei.editMode.description=JEI Item List Edit Mode:
gui.jei.editMode.description.hide=Ctrl-click to hide.
gui.jei.editMode.description.show=Hidden. Ctrl-click to show.
gui.jei.editMode.description.hide.wild=Ctrl-right-click to hide with wildcard.
gui.jei.editMode.description.show.wild=Hidden by Wildcard. Ctrl-right-click to show.
gui.jei.editMode.description.hide.mod.id=Ctrl-Shift-click to hide by ModId.
gui.jei.editMode.description.show.mod.id=Hidden by ModId. Ctrl-Shift-click to show.

# Recipe Categories
gui.jei.category.craftingTable=Crafting
gui.jei.category.smelting=Smelting
gui.jei.category.smelting.experience=%s XP
gui.jei.category.fuel=Kuras
gui.jei.category.fuel.burnTime=Burn Time: %s
gui.jei.category.brewing=Brewing
gui.jei.category.brewing.steps=Žingsniai: %s
gui.jei.category.itemDescription=Aprašymas

# DEBUG (for debug mode, do not need translation)
description.jei.wooden.door.1=Wooden Doors allow you to block monsters from entering your building.\nTesting sentences.
description.jei.wooden.door.2=Clicking on a door changes its state from open to closed and visa versa.
description.jei.wooden.door.3=Wooden Doors can be opened/closed via Redstone Circuits.
8 changes: 6 additions & 2 deletions src/main/resources/assets/jei/lang/zh_cn.lang
Expand Up @@ -21,6 +21,8 @@ jei.tooltip.error.crash=提示错误,请查看日志

# Error Messages
jei.chat.error.command.too.long=JEI必须安装于服务器上,方能处理本指令,这条指令对Minecraft来说太长了。
jei.chat.error.no.cheat.permission.1=你没有使用JEI作弊模式的权限。
jei.chat.error.no.cheat.permission.2=可以使用/give或处在创造模式下的玩家拥有此权限。

# Key Bindings
key.jei.toggleOverlay=切换物品列表叠层
Expand Down Expand Up @@ -73,6 +75,8 @@ config.jei.advanced.debugModeEnabled=调试模式
config.jei.advanced.debugModeEnabled.comment=仅对JEI开发者有用,启用后会添加数千测试物品以及一些测试合成表。
config.jei.advanced.centerSearchBarEnabled=搜索框居中
config.jei.advanced.centerSearchBarEnabled.comment=启用后,搜索框会被移动至底部居中的位置。
config.jei.advanced.modNameFormat=模组名称格式
config.jei.advanced.modNameFormat.comment=定义JEI界面的信息提示中的Mod名称格式。留空以禁用。

# Edit Mode
gui.jei.editMode.description=JEI物品列表编辑模式:
Expand All @@ -88,7 +92,7 @@ key.jei.ctrl=CTRL
#Mac Command Key
key.jei.ctrl.mac=CMD

# Recipes
# Recipe Categories
gui.jei.category.craftingTable=工作台合成
gui.jei.category.smelting=烧炼
gui.jei.category.smelting.experience=%s点经验
Expand All @@ -100,7 +104,7 @@ gui.jei.category.brewing=酿造配方
gui.jei.category.brewing.steps=步数:%s
gui.jei.category.itemDescription=描述

# DEBUG
# DEBUG (调试模式,无需翻译)
description.jei.wooden.door.1=木门允许你阻止怪物进入你的建筑。\n正在测试。
description.jei.wooden.door.2=点击一扇门把它的状态从开改变至关,或反之。
description.jei.wooden.door.3=木制的门可以通过红石电路开关。

0 comments on commit 8bd041d

Please sign in to comment.