mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-19 11:59:17 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
f1dea5460a
commit
f106b5e766
172 files changed
+2552
-2088
No files matched your search
@@ -1,5 +1,17 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
@@ -24,23 +36,15 @@ import codechicken.nei.recipe.IUsageHandler;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
/**
|
||||
* This is the main class that handles item property configuration.
|
||||
* WARNING: DO NOT access this class until the world has been loaded
|
||||
* These methods should be called from INEIConfig implementors
|
||||
* This is the main class that handles item property configuration. WARNING: DO NOT access this class until the world
|
||||
* has been loaded These methods should be called from INEIConfig implementors
|
||||
*/
|
||||
public class API {
|
||||
|
||||
/**
|
||||
* Register a new Crafting Recipe handler;
|
||||
*
|
||||
@@ -63,8 +67,7 @@ public class API {
|
||||
* Add a gui to the default overlay renderer with the default position
|
||||
*
|
||||
* @param classz The class of your gui
|
||||
* @param ident The identification string, currently
|
||||
* {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
* @param ident The identification string, currently {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
*/
|
||||
public static void registerGuiOverlay(Class<? extends GuiContainer> classz, String ident) {
|
||||
registerGuiOverlay(classz, ident, 5, 11);
|
||||
@@ -74,8 +77,7 @@ public class API {
|
||||
* Add a gui to the default overlay renderer with an offset
|
||||
*
|
||||
* @param classz The class of your gui
|
||||
* @param ident The identification string, currently
|
||||
* {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
* @param ident The identification string, currently {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
* @param x x-offset
|
||||
* @param y y-offset
|
||||
*/
|
||||
@@ -87,12 +89,11 @@ public class API {
|
||||
* Add a gui to the default overlay renderer
|
||||
*
|
||||
* @param classz The class of your gui
|
||||
* @param ident The identification string, currently
|
||||
* {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
* @param ident The identification string, currently {crafting, crafting2x2, smelting, fuel, brewing}
|
||||
* @param positioner A Stack Repositioner for moving the items to the right place
|
||||
*/
|
||||
public static void registerGuiOverlay(
|
||||
Class<? extends GuiContainer> classz, String ident, IStackPositioner positioner) {
|
||||
public static void registerGuiOverlay(Class<? extends GuiContainer> classz, String ident,
|
||||
IStackPositioner positioner) {
|
||||
RecipeInfo.registerGuiOverlay(classz, ident, positioner);
|
||||
}
|
||||
|
||||
@@ -101,13 +102,14 @@ public class API {
|
||||
* @param handler The handler to register
|
||||
* @param ident The recipe identification string
|
||||
*/
|
||||
public static void registerGuiOverlayHandler(
|
||||
Class<? extends GuiContainer> classz, IOverlayHandler handler, String ident) {
|
||||
public static void registerGuiOverlayHandler(Class<? extends GuiContainer> classz, IOverlayHandler handler,
|
||||
String ident) {
|
||||
RecipeInfo.registerOverlayHandler(classz, handler, ident);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the offset to be added to items to translate them into recipe coords on the actual gui, default is 5, 11. Primarily RecipeTransferRects
|
||||
* Set the offset to be added to items to translate them into recipe coords on the actual gui, default is 5, 11.
|
||||
* Primarily RecipeTransferRects
|
||||
*
|
||||
* @param classz The class of your gui
|
||||
* @param x
|
||||
@@ -127,8 +129,8 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide an item from the item panel
|
||||
* Damage values of OreDictionary.WILDCARD_VALUE and ItemStackMap.WILDCARD_TAG tags function as wildcards for their respective variables
|
||||
* Hide an item from the item panel Damage values of OreDictionary.WILDCARD_VALUE and ItemStackMap.WILDCARD_TAG tags
|
||||
* function as wildcards for their respective variables
|
||||
*/
|
||||
public static void hideItem(ItemStack item) {
|
||||
if (!ItemInfo.hiddenItems.contains(item)) {
|
||||
@@ -149,6 +151,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Adds an item to the item panel. Any items added using this function will override the default search pattern.
|
||||
*
|
||||
* @param item an item with data
|
||||
*/
|
||||
public static void addItemListEntry(ItemStack item) {
|
||||
@@ -171,6 +174,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Add a custom KeyBinding to be configured in the Controls menu.
|
||||
*
|
||||
* @param ident An identifier for your key, eg "shoot"
|
||||
* @param defaultKey The default value, commonly obtained from {@link Keyboard}
|
||||
*/
|
||||
@@ -182,6 +186,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Add a custom KeyBinding to be configured in the Controls menu.
|
||||
*
|
||||
* @param ident An identifier for your key, eg "shoot"
|
||||
* @param defaultKey The default value, commonly obtained from {@link Keyboard}
|
||||
*/
|
||||
@@ -196,6 +201,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Add a new Layout Style for the NEI interface
|
||||
*
|
||||
* @param styleID The Unique ID to be used for storing your style in the config and cycling through avaliable styles
|
||||
* @param style The style to add.
|
||||
*/
|
||||
@@ -205,6 +211,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Registers a new Infinite Item Handler.
|
||||
*
|
||||
* @param handler The handler to be registered.
|
||||
*/
|
||||
public static void addInfiniteItemHandler(IInfiniteItemHandler handler) {
|
||||
@@ -213,6 +220,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Registers a new Infinite Item Handler.
|
||||
*
|
||||
* @param block The block to handle, null for all.
|
||||
* @param handler The handler to be registered.
|
||||
*/
|
||||
@@ -222,6 +230,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Tells NEI not to perform any Fast Transfer operations on slots of a particular class
|
||||
*
|
||||
* @param slotClass The class of slot to be exempted
|
||||
*/
|
||||
public static void addFastTransferExemptSlot(Class<? extends Slot> slotClass) {
|
||||
@@ -230,8 +239,10 @@ public class API {
|
||||
|
||||
/**
|
||||
* Register a new text handler for the block highlight tooltip with a layout specification (HEADER, BODY or FOOTER).
|
||||
*
|
||||
* @param handler The handler to be registered.
|
||||
* @param layout A HUDAugmenterRegistry.Layout entry. HEADER is displayed before BODY which is displayed before FOOTER.
|
||||
* @param layout A HUDAugmenterRegistry.Layout entry. HEADER is displayed before BODY which is displayed before
|
||||
* FOOTER.
|
||||
*/
|
||||
public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layout) {
|
||||
ItemInfo.registerHighlightHandler(handler, layout);
|
||||
@@ -239,6 +250,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Register a mode handler for overriding NEI recipe/utility/cheat mode settings.
|
||||
*
|
||||
* @param handler The handler to be registered.
|
||||
*/
|
||||
public static void registerModeHandler(INEIModeHandler handler) {
|
||||
@@ -247,6 +259,7 @@ public class API {
|
||||
|
||||
/**
|
||||
* Register a filter provider for the item panel.
|
||||
*
|
||||
* @param filterProvider The filter provider to be registered.
|
||||
*/
|
||||
public static void addItemFilter(ItemFilterProvider filterProvider) {
|
||||
@@ -257,7 +270,8 @@ public class API {
|
||||
|
||||
/**
|
||||
* Adds a new tag to the item subset dropdown.
|
||||
* @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive
|
||||
*
|
||||
* @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive
|
||||
* @param filter A filter for matching items that fit in this subset
|
||||
*/
|
||||
public static void addSubset(String name, ItemFilter filter) {
|
||||
@@ -266,7 +280,8 @@ public class API {
|
||||
|
||||
/**
|
||||
* Adds a new tag to the item subset dropdown.
|
||||
* @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive
|
||||
*
|
||||
* @param name The fully qualified name, Eg Blocks.MobSpawners. NOT case sensitive
|
||||
* @param items An iterable of itemstacks to be added as a subset
|
||||
*/
|
||||
public static void addSubset(String name, Iterable<ItemStack> items) {
|
||||
@@ -291,15 +306,19 @@ public class API {
|
||||
|
||||
/**
|
||||
* Adds a new sorting option to the item panel sort menu
|
||||
* @param name A unique id for this sort option. Will be used in the config for saving and translated in the options gui. Note that if the translation key name.tip exists, it will be used for a tooltip
|
||||
*
|
||||
* @param name A unique id for this sort option. Will be used in the config for saving and translated in the options
|
||||
* gui. Note that if the translation key name.tip exists, it will be used for a tooltip
|
||||
*/
|
||||
public static void addSortOption(String name, Comparator<ItemStack> comparator) {
|
||||
ItemSorter.add(name, comparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an additional item list entry for an item, sorted after the rest of the items are found through the normal process
|
||||
* @param item The item to add the variant for
|
||||
* Adds an additional item list entry for an item, sorted after the rest of the items are found through the normal
|
||||
* process
|
||||
*
|
||||
* @param item The item to add the variant for
|
||||
* @param variant The stack to appear in the item panel
|
||||
*/
|
||||
public static void addItemVariant(Item item, ItemStack variant) {
|
||||
@@ -314,10 +333,12 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an association between an ingredient and what it can craft. (i.e. Furnace ItemStack -> Smelting and Fuel Recipes)
|
||||
* Allows players to see what ingredient they need to craft in order to make recipes from a recipe category.
|
||||
* @param stack the ingredient that can craft recipes (like a furnace or crafting table)
|
||||
* @param handler the recipe category handled by the ingredient
|
||||
* Adds an association between an ingredient and what it can craft. (i.e. Furnace ItemStack -> Smelting and Fuel
|
||||
* Recipes) Allows players to see what ingredient they need to craft in order to make recipes from a recipe
|
||||
* category.
|
||||
*
|
||||
* @param stack the ingredient that can craft recipes (like a furnace or crafting table)
|
||||
* @param handler the recipe category handled by the ingredient
|
||||
* @param priority higher priority comes first, default to 0
|
||||
*/
|
||||
public static void addRecipeCatalyst(ItemStack stack, IRecipeHandler handler, int priority) {
|
||||
@@ -333,11 +354,13 @@ public class API {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an association between an ingredient and what it can craft. (i.e. Furnace ItemStack -> Smelting and Fuel Recipes)
|
||||
* Allows players to see what ingredient they need to craft in order to make recipes from a recipe category.
|
||||
* @param stack the ingredient that can craft recipes (like a furnace or crafting table)
|
||||
* Adds an association between an ingredient and what it can craft. (i.e. Furnace ItemStack -> Smelting and Fuel
|
||||
* Recipes) Allows players to see what ingredient they need to craft in order to make recipes from a recipe
|
||||
* category.
|
||||
*
|
||||
* @param stack the ingredient that can craft recipes (like a furnace or crafting table)
|
||||
* @param handlerID recipe category identifier (see also {@link RecipeCatalysts#getRecipeID(IRecipeHandler)})
|
||||
* @param priority higher priority comes first, default to 0
|
||||
* @param priority higher priority comes first, default to 0
|
||||
*/
|
||||
public static void addRecipeCatalyst(ItemStack stack, String handlerID, int priority) {
|
||||
RecipeCatalysts.addRecipeCatalyst(handlerID, new CatalystInfo(stack, priority));
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class DefaultOverlayRenderer implements IRecipeOverlayRenderer {
|
||||
|
||||
public DefaultOverlayRenderer(List<PositionedStack> ai, IStackPositioner positioner) {
|
||||
positioner = this.positioner = positioner;
|
||||
ingreds = new ArrayList<>();
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.NEIChestGuiHandler;
|
||||
import codechicken.nei.NEICreativeGuiHandler;
|
||||
@@ -9,15 +18,9 @@ import codechicken.nei.recipe.CheatItemHandler;
|
||||
import codechicken.nei.recipe.FillFluidContainerHandler;
|
||||
import codechicken.nei.recipe.GuiRecipeCatalyst;
|
||||
import codechicken.nei.recipe.SearchInputDropHandler;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
|
||||
public class GuiInfo {
|
||||
|
||||
public static final LinkedList<INEIGuiHandler> guiHandlers = new LinkedList<>();
|
||||
public static final HashSet<Class<? extends GuiContainer>> customSlotGuis = new HashSet<>();
|
||||
public static ReentrantReadWriteLock guiHandlersLock = new ReentrantReadWriteLock();
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
/**
|
||||
* An nei configuration entry point should implement this class and have name "NEI<someting>Config"
|
||||
* loadConfig will only be called when NEI is installed.
|
||||
* An nei configuration entry point should implement this class and have name "NEI<someting>Config" loadConfig will only
|
||||
* be called when NEI is installed.
|
||||
*/
|
||||
public interface IConfigureNEI {
|
||||
|
||||
public void loadConfig();
|
||||
|
||||
public String getName();
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public interface IGuiContainerOverlay {
|
||||
|
||||
GuiContainer getFirstScreen();
|
||||
|
||||
default GuiScreen getFirstScreenGeneral() {
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IHighlightHandler {
|
||||
|
||||
public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop);
|
||||
|
||||
public List<String> handleTextData(
|
||||
ItemStack itemStack,
|
||||
World world,
|
||||
EntityPlayer player,
|
||||
MovingObjectPosition mop,
|
||||
List<String> currenttip,
|
||||
ItemInfo.Layout layout);
|
||||
public List<String> handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop,
|
||||
List<String> currenttip, ItemInfo.Layout layout);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IInfiniteItemHandler {
|
||||
|
||||
void onPickup(ItemStack heldItem);
|
||||
|
||||
void onPlaceInfinite(ItemStack heldItem);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
|
||||
/**
|
||||
* Lets you just override those things you want to
|
||||
*/
|
||||
@@ -41,8 +43,7 @@ public class INEIGuiAdapter implements INEIGuiHandler {
|
||||
}
|
||||
|
||||
protected String formattingText(String displayName) {
|
||||
return SPECIAL_REGEX_CHARS
|
||||
.matcher(EnumChatFormatting.getTextWithoutFormattingCodes(displayName))
|
||||
return SPECIAL_REGEX_CHARS.matcher(EnumChatFormatting.getTextWithoutFormattingCodes(displayName))
|
||||
.replaceAll("\\\\$0");
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
|
||||
/**
|
||||
* If this is implemented on a gui, it will be automatically registered
|
||||
*/
|
||||
public interface INEIGuiHandler {
|
||||
|
||||
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility);
|
||||
|
||||
/**
|
||||
* NEI will give the specified item to the InventoryRange returned if the player's inventory is full.
|
||||
* Should not return null, just an empty list
|
||||
* NEI will give the specified item to the InventoryRange returned if the player's inventory is full. Should not
|
||||
* return null, just an empty list
|
||||
*/
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item);
|
||||
|
||||
@@ -23,20 +26,24 @@ public interface INEIGuiHandler {
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui);
|
||||
|
||||
/**
|
||||
* Handles clicks while an itemstack has been dragged from the item panel. Use this to set configurable slots and the like.
|
||||
* Changes made to the stackSize of the dragged stack will be kept
|
||||
* @param gui The current gui instance
|
||||
* @param mousex The x position of the mouse
|
||||
* @param mousey The y position of the mouse
|
||||
* Handles clicks while an itemstack has been dragged from the item panel. Use this to set configurable slots and
|
||||
* the like. Changes made to the stackSize of the dragged stack will be kept
|
||||
*
|
||||
* @param gui The current gui instance
|
||||
* @param mousex The x position of the mouse
|
||||
* @param mousey The y position of the mouse
|
||||
* @param draggedStack The stack being dragged from the item panel
|
||||
* @param button The button presed
|
||||
* @return True if the drag n drop was handled. False to resume processing through other routes. The held stack will be deleted if draggedStack.stackSize == 0
|
||||
* @param button The button presed
|
||||
* @return True if the drag n drop was handled. False to resume processing through other routes. The held stack will
|
||||
* be deleted if draggedStack.stackSize == 0
|
||||
*/
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button);
|
||||
|
||||
/**
|
||||
* Used to prevent the item panel from drawing on top of other gui elements.
|
||||
* This function will also be called with a 1x1 size rectangle on the mouse position for determining if the given coordinate should override item panel functions such as scrolling
|
||||
* Used to prevent the item panel from drawing on top of other gui elements. This function will also be called with
|
||||
* a 1x1 size rectangle on the mouse position for determining if the given coordinate should override item panel
|
||||
* functions such as scrolling
|
||||
*
|
||||
* @param x The x coordinate of the rectangle bounding the slot
|
||||
* @param y The y coordinate of the rectangle bounding the slot
|
||||
* @param w The w coordinate of the rectangle bounding the slot
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
public interface INEIModeHandler {
|
||||
|
||||
public boolean isModeValid(int mode);
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public interface IOverlayHandler {
|
||||
|
||||
public void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift);
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public interface IRecipeOverlayRenderer {
|
||||
|
||||
public void renderOverlay(GuiContainerManager gui, Slot slot);
|
||||
}
|
||||
@@ -1,12 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
/**
|
||||
* For repositioning recipes in overlay renderers.
|
||||
*
|
||||
*/
|
||||
public interface IStackPositioner {
|
||||
|
||||
public ArrayList<PositionedStack> positionStacks(ArrayList<PositionedStack> ai);
|
||||
}
|
||||
@@ -3,10 +3,13 @@ package codechicken.nei.api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ItemFilter {
|
||||
|
||||
/**
|
||||
* Provides an item filter. May be called from any thread. Returned filter should only reference objects with immutable state.
|
||||
* Provides an item filter. May be called from any thread. Returned filter should only reference objects with
|
||||
* immutable state.
|
||||
*/
|
||||
public static interface ItemFilterProvider {
|
||||
|
||||
public ItemFilter getFilter();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,5 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.InfiniteStackSizeHandler;
|
||||
import codechicken.nei.InfiniteToolHandler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemMobSpawner;
|
||||
import codechicken.nei.ItemStackMap;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PopupInputHandler;
|
||||
import codechicken.nei.config.ArrayDumper;
|
||||
import codechicken.nei.config.HandlerDumper;
|
||||
import codechicken.nei.config.ItemPanelDumper;
|
||||
import codechicken.nei.config.RegistryDumper;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.BrewingRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeItemInputHandler;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -28,6 +7,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -59,10 +39,35 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.InfiniteStackSizeHandler;
|
||||
import codechicken.nei.InfiniteToolHandler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemMobSpawner;
|
||||
import codechicken.nei.ItemStackMap;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PopupInputHandler;
|
||||
import codechicken.nei.config.ArrayDumper;
|
||||
import codechicken.nei.config.HandlerDumper;
|
||||
import codechicken.nei.config.ItemPanelDumper;
|
||||
import codechicken.nei.config.RegistryDumper;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.BrewingRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeItemInputHandler;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
/**
|
||||
* This is an internal class for storing information about items, to be accessed by the API
|
||||
*/
|
||||
public class ItemInfo {
|
||||
|
||||
public static enum Layout {
|
||||
HEADER,
|
||||
BODY,
|
||||
@@ -83,6 +88,7 @@ public class ItemInfo {
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<>();
|
||||
|
||||
private static class ItemStackKey {
|
||||
|
||||
public final ItemStack stack;
|
||||
|
||||
public ItemStackKey(ItemStack stack) {
|
||||
@@ -96,8 +102,7 @@ public class ItemInfo {
|
||||
hashCode = 31 * hashCode + stack.stackSize;
|
||||
hashCode = 31 * hashCode + Item.getIdFromItem(stack.getItem());
|
||||
hashCode = 31 * hashCode + stack.getItemDamage();
|
||||
hashCode = 31 * hashCode
|
||||
+ (!stack.hasTagCompound() ? 0 : stack.getTagCompound().hashCode());
|
||||
hashCode = 31 * hashCode + (!stack.hasTagCompound() ? 0 : stack.getTagCompound().hashCode());
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@@ -129,8 +134,7 @@ public class ItemInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Use field directly
|
||||
* @deprecated Use field directly
|
||||
*/
|
||||
@Deprecated
|
||||
public static List<ItemStack> getItemOverrides(Item item) {
|
||||
@@ -176,22 +180,18 @@ public class ItemInfo {
|
||||
|
||||
private static void addIDDumps() {
|
||||
API.addOption(new RegistryDumper<Item>("tools.dump.item") {
|
||||
|
||||
@Override
|
||||
public String[] header() {
|
||||
return new String[] {"Name", "ID", "Has Block", "Mod", "Class", "Display Name"};
|
||||
return new String[] { "Name", "ID", "Has Block", "Mod", "Class", "Display Name" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] dump(Item item, int id, String name) {
|
||||
return new String[] {
|
||||
name,
|
||||
Integer.toString(id),
|
||||
Boolean.toString(Block.getBlockFromItem(item) != Blocks.air),
|
||||
ItemInfo.itemOwners.get(item),
|
||||
item.getClass().getCanonicalName(),
|
||||
EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.itemDisplayNameShort(new ItemStack(item)))
|
||||
};
|
||||
return new String[] { name, Integer.toString(id),
|
||||
Boolean.toString(Block.getBlockFromItem(item) != Blocks.air), ItemInfo.itemOwners.get(item),
|
||||
item.getClass().getCanonicalName(), EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.itemDisplayNameShort(new ItemStack(item))) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,25 +200,19 @@ public class ItemInfo {
|
||||
}
|
||||
});
|
||||
API.addOption(new RegistryDumper<Block>("tools.dump.block") {
|
||||
|
||||
@Override
|
||||
public String[] header() {
|
||||
return new String[] {"Name", "ID", "Has Item", "Mod", "Class", "Display Name"};
|
||||
return new String[] { "Name", "ID", "Has Item", "Mod", "Class", "Display Name" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] dump(Block block, int id, String name) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
return new String[] {
|
||||
name,
|
||||
Integer.toString(id),
|
||||
Boolean.toString(item != null),
|
||||
ItemInfo.itemOwners.get(block),
|
||||
block.getClass().getCanonicalName(),
|
||||
item != null
|
||||
? EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.itemDisplayNameShort(new ItemStack(item)))
|
||||
: "null"
|
||||
};
|
||||
return new String[] { name, Integer.toString(id), Boolean.toString(item != null),
|
||||
ItemInfo.itemOwners.get(block), block.getClass().getCanonicalName(),
|
||||
item != null ? EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.itemDisplayNameShort(new ItemStack(item))) : "null" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,15 +221,14 @@ public class ItemInfo {
|
||||
}
|
||||
});
|
||||
API.addOption(new ArrayDumper<Potion>("tools.dump.potion") {
|
||||
|
||||
public String[] header() {
|
||||
return new String[] {"ID", "Unlocalised name", "Class"};
|
||||
return new String[] { "ID", "Unlocalised name", "Class" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] dump(Potion potion, int id) {
|
||||
return new String[] {
|
||||
Integer.toString(id), potion.getName(), potion.getClass().getCanonicalName()
|
||||
};
|
||||
return new String[] { Integer.toString(id), potion.getName(), potion.getClass().getCanonicalName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,20 +237,16 @@ public class ItemInfo {
|
||||
}
|
||||
});
|
||||
API.addOption(new ArrayDumper<Enchantment>("tools.dump.enchantment") {
|
||||
|
||||
public String[] header() {
|
||||
return new String[] {"ID", "Unlocalised name", "Type", "Min Level", "Max Level", "Class"};
|
||||
return new String[] { "ID", "Unlocalised name", "Type", "Min Level", "Max Level", "Class" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] dump(Enchantment ench, int id) {
|
||||
return new String[] {
|
||||
Integer.toString(id),
|
||||
ench.getName(),
|
||||
ench.type.toString(),
|
||||
Integer.toString(ench.getMinLevel()),
|
||||
Integer.toString(ench.getMaxLevel()),
|
||||
ench.getClass().getCanonicalName()
|
||||
};
|
||||
return new String[] { Integer.toString(id), ench.getName(), ench.type.toString(),
|
||||
Integer.toString(ench.getMinLevel()), Integer.toString(ench.getMaxLevel()),
|
||||
ench.getClass().getCanonicalName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -266,19 +255,11 @@ public class ItemInfo {
|
||||
}
|
||||
});
|
||||
API.addOption(new ArrayDumper<BiomeGenBase>("tools.dump.biome") {
|
||||
|
||||
@Override
|
||||
public String[] header() {
|
||||
return new String[] {
|
||||
"ID",
|
||||
"Name",
|
||||
"Temperature",
|
||||
"Rainfall",
|
||||
"Spawn Chance",
|
||||
"Root Height",
|
||||
"Height Variation",
|
||||
"Types",
|
||||
"Class"
|
||||
};
|
||||
return new String[] { "ID", "Name", "Temperature", "Rainfall", "Spawn Chance", "Root Height",
|
||||
"Height Variation", "Types", "Class" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,17 +271,11 @@ public class ItemInfo {
|
||||
s_types.append(t.name());
|
||||
}
|
||||
|
||||
return new String[] {
|
||||
Integer.toString(id),
|
||||
biome.biomeName,
|
||||
Float.toString(biome.getFloatTemperature(0, 0, 0)),
|
||||
Float.toString(biome.getFloatRainfall()),
|
||||
Float.toString(biome.getSpawningChance()),
|
||||
Float.toString(biome.rootHeight),
|
||||
Float.toString(biome.heightVariation),
|
||||
s_types.toString(),
|
||||
biome.getClass().getCanonicalName()
|
||||
};
|
||||
return new String[] { Integer.toString(id), biome.biomeName,
|
||||
Float.toString(biome.getFloatTemperature(0, 0, 0)), Float.toString(biome.getFloatRainfall()),
|
||||
Float.toString(biome.getSpawningChance()), Float.toString(biome.rootHeight),
|
||||
Float.toString(biome.heightVariation), s_types.toString(),
|
||||
biome.getClass().getCanonicalName() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,8 +294,7 @@ public class ItemInfo {
|
||||
UniqueIdentifier ident = null;
|
||||
try {
|
||||
ident = GameRegistry.findUniqueIdentifierFor(item);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (ident == null) {
|
||||
NEIClientConfig.logger.error("Failed to find identifier for: " + item);
|
||||
@@ -410,8 +384,8 @@ public class ItemInfo {
|
||||
item.getSubItems(item, itemTab, stackList);
|
||||
for (ItemStack stack : stackList) set.add(stack);
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error(
|
||||
"Error loading sub-items for: " + item + ". Tab: " + itemTab.getTabLabel(), e);
|
||||
NEIClientConfig.logger
|
||||
.error("Error loading sub-items for: " + item + ". Tab: " + itemTab.getTabLabel(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,21 +397,20 @@ public class ItemInfo {
|
||||
else if (item instanceof ItemAxe) axes.with(item);
|
||||
else if (item instanceof ItemHoe) hoes.with(item);
|
||||
else if (item instanceof ItemSword) swords.with(item);
|
||||
else if (item instanceof ItemArmor)
|
||||
switch (((ItemArmor) item).armorType) {
|
||||
case 0:
|
||||
helmets.with(item);
|
||||
break;
|
||||
case 1:
|
||||
chest.with(item);
|
||||
break;
|
||||
case 2:
|
||||
legs.with(item);
|
||||
break;
|
||||
case 3:
|
||||
boots.with(item);
|
||||
break;
|
||||
}
|
||||
else if (item instanceof ItemArmor) switch (((ItemArmor) item).armorType) {
|
||||
case 0:
|
||||
helmets.with(item);
|
||||
break;
|
||||
case 1:
|
||||
chest.with(item);
|
||||
break;
|
||||
case 2:
|
||||
legs.with(item);
|
||||
break;
|
||||
case 3:
|
||||
boots.with(item);
|
||||
break;
|
||||
}
|
||||
else if (item == Items.arrow || item == Items.bow) ranged.with(item);
|
||||
else if (item == Items.fishing_rod || item == Items.flint_and_steel || item == Items.shears)
|
||||
other.with(item);
|
||||
@@ -517,8 +490,7 @@ public class ItemInfo {
|
||||
|
||||
try {
|
||||
items.addAll(mouseoverBlock.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0));
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
if (mouseoverBlock instanceof IShearable) {
|
||||
IShearable shearable = (IShearable) mouseoverBlock;
|
||||
if (shearable.isShearable(new ItemStack(Items.shears), world, x, y, z))
|
||||
@@ -531,12 +503,11 @@ public class ItemInfo {
|
||||
}
|
||||
|
||||
public static void registerHighlightHandler(IHighlightHandler handler, ItemInfo.Layout... layouts) {
|
||||
for (ItemInfo.Layout layout : layouts)
|
||||
ItemInfo.highlightHandlers.get(layout).add(handler);
|
||||
for (ItemInfo.Layout layout : layouts) ItemInfo.highlightHandlers.get(layout).add(handler);
|
||||
}
|
||||
|
||||
public static List<String> getText(
|
||||
ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) {
|
||||
public static List<String> getText(ItemStack itemStack, World world, EntityPlayer player,
|
||||
MovingObjectPosition mop) {
|
||||
List<String> retString = new ArrayList<>();
|
||||
|
||||
for (ItemInfo.Layout layout : ItemInfo.Layout.values())
|
||||
@@ -550,7 +521,6 @@ public class ItemInfo {
|
||||
return itemSearchNames.computeIfAbsent(
|
||||
new ItemStackKey(stack),
|
||||
key -> EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.concatenatedDisplayName(key.stack, true)
|
||||
.toLowerCase()));
|
||||
GuiContainerManager.concatenatedDisplayName(key.stack, true).toLowerCase()));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
public abstract class LayoutStyle {
|
||||
|
||||
public abstract void init();
|
||||
|
||||
public abstract void reset();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.config.OptionCycled;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class NEIInfo {
|
||||
|
||||
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<>();
|
||||
|
||||
public static void load(World world) {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
@@ -8,10 +15,6 @@ import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
public abstract class ShortcutInputHandler {
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class TaggedInventoryArea {
|
||||
|
||||
public final HashSet<Integer> slots = new HashSet<>();
|
||||
public final String tagName;
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user