mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-15 09:44:44 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19d8b42993 | ||
|
|
3b7eae67af | ||
|
|
64a747e4bd | ||
|
|
4f60928b61 | ||
|
|
8dba2ff4c1 | ||
|
|
eb40e3b112 | ||
|
|
98c8981f05 | ||
|
|
1ed35c8357 | ||
|
|
6249bab886 | ||
|
|
b525760dd3 | ||
|
|
83b4855f5e | ||
|
|
75352caf11 | ||
|
|
475f5811f6 | ||
|
|
7503e1dfcb | ||
|
|
9d1f475941 | ||
|
|
ac50d1b27e |
No files matched your search
+3
-1
@@ -2,7 +2,9 @@
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.4.1:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.5:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.18:dev')
|
||||
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
|
||||
compileOnly 'maven.modrinth:forge-essentials:7.5.1'
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ modId = NotEnoughItems
|
||||
modGroup = codechicken.nei
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -86,8 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -206,7 +205,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
// Add any additional repositiroes for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModClassLoader;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
@@ -254,11 +257,29 @@ public class ClientHandler {
|
||||
}
|
||||
|
||||
public static void loadPluginsList() {
|
||||
final ClassDiscoverer classDiscoverer = new ClassDiscoverer(
|
||||
test -> test.startsWith("NEI") && test.endsWith("Config.class"),
|
||||
IConfigureNEI.class);
|
||||
if (!Loader.isModLoaded("jarjar")) {
|
||||
// Do the old style class discovery
|
||||
final ClassDiscoverer classDiscoverer = new ClassDiscoverer(
|
||||
test -> test.startsWith("NEI") && test.endsWith("Config.class"),
|
||||
IConfigureNEI.class);
|
||||
|
||||
NEIClientConfig.pluginsList.addAll(classDiscoverer.findClasses());
|
||||
NEIClientConfig.pluginsList.addAll(classDiscoverer.findClasses());
|
||||
} else {
|
||||
// If JarJar's loaded, the ASMDataTable now includes interfaces in addition to Annotations, so use that
|
||||
// instead Includes a small change in behavior of no longer requiring the class to start with NEI and end
|
||||
// with Config; This could easily be changed if desired, but the previous behavior was likely to speed
|
||||
// things up by limiting the scope when looking at all of the jars and classes in the classpath.
|
||||
final ASMDataTable dataTable = NEIModContainer.getAsmDataTable();
|
||||
final ModClassLoader modClassLoader = (ModClassLoader) Loader.instance().getModClassLoader();
|
||||
for (ASMDataTable.ASMData asmData : dataTable.getAll(IConfigureNEI.class.getName().replace('.', '/'))) {
|
||||
final String className = asmData.getClassName().replace('/', '.');
|
||||
try {
|
||||
NEIClientConfig.pluginsList.add(Class.forName(className, true, modClassLoader));
|
||||
} catch (ClassNotFoundException e) {
|
||||
NEIClientConfig.logger.error("Failed to load plugin class {}", className, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -317,8 +338,9 @@ public class ClientHandler {
|
||||
public void loadWorld(World world, boolean fromServer) {
|
||||
if (world != lastworld) {
|
||||
SMPmagneticItems.clear();
|
||||
WorldOverlayRenderer.reset();
|
||||
|
||||
if (!NEIClientConfig.getBooleanSetting("world.overlays.lock")) {
|
||||
WorldOverlayRenderer.reset();
|
||||
}
|
||||
if (!fromServer) {
|
||||
NEIClientConfig.setHasSMPCounterPart(false);
|
||||
NEIClientConfig.setInternalEnabled(false);
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -102,6 +103,39 @@ public class FormattedTextField extends GuiTextField {
|
||||
this.editable = p_146184_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeText(String p_146191_1_) {
|
||||
String newText = "";
|
||||
String substr = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
|
||||
int cursorPosition = getCursorPosition();
|
||||
int maxStringLength = getMaxStringLength();
|
||||
String text = getText();
|
||||
|
||||
if (text.isEmpty()) {
|
||||
newText = substr.substring(0, Math.min(maxStringLength, substr.length()));
|
||||
cursorPosition = newText.length();
|
||||
} else {
|
||||
int selectionEnd = getSelectionEnd();
|
||||
String textStart = text.substring(0, Math.min(cursorPosition, selectionEnd));
|
||||
String textEnd = text.substring(Math.max(cursorPosition, selectionEnd));
|
||||
newText = textStart + substr + textEnd;
|
||||
|
||||
if (newText.length() > maxStringLength) {
|
||||
newText = newText.substring(0, maxStringLength);
|
||||
}
|
||||
|
||||
cursorPosition = Math.min(textStart.length() + substr.length(), newText.length());
|
||||
}
|
||||
|
||||
setText(newText);
|
||||
setCursorPosition(cursorPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNthWordFromPos(int p_146183_1_, int p_146183_2_) {
|
||||
return this.func_146197_a(p_146183_1_, p_146183_2_, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
if (this.getVisible()) {
|
||||
|
||||
@@ -234,8 +234,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return true;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.next_tooltip")) {
|
||||
GuiContainerManager.incrementTooltipPage();
|
||||
if (NEIClientConfig.isKeyHashDown("gui.next_tooltip") && GuiContainerManager.incrementTooltipPage()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ public class LayoutStyleMinecraft extends LayoutStyle {
|
||||
final Rectangle4i area = new Rectangle4i(0, 0, 0, BUTTON_SIZE);
|
||||
|
||||
if (NEIClientConfig.isSearchWidgetCentered()) {
|
||||
area.w = gui.xSize - MARGIN * 2;
|
||||
area.w = Math.min(gui.xSize, 176) - MARGIN * 2;
|
||||
area.x = (gui.width - area.w) / 2;
|
||||
area.y = gui.height - BUTTON_SIZE - MARGIN;
|
||||
} else if (NEIClientConfig.showItemQuantityWidget()) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -45,7 +46,6 @@ import codechicken.nei.config.GuiHighlightTips;
|
||||
import codechicken.nei.config.GuiNEIOptionList;
|
||||
import codechicken.nei.config.GuiOptionList;
|
||||
import codechicken.nei.config.GuiPanelSettings;
|
||||
import codechicken.nei.config.OptionButton;
|
||||
import codechicken.nei.config.OptionCycled;
|
||||
import codechicken.nei.config.OptionGamemodes;
|
||||
import codechicken.nei.config.OptionIntegerField;
|
||||
@@ -61,6 +61,7 @@ import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.util.NEIKeyboardUtils;
|
||||
import codechicken.obfuscator.ObfuscationRun;
|
||||
|
||||
public class NEIClientConfig {
|
||||
@@ -287,19 +288,6 @@ public class NEIClientConfig {
|
||||
0,
|
||||
OptionIntegerField.UNSIGNED_INT_MAX));
|
||||
|
||||
API.addOption(
|
||||
new OptionButton(
|
||||
"inventory.collapsibleItems.reloadLabel",
|
||||
"inventory.collapsibleItems.reloadButton",
|
||||
"inventory.collapsibleItems.reloadTip") {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
LayoutManager.markItemsDirty();
|
||||
return super.onClick(button);
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.itemzoom.enabled").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.enabled", true));
|
||||
|
||||
@@ -347,6 +335,9 @@ public class NEIClientConfig {
|
||||
|
||||
API.addOption(new OptionOpenGui("world.presets", GuiPresetList.class));
|
||||
|
||||
tag.getTag("world.overlays.lock").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("world.overlays.lock", true));
|
||||
|
||||
tag.getTag("inventory.disableMouseScrollTransfer").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.disableMouseScrollTransfer", true));
|
||||
|
||||
@@ -364,6 +355,19 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.gridRenderingCacheMode").getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.gridRenderingCacheMode", 3, true));
|
||||
|
||||
tag.getTag("inventory.gridRenderingCacheFPS").getIntValue(8);
|
||||
API.addOption(new OptionIntegerField("inventory.gridRenderingCacheFPS", 1, 144) {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return OpenGlHelper.framebufferSupported && getIntSetting("inventory.gridRenderingCacheMode") == 1;
|
||||
}
|
||||
|
||||
});
|
||||
tag.getTag("inventory.hotkeysHelpText").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.hotkeysHelpText", true));
|
||||
|
||||
tag.getTag("loadPluginsInParallel").getBooleanValue(true);
|
||||
tag.getTag("itemLoadingTimeout").getIntValue(500);
|
||||
|
||||
tag.getTag("command.creative").setDefaultValue("/gamemode {0} {1}");
|
||||
@@ -789,7 +793,7 @@ public class NEIClientConfig {
|
||||
private static final Map<String, String> keySettings = new HashMap<>();
|
||||
|
||||
public static int getKeyBinding(String string) {
|
||||
final String key = keySettings.computeIfAbsent(string, (s) -> "keys." + s);
|
||||
final String key = keySettings.computeIfAbsent(string, s -> "keys." + s);
|
||||
return getSetting(key).getIntValue(Keyboard.KEY_NONE);
|
||||
}
|
||||
|
||||
@@ -799,17 +803,37 @@ public class NEIClientConfig {
|
||||
|
||||
public static boolean isKeyHashDown(String string) {
|
||||
final int hash = getKeyBinding(string);
|
||||
return hash != Keyboard.CHAR_NONE && hash == NEIClientUtils.getKeyHash();
|
||||
|
||||
if (hash != Keyboard.CHAR_NONE && Keyboard.getEventKeyState()) {
|
||||
return KeyManager.keyStates.containsKey(string) ? hash == Keyboard.getEventKey()
|
||||
: hash == NEIClientUtils.getKeyHash();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getKeyName(String keyBind) {
|
||||
return getKeyName(keyBind, 0);
|
||||
}
|
||||
|
||||
public static String getKeyName(String keyBind, int meta, int mouseBind) {
|
||||
final int hash = getKeyBinding(keyBind);
|
||||
|
||||
if (hash == Keyboard.CHAR_NONE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return NEIClientUtils.getKeyName(hash);
|
||||
return NEIClientUtils.getKeyName(hash + meta, mouseBind);
|
||||
}
|
||||
|
||||
public static String getKeyName(String keyBind, int meta) {
|
||||
final int hash = getKeyBinding(keyBind);
|
||||
|
||||
if (hash == Keyboard.CHAR_NONE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return NEIKeyboardUtils.getKeyName(hash + meta);
|
||||
}
|
||||
|
||||
public static void bootNEI(World world) {
|
||||
@@ -828,8 +852,11 @@ public class NEIClientConfig {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final Stream<Class<?>> stream = NEIClientConfig.getBooleanSetting("loadPluginsInParallel")
|
||||
? NEIClientConfig.pluginsList.parallelStream()
|
||||
: NEIClientConfig.pluginsList.stream();
|
||||
|
||||
NEIClientConfig.pluginsList.parallelStream().forEach(clazz -> {
|
||||
stream.forEach(clazz -> {
|
||||
try {
|
||||
IConfigureNEI config = (IConfigureNEI) clazz.getConstructor().newInstance();
|
||||
config.loadConfig();
|
||||
|
||||
@@ -50,6 +50,8 @@ import codechicken.lib.util.LangProxy;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.api.IInfiniteItemHandler;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.util.NEIKeyboardUtils;
|
||||
import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public class NEIClientUtils extends NEIServerUtils {
|
||||
|
||||
@@ -57,25 +59,10 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
|
||||
/** Formats a number with group separator and at most 2 fraction digits. */
|
||||
private static final Map<Locale, DecimalFormat> decimalFormatters = new HashMap<>();
|
||||
private static final Map<Integer, Integer> keyHashMap = new HashMap<>();
|
||||
|
||||
public static final int ALT_HASH = 1 << 27;
|
||||
public static final int SHIFT_HASH = 1 << 26;
|
||||
public static final int CTRL_HASH = 1 << 25;
|
||||
|
||||
static {
|
||||
keyHashMap.put(Keyboard.KEY_LSHIFT, SHIFT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RSHIFT, SHIFT_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMETA, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RMETA, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
}
|
||||
public static final int ALT_HASH = NEIKeyboardUtils.ALT_HASH;
|
||||
public static final int SHIFT_HASH = NEIKeyboardUtils.SHIFT_HASH;
|
||||
public static final int CTRL_HASH = NEIKeyboardUtils.CTRL_HASH;
|
||||
|
||||
public static Minecraft mc() {
|
||||
return Minecraft.getMinecraft();
|
||||
@@ -452,7 +439,7 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
final int keycode = Keyboard.getEventKey();
|
||||
|
||||
if (!keyHashMap.containsKey(keycode)) {
|
||||
if (!NEIKeyboardUtils.isHashKey(keycode)) {
|
||||
return getMetaHash() + keycode;
|
||||
}
|
||||
}
|
||||
@@ -460,45 +447,22 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
return Keyboard.CHAR_NONE;
|
||||
}
|
||||
|
||||
public static String getKeyHashName(int keyBind) {
|
||||
public static String getKeyName(int keyBind, int mouseBind) {
|
||||
StringJoiner keyText = new StringJoiner(" + ");
|
||||
String keyHash = keyBind == Keyboard.KEY_NONE ? "" : NEIKeyboardUtils.getKeyName(keyBind);
|
||||
String mouseHash = mouseBind == NEIMouseUtils.MOUSE_BTN_NONE ? "" : NEIMouseUtils.getKeyName(mouseBind);
|
||||
|
||||
if ((keyBind & CTRL_HASH) != 0) {
|
||||
keyText.add(translate(Minecraft.isRunningOnMac ? "key.ctrl.mac" : "key.ctrl"));
|
||||
if (!keyHash.isEmpty()) {
|
||||
keyText.add(keyHash);
|
||||
}
|
||||
|
||||
if ((keyBind & SHIFT_HASH) != 0) {
|
||||
keyText.add(translate("key.shift"));
|
||||
}
|
||||
|
||||
if ((keyBind & ALT_HASH) != 0) {
|
||||
keyText.add(translate("key.alt"));
|
||||
if (!mouseHash.isEmpty()) {
|
||||
keyText.add(mouseHash);
|
||||
}
|
||||
|
||||
return keyText.toString();
|
||||
}
|
||||
|
||||
public static String getKeyName(int keyBind) {
|
||||
keyBind = keyHashMap.getOrDefault(keyBind, keyBind);
|
||||
StringJoiner keyText = new StringJoiner(" + ");
|
||||
String hashText = getKeyHashName(keyBind);
|
||||
int keyID = unHashKey(keyBind);
|
||||
|
||||
if (!hashText.isEmpty()) {
|
||||
keyText.add(hashText);
|
||||
}
|
||||
|
||||
if (keyID != Keyboard.CHAR_NONE || hashText.isEmpty()) {
|
||||
keyText.add(Keyboard.getKeyName(keyID));
|
||||
}
|
||||
|
||||
return keyText.toString();
|
||||
}
|
||||
|
||||
public static int unHashKey(int keyBind) {
|
||||
return keyBind & ~(CTRL_HASH | SHIFT_HASH | ALT_HASH);
|
||||
}
|
||||
|
||||
public static void playClickSound() {
|
||||
mc().getSoundHandler()
|
||||
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
@@ -25,6 +25,7 @@ import cpw.mods.fml.common.DummyModContainer;
|
||||
import cpw.mods.fml.common.LoadController;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
@@ -41,6 +42,8 @@ public class NEIModContainer extends DummyModContainer {
|
||||
private static boolean gregTech5Loaded;
|
||||
private static boolean gtnhLibLoaded;
|
||||
|
||||
private static ASMDataTable asmDataTable;
|
||||
|
||||
public NEIModContainer() {
|
||||
super(getModMetadata());
|
||||
loadMetadata();
|
||||
@@ -117,6 +120,7 @@ public class NEIModContainer extends DummyModContainer {
|
||||
gregTech5Loaded = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi_post");
|
||||
gtnhLibLoaded = Loader.isModLoaded("gtnhlib");
|
||||
if (CommonUtils.isClient()) ClientHandler.preInit();
|
||||
asmDataTable = event.getAsmData();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -139,6 +143,7 @@ public class NEIModContainer extends DummyModContainer {
|
||||
GuiRecipeTab.loadHandlerInfo();
|
||||
ClientHandler.loadPluginsList();
|
||||
ClientHandler.loadHandlerOrdering();
|
||||
asmDataTable = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,4 +166,8 @@ public class NEIModContainer extends DummyModContainer {
|
||||
public Class<?> getCustomResourcePackClass() {
|
||||
return getSource().isDirectory() ? FMLFolderResourcePack.class : FMLFileResourcePack.class;
|
||||
}
|
||||
|
||||
public static ASMDataTable getAsmDataTable() {
|
||||
return asmDataTable;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.permission.PermissionLevel;
|
||||
import net.minecraftforge.permission.PermissionManager;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -44,6 +46,8 @@ public class NEIServerConfig {
|
||||
public static HashMap<String, PlayerSave> playerSaves = new HashMap<>();
|
||||
public static ItemStackMap<Set<String>> bannedItems = new ItemStackMap<>();
|
||||
|
||||
private static boolean doesPermAPIExist = false;
|
||||
|
||||
public static void load(World world) {
|
||||
if (MinecraftServer.getServer() != server) {
|
||||
logger.debug("Loading NEI Server");
|
||||
@@ -53,6 +57,16 @@ public class NEIServerConfig {
|
||||
dimTags.clear();
|
||||
loadConfig();
|
||||
loadBannedItems();
|
||||
|
||||
try {
|
||||
Class.forName("net.minecraftforge.permission.PermissionManager");
|
||||
doesPermAPIExist = true;
|
||||
|
||||
NEIActions.baseActions().forEach(
|
||||
action -> {
|
||||
PermissionManager.registerPermission("nei.permissions." + action, PermissionLevel.OP);
|
||||
});
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
loadWorld(world);
|
||||
}
|
||||
@@ -121,7 +135,12 @@ public class NEIServerConfig {
|
||||
}
|
||||
|
||||
public static boolean canPlayerPerformAction(String playername, String name) {
|
||||
return isPlayerInList(playername, getPlayerList("permissions." + NEIActions.base(name)), true);
|
||||
String node = "permissions." + NEIActions.base(name);
|
||||
boolean hasPerm = doesPermAPIExist
|
||||
? PermissionManager.checkPermission(ServerUtils.getPlayer(playername), "nei." + node)
|
||||
: false;
|
||||
|
||||
return hasPerm || isPlayerInList(playername, getPlayerList(node), true);
|
||||
}
|
||||
|
||||
public static boolean isPlayerInList(String playername, Set<String> list, boolean allowCards) {
|
||||
|
||||
@@ -82,7 +82,11 @@ public class PositionedStack {
|
||||
}
|
||||
|
||||
public PositionedStack copy() {
|
||||
PositionedStack pStack = new PositionedStack(Arrays.asList(items), relx, rely, false);
|
||||
PositionedStack pStack = new PositionedStack(
|
||||
Arrays.stream(this.items).map(ItemStack::copy).toArray(ItemStack[]::new),
|
||||
relx,
|
||||
rely,
|
||||
false);
|
||||
pStack.permutated = this.permutated;
|
||||
return pStack;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public class SubsetWidget extends Button implements ItemFilterProvider, IContainerTooltipHandler {
|
||||
|
||||
@@ -841,21 +842,21 @@ public class SubsetWidget extends Button implements ItemFilterProvider, IContain
|
||||
|
||||
if (NEIClientConfig.canCheatItem(SubsetWidget.hoverStack)) {
|
||||
hotkeys.put(
|
||||
NEIClientUtils.translate("subsets.item.cheat.key"),
|
||||
NEIClientUtils.getKeyName(NEIClientUtils.CTRL_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
|
||||
NEIClientUtils.translate("subsets.item.cheat"));
|
||||
}
|
||||
|
||||
if (SubsetWidget.enableSearchBySubsets) {
|
||||
hotkeys.put(
|
||||
NEIClientUtils.translate("subsets.item.search.key"),
|
||||
NEIClientUtils.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
|
||||
NEIClientUtils.translate("subsets.item.search"));
|
||||
}
|
||||
|
||||
hotkeys.put(
|
||||
NEIClientUtils.translate("subsets.item.show.key"),
|
||||
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB),
|
||||
NEIClientUtils.translate("subsets.item.show"));
|
||||
hotkeys.put(
|
||||
NEIClientUtils.translate("subsets.item.hide.key"),
|
||||
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB),
|
||||
NEIClientUtils.translate("subsets.item.hide"));
|
||||
} else if (SubsetWidget.hoverTag != null) {
|
||||
hotkeys.put(
|
||||
@@ -864,12 +865,16 @@ public class SubsetWidget extends Button implements ItemFilterProvider, IContain
|
||||
|
||||
if (SubsetWidget.enableSearchBySubsets) {
|
||||
hotkeys.put(
|
||||
NEIClientUtils.translate("subsets.tag.search.key"),
|
||||
NEIClientUtils.getKeyName(NEIClientUtils.SHIFT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
|
||||
NEIClientUtils.translate("subsets.tag.search"));
|
||||
}
|
||||
|
||||
hotkeys.put(NEIClientUtils.translate("subsets.tag.show.key"), NEIClientUtils.translate("subsets.tag.show"));
|
||||
hotkeys.put(NEIClientUtils.translate("subsets.tag.hide.key"), NEIClientUtils.translate("subsets.tag.hide"));
|
||||
hotkeys.put(
|
||||
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB),
|
||||
NEIClientUtils.translate("subsets.tag.show"));
|
||||
hotkeys.put(
|
||||
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB),
|
||||
NEIClientUtils.translate("subsets.tag.hide"));
|
||||
}
|
||||
|
||||
return hotkeys;
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.awt.Rectangle;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.util.NEIKeyboardUtils;
|
||||
|
||||
public class OptionKeyBind extends OptionButton {
|
||||
|
||||
@@ -123,10 +124,10 @@ public class OptionKeyBind extends OptionButton {
|
||||
public String getButtonText() {
|
||||
|
||||
if (editing) {
|
||||
return NEIClientUtils.getKeyHashName(NEIClientUtils.getMetaHash());
|
||||
return NEIKeyboardUtils.getHashName(NEIClientUtils.getMetaHash());
|
||||
}
|
||||
|
||||
return NEIClientUtils.getKeyName(Math.max(getValue(), 0));
|
||||
return NEIKeyboardUtils.getKeyName(Math.max(getValue(), 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,7 @@ import codechicken.nei.TextField;
|
||||
|
||||
public class OptionTextField extends Option {
|
||||
|
||||
protected final TextField textField = new TextField("test") {
|
||||
protected final TextField textField = new TextField("option-text-field") {
|
||||
|
||||
{
|
||||
this.h = 20;
|
||||
@@ -19,6 +19,7 @@ public class OptionTextField extends Option {
|
||||
// don't override global if text hasn't changed
|
||||
if (focused() && isValidValue(text()) && (!defaulting() || !text().equals(getTag().getValue()))) {
|
||||
getTag().setValue(text());
|
||||
OptionTextField.this.onTextChange(text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +28,20 @@ public class OptionTextField extends Option {
|
||||
if (!focus && !isValidValue(text())) setText(renderTag().getValue());
|
||||
super.setFocus(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
this.field.setEnabled(isEnabled());
|
||||
super.draw(mousex, mousey);
|
||||
}
|
||||
};
|
||||
|
||||
public OptionTextField(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void onTextChange(String text) {}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
textField.update();
|
||||
@@ -47,6 +56,10 @@ public class OptionTextField extends Option {
|
||||
return slot.slotWidth();
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
GuiDraw.drawString(getPrefix(), 10, 6, -1);
|
||||
@@ -59,12 +72,14 @@ public class OptionTextField extends Option {
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int keycode) {
|
||||
textField.handleKeyPress(keycode, c);
|
||||
if (isEnabled()) {
|
||||
textField.handleKeyPress(keycode, c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mousex, int mousey, int button) {
|
||||
if (textField.contains(mousex, mousey)) textField.handleClick(mousex, mousey, button);
|
||||
if (isEnabled() && textField.contains(mousex, mousey)) textField.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,7 +89,7 @@ public class OptionTextField extends Option {
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
|
||||
if (new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
if (isEnabled() && new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
String tip = translateN(name + ".tip");
|
||||
if (!tip.equals(namespaced(name + ".tip"))) currenttip.add(tip);
|
||||
}
|
||||
|
||||
@@ -554,7 +554,8 @@ public class GuiContainerManager {
|
||||
}
|
||||
|
||||
ItemStack stack = getStackMouseOver(window);
|
||||
if (tooltip.isEmpty() && shouldShowTooltip(window)) { // mouseover tip, not holding an item
|
||||
boolean showTooltip = shouldShowTooltip(window);
|
||||
if (tooltip.isEmpty() && showTooltip) { // mouseover tip, not holding an item
|
||||
font = getFontRenderer(stack);
|
||||
if (stack != null) {
|
||||
tooltip = itemDisplayNameMultiline(stack, window, true);
|
||||
@@ -569,7 +570,7 @@ public class GuiContainerManager {
|
||||
|
||||
if (!tooltip.isEmpty()) tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
|
||||
if (shouldShowTooltip(window)) {
|
||||
if (showTooltip) {
|
||||
List<String> hotkeystips = collectHotkeyTips(mousex, mousey);
|
||||
|
||||
if (!hotkeystips.isEmpty()) {
|
||||
@@ -615,23 +616,19 @@ public class GuiContainerManager {
|
||||
}
|
||||
|
||||
private List<String> collectHotkeyTips(int mousex, int mousey) {
|
||||
Map<String, String> hotkeys = new HashMap<>();
|
||||
|
||||
synchronized (instanceTooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers) {
|
||||
hotkeys = handler.handleHotkeys(window, mousex, mousey, hotkeys);
|
||||
if (NEIClientUtils.altKey()) {
|
||||
Map<String, String> hotkeys = new HashMap<>();
|
||||
|
||||
synchronized (instanceTooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers) {
|
||||
hotkeys = handler.handleHotkeys(window, mousex, mousey, hotkeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hotkeys.isEmpty()) {
|
||||
List<String> hotkeystips = new ArrayList<>();
|
||||
if (!hotkeys.isEmpty()) {
|
||||
List<String> hotkeystips = new ArrayList<>();
|
||||
|
||||
if (!NEIClientUtils.altKey()) {
|
||||
hotkeystips.add(
|
||||
EnumChatFormatting.GRAY + translate(
|
||||
"showHotkeys",
|
||||
EnumChatFormatting.GOLD + translate("key.alt") + EnumChatFormatting.GRAY));
|
||||
} else {
|
||||
Map<String, List<String>> messages = new HashMap<>();
|
||||
hotkeys.remove(null);
|
||||
hotkeys.remove("");
|
||||
@@ -664,9 +661,28 @@ public class GuiContainerManager {
|
||||
hotkeystips.set(
|
||||
hotkeystips.size() - 1,
|
||||
hotkeystips.get(hotkeystips.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
|
||||
|
||||
return hotkeystips;
|
||||
}
|
||||
|
||||
return hotkeystips;
|
||||
} else if (NEIClientConfig.getBooleanSetting("inventory.hotkeysHelpText")) {
|
||||
boolean existsHotkeys = false;
|
||||
|
||||
synchronized (instanceTooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers) {
|
||||
if (!handler.handleHotkeys(window, mousex, mousey, new HashMap<>()).isEmpty()) {
|
||||
existsHotkeys = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (existsHotkeys) {
|
||||
return Collections.singletonList(
|
||||
EnumChatFormatting.GRAY + translate(
|
||||
"showHotkeys",
|
||||
EnumChatFormatting.GOLD + translate("key.alt") + EnumChatFormatting.GRAY));
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.emptyList();
|
||||
@@ -675,39 +691,50 @@ public class GuiContainerManager {
|
||||
private String getHotkeyTip(List<String> keys, String message) {
|
||||
return EnumChatFormatting.GOLD
|
||||
+ String.join(EnumChatFormatting.DARK_GRAY + " / " + EnumChatFormatting.GOLD, keys)
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ EnumChatFormatting.DARK_GRAY
|
||||
+ " - "
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ message
|
||||
+ EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
private static int tooltipPage;
|
||||
private static int maxTooltipPage;
|
||||
|
||||
public static void drawPagedTooltip(FontRenderer font, int x, int y, List<String> list) {
|
||||
if (list.isEmpty()) return;
|
||||
List<List<String>> tooltips = splitTooltipByPage(list);
|
||||
tooltipPage = tooltipPage < tooltips.size() ? tooltipPage : 0;
|
||||
if (tooltips.size() > 1) {
|
||||
tooltips.get(tooltipPage).add(
|
||||
EnumChatFormatting.ITALIC + NEIClientUtils.translate(
|
||||
"inventory.tooltip.page",
|
||||
tooltipPage + 1,
|
||||
tooltips.size(),
|
||||
NEIClientConfig.getKeyName("gui.next_tooltip")));
|
||||
maxTooltipPage = tooltips.size();
|
||||
tooltipPage = tooltipPage < maxTooltipPage ? tooltipPage : 0;
|
||||
final List<String> currentTooltip = tooltips.get(tooltipPage);
|
||||
|
||||
if (maxTooltipPage > 1) {
|
||||
final String pageTooltip = EnumChatFormatting.ITALIC + NEIClientUtils.translate(
|
||||
"inventory.tooltip.page",
|
||||
tooltipPage + 1,
|
||||
maxTooltipPage,
|
||||
NEIClientConfig.getKeyName("gui.next_tooltip"));
|
||||
|
||||
currentTooltip.set(
|
||||
currentTooltip.size() - 1,
|
||||
currentTooltip.get(currentTooltip.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
|
||||
|
||||
currentTooltip.add(pageTooltip);
|
||||
}
|
||||
|
||||
if (NEIModContainer.isGTNHLibLoaded()) {
|
||||
drawMultilineTip(
|
||||
font,
|
||||
x,
|
||||
y,
|
||||
tooltips.get(tooltipPage),
|
||||
currentTooltip,
|
||||
RenderTooltipEventHelper.getBackgroundStart(),
|
||||
RenderTooltipEventHelper.getBackgroundEnd(),
|
||||
RenderTooltipEventHelper.getBorderStart(),
|
||||
RenderTooltipEventHelper.getBorderEnd());
|
||||
return;
|
||||
} else {
|
||||
drawMultilineTip(font, x, y, currentTooltip);
|
||||
}
|
||||
drawMultilineTip(font, x, y, tooltips.get(tooltipPage));
|
||||
}
|
||||
|
||||
public static List<List<String>> splitTooltipByPage(List<String> list) {
|
||||
@@ -719,8 +746,9 @@ public class GuiContainerManager {
|
||||
GuiDraw.ITooltipLineHandler line = GuiDraw.getTipLine(text);
|
||||
int lineHeight = line != null ? line.getSize().height
|
||||
: text.endsWith(GuiDraw.TOOLTIP_LINESPACE) && i + 1 < list.size() ? 12 : 10;
|
||||
if (height + lineHeight <= GuiDraw.displaySize().height - 8 * 2 - 10) {
|
||||
if (height + lineHeight <= GuiDraw.displaySize().height - 8 * 2 - 10 || tmp.isEmpty()) {
|
||||
// top & bottom 8px + last line for showing page
|
||||
// and at least include one line per page
|
||||
height += lineHeight;
|
||||
} else {
|
||||
ret.add(new ArrayList<>(tmp));
|
||||
@@ -752,8 +780,8 @@ public class GuiContainerManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementTooltipPage() {
|
||||
tooltipPage++;
|
||||
public static boolean incrementTooltipPage() {
|
||||
return tooltipPage != Math.min(tooltipPage++, maxTooltipPage);
|
||||
}
|
||||
|
||||
public void renderSlotUnderlay(Slot slot) {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class StackInfo {
|
||||
}
|
||||
|
||||
public static boolean equalItemAndNBT(ItemStack stackA, ItemStack stackB, boolean useNBT) {
|
||||
if (stackA == null || stackB == null || !stackA.isItemEqual(stackB)) {
|
||||
if (stackA == null || stackB == null || stackA.getItem() != stackB.getItem()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DefaultStackStringifyHandler implements IStackStringifyHandler {
|
||||
nbTag.setInteger("Count", saveStackSize ? stack.stackSize : 1);
|
||||
nbTag.setShort("Damage", (short) stack.getItemDamage());
|
||||
|
||||
if (stack.hasTagCompound()) {
|
||||
if (stack.hasTagCompound() && !stack.getTagCompound().hasNoTags()) {
|
||||
nbTag.setTag("tag", stack.getTagCompound());
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package codechicken.nei.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public class NEIKeyboardUtils {
|
||||
|
||||
public static final int ALT_HASH = 1 << 27;
|
||||
public static final int SHIFT_HASH = 1 << 26;
|
||||
public static final int CTRL_HASH = 1 << 25;
|
||||
|
||||
private static final Map<Integer, Integer> keyHashMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
keyHashMap.put(Keyboard.KEY_LSHIFT, SHIFT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RSHIFT, SHIFT_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMETA, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RMETA, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
}
|
||||
|
||||
private NEIKeyboardUtils() {}
|
||||
|
||||
public static boolean isHashKey(int keycode) {
|
||||
return keyHashMap.containsKey(keycode);
|
||||
}
|
||||
|
||||
public static String getHashName(int keyBind) {
|
||||
StringJoiner keyText = new StringJoiner(" + ");
|
||||
|
||||
if ((keyBind & CTRL_HASH) != 0) {
|
||||
keyText.add(NEIClientUtils.translate(Minecraft.isRunningOnMac ? "key.ctrl.mac" : "key.ctrl"));
|
||||
}
|
||||
|
||||
if ((keyBind & SHIFT_HASH) != 0) {
|
||||
keyText.add(NEIClientUtils.translate("key.shift"));
|
||||
}
|
||||
|
||||
if ((keyBind & ALT_HASH) != 0) {
|
||||
keyText.add(NEIClientUtils.translate("key.alt"));
|
||||
}
|
||||
|
||||
return keyText.toString();
|
||||
}
|
||||
|
||||
public static String getKeyName(int keyBind) {
|
||||
keyBind = keyHashMap.getOrDefault(keyBind, keyBind);
|
||||
StringJoiner keyText = new StringJoiner(" + ");
|
||||
String hashText = getHashName(keyBind);
|
||||
int keyID = unhash(keyBind);
|
||||
|
||||
if (!hashText.isEmpty()) {
|
||||
keyText.add(hashText);
|
||||
}
|
||||
|
||||
if (keyID != Keyboard.CHAR_NONE || hashText.isEmpty()) {
|
||||
keyText.add(Keyboard.getKeyName(keyID));
|
||||
}
|
||||
|
||||
return keyText.toString();
|
||||
}
|
||||
|
||||
public static int unhash(int keyBind) {
|
||||
return keyBind & ~(CTRL_HASH | SHIFT_HASH | ALT_HASH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package codechicken.nei.util;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public class NEIMouseUtils {
|
||||
|
||||
public static final int MOUSE_BTN_NONE = Integer.MIN_VALUE;
|
||||
|
||||
public static final int MOUSE_BTN_LMB = 0;
|
||||
public static final int MOUSE_BTN_RMB = 1;
|
||||
public static final int MOUSE_BTN_MMB = 2;
|
||||
|
||||
public static final int MOUSE_SCROLL = 1 << 27;
|
||||
public static final int MOUSE_DRAG = 1 << 26;
|
||||
|
||||
private NEIMouseUtils() {}
|
||||
|
||||
public static String getHashName(int mouseBind) {
|
||||
StringJoiner mouseText = new StringJoiner(" + ");
|
||||
|
||||
if ((mouseBind & MOUSE_SCROLL) != 0) {
|
||||
mouseText.add(NEIClientUtils.translate("mouse.scroll"));
|
||||
}
|
||||
|
||||
if ((mouseBind & MOUSE_DRAG) != 0) {
|
||||
mouseText.add(NEIClientUtils.translate("mouse.drag"));
|
||||
}
|
||||
|
||||
return mouseText.toString();
|
||||
}
|
||||
|
||||
public static String getKeyName(int mouseBind) {
|
||||
StringJoiner mouseText = new StringJoiner(" + ");
|
||||
String hashText = getHashName(mouseBind < 0 ? mouseBind - MOUSE_BTN_NONE : mouseBind);
|
||||
|
||||
if (mouseBind >= 0) {
|
||||
int button = unhash(mouseBind);
|
||||
switch (button) {
|
||||
case MOUSE_BTN_LMB:
|
||||
mouseText.add(NEIClientUtils.translate("mouse.left"));
|
||||
break;
|
||||
case MOUSE_BTN_RMB:
|
||||
mouseText.add(NEIClientUtils.translate("mouse.right"));
|
||||
break;
|
||||
case MOUSE_BTN_MMB:
|
||||
mouseText.add(NEIClientUtils.translate("mouse.middle"));
|
||||
break;
|
||||
default:
|
||||
mouseText.add(NEIClientUtils.translate("mouse.other", button));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hashText.isEmpty()) {
|
||||
mouseText.add(hashText);
|
||||
}
|
||||
|
||||
return mouseText.toString();
|
||||
}
|
||||
|
||||
public static int unhash(int mouseBind) {
|
||||
return mouseBind & ~(MOUSE_SCROLL | MOUSE_DRAG);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public enum ReadableNumberConverter {
|
||||
/**
|
||||
* String representation of the sorted postfixes
|
||||
*/
|
||||
private static final char[] ENCODED_POSTFIXES = "KMGTPE".toCharArray();
|
||||
private static final char[] ENCODED_POSTFIXES = "kMGTPE".toCharArray();
|
||||
|
||||
private final Format format;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler,Applied Energistics
|
||||
appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler,Applied Energistics 2,appliedenergistics2:tile.BlockGrinder,,appliedenergistics2,TRUE,,,,,,,,,,,
|
||||
appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler,Applied Energistics 2,appliedenergistics2:tile.BlockInscriber,,appliedenergistics2,TRUE,,,70,,5,,,,,,
|
||||
appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler,Applied Energistics 2,appliedenergistics2:item.ItemMultiMaterial:9,,appliedenergistics2,TRUE,,,85,,5,,,,,,There's only some explanatory text for fluix crystals and QEDs
|
||||
appeng.integration.modules.NEIHelpers.NEICellViewHandler,Applied Energistics 2,appliedenergistics2:item.ItemBasicStorageCell.64k,,appliedenergistics2,TRUE,,,180,,1,,,,,,,
|
||||
com.glodblock.github.nei.NEICellViewHandler,AE2 Fluid Crafting,ae2fc:multi_fluid_storage64,,ae2fc,TRUE,,,,,1,,,,,,,
|
||||
aroma1997.core.recipes.nei.ShapedAromicRecipeHandler,AromaBackup,minecraft:crafting_table,,AromaBackup,TRUE,,,65,,5,,,,,,
|
||||
aroma1997.core.recipes.nei.ShapelessAromicRecipeHandler,AromaBackup,minecraft:crafting_table,,AromaBackup,TRUE,,,,,,,,,,,
|
||||
fox.spiteful.avaritia.compat.nei.CompressionHandler,Avaritia,Avaritia:Neutronium_Compressor,,Avaritia,TRUE,,,50,,6,,,,,,
|
||||
|
||||
|
@@ -5,6 +5,12 @@ nei.save=Save
|
||||
nei.key.ctrl=CTRL
|
||||
nei.key.shift=SHIFT
|
||||
nei.key.alt=ALT
|
||||
nei.mouse.left=LMB
|
||||
nei.mouse.right=RMB
|
||||
nei.mouse.middle=MMB
|
||||
nei.mouse.other=Button %d
|
||||
nei.mouse.scroll=Scroll
|
||||
nei.mouse.drag=Drag
|
||||
# Mac Command Key
|
||||
nei.key.ctrl.mac=CMD
|
||||
nei.showHotkeys=Hold %s for hotkeys
|
||||
@@ -192,6 +198,9 @@ nei.options.inventory.bookmarks.ignorePotionOverlap.false=No
|
||||
nei.options.inventory.bookmarks.worldSpecific=World Specific Bookmarks
|
||||
nei.options.inventory.bookmarks.worldSpecific.true=Yes
|
||||
nei.options.inventory.bookmarks.worldSpecific.false=No
|
||||
nei.options.inventory.hotkeysHelpText=Show Hotkeys Help Text
|
||||
nei.options.inventory.hotkeysHelpText.true=Yes
|
||||
nei.options.inventory.hotkeysHelpText.false=No
|
||||
nei.options.inventory.guirecipe=Recipes GUI
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs=JEI Style Tabs
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.true=Yes
|
||||
@@ -311,6 +320,7 @@ nei.options.inventory.gridRenderingCacheMode=Grid Rendering Cache Mode
|
||||
nei.options.inventory.gridRenderingCacheMode.0=Off
|
||||
nei.options.inventory.gridRenderingCacheMode.1=Low FPS
|
||||
nei.options.inventory.gridRenderingCacheMode.2=Freeze
|
||||
nei.options.inventory.gridRenderingCacheFPS=Grid Rendering Cache FPS
|
||||
nei.options.inventory.collapsibleItems=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled.true=Enabled
|
||||
@@ -320,8 +330,6 @@ nei.options.inventory.collapsibleItems.customName.true=Yes
|
||||
nei.options.inventory.collapsibleItems.customName.false=No
|
||||
nei.options.inventory.collapsibleItems.expandedColor=Expanded Color
|
||||
nei.options.inventory.collapsibleItems.collapsedColor=Collapsed Color
|
||||
nei.options.inventory.collapsibleItems.reloadLabel=Reload
|
||||
nei.options.inventory.collapsibleItems.reloadButton=Run
|
||||
nei.options.inventory.history=History Panel
|
||||
nei.options.inventory.history.enabled=History Panel Visibility
|
||||
nei.options.inventory.history.enabled.true=Enabled
|
||||
@@ -380,6 +388,11 @@ nei.options.world.highlight_tips.sample=Sample
|
||||
nei.options.world.panels=Panels Settings
|
||||
nei.options.world.presets=Presets List
|
||||
|
||||
nei.options.world.overlays=Overlays Settings
|
||||
nei.options.world.overlays.lock=Lock overlays between dimensions
|
||||
nei.options.world.overlays.lock.true=Enabled
|
||||
nei.options.world.overlays.lock.false=Disabled
|
||||
|
||||
nei.options.tools=Tools
|
||||
nei.options.tools.handler_load_from_config=Load handlers from Config
|
||||
nei.options.tools.handler_load_from_config.true=Config
|
||||
@@ -461,21 +474,14 @@ nei.itemsort.damage=Item Damage
|
||||
nei.itemsort.name=Display Name
|
||||
|
||||
nei.subsets.item.cheat=Give out an Item
|
||||
nei.subsets.item.cheat.key=Ctrl + LMB
|
||||
nei.subsets.item.search=Search by Item
|
||||
nei.subsets.item.search.key=Shift + LMB
|
||||
nei.subsets.item.show=Show Item
|
||||
nei.subsets.item.show.key=LMB
|
||||
nei.subsets.item.hide=Hide Item
|
||||
nei.subsets.item.hide.key=RMB
|
||||
nei.subsets.tag.search=Search by Subset
|
||||
nei.subsets.tag.search.key=Shift + LMB
|
||||
nei.subsets.tag.onlythis=Show only this Subset
|
||||
nei.subsets.tag.onlythis.key=Double LMB
|
||||
nei.subsets.tag.show=Show Subset
|
||||
nei.subsets.tag.show.key=LMB
|
||||
nei.subsets.tag.hide=Hide Subset
|
||||
nei.subsets.tag.hide.key=RMB
|
||||
|
||||
nei.subsets.Blocks=Blocks
|
||||
nei.subsets.Blocks.MobSpawners=Mob Spawners
|
||||
|
||||
@@ -134,6 +134,11 @@ nei.options.world.highlight_tips=Mettez en surbrillance les info-bulles
|
||||
nei.options.world.highlight_tips.hide=Caché
|
||||
nei.options.world.highlight_tips.show=Montré
|
||||
|
||||
nei.options.world.overlays=Paramètres des overlays
|
||||
nei.options.world.overlays.lock.true=Activé
|
||||
nei.options.world.overlays.lock.false=Désactivé
|
||||
nei.options.world.overlays.lock=Conserver les overlays entre les dimensions
|
||||
|
||||
nei.options.tools=Outils
|
||||
nei.options.tools.dump=Data Dumps
|
||||
nei.options.tools.dump.dump=Jeter
|
||||
|
||||
@@ -301,8 +301,6 @@ nei.options.inventory.collapsibleItems.customName.true=Да
|
||||
nei.options.inventory.collapsibleItems.customName.false=Нет
|
||||
nei.options.inventory.collapsibleItems.expandedColor=Цвет развернутого
|
||||
nei.options.inventory.collapsibleItems.collapsedColor=Цвет свернутого
|
||||
nei.options.inventory.collapsibleItems.reloadLabel=Перезагрузить
|
||||
nei.options.inventory.collapsibleItems.reloadButton=Запустить
|
||||
nei.options.inventory.history=Панель истории
|
||||
nei.options.inventory.history.enabled=Видимость панели истории
|
||||
nei.options.inventory.history.enabled.true=Включено
|
||||
|
||||
Reference in new issue
Block a user