mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-20 20:22:17 +00:00
Intellij suggested changes
This commit is contained in:
1 parent
e3462ac9c9
commit
05b5fa7baf
80 files changed
+479
-487
No files matched your search
@@ -2,4 +2,4 @@ mc_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
ccl_version=1.1.3.138
|
||||
ccc_version=1.0.7.+
|
||||
mod_version=2.0.0-pre-4-GTNH
|
||||
mod_version=2.0.0-pre-5-GTNH
|
||||
@@ -10,7 +10,6 @@ nei.inventory.options=옵션
|
||||
nei.inventory.prev=이전
|
||||
nei.inventory.next=다음
|
||||
nei.inventory.item_subsets=아이템 하위집합
|
||||
nei.inventory.delete.all=현재의 화면에 있는 모든 항목을 삭제
|
||||
nei.inventory.delete.one=%s 삭제
|
||||
nei.inventory.delete.all=%s 모두삭제
|
||||
nei.inventory.delete.enable=삭제모드 활성화
|
||||
|
||||
@@ -64,7 +64,6 @@ nei.options.keys.gui.back=Poprzednia recepta
|
||||
nei.options.keys.gui.prev=Poprzednia strona
|
||||
nei.options.keys.gui.next=Następna strona
|
||||
nei.options.keys.gui.hide=Przełącz widzialność NEI
|
||||
nei.options.keys.gui.search=Focus Search Bar
|
||||
nei.options.keys.gui.search=Ustaw ostrość na pasek wyszukiwania
|
||||
nei.options.keys.world=Świat
|
||||
nei.options.keys.world.chunkoverlay=Nakładka granic chunków
|
||||
@@ -99,7 +98,6 @@ nei.options.inventory.searchmode.0=Prosty
|
||||
nei.options.inventory.searchmode.1=Rozszerzony
|
||||
nei.options.inventory.searchmode.2=Wyrażenia regularne
|
||||
nei.options.inventory.utilities=Narzędzia
|
||||
nei.options.inventory.utilities.tip=Select features for utility mode
|
||||
nei.options.inventory.utilities.tip=Wybierz cechy trybu użytkowego
|
||||
nei.options.inventory.utilities.time=Czas
|
||||
nei.options.inventory.utilities.rain=Deszcz
|
||||
|
||||
@@ -14,7 +14,6 @@ nei.inventory.options=Опции
|
||||
nei.inventory.prev=Предыдущая
|
||||
nei.inventory.next=Следующая
|
||||
nei.inventory.item_subsets=Подмножества предметов
|
||||
nei.inventory.delete.all=УДАЛИТЬ ВСЕ ПРЕДМЕТЫ из текущего инвентаря
|
||||
nei.inventory.delete.one=Удалить %s
|
||||
nei.inventory.delete.all=Удалить ВСЕ %s
|
||||
nei.inventory.delete.enable=Режим удаления
|
||||
|
||||
@@ -12,7 +12,6 @@ nei.inventory.next=下一頁
|
||||
nei.inventory.item_subsets=物品分類表
|
||||
nei.inventory.delete.all=刪除當前物品欄內所有物品
|
||||
nei.inventory.delete.one=刪除 %s
|
||||
nei.inventory.delete.all=清空物品欄
|
||||
nei.inventory.delete.enable=開啟刪除模式設定
|
||||
nei.inventory.delete.1=開啟刪除模式
|
||||
nei.inventory.delete.0=關閉刪除模式
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class Button extends Widget
|
||||
return label;
|
||||
}
|
||||
|
||||
public String label;
|
||||
public final String label;
|
||||
public Image icon;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,11 @@ import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.*;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiErrorScreen;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiSelectWorld;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -28,14 +32,14 @@ public class ClientHandler
|
||||
{
|
||||
private static ClientHandler instance;
|
||||
|
||||
private ArrayList<EntityItem> SMPmagneticItems = new ArrayList<EntityItem>();
|
||||
private ArrayList<EntityItem> SMPmagneticItems = new ArrayList<>();
|
||||
private World lastworld;
|
||||
private GuiScreen lastGui;
|
||||
|
||||
public void addSMPMagneticItem(int i, World world) {
|
||||
WorldClient cworld = (WorldClient) world;
|
||||
Entity e = cworld.getEntityByID(i);
|
||||
if (e == null || !(e instanceof EntityItem)) {
|
||||
if (!(e instanceof EntityItem)) {
|
||||
return;
|
||||
}
|
||||
SMPmagneticItems.add((EntityItem) e);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ContainerCreativeInv extends Container
|
||||
{
|
||||
private class SlotArmor extends Slot
|
||||
{
|
||||
int armorType;
|
||||
final int armorType;
|
||||
|
||||
public SlotArmor(IInventory inv, int x, int y, int slot, int armor) {
|
||||
super(inv, x, y, slot);
|
||||
|
||||
@@ -29,12 +29,12 @@ public class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
level = l;
|
||||
}
|
||||
|
||||
Enchantment enchantment;
|
||||
final Enchantment enchantment;
|
||||
int state;
|
||||
int level;
|
||||
final int level;
|
||||
}
|
||||
|
||||
public ArrayList<EnchantmentHash> slotEnchantment = new ArrayList<EnchantmentHash>();
|
||||
public final ArrayList<EnchantmentHash> slotEnchantment = new ArrayList<>();
|
||||
int level = 5;
|
||||
|
||||
public int scrollclicky = -1;
|
||||
@@ -60,11 +60,7 @@ public class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
int sbarh = (int) ((height / (float) getContentHeight()) * height);
|
||||
if (sbarh > height) {
|
||||
return height;
|
||||
} else if (sbarh < height / 15) {
|
||||
return height / 15;
|
||||
} else {
|
||||
return sbarh;
|
||||
}
|
||||
} else return Math.max(sbarh, height / 15);
|
||||
}
|
||||
|
||||
public int getScrollBarWidth() {
|
||||
@@ -237,7 +233,7 @@ public class ContainerEnchantmentModifier extends ContainerEnchantment
|
||||
|
||||
public void drawSlots(GuiEnchantmentModifier gui) {
|
||||
for (int slot = 0; slot < 3; slot++) {
|
||||
int shade = 0;
|
||||
int shade;
|
||||
String text = "";
|
||||
|
||||
int containerslot = slot + getScrolledSlots();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.lib.inventory.ContainerExtended;
|
||||
import codechicken.lib.inventory.SlotHandleClicks;
|
||||
import codechicken.lib.inventory.InventoryNBT;
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.lib.inventory.SlotHandleClicks;
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -86,9 +86,9 @@ public class ContainerPotionCreator extends ContainerExtended
|
||||
}
|
||||
}
|
||||
|
||||
InventoryPlayer playerInv;
|
||||
InventoryBasic potionInv;
|
||||
IInventory potionStoreInv;
|
||||
final InventoryPlayer playerInv;
|
||||
final InventoryBasic potionInv;
|
||||
final IInventory potionStoreInv;
|
||||
|
||||
public ContainerPotionCreator(InventoryPlayer inventoryPlayer, IInventory potionStoreInv) {
|
||||
playerInv = inventoryPlayer;
|
||||
|
||||
@@ -7,8 +7,8 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ExtendedCreativeInv implements IInventory
|
||||
{
|
||||
PlayerSave playerSave;
|
||||
Side side;
|
||||
final PlayerSave playerSave;
|
||||
final Side side;
|
||||
|
||||
public ExtendedCreativeInv(PlayerSave playerSave, Side side) {
|
||||
this.playerSave = playerSave;
|
||||
@@ -33,10 +33,9 @@ public class ExtendedCreativeInv implements IInventory
|
||||
|
||||
if (item != null) {
|
||||
if (item.stackSize <= size) {
|
||||
ItemStack itemstack = item;
|
||||
setInventorySlotContents(slot, null);
|
||||
markDirty();
|
||||
return itemstack;
|
||||
return item;
|
||||
}
|
||||
ItemStack itemstack1 = item.splitStack(size);
|
||||
if (item.stackSize == 0) {
|
||||
|
||||
@@ -6,9 +6,14 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import static codechicken.nei.NEIServerUtils.*;
|
||||
import static codechicken.nei.NEIServerUtils.areStacksIdentical;
|
||||
import static codechicken.nei.NEIServerUtils.areStacksSameType;
|
||||
import static codechicken.nei.NEIServerUtils.copyStack;
|
||||
|
||||
public class FastTransferManager
|
||||
{
|
||||
@@ -17,7 +22,7 @@ public class FastTransferManager
|
||||
*/
|
||||
public static class SlotPositionComparator implements Comparator<Integer>
|
||||
{
|
||||
Container container;
|
||||
final Container container;
|
||||
|
||||
public SlotPositionComparator(Container c) {
|
||||
container = c;
|
||||
@@ -34,8 +39,8 @@ public class FastTransferManager
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedList<LinkedList<Integer>> slotZones = new LinkedList<LinkedList<Integer>>();
|
||||
public HashMap<Integer, Integer> slotZoneMap = new HashMap<Integer, Integer>();
|
||||
public LinkedList<LinkedList<Integer>> slotZones = new LinkedList<>();
|
||||
public HashMap<Integer, Integer> slotZoneMap = new HashMap<>();
|
||||
|
||||
private void generateSlotMap(Container container, ItemStack stack) {
|
||||
stack = stack.copy();
|
||||
@@ -45,11 +50,11 @@ public class FastTransferManager
|
||||
if (slotZoneMap.containsKey(slotNo) || !container.getSlot(slotNo).isItemValid(stack))
|
||||
continue;
|
||||
|
||||
HashSet<Integer> connectedSlots = new HashSet<Integer>();
|
||||
HashSet<Integer> connectedSlots = new HashSet<>();
|
||||
findConnectedSlots(container, slotNo, connectedSlots);
|
||||
|
||||
LinkedList<Integer> zoneSlots = new LinkedList<Integer>(connectedSlots);
|
||||
Collections.sort(zoneSlots, new SlotPositionComparator(container));
|
||||
LinkedList<Integer> zoneSlots = new LinkedList<>(connectedSlots);
|
||||
zoneSlots.sort(new SlotPositionComparator(container));
|
||||
slotZones.add(zoneSlots);
|
||||
|
||||
for (int i : zoneSlots) {
|
||||
@@ -77,7 +82,7 @@ public class FastTransferManager
|
||||
public static int findSlotWithItem(Container container, ItemStack teststack) {
|
||||
for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) {
|
||||
ItemStack stack = container.getSlot(slotNo).getStack();
|
||||
if (stack != null && areStacksSameType(stack, teststack))
|
||||
if (areStacksSameType(stack, teststack))
|
||||
return slotNo;
|
||||
}
|
||||
return -1;
|
||||
@@ -159,7 +164,7 @@ public class FastTransferManager
|
||||
}
|
||||
|
||||
public LinkedList<ItemStack> saveContainer(Container container) {
|
||||
LinkedList<ItemStack> stacks = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> stacks = new LinkedList<>();
|
||||
for (int i = 0; i < container.inventorySlots.size(); i++)
|
||||
stacks.add(copyStack(container.getSlot(i).getStack()));
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
public class GuiEnchantmentModifier extends GuiContainer
|
||||
{
|
||||
ContainerEnchantmentModifier container;
|
||||
final ContainerEnchantmentModifier container;
|
||||
|
||||
public GuiEnchantmentModifier(InventoryPlayer inventoryplayer, World world, int i, int j, int k) {
|
||||
super(new ContainerEnchantmentModifier(inventoryplayer, world, i, j, k));
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler
|
||||
@@ -41,7 +41,7 @@ public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandl
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return Arrays.asList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
|
||||
return Collections.singletonList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiNEIButton extends GuiButton
|
||||
{
|
||||
protected static ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
public GuiNEIButton(int i, int j, int k, int l, int i1, String s)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
@@ -25,7 +25,7 @@ public class GuiPotionCreator extends GuiContainerWidget
|
||||
{
|
||||
public int selectedslot = -1;
|
||||
public boolean enabled = true;
|
||||
private ArrayList<Potion> validPotions = new ArrayList<Potion>();
|
||||
private final ArrayList<Potion> validPotions = new ArrayList<>();
|
||||
|
||||
public GuiSlotPotionEffects(int x, int y) {
|
||||
super(x, y, 108, 76);
|
||||
@@ -256,7 +256,7 @@ public class GuiPotionCreator extends GuiContainerWidget
|
||||
GuiCCButton ampUp;
|
||||
GuiSlotPotionEffects slotPotionEffects;
|
||||
GuiDurationField durationField;
|
||||
ContainerPotionCreator container;
|
||||
final ContainerPotionCreator container;
|
||||
|
||||
public GuiPotionCreator(InventoryPlayer inventoryplayer) {
|
||||
super(new ContainerPotionCreator(inventoryplayer, new ContainerPotionCreator.InventoryPotionStore()), 176, 208);
|
||||
|
||||
@@ -12,13 +12,15 @@ import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.displaySize;
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTooltipBox;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public class HUDRenderer implements IKeyStateTracker
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ItemList
|
||||
/**
|
||||
* Fields are replaced atomically and contents never modified.
|
||||
*/
|
||||
public static volatile List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
public static volatile List<ItemStack> items = new ArrayList<>();
|
||||
/**
|
||||
* Fields are replaced atomically and contents never modified.
|
||||
*/
|
||||
@@ -30,11 +30,11 @@ public class ItemList
|
||||
/**
|
||||
* Updates to this should be synchronised on this
|
||||
*/
|
||||
public static final List<ItemFilterProvider> itemFilterers = new LinkedList<ItemFilterProvider>();
|
||||
public static final List<ItemsLoadedCallback> loadCallbacks = new LinkedList<ItemsLoadedCallback>();
|
||||
public static final List<ItemFilterProvider> itemFilterers = new LinkedList<>();
|
||||
public static final List<ItemsLoadedCallback> loadCallbacks = new LinkedList<>();
|
||||
|
||||
private static HashSet<Item> erroredItems = new HashSet<Item>();
|
||||
private static HashSet<String> stackTraces = new HashSet<String>();
|
||||
private static final HashSet<Item> erroredItems = new HashSet<>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
|
||||
public static class EverythingItemFilter implements ItemFilter
|
||||
{
|
||||
@@ -68,14 +68,14 @@ public class ItemList
|
||||
|
||||
public static class AllMultiItemFilter implements ItemFilter
|
||||
{
|
||||
public List<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
public List<ItemFilter> filters;
|
||||
|
||||
public AllMultiItemFilter(List<ItemFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AllMultiItemFilter() {
|
||||
this(new LinkedList<ItemFilter>());
|
||||
this(new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,14 +93,14 @@ public class ItemList
|
||||
|
||||
public static class AnyMultiItemFilter implements ItemFilter
|
||||
{
|
||||
public List<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
public List<ItemFilter> filters;
|
||||
|
||||
public AnyMultiItemFilter(List<ItemFilter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AnyMultiItemFilter() {
|
||||
this(new LinkedList<ItemFilter>());
|
||||
this(new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +147,7 @@ public class ItemList
|
||||
}
|
||||
|
||||
public static List<ItemFilter> getItemFilters() {
|
||||
LinkedList<ItemFilter> filters = new LinkedList<ItemFilter>();
|
||||
LinkedList<ItemFilter> filters = new LinkedList<>();
|
||||
synchronized (itemFilterers) {
|
||||
for(ItemFilterProvider p : itemFilterers)
|
||||
filters.add(p.getFilter());
|
||||
@@ -158,7 +158,7 @@ public class ItemList
|
||||
public static final RestartableTask loadItems = new RestartableTask("NEI Item Loading")
|
||||
{
|
||||
private void damageSearch(Item item, List<ItemStack> permutations) {
|
||||
HashSet<String> damageIconSet = new HashSet<String>();
|
||||
HashSet<String> damageIconSet = new HashSet<>();
|
||||
for (int damage = 0; damage < 16; damage++)
|
||||
try {
|
||||
ItemStack itemstack = new ItemStack(item, 1, damage);
|
||||
@@ -182,8 +182,8 @@ public class ItemList
|
||||
public void execute() {
|
||||
ThreadOperationTimer timer = getTimer(500);
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> items = new LinkedList<>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<>();
|
||||
ListMultimap<Item, ItemStack> itemMap = ArrayListMultimap.create();
|
||||
|
||||
timer.setLimit(500);
|
||||
@@ -231,7 +231,7 @@ public class ItemList
|
||||
{
|
||||
@Override
|
||||
public void execute() {
|
||||
ArrayList<ItemStack> filtered = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> filtered = new ArrayList<>();
|
||||
ItemFilter filter = getItemListFilter();
|
||||
|
||||
items.parallelStream().forEach(item -> {
|
||||
@@ -247,7 +247,7 @@ public class ItemList
|
||||
if(interrupted()) return;
|
||||
ItemSorter.sort(filtered);
|
||||
if(interrupted()) return;
|
||||
ItemPanels.itemPanel.updateItemList(filtered);
|
||||
ItemPanel.updateItemList(filtered);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public class ItemMobSpawner extends ItemBlock
|
||||
hasSubtypes = true;
|
||||
MinecraftForgeClient.registerItemRenderer(this, new SpawnerRenderer());
|
||||
|
||||
entityHashMap = new HashMap<Integer, EntityLiving>();
|
||||
IDtoNameMap = new HashMap<Integer, String>();
|
||||
entityHashMap = new HashMap<>();
|
||||
IDtoNameMap = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ItemPanel extends Widget {
|
||||
/**
|
||||
* Should not be externally modified, use updateItemList
|
||||
*/
|
||||
public ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
public ArrayList<ItemStack> items = new ArrayList<>();
|
||||
/**
|
||||
* Swapped into visible items on update
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
public class ItemPanels {
|
||||
public static ItemPanel itemPanel = new ItemPanel();
|
||||
public static BookmarkPanel bookmarkPanel = new BookmarkPanel();
|
||||
public static final ItemPanel itemPanel = new ItemPanel();
|
||||
public static final BookmarkPanel bookmarkPanel = new BookmarkPanel();
|
||||
}
|
||||
@@ -19,8 +19,8 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
{
|
||||
public static class SortEntry
|
||||
{
|
||||
public String name;
|
||||
public Comparator<ItemStack> comparator;
|
||||
public final String name;
|
||||
public final Comparator<ItemStack> comparator;
|
||||
|
||||
public SortEntry(String name, Comparator<ItemStack> comparator) {
|
||||
this.name = name;
|
||||
@@ -38,8 +38,8 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<SortEntry> entries = new ArrayList<SortEntry>();
|
||||
public static ArrayList<SortEntry> list = new ArrayList<SortEntry>();
|
||||
public static final ArrayList<SortEntry> entries = new ArrayList<>();
|
||||
public static ArrayList<SortEntry> list = new ArrayList<>();
|
||||
public static final ItemSorter instance = new ItemSorter();
|
||||
|
||||
//optimisations
|
||||
@@ -65,7 +65,7 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
|
||||
@Override
|
||||
public void itemsLoaded() {
|
||||
HashMap<ItemStack, Integer> newMap = new HashMap<ItemStack, Integer>();
|
||||
HashMap<ItemStack, Integer> newMap = new HashMap<>();
|
||||
int i = 0;
|
||||
for(ItemStack stack : ItemList.items)
|
||||
newMap.put(stack, i++);
|
||||
@@ -81,76 +81,52 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
}
|
||||
|
||||
public static int compareInt(int a, int b) {
|
||||
return a == b ? 0 : a < b ? -1 : 1;
|
||||
return Integer.compare(a, b);
|
||||
}
|
||||
|
||||
public static void add(String name, Comparator<ItemStack> comparator) {
|
||||
SortEntry e = new SortEntry(name, comparator);
|
||||
entries.add(e);
|
||||
ArrayList<SortEntry> nlist = new ArrayList<SortEntry>(list);
|
||||
ArrayList<SortEntry> nlist = new ArrayList<>(list);
|
||||
nlist.add(e);
|
||||
list = nlist;//concurrency
|
||||
}
|
||||
|
||||
public static void initConfig(ConfigTagParent tag) {
|
||||
//minecraft, mod, id, default, meta, name
|
||||
API.addSortOption("nei.itemsort.minecraft", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.getItem()));
|
||||
boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.getItem()));
|
||||
return m1 == m2 ? 0 : m1 ? -1 : 1;
|
||||
}
|
||||
API.addSortOption("nei.itemsort.minecraft", (o1, o2) -> {
|
||||
boolean m1 = "minecraft".equals(ItemInfo.itemOwners.get(o1.getItem()));
|
||||
boolean m2 = "minecraft".equals(ItemInfo.itemOwners.get(o2.getItem()));
|
||||
return m1 == m2 ? 0 : m1 ? -1 : 1;
|
||||
});
|
||||
API.addSortOption("nei.itemsort.mod", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
String mod1 = ItemInfo.itemOwners.get(o1.getItem());
|
||||
String mod2 = ItemInfo.itemOwners.get(o2.getItem());
|
||||
if(mod1 == null) return mod2 == null ? 0 : 1;
|
||||
if(mod2 == null) return -1;
|
||||
return mod1.compareTo(mod2);
|
||||
}
|
||||
API.addSortOption("nei.itemsort.mod", (o1, o2) -> {
|
||||
String mod1 = ItemInfo.itemOwners.get(o1.getItem());
|
||||
String mod2 = ItemInfo.itemOwners.get(o2.getItem());
|
||||
if(mod1 == null) return mod2 == null ? 0 : 1;
|
||||
if(mod2 == null) return -1;
|
||||
return mod1.compareTo(mod2);
|
||||
});
|
||||
API.addSortOption("nei.itemsort.id", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
int id1 = Item.getIdFromItem(o1.getItem());
|
||||
int id2 = Item.getIdFromItem(o2.getItem());
|
||||
return compareInt(id1, id2);
|
||||
}
|
||||
API.addSortOption("nei.itemsort.id", (o1, o2) -> {
|
||||
int id1 = Item.getIdFromItem(o1.getItem());
|
||||
int id2 = Item.getIdFromItem(o2.getItem());
|
||||
return compareInt(id1, id2);
|
||||
});
|
||||
API.addSortOption("nei.itemsort.default", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
Integer order1 = instance.ordering.get(o1);
|
||||
Integer order2 = instance.ordering.get(o2);
|
||||
if(order1 == null) return order2 == null ? 0 : 1;
|
||||
if(order2 == null) return -1;
|
||||
return compareInt(order1, order2);
|
||||
}
|
||||
API.addSortOption("nei.itemsort.default", (o1, o2) -> {
|
||||
Integer order1 = instance.ordering.get(o1);
|
||||
Integer order2 = instance.ordering.get(o2);
|
||||
if(order1 == null) return order2 == null ? 0 : 1;
|
||||
if(order2 == null) return -1;
|
||||
return compareInt(order1, order2);
|
||||
});
|
||||
API.addSortOption("nei.itemsort.damage", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
int id1 = o1.getItemDamage();
|
||||
int id2 = o2.getItemDamage();
|
||||
return compareInt(id1, id2);
|
||||
}
|
||||
API.addSortOption("nei.itemsort.damage", (o1, o2) -> {
|
||||
int id1 = o1.getItemDamage();
|
||||
int id2 = o2.getItemDamage();
|
||||
return compareInt(id1, id2);
|
||||
});
|
||||
API.addSortOption("nei.itemsort.name", new Comparator<ItemStack>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ItemStack o1, ItemStack o2) {
|
||||
String name1 = ItemInfo.getSearchName(o1);
|
||||
String name2 = ItemInfo.getSearchName(o2);
|
||||
return name1.compareTo(name2);
|
||||
}
|
||||
API.addSortOption("nei.itemsort.name", (o1, o2) -> {
|
||||
String name1 = ItemInfo.getSearchName(o1);
|
||||
String name2 = ItemInfo.getSearchName(o2);
|
||||
return name1.compareTo(name2);
|
||||
});
|
||||
tag.getTag("inventory.itemsort").setDefaultValue(getSaveString(list));
|
||||
API.addOption(new OptionOpenGui("inventory.itemsort", GuiItemSorter.class) {
|
||||
@@ -175,9 +151,9 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback
|
||||
|
||||
public static ArrayList<SortEntry> fromSaveString(String s) {
|
||||
if(s == null)
|
||||
return new ArrayList<SortEntry>(entries);
|
||||
return new ArrayList<>(entries);
|
||||
|
||||
ArrayList<SortEntry> list = new ArrayList<SortEntry>();
|
||||
ArrayList<SortEntry> list = new ArrayList<>();
|
||||
for(String s2 : s.split(",")) {
|
||||
SortEntry e = find(s2.trim());
|
||||
if(e != null)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import com.google.common.base.*;
|
||||
import com.google.common.base.Objects;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,8 +21,8 @@ public class ItemStackMap<T>
|
||||
{
|
||||
public static class StackMetaKey
|
||||
{
|
||||
public int damage;
|
||||
public NBTTagCompound tag;
|
||||
public final int damage;
|
||||
public final NBTTagCompound tag;
|
||||
|
||||
public StackMetaKey(int damage, NBTTagCompound tag) {
|
||||
this.damage = damage;
|
||||
@@ -47,8 +47,8 @@ public class ItemStackMap<T>
|
||||
|
||||
public static class Entry<T>
|
||||
{
|
||||
public ItemStack key;
|
||||
public T value;
|
||||
public final ItemStack key;
|
||||
public final T value;
|
||||
|
||||
public Entry(ItemStack key, T value) {
|
||||
this.key = key;
|
||||
@@ -70,11 +70,11 @@ public class ItemStackMap<T>
|
||||
return wildcard;
|
||||
|
||||
if (damageMap != null) {
|
||||
T ret = damageMap.get(actualDamage(key));
|
||||
final T ret = damageMap.get(actualDamage(key));
|
||||
if (ret != null) return ret;
|
||||
}
|
||||
if (tagMap != null) {
|
||||
T ret = tagMap.get(key.stackTagCompound);
|
||||
final T ret = tagMap.get(key.stackTagCompound);
|
||||
if (ret != null) return ret;
|
||||
}
|
||||
if (metaMap != null)
|
||||
@@ -87,13 +87,13 @@ public class ItemStackMap<T>
|
||||
try {
|
||||
switch (getKeyType(actualDamage(key), key.stackTagCompound)) {
|
||||
case 0:
|
||||
if (metaMap == null) metaMap = new HashMap<StackMetaKey, T>();
|
||||
if (metaMap == null) metaMap = new HashMap<>();
|
||||
return metaMap.put(new StackMetaKey(key), value);
|
||||
case 1:
|
||||
if (tagMap == null) tagMap = new HashMap<NBTTagCompound, T>();
|
||||
if (tagMap == null) tagMap = new HashMap<>();
|
||||
return tagMap.put(key.stackTagCompound, value);
|
||||
case 2:
|
||||
if (damageMap == null) damageMap = new HashMap<Integer, T>();
|
||||
if (damageMap == null) damageMap = new HashMap<>();
|
||||
return damageMap.put(actualDamage(key), value);
|
||||
case 3:
|
||||
T ret = wildcard;
|
||||
@@ -167,16 +167,16 @@ public class ItemStackMap<T>
|
||||
|
||||
public void addEntries(Item item, List<Entry<T>> list) {
|
||||
if (wildcard != null)
|
||||
list.add(new Entry<T>(newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG), wildcard));
|
||||
list.add(new Entry<>(newItemStack(item, 1, WILDCARD_VALUE, WILDCARD_TAG), wildcard));
|
||||
if (damageMap != null)
|
||||
for (Map.Entry<Integer, T> entry : damageMap.entrySet())
|
||||
list.add(new Entry<T>(newItemStack(item, 1, entry.getKey(), WILDCARD_TAG), entry.getValue()));
|
||||
list.add(new Entry<>(newItemStack(item, 1, entry.getKey(), WILDCARD_TAG), entry.getValue()));
|
||||
if (tagMap != null)
|
||||
for (Map.Entry<NBTTagCompound, T> entry : tagMap.entrySet())
|
||||
list.add(new Entry<T>(newItemStack(item, 1, WILDCARD_VALUE, entry.getKey()), entry.getValue()));
|
||||
list.add(new Entry<>(newItemStack(item, 1, WILDCARD_VALUE, entry.getKey()), entry.getValue()));
|
||||
if (metaMap != null)
|
||||
for (Map.Entry<StackMetaKey, T> entry : metaMap.entrySet())
|
||||
list.add(new Entry<T>(newItemStack(item, 1, entry.getKey().damage, entry.getKey().tag), entry.getValue()));
|
||||
list.add(new Entry<>(newItemStack(item, 1, entry.getKey().damage, entry.getKey().tag), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,21 +199,22 @@ public class ItemStackMap<T>
|
||||
return tag != null && tag.getBoolean("*");
|
||||
}
|
||||
|
||||
public static NBTTagCompound WILDCARD_TAG;
|
||||
public static final NBTTagCompound WILDCARD_TAG;
|
||||
|
||||
static {
|
||||
WILDCARD_TAG = new NBTTagCompound();
|
||||
WILDCARD_TAG.setBoolean("*", true);
|
||||
}
|
||||
|
||||
private HashMap<Item, DetailMap> itemMap = new HashMap<Item, DetailMap>();
|
||||
private final HashMap<Item, DetailMap> itemMap = new HashMap<>();
|
||||
private int size;
|
||||
|
||||
public T get(ItemStack key) {
|
||||
if (key == null || key.getItem() == null)
|
||||
return null;
|
||||
if (key == null) return null;
|
||||
final Item item = key.getItem();
|
||||
if (item == null) return null;
|
||||
|
||||
DetailMap map = itemMap.get(key.getItem());
|
||||
final DetailMap map = itemMap.get(item);
|
||||
return map == null ? null : map.get(key);
|
||||
}
|
||||
|
||||
@@ -240,21 +241,21 @@ public class ItemStackMap<T>
|
||||
}
|
||||
|
||||
public List<ItemStack> keys() {
|
||||
LinkedList<ItemStack> list = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> list = new LinkedList<>();
|
||||
for (Map.Entry<Item, DetailMap> entry : itemMap.entrySet())
|
||||
entry.getValue().addKeys(entry.getKey(), list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<T> values() {
|
||||
LinkedList<T> list = new LinkedList<T>();
|
||||
LinkedList<T> list = new LinkedList<>();
|
||||
for (DetailMap map : itemMap.values())
|
||||
map.addValues(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Entry<T>> entries() {
|
||||
LinkedList<Entry<T>> list = new LinkedList<Entry<T>>();
|
||||
LinkedList<Entry<T>> list = new LinkedList<>();
|
||||
for (Map.Entry<Item, DetailMap> entry : itemMap.entrySet())
|
||||
entry.getValue().addEntries(entry.getKey(), list);
|
||||
return list;
|
||||
|
||||
@@ -23,8 +23,8 @@ public class KeyManager
|
||||
public boolean up;
|
||||
}
|
||||
|
||||
public static HashMap<String, KeyState> keyStates = new HashMap<String, KeyState>();
|
||||
public static LinkedList<IKeyStateTracker> trackers = new LinkedList<IKeyStateTracker>();
|
||||
public static HashMap<String, KeyState> keyStates = new HashMap<>();
|
||||
public static LinkedList<IKeyStateTracker> trackers = new LinkedList<>();
|
||||
|
||||
public static void tickKeyStates()
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
|
||||
public class Label extends Widget
|
||||
{
|
||||
boolean centered;
|
||||
int colour;
|
||||
final boolean centered;
|
||||
final int colour;
|
||||
public String text;
|
||||
|
||||
public Label(String s, boolean center, int color)
|
||||
|
||||
@@ -97,7 +97,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public static IRecipeOverlayRenderer overlayRenderer;
|
||||
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<Integer, LayoutStyle>();
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<>();
|
||||
|
||||
public static boolean ftbUtilsLoaded = false;
|
||||
|
||||
@@ -588,8 +588,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) {
|
||||
drawWidgets = new TreeSet<Widget>(new WidgetZOrder(false));
|
||||
controlWidgets = new TreeSet<Widget>(new WidgetZOrder(true));
|
||||
drawWidgets = new TreeSet<>(new WidgetZOrder(false));
|
||||
controlWidgets = new TreeSet<>(new WidgetZOrder(true));
|
||||
|
||||
if (!visiblity.showNEI)
|
||||
return;
|
||||
@@ -709,7 +709,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public void renderSlotOverlay(GuiContainer window, Slot slot) {
|
||||
ItemStack item = slot.getStack();
|
||||
if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.itemMatches(item))) {
|
||||
if (world.nbt.getBoolean("searchinventories") && (item == null ? !getSearchExpression().equals("") : !ItemList.getItemListFilter().matches(item))) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0, 0, 150);
|
||||
drawRect(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, 0x80000000);
|
||||
|
||||
@@ -9,8 +9,8 @@ public class NEIActions
|
||||
{
|
||||
public static final int protocol = 0;
|
||||
|
||||
public static HashMap<String, NEIActions> nameActionMap = new HashMap<String, NEIActions>();
|
||||
public static HashSet<String> canDisable = new HashSet<String>();
|
||||
public static HashMap<String, NEIActions> nameActionMap = new HashMap<>();
|
||||
public static HashSet<String> canDisable = new HashSet<>();
|
||||
|
||||
public static void addAction(String name, String base, boolean smpreq)
|
||||
{
|
||||
@@ -85,7 +85,7 @@ public class NEIActions
|
||||
|
||||
public static List<String> baseActions()
|
||||
{
|
||||
List<String> list = new LinkedList<String>();
|
||||
List<String> list = new LinkedList<>();
|
||||
for(NEIActions a : nameActionMap.values())
|
||||
if(a.base.equals(a.name))
|
||||
list.add(a.name);
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.ContainerChest;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,11 +18,11 @@ public class NEIChestGuiHandler extends INEIGuiAdapter
|
||||
|
||||
@Override
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||
return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.<Integer>emptyList();
|
||||
return gui instanceof GuiChest ? NEIServerUtils.getRange(0, chestSize(gui)) : Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return gui instanceof GuiChest ? Arrays.asList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
|
||||
return gui instanceof GuiChest ? Collections.singletonList(new TaggedInventoryArea("Chest", 0, chestSize(gui), gui.inventorySlots)) : null;
|
||||
}
|
||||
}
|
||||
@@ -50,14 +50,14 @@ public class NEIClientConfig
|
||||
new File("saves/NEI/client.dat"),
|
||||
new ConfigFile(new File(configDir, "client.cfg")));
|
||||
public static ConfigSet world;
|
||||
public static File bookmarkFile = new File(configDir, "bookmarks.ini");
|
||||
public static final File bookmarkFile = new File(configDir, "bookmarks.ini");
|
||||
|
||||
public static ItemStack[] creativeInv;
|
||||
|
||||
public static boolean hasSMPCounterpart;
|
||||
public static HashSet<String> permissableActions = new HashSet<String>();
|
||||
public static HashSet<String> disabledActions = new HashSet<String>();
|
||||
public static HashSet<String> enabledActions = new HashSet<String>();
|
||||
public static HashSet<String> permissableActions = new HashSet<>();
|
||||
public static HashSet<String> disabledActions = new HashSet<>();
|
||||
public static HashSet<String> enabledActions = new HashSet<>();
|
||||
|
||||
public static ItemStackSet bannedBlocks = new ItemStackSet();
|
||||
|
||||
@@ -417,7 +417,7 @@ public class NEIClientConfig
|
||||
logger.error("Error loading saves", e);
|
||||
return;
|
||||
}
|
||||
HashSet<String> saveFileNames = new HashSet<String>();
|
||||
HashSet<String> saveFileNames = new HashSet<>();
|
||||
for (SaveFormatComparator save : saves)
|
||||
saveFileNames.add(save.getFileName());
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ public class NEIClientUtils extends NEIServerUtils
|
||||
ItemStack typestack = copyStack(stack, 1);
|
||||
if (!infinite && !canItemFitInInventory(mc().thePlayer, stack) && (mc().currentScreen instanceof GuiContainer)) {
|
||||
GuiContainer gui = getGuiContainer();
|
||||
List<Iterable<Integer>> handlerSlots = new LinkedList<Iterable<Integer>>();
|
||||
List<Iterable<Integer>> handlerSlots = new LinkedList<>();
|
||||
for(INEIGuiHandler handler : GuiInfo.guiHandlers)
|
||||
handlerSlots.add(handler.getItemSpawnSlots(gui, typestack));
|
||||
|
||||
@@ -306,7 +306,7 @@ public class NEIClientUtils extends NEIServerUtils
|
||||
}
|
||||
|
||||
public static ArrayList<int[]> concatIntegersToRanges(List<Integer> damages) {
|
||||
ArrayList<int[]> ranges = new ArrayList<int[]>();
|
||||
ArrayList<int[]> ranges = new ArrayList<>();
|
||||
if (damages.size() == 0) return ranges;
|
||||
|
||||
Collections.sort(damages);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.nei.api.*;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.api.IInfiniteItemHandler;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.guihook.IContainerSlotClickHandler;
|
||||
@@ -11,14 +15,14 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
public class NEIController implements IContainerSlotClickHandler, IContainerInputHandler
|
||||
{
|
||||
private static NEIController instance = new NEIController();
|
||||
private static final NEIController instance = new NEIController();
|
||||
|
||||
public static GuiContainerManager manager;
|
||||
public static FastTransferManager fastTransferManager;
|
||||
@@ -56,7 +60,7 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
if (!NEIClientConfig.canPerformAction("item") || !NEIClientConfig.hasSMPCounterPart())
|
||||
return;
|
||||
|
||||
LinkedList<ItemStack> beforeStacks = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> beforeStacks = new LinkedList<>();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++)
|
||||
beforeStacks.add(NEIServerUtils.copyStack(inventory.getStackInSlot(i)));
|
||||
|
||||
|
||||
@@ -20,11 +20,14 @@ import cpw.mods.fml.common.versioning.VersionRange;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class NEIModContainer extends DummyModContainer
|
||||
{
|
||||
public static LinkedList<IConfigureNEI> plugins = new LinkedList<IConfigureNEI>();
|
||||
public static LinkedList<IConfigureNEI> plugins = new LinkedList<>();
|
||||
|
||||
public NEIModContainer() {
|
||||
super(MetadataCollection.from(MetadataCollection.class.getResourceAsStream("/neimod.info"), "NotEnoughItems").getMetadataForId("NotEnoughItems", null));
|
||||
@@ -33,14 +36,14 @@ public class NEIModContainer extends DummyModContainer
|
||||
|
||||
@Override
|
||||
public Set<ArtifactVersion> getRequirements() {
|
||||
Set<ArtifactVersion> deps = new HashSet<ArtifactVersion>();
|
||||
Set<ArtifactVersion> deps = new HashSet<>();
|
||||
deps.add(VersionParser.parseVersionReference("CodeChickenCore@["+CodeChickenCorePlugin.version+",)"));
|
||||
return deps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArtifactVersion> getDependencies() {
|
||||
return new LinkedList<ArtifactVersion>(getRequirements());
|
||||
return new LinkedList<>(getRequirements());
|
||||
}
|
||||
|
||||
private String description;
|
||||
@@ -50,22 +53,22 @@ public class NEIModContainer extends DummyModContainer
|
||||
|
||||
@Override
|
||||
public ModMetadata getMetadata() {
|
||||
String s_plugins = "";
|
||||
StringBuilder s_plugins = new StringBuilder();
|
||||
if (plugins.size() == 0) {
|
||||
s_plugins += EnumChatFormatting.RED+"No installed plugins.";
|
||||
s_plugins.append(EnumChatFormatting.RED).append("No installed plugins.");
|
||||
} else {
|
||||
s_plugins += EnumChatFormatting.GREEN+"Installed plugins: ";
|
||||
s_plugins.append(EnumChatFormatting.GREEN).append("Installed plugins: ");
|
||||
for (int i = 0; i < plugins.size(); i++) {
|
||||
if (i > 0)
|
||||
s_plugins += ", ";
|
||||
s_plugins.append(", ");
|
||||
IConfigureNEI plugin = plugins.get(i);
|
||||
s_plugins += plugin.getName() + " " + plugin.getVersion();
|
||||
s_plugins.append(plugin.getName()).append(" ").append(plugin.getVersion());
|
||||
}
|
||||
s_plugins += ".";
|
||||
s_plugins.append(".");
|
||||
}
|
||||
|
||||
ModMetadata meta = super.getMetadata();
|
||||
meta.description = description.replace("<plugins>", s_plugins);
|
||||
meta.description = description.replace("<plugins>", s_plugins.toString());
|
||||
return meta;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.core.IGuiPacketSender;
|
||||
import codechicken.core.ServerUtils;
|
||||
import codechicken.lib.inventory.SlotDummy;
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
@@ -112,15 +111,11 @@ public class NEISPH implements IServerPacketHandler
|
||||
|
||||
public static void processCreativeInv(EntityPlayerMP sender, boolean open) {
|
||||
if (open) {
|
||||
ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getCommandSenderName()), Side.SERVER)), new IGuiPacketSender()
|
||||
{
|
||||
@Override
|
||||
public void sendPacket(EntityPlayerMP player, int windowId) {
|
||||
PacketCustom packet = new PacketCustom(channel, 23);
|
||||
packet.writeBoolean(true);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player);
|
||||
}
|
||||
ServerUtils.openSMPContainer(sender, new ContainerCreativeInv(sender, new ExtendedCreativeInv(NEIServerConfig.forPlayer(sender.getCommandSenderName()), Side.SERVER)), (player, windowId) -> {
|
||||
PacketCustom packet = new PacketCustom(channel, 23);
|
||||
packet.writeBoolean(true);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player);
|
||||
});
|
||||
} else {
|
||||
sender.closeContainer();
|
||||
@@ -155,14 +150,10 @@ public class NEISPH implements IServerPacketHandler
|
||||
}
|
||||
|
||||
private void openEnchantmentGui(EntityPlayerMP player) {
|
||||
ServerUtils.openSMPContainer(player, new ContainerEnchantmentModifier(player.inventory, player.worldObj, 0, 0, 0), new IGuiPacketSender()
|
||||
{
|
||||
@Override
|
||||
public void sendPacket(EntityPlayerMP player, int windowId) {
|
||||
PacketCustom packet = new PacketCustom(channel, 21);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player);
|
||||
}
|
||||
ServerUtils.openSMPContainer(player, new ContainerEnchantmentModifier(player.inventory, player.worldObj, 0, 0, 0), (player1, windowId) -> {
|
||||
PacketCustom packet = new PacketCustom(channel, 21);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -170,14 +161,10 @@ public class NEISPH implements IServerPacketHandler
|
||||
InventoryBasic b = new InventoryBasic("potionStore", true, 9);
|
||||
for (int i = 0; i < b.getSizeInventory(); i++)
|
||||
b.setInventorySlotContents(i, packet.readItemStack());
|
||||
ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), new IGuiPacketSender()
|
||||
{
|
||||
@Override
|
||||
public void sendPacket(EntityPlayerMP player, int windowId) {
|
||||
PacketCustom packet = new PacketCustom(channel, 24);
|
||||
packet.writeByte(windowId);
|
||||
packet.sendToPlayer(player);
|
||||
}
|
||||
ServerUtils.openSMPContainer(player, new ContainerPotionCreator(player.inventory, b), (player1, windowId) -> {
|
||||
PacketCustom packet1 = new PacketCustom(channel, 24);
|
||||
packet1.writeByte(windowId);
|
||||
packet1.sendToPlayer(player1);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,10 +183,10 @@ public class NEISPH implements IServerPacketHandler
|
||||
}
|
||||
|
||||
private void sendLoginState(EntityPlayerMP player) {
|
||||
LinkedList<String> actions = new LinkedList<String>();
|
||||
LinkedList<String> disabled = new LinkedList<String>();
|
||||
LinkedList<String> enabled = new LinkedList<String>();
|
||||
LinkedList<ItemStack> bannedItems = new LinkedList<ItemStack>();
|
||||
LinkedList<String> actions = new LinkedList<>();
|
||||
LinkedList<String> disabled = new LinkedList<>();
|
||||
LinkedList<String> enabled = new LinkedList<>();
|
||||
LinkedList<ItemStack> bannedItems = new LinkedList<>();
|
||||
PlayerSave playerSave = NEIServerConfig.forPlayer(player.getCommandSenderName());
|
||||
|
||||
for (String name : NEIActions.nameActionMap.keySet()) {
|
||||
|
||||
@@ -21,7 +21,14 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class NEIServerConfig
|
||||
{
|
||||
@@ -30,9 +37,9 @@ public class NEIServerConfig
|
||||
public static Logger logger = LogManager.getLogger("NotEnoughItems");
|
||||
public static File saveDir;
|
||||
public static ConfigFile serverConfig;
|
||||
public static Map<Integer, NBTTagCompound> dimTags = new HashMap<Integer, NBTTagCompound>();
|
||||
public static HashMap<String, PlayerSave> playerSaves = new HashMap<String, PlayerSave>();
|
||||
public static ItemStackMap<Set<String>> bannedItems = new ItemStackMap<Set<String>>();
|
||||
public static Map<Integer, NBTTagCompound> dimTags = new HashMap<>();
|
||||
public static HashMap<String, PlayerSave> playerSaves = new HashMap<>();
|
||||
public static ItemStackMap<Set<String>> bannedItems = new ItemStackMap<>();
|
||||
|
||||
public static void load(World world) {
|
||||
if (MinecraftServer.getServer() != server) {
|
||||
@@ -89,13 +96,13 @@ public class NEIServerConfig
|
||||
if (names.length == 0)
|
||||
names = new String[]{"OP"};
|
||||
|
||||
String list = "";
|
||||
StringBuilder list = new StringBuilder();
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
if (i >= 1)
|
||||
list += ", ";
|
||||
list += names[i];
|
||||
list.append(", ");
|
||||
list.append(names[i]);
|
||||
}
|
||||
serverConfig.getTag("permissions." + featurename).setDefaultValue(list);
|
||||
serverConfig.getTag("permissions." + featurename).setDefaultValue(list.toString());
|
||||
}
|
||||
|
||||
private static void saveWorld(int dim) {
|
||||
@@ -139,7 +146,7 @@ public class NEIServerConfig
|
||||
|
||||
public static HashSet<String> getPlayerList(String tag) {
|
||||
String[] list = serverConfig.getTag(tag).getValue("").replace(" ", "").split(",");
|
||||
return new HashSet<String>(Arrays.asList(list));
|
||||
return new HashSet<>(Arrays.asList(list));
|
||||
}
|
||||
|
||||
public static void addPlayerToList(String playername, String tag) {
|
||||
@@ -179,7 +186,7 @@ public class NEIServerConfig
|
||||
bannedItems.clear();
|
||||
File file = new File(saveDir, "banneditems.cfg");
|
||||
if(!file.exists()) {
|
||||
bannedItems.put(new ItemStack(Blocks.command_block), new HashSet<String>(Arrays.asList("NONE")));
|
||||
bannedItems.put(new ItemStack(Blocks.command_block), new HashSet<>(Collections.singletonList("NONE")));
|
||||
saveBannedItems();
|
||||
return;
|
||||
}
|
||||
@@ -196,7 +203,7 @@ public class NEIServerConfig
|
||||
}
|
||||
try {
|
||||
NBTTagCompound key = (NBTTagCompound) JsonToNBT.func_150315_a(s.substring(0, delim));
|
||||
Set<String> values = new HashSet<String>();
|
||||
Set<String> values = new HashSet<>();
|
||||
for(String s2 : s.substring(delim+1).split(","))
|
||||
values.add(s2.trim());
|
||||
bannedItems.put(InventoryUtils.loadPersistant(key), values);
|
||||
|
||||
@@ -25,8 +25,16 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings.GameType;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.AbstractList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipException;
|
||||
|
||||
public class NEIServerUtils
|
||||
@@ -287,7 +295,7 @@ public class NEIServerUtils
|
||||
}
|
||||
|
||||
public static List<int[]> getEnchantments(ItemStack itemstack) {
|
||||
ArrayList<int[]> arraylist = new ArrayList<int[]>();
|
||||
ArrayList<int[]> arraylist = new ArrayList<>();
|
||||
if (itemstack != null) {
|
||||
NBTTagList nbttaglist = itemstack.getEnchantmentTagList();
|
||||
if (nbttaglist != null)
|
||||
|
||||
@@ -24,5 +24,5 @@ public class OffsetPositioner implements IStackPositioner
|
||||
}
|
||||
|
||||
public int offsetx;
|
||||
public int offsety;
|
||||
public int offsety;
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import codechicken.core.ServerUtils;
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public class PositionedStack
|
||||
{
|
||||
public int relx;
|
||||
public int rely;
|
||||
public ItemStack items[];
|
||||
public ItemStack[] items;
|
||||
//compatibility dummy
|
||||
public ItemStack item;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class PositionedStack
|
||||
if(permutated)
|
||||
return;
|
||||
|
||||
ArrayList<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> stacks = new ArrayList<>();
|
||||
for(ItemStack item : items)
|
||||
{
|
||||
if(item == null || item.getItem() == null)
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ISearchProvider> searchProviders = new LinkedList<ISearchProvider>();
|
||||
public static List<ISearchProvider> searchProviders = new LinkedList<>();
|
||||
|
||||
long lastclicktime;
|
||||
|
||||
@@ -142,8 +142,8 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
public ItemFilter getFilter() {
|
||||
String s_filter = text().toLowerCase();
|
||||
|
||||
List<ItemFilter> primary = new LinkedList<ItemFilter>();
|
||||
List<ItemFilter> secondary = new LinkedList<ItemFilter>();
|
||||
List<ItemFilter> primary = new LinkedList<>();
|
||||
List<ItemFilter> secondary = new LinkedList<>();
|
||||
for (ISearchProvider p : searchProviders) {
|
||||
ItemFilter filter = p.getFilter(s_filter);
|
||||
if (filter != null)
|
||||
|
||||
@@ -2,7 +2,6 @@ package codechicken.nei;
|
||||
|
||||
import codechicken.core.ClientUtils;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.render.TextureUtils;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
public static class SubsetState
|
||||
{
|
||||
int state = 2;
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static class SubsetTag
|
||||
@@ -128,7 +128,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
|
||||
public final String fullname;
|
||||
public final ItemFilter filter;
|
||||
public TreeMap<String, SubsetTag> children = new TreeMap<String, SubsetTag>();
|
||||
public TreeMap<String, SubsetTag> children = new TreeMap<>();
|
||||
public List<SubsetTag> sorted = Collections.emptyList();
|
||||
private int childwidth;
|
||||
|
||||
@@ -177,7 +177,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
}
|
||||
|
||||
private void recacheChildren() {
|
||||
sorted = new ArrayList<SubsetTag>(children.values());
|
||||
sorted = new ArrayList<>(children.values());
|
||||
childwidth = 0;
|
||||
for(SubsetTag tag : sorted)
|
||||
childwidth = Math.max(childwidth, tag.nameWidth()+2);
|
||||
@@ -372,12 +372,12 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
public static Rectangle4i area = new Rectangle4i();
|
||||
public static ItemStack hoverStack;
|
||||
|
||||
private static HashMap<String, SubsetState> subsetState = new HashMap<String, SubsetState>();
|
||||
private static HashMap<String, SubsetState> subsetState = new HashMap<>();
|
||||
/**
|
||||
* All operations on this variable should be synchronised.
|
||||
*/
|
||||
private static final ItemStackSet hiddenItems = new ItemStackSet();
|
||||
private static final AtomicReference<NBTTagList> dirtyHiddenItems = new AtomicReference<NBTTagList>();
|
||||
private static final AtomicReference<NBTTagList> dirtyHiddenItems = new AtomicReference<>();
|
||||
|
||||
public static SubsetState getState(SubsetTag tag) {
|
||||
SubsetState state = subsetState.get(tag.fullname);
|
||||
@@ -388,6 +388,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
updateState.stop();
|
||||
synchronized (root) {
|
||||
root.addTag(tag);
|
||||
NEIClientConfig.logger.info("Adding Tag {}", tag.displayName());
|
||||
updateState.reallocate();
|
||||
}
|
||||
}
|
||||
@@ -455,7 +456,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
hiddenItems.clear();
|
||||
}
|
||||
|
||||
List<ItemStack> itemList = new LinkedList<ItemStack>();
|
||||
List<ItemStack> itemList = new LinkedList<>();
|
||||
try {
|
||||
NBTTagList list = NEIClientConfig.world.nbt.getTagList("hiddenItems", 10);
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
@@ -524,8 +525,8 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
HashMap<String, SubsetState> state = new HashMap<String, SubsetState>();
|
||||
List<SubsetTag> tags = new LinkedList<SubsetTag>();
|
||||
HashMap<String, SubsetState> state = new HashMap<>();
|
||||
List<SubsetTag> tags = new LinkedList<>();
|
||||
synchronized (root) {
|
||||
cloneStates(root, tags, state);
|
||||
if(interrupted()) return;
|
||||
@@ -728,7 +729,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
Pattern p = SearchField.getPattern(searchText);
|
||||
if(p == null) return null;
|
||||
|
||||
List<SubsetTag> matching = new LinkedList<SubsetTag>();
|
||||
List<SubsetTag> matching = new LinkedList<>();
|
||||
root.search(matching, p);
|
||||
if(matching.isEmpty()) return null;
|
||||
for(SubsetTag tag2 : matching)
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import cpw.mods.fml.client.config.HoverChecker;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public abstract class TextField extends Widget
|
||||
{
|
||||
protected GuiTextField field;
|
||||
protected final HoverChecker hoverChecker;
|
||||
protected final GuiTextField field;
|
||||
|
||||
private static final int maxSearchLength = 256;
|
||||
|
||||
@@ -21,7 +19,6 @@ public abstract class TextField extends Widget
|
||||
identifier = ident;
|
||||
field = new GuiTextField(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0);
|
||||
field.setMaxStringLength(maxSearchLength);
|
||||
this.hoverChecker = new HoverChecker(0, 0, 0, 0, 0);
|
||||
field.setCursorPositionZero();
|
||||
// Keyboard.enableRepeatEvents(true);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class ThreadOperationTimer extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
private Thread thread;
|
||||
private final Thread thread;
|
||||
private Object operation;
|
||||
private long opTime;
|
||||
private long limit;
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.Comparator;
|
||||
public class WidgetZOrder
|
||||
implements Comparator<Widget>
|
||||
{
|
||||
boolean topfirst;
|
||||
final boolean topfirst;
|
||||
public WidgetZOrder(boolean topfirst)
|
||||
{
|
||||
this.topfirst = topfirst;
|
||||
|
||||
@@ -98,8 +98,8 @@ public class WorldOverlayRenderer implements IKeyStateTracker
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private static Entity dummyEntity = new EntityPig(null);
|
||||
private static AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
private static final Entity dummyEntity = new EntityPig(null);
|
||||
private static final AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
|
||||
private static int getSpawnMode(Chunk chunk, int x, int y, int z) {
|
||||
if (!SpawnerAnimals.canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, chunk.worldObj, x, y, z) ||
|
||||
chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15) >= 8)
|
||||
|
||||
@@ -13,7 +13,7 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer
|
||||
public DefaultOverlayRenderer(List<PositionedStack> ai, IStackPositioner positioner)
|
||||
{
|
||||
positioner = this.positioner = positioner;
|
||||
ingreds = new ArrayList<PositionedStack>();
|
||||
ingreds = new ArrayList<>();
|
||||
for(PositionedStack stack : ai)
|
||||
ingreds.add(stack.copy());
|
||||
ingreds = positioner.positionStacks(ingreds);
|
||||
@@ -39,6 +39,6 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
|
||||
IStackPositioner positioner;
|
||||
final IStackPositioner positioner;
|
||||
ArrayList<PositionedStack> ingreds;
|
||||
}
|
||||
@@ -12,8 +12,8 @@ import java.util.LinkedList;
|
||||
|
||||
public class GuiInfo
|
||||
{
|
||||
public static LinkedList<INEIGuiHandler> guiHandlers = new LinkedList<INEIGuiHandler>();
|
||||
public static HashSet<Class<? extends GuiContainer>> customSlotGuis = new HashSet<Class<? extends GuiContainer>>();
|
||||
public static final LinkedList<INEIGuiHandler> guiHandlers = new LinkedList<>();
|
||||
public static final HashSet<Class<? extends GuiContainer>> customSlotGuis = new HashSet<>();
|
||||
|
||||
public static void load() {
|
||||
API.registerNEIGuiHandler(new NEICreativeGuiHandler());
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.*;
|
||||
import codechicken.nei.ItemList.ItemsLoadedCallback;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
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.ItemPanelDumper;
|
||||
import codechicken.nei.config.RegistryDumper;
|
||||
@@ -27,7 +32,15 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@@ -38,7 +51,11 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
@@ -52,20 +69,20 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
public static final ArrayListMultimap<Layout, IHighlightHandler> highlightHandlers = ArrayListMultimap.create();
|
||||
public static final ItemStackMap<String> nameOverrides = new ItemStackMap<String>();
|
||||
public static final ItemStackMap<String> nameOverrides = new ItemStackMap<>();
|
||||
public static final ItemStackSet hiddenItems = new ItemStackSet();
|
||||
public static final ItemStackSet finiteItems = new ItemStackSet();
|
||||
public static final ArrayListMultimap<Item, ItemStack> itemOverrides = ArrayListMultimap.create();
|
||||
public static final ArrayListMultimap<Item, ItemStack> itemVariants = ArrayListMultimap.create();
|
||||
|
||||
public static final LinkedList<IInfiniteItemHandler> infiniteHandlers = new LinkedList<IInfiniteItemHandler>();
|
||||
public static final LinkedList<IInfiniteItemHandler> infiniteHandlers = new LinkedList<>();
|
||||
public static final ArrayListMultimap<Block, IHighlightHandler> highlightIdentifiers = ArrayListMultimap.create();
|
||||
public static final HashSet<Class<? extends Slot>> fastTransferExemptions = new HashSet<Class<? extends Slot>>();
|
||||
public static final HashSet<Class<? extends Slot>> fastTransferExemptions = new HashSet<>();
|
||||
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<Item, String>();
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<>();
|
||||
|
||||
//lookup optimisation
|
||||
public static final HashMap<ItemStack, String> itemSearchNames = new HashMap<ItemStack, String>();
|
||||
public static final HashMap<ItemStack, String> itemSearchNames = new HashMap<>();
|
||||
|
||||
public static boolean isHidden(ItemStack stack) {
|
||||
return hiddenItems.contains(stack);
|
||||
@@ -111,28 +128,11 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void addSearchOptimisation() {
|
||||
ItemList.loadCallbacks.add(new ItemsLoadedCallback()
|
||||
{
|
||||
@Override public void itemsLoaded() {
|
||||
itemSearchNames.clear();
|
||||
}
|
||||
});
|
||||
ItemList.loadCallbacks.add(itemSearchNames::clear);
|
||||
}
|
||||
|
||||
private static void addHiddenItemFilter() {
|
||||
API.addItemFilter(new ItemFilterProvider()
|
||||
{
|
||||
@Override
|
||||
public ItemFilter getFilter() {
|
||||
return new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return !hiddenItems.contains(item);
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
API.addItemFilter(() -> item -> !hiddenItems.contains(item));
|
||||
}
|
||||
|
||||
private static void addIDDumps() {
|
||||
@@ -264,7 +264,7 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void parseModItems() {
|
||||
HashMap<String, ItemStackSet> modSubsets = new HashMap<String, ItemStackSet>();
|
||||
HashMap<String, ItemStackSet> modSubsets = new HashMap<>();
|
||||
for (Item item : (Iterable<Item>) Item.itemRegistry) {
|
||||
UniqueIdentifier ident = null;
|
||||
try {
|
||||
@@ -323,20 +323,8 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
private static void addDefaultDropDowns() {
|
||||
API.addSubset("Items", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return Block.getBlockFromItem(item.getItem()) == Blocks.air;
|
||||
}
|
||||
});
|
||||
API.addSubset("Blocks", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return Block.getBlockFromItem(item.getItem()) != Blocks.air;
|
||||
}
|
||||
});
|
||||
API.addSubset("Items", item -> Block.getBlockFromItem(item.getItem()) == Blocks.air);
|
||||
API.addSubset("Blocks", item -> Block.getBlockFromItem(item.getItem()) != Blocks.air);
|
||||
API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner));
|
||||
}
|
||||
|
||||
@@ -356,8 +344,8 @@ public class ItemInfo
|
||||
ItemStackSet food = new ItemStackSet();
|
||||
ItemStackSet potioningredients = new ItemStackSet();
|
||||
|
||||
ArrayList<ItemStackSet> creativeTabRanges = new ArrayList<ItemStackSet>(CreativeTabs.creativeTabArray.length);
|
||||
List<ItemStack> stackList = new LinkedList<ItemStack>();
|
||||
ArrayList<ItemStackSet> creativeTabRanges = new ArrayList<>(CreativeTabs.creativeTabArray.length);
|
||||
List<ItemStack> stackList = new LinkedList<>();
|
||||
|
||||
for (Item item : (Iterable<Item>) Item.itemRegistry) {
|
||||
if (item == null)
|
||||
@@ -419,7 +407,7 @@ public class ItemInfo
|
||||
food.with(item);
|
||||
|
||||
try {
|
||||
LinkedList<ItemStack> subItems = new LinkedList<ItemStack>();
|
||||
LinkedList<ItemStack> subItems = new LinkedList<>();
|
||||
item.getSubItems(item, null, subItems);
|
||||
for(ItemStack stack : subItems) {
|
||||
if (item.isPotionIngredient(stack) && item.getPotionEffect(stack) != null) {
|
||||
@@ -473,9 +461,9 @@ public class ItemInfo
|
||||
int z = hit.blockZ;
|
||||
Block mouseoverBlock = world.getBlock(x, y, z);
|
||||
|
||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<IHighlightHandler>();
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<>();
|
||||
if (highlightIdentifiers.containsKey(null))
|
||||
handlers.addAll(highlightIdentifiers.get(null));
|
||||
if (highlightIdentifiers.containsKey(mouseoverBlock))
|
||||
@@ -514,7 +502,7 @@ public class ItemInfo
|
||||
}
|
||||
|
||||
public static List<String> getText(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop) {
|
||||
List<String> retString = new ArrayList<String>();
|
||||
List<String> retString = new ArrayList<>();
|
||||
|
||||
for (ItemInfo.Layout layout : ItemInfo.Layout.values())
|
||||
for (IHighlightHandler handler : ItemInfo.highlightHandlers.get(layout))
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.LinkedList;
|
||||
|
||||
public class NEIInfo
|
||||
{
|
||||
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<INEIModeHandler>();
|
||||
public static final LinkedList<INEIModeHandler> modeHandlers = new LinkedList<>();
|
||||
|
||||
public static void load(World world) {
|
||||
OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode");
|
||||
|
||||
@@ -9,8 +9,8 @@ import java.util.HashSet;
|
||||
|
||||
public class TaggedInventoryArea
|
||||
{
|
||||
public HashSet<Integer> slots = new HashSet<Integer>();
|
||||
public String tagName;
|
||||
public final HashSet<Integer> slots = new HashSet<>();
|
||||
public final String tagName;
|
||||
/**
|
||||
* Only for player inventories.
|
||||
*/
|
||||
@@ -18,7 +18,7 @@ public class TaggedInventoryArea
|
||||
/**
|
||||
* Other inventories
|
||||
*/
|
||||
private Container container;
|
||||
private final Container container;
|
||||
|
||||
public TaggedInventoryArea(InventoryPlayer invPlayer)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,43 @@
|
||||
package codechicken.nei.asm;
|
||||
|
||||
import codechicken.lib.asm.*;
|
||||
import codechicken.lib.asm.ModularASMTransformer.*;
|
||||
import codechicken.lib.asm.ASMBlock;
|
||||
import codechicken.lib.asm.ASMHelper;
|
||||
import codechicken.lib.asm.ASMInit;
|
||||
import codechicken.lib.asm.ASMReader;
|
||||
import codechicken.lib.asm.ClassHeirachyManager;
|
||||
import codechicken.lib.asm.InsnListSection;
|
||||
import codechicken.lib.asm.ModularASMTransformer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.FieldWriter;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodInjector;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodReplacer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodTransformer;
|
||||
import codechicken.lib.asm.ModularASMTransformer.MethodWriter;
|
||||
import codechicken.lib.asm.ObfMapping;
|
||||
import cpw.mods.fml.relauncher.FMLLaunchHandler;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.*;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.InsnList;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static codechicken.lib.asm.InsnComparator.*;
|
||||
import static codechicken.lib.asm.InsnComparator.findN;
|
||||
import static codechicken.lib.asm.InsnComparator.findOnce;
|
||||
import static codechicken.lib.asm.InsnComparator.getControlFlowLabels;
|
||||
import static codechicken.lib.asm.InsnComparator.matches;
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
|
||||
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
|
||||
import static org.objectweb.asm.Opcodes.ACC_STATIC;
|
||||
import static org.objectweb.asm.Opcodes.ALOAD;
|
||||
import static org.objectweb.asm.Opcodes.ILOAD;
|
||||
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
|
||||
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
|
||||
import static org.objectweb.asm.Opcodes.IRETURN;
|
||||
|
||||
public class NEITransformer implements IClassTransformer
|
||||
{
|
||||
@@ -20,8 +45,8 @@ public class NEITransformer implements IClassTransformer
|
||||
ASMInit.init();
|
||||
}
|
||||
|
||||
private ModularASMTransformer transformer = new ModularASMTransformer();
|
||||
private Map<String, ASMBlock> asmblocks = ASMReader.loadResource("/assets/nei/asm/blocks.asm");
|
||||
private final ModularASMTransformer transformer = new ModularASMTransformer();
|
||||
private final Map<String, ASMBlock> asmblocks = ASMReader.loadResource("/assets/nei/asm/blocks.asm");
|
||||
|
||||
public NEITransformer() {
|
||||
if(FMLLaunchHandler.side().isClient()) {
|
||||
@@ -199,7 +224,7 @@ public class NEITransformer implements IClassTransformer
|
||||
transformer.add(new MethodWriter(ACC_PUBLIC, publicCall, forward2));
|
||||
}
|
||||
|
||||
private ObfMapping c_GuiContainer = new ObfMapping("net/minecraft/client/gui/inventory/GuiContainer").toClassloading();
|
||||
private final ObfMapping c_GuiContainer = new ObfMapping("net/minecraft/client/gui/inventory/GuiContainer").toClassloading();
|
||||
/**
|
||||
* Adds super.updateScreen() to non implementing GuiContainer subclasses
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@ public abstract class ArrayDumper<T> extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
T[] array = array();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
T obj = array[i];
|
||||
|
||||
@@ -2,16 +2,15 @@ package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.config.ConfigTagParent;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class ConfigSet
|
||||
{
|
||||
private File nbtFile;
|
||||
private final File nbtFile;
|
||||
public NBTTagCompound nbt;
|
||||
public ConfigTagParent config;
|
||||
public final ConfigTagParent config;
|
||||
|
||||
public ConfigSet(File nbtFile, ConfigTagParent config) {
|
||||
this.nbtFile = nbtFile;
|
||||
|
||||
@@ -11,7 +11,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,9 +22,9 @@ import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
public class GuiHighlightTips extends GuiScreenWidget
|
||||
{
|
||||
private String name;
|
||||
private final String name;
|
||||
private GuiCCButton toggleButton;
|
||||
private Option opt;
|
||||
private final Option opt;
|
||||
private Point dragDown;
|
||||
|
||||
public GuiHighlightTips(Option opt) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
private Option opt;
|
||||
private int drawIndex;
|
||||
private int parseIndex;
|
||||
private File dir = new File(CommonUtils.getMinecraftDir(), "dumps/itempanel_icons");
|
||||
private final File dir = new File(CommonUtils.getMinecraftDir(), "dumps/itempanel_icons");
|
||||
private int iconSize;
|
||||
private int borderSize;
|
||||
private int boxSize;
|
||||
@@ -127,7 +127,7 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
public static String cleanFileName(String name) {
|
||||
StringBuilder cleanName = new StringBuilder();
|
||||
for (int i = 0; i < name.length(); i++) {
|
||||
int c = (int)name.charAt(i);
|
||||
int c = name.charAt(i);
|
||||
if (Arrays.binarySearch(illegalChars, c) < 0)
|
||||
cleanName.append((char)c);
|
||||
else
|
||||
|
||||
@@ -20,7 +20,7 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
{
|
||||
public double ya;
|
||||
public double y;
|
||||
public SortEntry e;
|
||||
public final SortEntry e;
|
||||
|
||||
public SortItem(SortEntry e) {
|
||||
this.e = e;
|
||||
@@ -45,9 +45,9 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
}
|
||||
}
|
||||
|
||||
public Option opt;
|
||||
public List<SortItem> slots = new ArrayList<SortItem>();
|
||||
public List<SortEntry> list;
|
||||
public final Option opt;
|
||||
public final List<SortItem> slots = new ArrayList<>();
|
||||
public final List<SortEntry> list;
|
||||
|
||||
boolean dragging;
|
||||
public SortItem dragged;
|
||||
@@ -120,7 +120,7 @@ public class GuiItemSorter extends GuiOptionPane
|
||||
list.add(nslot, dragged.e);
|
||||
opt.getTag().setValue(ItemSorter.getSaveString(list));
|
||||
if(opt.activeTag() == opt.getTag())
|
||||
ItemSorter.list = new ArrayList<SortEntry>(list);
|
||||
ItemSorter.list = new ArrayList<>(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GuiOptionList extends GuiScreenWidget
|
||||
{
|
||||
public class OptionScrollSlot extends GuiScrollSlot
|
||||
{
|
||||
public ArrayList<Option> options = new ArrayList<Option>();
|
||||
public final ArrayList<Option> options = new ArrayList<>();
|
||||
|
||||
public OptionScrollSlot() {
|
||||
super(0, 0, 0, 0);
|
||||
@@ -244,7 +244,7 @@ public class GuiOptionList extends GuiScreenWidget
|
||||
}
|
||||
|
||||
private void drawTooltip() {
|
||||
List<String> tooltip = new LinkedList<String>();
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
Point mouse = getMousePosition();
|
||||
if (worldButton.pointInside(mouse.x, mouse.y))
|
||||
tooltip.addAll(Arrays.asList(translateToLocal("nei.options.global.tip." + (world ? "1" : "0")).split(":")));
|
||||
|
||||
@@ -6,8 +6,9 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
@@ -93,7 +94,7 @@ public abstract class GuiOptionPane extends GuiScreenWidget
|
||||
|
||||
public void drawTooltip() {
|
||||
Point mouse = getMousePosition();
|
||||
drawMultilineTip(mouse.x + 12, mouse.y - 12, handleTooltip(mouse.x, mouse.y, new LinkedList<String>()));
|
||||
drawMultilineTip(mouse.x + 12, mouse.y - 12, handleTooltip(mouse.x, mouse.y, new LinkedList<>()));
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mx, int my, List<String> tooltip) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.LinkedList;
|
||||
|
||||
public class ItemPanelDumper extends DataDumper
|
||||
{
|
||||
private static int[] resolutions = new int[]{16, 32, 48, 64, 128, 256};
|
||||
private static final int[] resolutions = new int[]{16, 32, 48, 64, 128, 256};
|
||||
|
||||
public ItemPanelDumper(String name) {
|
||||
super(name);
|
||||
@@ -35,7 +35,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
for (ItemStack stack : ItemPanels.itemPanel.items)
|
||||
list.add(new String[]{
|
||||
Item.itemRegistry.getNameForObject(stack.getItem()),
|
||||
|
||||
@@ -14,7 +14,7 @@ import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public abstract class OptionButton extends Option
|
||||
{
|
||||
protected static ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
public final String prefix;
|
||||
public final String text;
|
||||
|
||||
@@ -2,8 +2,8 @@ package codechicken.nei.config;
|
||||
|
||||
public class OptionIntegerField extends OptionTextField
|
||||
{
|
||||
public int min;
|
||||
public int max;
|
||||
public final int min;
|
||||
public final int max;
|
||||
public OptionIntegerField(String name, int min, int max) {
|
||||
super(name);
|
||||
this.min = min;
|
||||
|
||||
@@ -74,8 +74,8 @@ public class OptionList extends OptionButton
|
||||
return fullName.substring(i + 1);
|
||||
}
|
||||
|
||||
public ArrayList<Option> optionList = new ArrayList<Option>();
|
||||
public HashMap<String, Option> options = new HashMap<String, Option>();
|
||||
public ArrayList<Option> optionList = new ArrayList<>();
|
||||
public HashMap<String, Option> options = new HashMap<>();
|
||||
|
||||
public OptionList(String name) {
|
||||
super(name);
|
||||
|
||||
@@ -15,10 +15,10 @@ import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
|
||||
public abstract class OptionStringSet extends Option
|
||||
{
|
||||
public LinkedList<String> options = new LinkedList<String>();
|
||||
public Multimap<String, String> dependants = ArrayListMultimap.create();
|
||||
public Map<String, String> dependancies = new HashMap<String, String>();
|
||||
public Multimap<String, String> groups = ArrayListMultimap.create();
|
||||
public final LinkedList<String> options = new LinkedList<>();
|
||||
public final Multimap<String, String> dependants = ArrayListMultimap.create();
|
||||
public final Map<String, String> dependancies = new HashMap<>();
|
||||
public final Multimap<String, String> groups = ArrayListMultimap.create();
|
||||
|
||||
public OptionStringSet(String name) {
|
||||
super(name);
|
||||
@@ -76,14 +76,13 @@ public abstract class OptionStringSet extends Option
|
||||
List<String> values = values();
|
||||
for (String option : options) {
|
||||
if (new Rectangle4i(x, 0, 20, 20).contains(mousex, mousey)) {
|
||||
String s = option;
|
||||
boolean set = values.contains(s);
|
||||
boolean set = values.contains(option);
|
||||
if (button == 0 && !set) {
|
||||
setValue(s);
|
||||
setValue(option);
|
||||
return true;
|
||||
}
|
||||
if (button == 1 && set) {
|
||||
remValue(s);
|
||||
remValue(option);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -105,7 +104,7 @@ public abstract class OptionStringSet extends Option
|
||||
for (String grp : groups.get(s))
|
||||
setValue(grp);
|
||||
} else {
|
||||
List<String> setUtils = new LinkedList<String>(values());
|
||||
List<String> setUtils = new LinkedList<>(values());
|
||||
setUtils.add(s);
|
||||
setValues(setUtils);
|
||||
}
|
||||
@@ -119,7 +118,7 @@ public abstract class OptionStringSet extends Option
|
||||
for (String grp : groups.get(s))
|
||||
remValue(grp);
|
||||
} else {
|
||||
List<String> values = new LinkedList<String>(values());
|
||||
List<String> values = new LinkedList<>(values());
|
||||
values.remove(s);
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
public class OptionTextField extends Option
|
||||
{
|
||||
private boolean focused = false;
|
||||
private TextField textField = new TextField("")
|
||||
private final TextField textField = new TextField("")
|
||||
{
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ public abstract class RegistryDumper <T> extends DataDumper
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<String[]>();
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
RegistryNamespaced registry = registry();
|
||||
|
||||
for(T obj : (Iterable<T>)registry)
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -24,18 +24,21 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.lib.gui.GuiDraw.renderEngine;
|
||||
|
||||
public class GuiContainerManager
|
||||
{
|
||||
public GuiContainer window;
|
||||
|
||||
public static RenderItem drawItems = new RenderItem();
|
||||
public static final LinkedList<IContainerTooltipHandler> tooltipHandlers = new LinkedList<IContainerTooltipHandler>();
|
||||
public static final LinkedList<IContainerInputHandler> inputHandlers = new LinkedList<IContainerInputHandler>();
|
||||
public static final LinkedList<IContainerDrawHandler> drawHandlers = new LinkedList<IContainerDrawHandler>();
|
||||
public static final LinkedList<IContainerObjectHandler> objectHandlers = new LinkedList<IContainerObjectHandler>();
|
||||
public static final LinkedList<IContainerSlotClickHandler> slotClickHandlers = new LinkedList<IContainerSlotClickHandler>();
|
||||
public static final RenderItem drawItems = new RenderItem();
|
||||
public static final LinkedList<IContainerTooltipHandler> tooltipHandlers = new LinkedList<>();
|
||||
public static final LinkedList<IContainerInputHandler> inputHandlers = new LinkedList<>();
|
||||
public static final LinkedList<IContainerDrawHandler> drawHandlers = new LinkedList<>();
|
||||
public static final LinkedList<IContainerObjectHandler> objectHandlers = new LinkedList<>();
|
||||
public static final LinkedList<IContainerSlotClickHandler> slotClickHandlers = new LinkedList<>();
|
||||
|
||||
static {
|
||||
addSlotClickHandler(new DefaultSlotClickHandler());
|
||||
@@ -120,7 +123,7 @@ public class GuiContainerManager
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
if (namelist == null)
|
||||
namelist = new ArrayList<String>();
|
||||
namelist = new ArrayList<>();
|
||||
|
||||
if (namelist.size() == 0)
|
||||
namelist.add("Unnamed");
|
||||
@@ -178,7 +181,7 @@ public class GuiContainerManager
|
||||
}
|
||||
|
||||
private static int modelviewDepth = -1;
|
||||
private static HashSet<String> stackTraces = new HashSet<String>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) {
|
||||
enable3DRender();
|
||||
@@ -251,7 +254,7 @@ public class GuiContainerManager
|
||||
public GuiContainerManager(GuiContainer screen) {
|
||||
window = screen;
|
||||
if (screen instanceof IContainerTooltipHandler) {
|
||||
instanceTooltipHandlers = new LinkedList<IContainerTooltipHandler>();
|
||||
instanceTooltipHandlers = new LinkedList<>();
|
||||
instanceTooltipHandlers.add((IContainerTooltipHandler) screen);
|
||||
instanceTooltipHandlers.addAll(tooltipHandlers);
|
||||
} else
|
||||
@@ -392,7 +395,7 @@ public class GuiContainerManager
|
||||
}
|
||||
|
||||
public void renderToolTips(int mousex, int mousey) {
|
||||
List<String> tooltip = new LinkedList<String>();
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
FontRenderer font = GuiDraw.fontRenderer;
|
||||
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers)
|
||||
|
||||
@@ -5,9 +5,6 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.client.gui.inventory.GuiBrewingStand;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemPotion;
|
||||
@@ -16,11 +13,12 @@ import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static net.minecraft.init.Items.potionitem;
|
||||
|
||||
@@ -41,7 +39,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public class CachedBrewingRecipe extends CachedRecipe
|
||||
{
|
||||
public BrewingRecipe recipe;
|
||||
public final BrewingRecipe recipe;
|
||||
|
||||
public CachedBrewingRecipe(BrewingRecipe recipe) {
|
||||
this.recipe = recipe;
|
||||
@@ -54,7 +52,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> getIngredients() {
|
||||
ArrayList<PositionedStack> recipestacks = new ArrayList<PositionedStack>();
|
||||
ArrayList<PositionedStack> recipestacks = new ArrayList<>();
|
||||
recipestacks.add(recipe.ingredient);
|
||||
recipestacks.add(recipe.precursorPotion);
|
||||
return recipestacks;
|
||||
@@ -62,7 +60,7 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
public static final ItemStackSet ingredients = new ItemStackSet();
|
||||
public static final HashSet<BrewingRecipe> apotions = new HashSet<BrewingRecipe>();
|
||||
public static final HashSet<BrewingRecipe> apotions = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
@@ -121,12 +119,12 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
public static void searchPotions() {
|
||||
TreeSet<Integer> allPotions = new TreeSet<Integer>();
|
||||
HashSet<Integer> searchPotions = new HashSet<Integer>();
|
||||
TreeSet<Integer> allPotions = new TreeSet<>();
|
||||
HashSet<Integer> searchPotions = new HashSet<>();
|
||||
searchPotions.add(0);
|
||||
allPotions.add(0);
|
||||
do {
|
||||
HashSet<Integer> newPotions = new HashSet<Integer>();
|
||||
HashSet<Integer> newPotions = new HashSet<>();
|
||||
for (Integer basePotion : searchPotions) {
|
||||
if (ItemPotion.isSplash(basePotion))
|
||||
continue;
|
||||
@@ -155,21 +153,9 @@ public class BrewingRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
while (!searchPotions.isEmpty());
|
||||
|
||||
API.setItemListEntries(potionitem, Iterables.transform(allPotions, new Function<Integer, ItemStack>()//override with only potions that can be crafted
|
||||
{
|
||||
@Override
|
||||
public ItemStack apply(Integer potionID) {
|
||||
return new ItemStack(potionitem, 1, potionID);
|
||||
}
|
||||
}));
|
||||
API.setItemListEntries(potionitem, allPotions.stream().map(potionID -> new ItemStack(potionitem, 1, potionID)).collect(Collectors.toList()));
|
||||
API.addSubset("Items.Potions", new ItemStackSet().with(potionitem));
|
||||
API.addSubset("Items.Potions.Splash", new ItemFilter()
|
||||
{
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return item.getItem() == potionitem && (item.getItemDamage() & 0x4000) != 0;
|
||||
}
|
||||
});
|
||||
API.addSubset("Items.Potions.Splash", item -> item.getItem() == potionitem && (item.getItemDamage() & 0x4000) != 0);
|
||||
|
||||
ItemStackSet positivepots = new ItemStackSet();
|
||||
ItemStackSet negativepots = new ItemStackSet();
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ContainerRecipe extends Container
|
||||
}
|
||||
}
|
||||
|
||||
private RecipeInventory recipeInventory = new RecipeInventory();
|
||||
private final RecipeInventory recipeInventory = new RecipeInventory();
|
||||
|
||||
public void clearInventory()
|
||||
{
|
||||
@@ -119,10 +119,9 @@ public class ContainerRecipe extends Container
|
||||
|
||||
public Slot getSlotWithStack(PositionedStack stack, int recipex, int recipey)
|
||||
{
|
||||
for(int i = 0; i < inventorySlots.size(); i++)
|
||||
{
|
||||
Slot slot = (Slot) inventorySlots.get(i);
|
||||
if(slot.xDisplayPosition == (stack.relx + recipex) && slot.yDisplayPosition == (stack.rely + recipey))
|
||||
for (Object inventorySlot : inventorySlots) {
|
||||
Slot slot = (Slot) inventorySlot;
|
||||
if (slot.xDisplayPosition == (stack.relx + recipex) && slot.yDisplayPosition == (stack.rely + recipey))
|
||||
return slot;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -9,7 +9,12 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class DefaultOverlayHandler implements IOverlayHandler
|
||||
{
|
||||
@@ -20,7 +25,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
stack = InventoryUtils.copyStack(item, 1);
|
||||
}
|
||||
|
||||
public ItemStack stack;
|
||||
public ItemStack stack;
|
||||
public int invAmount;
|
||||
public int distributed;
|
||||
public int numSlots;
|
||||
@@ -164,19 +169,19 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
{
|
||||
Slot[][] recipeSlots = mapIngredSlots(gui, ingredients);//setup the slot map
|
||||
|
||||
HashMap<Slot, Integer> distribution = new HashMap<Slot, Integer>();
|
||||
for(int i = 0; i < recipeSlots.length; i++)
|
||||
for(Slot slot : recipeSlots[i])
|
||||
if(!distribution.containsKey(slot))
|
||||
HashMap<Slot, Integer> distribution = new HashMap<>();
|
||||
for (Slot[] recipeSlot : recipeSlots)
|
||||
for (Slot slot : recipeSlot)
|
||||
if (!distribution.containsKey(slot))
|
||||
distribution.put(slot, -1);
|
||||
|
||||
HashSet<Slot> avaliableSlots = new HashSet<Slot>(distribution.keySet());
|
||||
HashSet<Integer> remainingIngreds = new HashSet<Integer>();
|
||||
ArrayList<LinkedList<Slot>> assignedSlots = new ArrayList<LinkedList<Slot>>();
|
||||
HashSet<Slot> avaliableSlots = new HashSet<>(distribution.keySet());
|
||||
HashSet<Integer> remainingIngreds = new HashSet<>();
|
||||
ArrayList<LinkedList<Slot>> assignedSlots = new ArrayList<>();
|
||||
for(int i = 0; i < ingredients.size(); i++)
|
||||
{
|
||||
remainingIngreds.add(i);
|
||||
assignedSlots.add(new LinkedList<Slot>());
|
||||
assignedSlots.add(new LinkedList<>());
|
||||
}
|
||||
|
||||
while(avaliableSlots.size() > 0 && remainingIngreds.size() > 0)
|
||||
@@ -214,7 +219,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
|
||||
private List<IngredientDistribution> assignIngredients(List<PositionedStack> ingredients, List<DistributedIngred> ingredStacks)
|
||||
{
|
||||
ArrayList<IngredientDistribution> assignedIngredients = new ArrayList<IngredientDistribution>();
|
||||
ArrayList<IngredientDistribution> assignedIngredients = new ArrayList<>();
|
||||
for(PositionedStack posstack : ingredients)//assign what we need and have
|
||||
{
|
||||
DistributedIngred biggestIngred = null;
|
||||
@@ -222,15 +227,12 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
int biggestSize = 0;
|
||||
for(ItemStack pstack : posstack.items)
|
||||
{
|
||||
for(int j = 0; j < ingredStacks.size(); j++)
|
||||
{
|
||||
DistributedIngred istack = ingredStacks.get(j);
|
||||
if(!canStack(pstack, istack.stack) || istack.invAmount-istack.distributed < pstack.stackSize)
|
||||
for (DistributedIngred istack : ingredStacks) {
|
||||
if (!canStack(pstack, istack.stack) || istack.invAmount - istack.distributed < pstack.stackSize)
|
||||
continue;
|
||||
|
||||
int relsize = (istack.invAmount-istack.invAmount/istack.recipeAmount*istack.distributed)/pstack.stackSize;
|
||||
if(relsize > biggestSize)
|
||||
{
|
||||
|
||||
int relsize = (istack.invAmount - istack.invAmount / istack.recipeAmount * istack.distributed) / pstack.stackSize;
|
||||
if (relsize > biggestSize) {
|
||||
biggestSize = relsize;
|
||||
biggestIngred = istack;
|
||||
permutation = pstack;
|
||||
@@ -266,7 +268,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
|
||||
private List<DistributedIngred> getPermutationIngredients(List<PositionedStack> ingredients)
|
||||
{
|
||||
ArrayList<DistributedIngred> ingredStacks = new ArrayList<DistributedIngred>();
|
||||
ArrayList<DistributedIngred> ingredStacks = new ArrayList<>();
|
||||
for(PositionedStack posstack : ingredients)//work out what we need
|
||||
{
|
||||
for(ItemStack pstack : posstack.items)
|
||||
@@ -290,7 +292,7 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
Slot[][] recipeSlotList = new Slot[ingredients.size()][];
|
||||
for(int i = 0; i < ingredients.size(); i++)//identify slots
|
||||
{
|
||||
LinkedList<Slot> recipeSlots = new LinkedList<Slot>();
|
||||
LinkedList<Slot> recipeSlots = new LinkedList<>();
|
||||
PositionedStack pstack = ingredients.get(i);
|
||||
for(Slot slot : (List<Slot>)gui.inventorySlots.inventorySlots)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipeFireworks;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,11 +22,11 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
{
|
||||
public class CachedFireworkRecipe extends CachedShapelessRecipe
|
||||
{
|
||||
LinkedList<Object> itemList = new LinkedList<Object>();
|
||||
final LinkedList<Object> itemList = new LinkedList<>();
|
||||
|
||||
public Object[] baseIngredients;
|
||||
public Object extraIngred;
|
||||
public int recipeType;
|
||||
public final Object[] baseIngredients;
|
||||
public final Object extraIngred;
|
||||
public final int recipeType;
|
||||
|
||||
public CachedFireworkRecipe(Object[] base, Object extra, int type) {
|
||||
super(new ItemStack(Items.fireworks));
|
||||
@@ -37,8 +39,7 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
|
||||
public void cycle() {
|
||||
itemList.clear();
|
||||
for (Object obj : baseIngredients)
|
||||
itemList.add(obj);
|
||||
itemList.addAll(Arrays.asList(baseIngredients));
|
||||
int extras = (cycleticks / 40) % (10 - itemList.size());
|
||||
for (int i = 0; i < extras; i++)
|
||||
itemList.add(extraIngred);
|
||||
@@ -54,10 +55,10 @@ public class FireworkRecipeHandler extends ShapelessRecipeHandler
|
||||
}
|
||||
}
|
||||
|
||||
private InventoryCrafting inventoryCrafting = new InventoryCraftingDummy();
|
||||
private RecipeFireworks recipeFireworks = new RecipeFireworks();
|
||||
private final InventoryCrafting inventoryCrafting = new InventoryCraftingDummy();
|
||||
private final RecipeFireworks recipeFireworks = new RecipeFireworks();
|
||||
|
||||
public ArrayList<CachedFireworkRecipe> mfireworks = new ArrayList<CachedFireworkRecipe>();
|
||||
public final ArrayList<CachedFireworkRecipe> mfireworks = new ArrayList<>();
|
||||
|
||||
public FireworkRecipeHandler() {
|
||||
super();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class FuelRecipeHandler extends FurnaceRecipeHandler
|
||||
{
|
||||
public class CachedFuelRecipe extends CachedRecipe
|
||||
{
|
||||
public FuelPair fuel;
|
||||
public final FuelPair fuel;
|
||||
|
||||
public CachedFuelRecipe(FuelPair fuel) {
|
||||
this.fuel = fuel;
|
||||
@@ -38,7 +38,7 @@ public class FuelRecipeHandler extends FurnaceRecipeHandler
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<SmeltingPair> mfurnace = new ArrayList<FurnaceRecipeHandler.SmeltingPair>();
|
||||
private final ArrayList<SmeltingPair> mfurnace = new ArrayList<>();
|
||||
|
||||
public FuelRecipeHandler() {
|
||||
super();
|
||||
|
||||
@@ -8,16 +8,19 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiFurnace;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
{
|
||||
@@ -30,7 +33,7 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
|
||||
return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
@@ -41,8 +44,8 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
return afuels.get((cycleticks / 48) % afuels.size()).stack;
|
||||
}
|
||||
|
||||
PositionedStack ingred;
|
||||
PositionedStack result;
|
||||
final PositionedStack ingred;
|
||||
final PositionedStack result;
|
||||
}
|
||||
|
||||
public static class FuelPair
|
||||
@@ -52,8 +55,8 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
public final PositionedStack stack;
|
||||
public final int burnTime;
|
||||
}
|
||||
|
||||
public static ArrayList<FuelPair> afuels;
|
||||
@@ -114,7 +117,7 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet())
|
||||
if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) {
|
||||
SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue());
|
||||
arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient);
|
||||
arecipe.setIngredientPermutation(Collections.singletonList(arecipe.ingred), ingredient);
|
||||
arecipes.add(arecipe);
|
||||
}
|
||||
}
|
||||
@@ -131,7 +134,7 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
private static Set<Item> excludedFuels() {
|
||||
Set<Item> efuels = new HashSet<Item>();
|
||||
Set<Item> efuels = new HashSet<>();
|
||||
efuels.add(Item.getItemFromBlock(Blocks.brown_mushroom));
|
||||
efuels.add(Item.getItemFromBlock(Blocks.red_mushroom));
|
||||
efuels.add(Item.getItemFromBlock(Blocks.standing_sign));
|
||||
@@ -142,7 +145,7 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler
|
||||
}
|
||||
|
||||
private static void findFuels() {
|
||||
afuels = new ArrayList<FuelPair>();
|
||||
afuels = new ArrayList<>();
|
||||
Set<Item> efuels = excludedFuels();
|
||||
for (ItemStack item : ItemList.items)
|
||||
if (!efuels.contains(item.getItem())) {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
|
||||
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
ArrayList<ICraftingHandler> handlers = new ArrayList<ICraftingHandler>();
|
||||
ArrayList<ICraftingHandler> handlers = new ArrayList<>();
|
||||
for (ICraftingHandler craftinghandler : craftinghandlers) {
|
||||
profiler.start(craftinghandler.getRecipeName());
|
||||
ICraftingHandler handler = craftinghandler.getRecipeHandler(outputId, results);
|
||||
@@ -48,5 +48,5 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
|
||||
public ArrayList<ICraftingHandler> currenthandlers;
|
||||
|
||||
public static ArrayList<ICraftingHandler> craftinghandlers = new ArrayList<ICraftingHandler>();
|
||||
public static ArrayList<ICraftingHandler> craftinghandlers = new ArrayList<>();
|
||||
}
|
||||
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
|
||||
public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOverlay, IGuiClientSide, IGuiHandleMouseWheel, IContainerTooltipHandler
|
||||
{
|
||||
public ArrayList<? extends IRecipeHandler> currenthandlers = new ArrayList<IRecipeHandler>();
|
||||
public ArrayList<? extends IRecipeHandler> currenthandlers = new ArrayList<>();
|
||||
|
||||
public int page;
|
||||
public int recipetype;
|
||||
|
||||
@@ -14,7 +14,7 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
|
||||
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
ArrayList<IUsageHandler> handlers = new ArrayList<IUsageHandler>();
|
||||
ArrayList<IUsageHandler> handlers = new ArrayList<>();
|
||||
for (IUsageHandler usagehandler : usagehandlers) {
|
||||
profiler.start(usagehandler.getRecipeName());
|
||||
IUsageHandler handler = usagehandler.getUsageHandler(inputId, ingredients);
|
||||
@@ -49,5 +49,5 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
|
||||
public ArrayList<IUsageHandler> currenthandlers;
|
||||
|
||||
public static ArrayList<IUsageHandler> usagehandlers = new ArrayList<IUsageHandler>();
|
||||
public static ArrayList<IUsageHandler> usagehandlers = new ArrayList<>();
|
||||
}
|
||||
@@ -12,14 +12,16 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler
|
||||
{
|
||||
private static TaskProfiler profiler = new TaskProfiler();
|
||||
private static final TaskProfiler profiler = new TaskProfiler();
|
||||
|
||||
public static TaskProfiler getProfiler()
|
||||
{
|
||||
@@ -27,7 +29,7 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler
|
||||
return profiler;
|
||||
}
|
||||
|
||||
private boolean crafting;
|
||||
private final boolean crafting;
|
||||
|
||||
public ProfilerRecipeHandler(boolean crafting)
|
||||
{
|
||||
@@ -64,14 +66,7 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler
|
||||
if(it.next().name.equals(getRecipeName()))
|
||||
it.remove();
|
||||
|
||||
Collections.sort(results, new Comparator<ProfilerResult>()
|
||||
{
|
||||
@Override
|
||||
public int compare(ProfilerResult o1, ProfilerResult o2)
|
||||
{
|
||||
return o1.time < o2.time ? 1 : -1;
|
||||
}
|
||||
});
|
||||
results.sort((o1, o2) -> o1.time < o2.time ? 1 : -1);
|
||||
|
||||
for(int i = recipe*6; i < results.size() && i < (recipe+1)*6; i++)
|
||||
{
|
||||
@@ -93,13 +88,13 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler
|
||||
@Override
|
||||
public ArrayList<PositionedStack> getIngredientStacks(int recipe)
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<PositionedStack> getOtherStacks(int recipetype)
|
||||
{
|
||||
return new ArrayList<PositionedStack>();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,11 @@ import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import com.google.common.base.Objects;
|
||||
import net.minecraft.client.gui.inventory.*;
|
||||
import net.minecraft.client.gui.inventory.GuiBrewingStand;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiCrafting;
|
||||
import net.minecraft.client.gui.inventory.GuiFurnace;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -13,8 +17,8 @@ public class RecipeInfo
|
||||
{
|
||||
private static class OverlayKey
|
||||
{
|
||||
String ident;
|
||||
Class<? extends GuiContainer> guiClass;
|
||||
final String ident;
|
||||
final Class<? extends GuiContainer> guiClass;
|
||||
|
||||
public OverlayKey(Class<? extends GuiContainer> classz, String ident)
|
||||
{
|
||||
@@ -38,9 +42,9 @@ public class RecipeInfo
|
||||
}
|
||||
}
|
||||
|
||||
static HashMap<OverlayKey, IOverlayHandler> overlayMap = new HashMap<OverlayKey, IOverlayHandler>();
|
||||
static HashMap<OverlayKey, IStackPositioner> positionerMap = new HashMap<OverlayKey, IStackPositioner>();
|
||||
static HashMap<Class<? extends GuiContainer>, int[]> offsets = new HashMap<Class<? extends GuiContainer>, int[]>();
|
||||
static final HashMap<OverlayKey, IOverlayHandler> overlayMap = new HashMap<>();
|
||||
static final HashMap<OverlayKey, IStackPositioner> positionerMap = new HashMap<>();
|
||||
static final HashMap<Class<? extends GuiContainer>, int[]> offsets = new HashMap<>();
|
||||
|
||||
public static void registerOverlayHandler(Class<? extends GuiContainer> classz, IOverlayHandler handler, String ident)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ShapedRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public CachedShapedRecipe(int width, int height, Object[] items, ItemStack out) {
|
||||
result = new PositionedStack(out, 119, 24);
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
ingredients = new ArrayList<>();
|
||||
setIngredients(width, height, items);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
|
||||
public class CachedShapelessRecipe extends CachedRecipe
|
||||
{
|
||||
public CachedShapelessRecipe() {
|
||||
ingredients = new ArrayList<PositionedStack>();
|
||||
ingredients = new ArrayList<>();
|
||||
}
|
||||
|
||||
public CachedShapelessRecipe(ItemStack output) {
|
||||
|
||||
@@ -18,11 +18,19 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.*;
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
/**
|
||||
* A Template Recipe Handler!
|
||||
@@ -53,7 +61,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
* @return A list of positioned ingredient items.
|
||||
*/
|
||||
public List<PositionedStack> getIngredients() {
|
||||
ArrayList<PositionedStack> stacks = new ArrayList<PositionedStack>();
|
||||
ArrayList<PositionedStack> stacks = new ArrayList<>();
|
||||
PositionedStack stack = getIngredient();
|
||||
if (stack != null)
|
||||
stacks.add(stack);
|
||||
@@ -74,7 +82,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
* @return A list of positioned items.
|
||||
*/
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
ArrayList<PositionedStack> stacks = new ArrayList<PositionedStack>();
|
||||
ArrayList<PositionedStack> stacks = new ArrayList<>();
|
||||
PositionedStack stack = getOtherStack();
|
||||
if (stack != null)
|
||||
stacks.add(stack);
|
||||
@@ -183,18 +191,14 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
|
||||
public static class RecipeTransferRectHandler implements IContainerInputHandler, IContainerTooltipHandler
|
||||
{
|
||||
private static HashMap<Class<? extends GuiContainer>, HashSet<RecipeTransferRect>> guiMap = new HashMap<Class<? extends GuiContainer>, HashSet<RecipeTransferRect>>();
|
||||
private static HashMap<Class<? extends GuiContainer>, HashSet<RecipeTransferRect>> guiMap = new HashMap<>();
|
||||
|
||||
public static void registerRectsToGuis(List<Class<? extends GuiContainer>> classes, List<RecipeTransferRect> rects) {
|
||||
if (classes == null)
|
||||
return;
|
||||
|
||||
for (Class<? extends GuiContainer> clazz : classes) {
|
||||
HashSet<RecipeTransferRect> set = guiMap.get(clazz);
|
||||
if (set == null) {
|
||||
set = new HashSet<RecipeTransferRect>();
|
||||
guiMap.put(clazz, set);
|
||||
}
|
||||
HashSet<RecipeTransferRect> set = guiMap.computeIfAbsent(clazz, k -> new HashSet<>());
|
||||
set.addAll(rects);
|
||||
}
|
||||
}
|
||||
@@ -300,11 +304,11 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
/**
|
||||
* The list of matching recipes
|
||||
*/
|
||||
public ArrayList<CachedRecipe> arecipes = new ArrayList<CachedRecipe>();
|
||||
public ArrayList<CachedRecipe> arecipes = new ArrayList<>();
|
||||
/**
|
||||
* A list of transferRects that apon when clicked or R is pressed will open a new recipe.
|
||||
*/
|
||||
public LinkedList<RecipeTransferRect> transferRects = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRects = new LinkedList<>();
|
||||
|
||||
public TemplateRecipeHandler() {
|
||||
loadTransferRects();
|
||||
@@ -439,7 +443,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
public List<Class<? extends GuiContainer>> getRecipeTransferRectGuis() {
|
||||
Class<? extends GuiContainer> clazz = getGuiClass();
|
||||
if (clazz != null) {
|
||||
LinkedList<Class<? extends GuiContainer>> list = new LinkedList<Class<? extends GuiContainer>>();
|
||||
LinkedList<Class<? extends GuiContainer>> list = new LinkedList<>();
|
||||
list.add(clazz);
|
||||
return list;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user