Compare commits

...
9 changed files with 32 additions and 25 deletions

No files matched your search

+4 -4
View File
@@ -42,7 +42,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
if (this.stack != null && this.availableAreaWidth >= SLOT_SIZE * 2
&& (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
|| KeyManager.isHashDown("itemzoom.hold"))
|| KeyManager.isKeyDown("itemzoom.hold"))
&& GuiContainerManager.shouldShowTooltip(NEIClientUtils.getGuiContainer())) {
final float inverseScaleFactor = 1.0f / this.scale;
final float screenScale = getScreenScale();
@@ -204,18 +204,18 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
return true;
}
if (this.stack != null && KeyManager.isHashDown("itemzoom.hold")) {
if (this.stack != null && KeyManager.isKeyDown("itemzoom.hold")) {
return true;
}
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_in")) {
if (this.stack != null && KeyManager.isKeyDown("itemzoom.zoom_in")) {
increaseZoom(gui);
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
Keyboard.enableRepeatEvents(true);
return true;
}
if (this.stack != null && KeyManager.isHashDown("itemzoom.zoom_out")) {
if (this.stack != null && KeyManager.isKeyDown("itemzoom.zoom_out")) {
decreaseZoom(gui);
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
Keyboard.enableRepeatEvents(true);
+10 -8
View File
@@ -67,17 +67,19 @@ public class KeyManager {
}
public static boolean isKeyDown(String ident) {
final int keyCode = getKeyCode(ident);
final KeyBinding binding = getKeyBinding(ident);
if (keyCode == Keyboard.KEY_NONE) {
return false;
if (binding != null) {
final int keyCode = binding.getKeyCode();
if (keyCode < 0) {
return Mouse.isButtonDown(keyCode + 100);
} else if (keyCode > Keyboard.KEY_NONE && keyCode < Keyboard.KEYBOARD_SIZE) {
return Keyboard.isKeyDown(keyCode);
}
}
if (keyCode < 0) {
return Mouse.isButtonDown(keyCode + 100);
}
return keyCode < Keyboard.KEYBOARD_SIZE && Keyboard.isKeyDown(keyCode);
return false;
}
public static boolean isHashDown(String ident) {
@@ -224,12 +224,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
if (KeyManager.isHashDown("gui.hide")) {
if (KeyManager.isKeyDown("gui.hide")) {
toggleBooleanSetting("inventory.hidden");
return true;
}
if (KeyManager.isHashDown("bookmark.hide")) {
if (KeyManager.isKeyDown("bookmark.hide")) {
toggleBooleanSetting("inventory.bookmarks.enabled");
return true;
}
@@ -60,6 +60,7 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
}
public static void render(float frame) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_LINE_BIT);
GL11.glPushMatrix();
Entity entity = Minecraft.getMinecraft().renderViewEntity;
@@ -73,9 +74,12 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
GL11.glTranslated(-interpPosX + intOffsetX, -interpPosY + intOffsetY, -interpPosZ + intOffsetZ);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_LEQUAL);
renderChunkBounds(entity, intOffsetX, intOffsetY, intOffsetZ);
renderMobSpawnOverlay(entity, intOffsetX, intOffsetY, intOffsetZ);
GL11.glPopMatrix();
GL11.glPopAttrib();
}
private static void buildMobSpawnOverlay(Entity entity) {
@@ -144,11 +144,11 @@ public abstract class ShortcutInputHandler {
return sendRecipeInChatLink(stackover, NEIClientUtils.shiftKey());
}
if (KeyManager.isHashDown("recipe.recipe")) {
if (KeyManager.isKeyDown("recipe.recipe")) {
return GuiCraftingRecipe.openRecipeGui("item", stackover);
}
if (KeyManager.isHashDown("recipe.usage")) {
if (KeyManager.isKeyDown("recipe.usage")) {
return GuiUsageRecipe.openRecipeGui("item", stackover);
}
@@ -85,11 +85,11 @@ public class RightPanel extends GuiWidget {
setFocus(true);
}
if (focused() && KeyManager.isHashDown("gui.getprevioussearch")) {
if (focused() && KeyManager.isKeyDown("gui.getprevioussearch")) {
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
}
if (focused() && KeyManager.isHashDown("gui.getnextsearch")) {
if (focused() && KeyManager.isKeyDown("gui.getnextsearch")) {
handleNavigateHistory(TextHistory.Direction.NEXT);
}
}
@@ -210,7 +210,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
for (IngredientDistribution distrib : assignedIngredients) {
if (distrib.slots.length == 0 || !slot.getHasStack() || !canStack(distrib.permutation, stack)) continue;
int transferCap = Math.min(slotTransferCap, multiplier * distrib.permutation.stackSize);
int transferCap = Math.min(slotTransferCap, Math.max(multiplier * distrib.permutation.stackSize, 1));
int stackSize = slot.getStack().stackSize;
boolean pickup = false;
@@ -289,9 +289,9 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) {
if (!canHandle(gui)) return false;
if (KeyManager.isHashDown("recipe.recipe")) {
if (KeyManager.isKeyDown("recipe.recipe")) {
return transferRect(gui, false);
} else if (KeyManager.isHashDown("recipe.usage")) {
} else if (KeyManager.isKeyDown("recipe.usage")) {
return transferRect(gui, true);
}
@@ -673,9 +673,9 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
@Override
public boolean keyTyped(GuiRecipe<?> gui, char keyChar, int keyCode, int recipe) {
if (KeyManager.isHashDown("recipe.recipe")) {
if (KeyManager.isKeyDown("recipe.recipe")) {
return transferRect(gui, recipe, false);
} else if (KeyManager.isHashDown("recipe.usage")) {
} else if (KeyManager.isKeyDown("recipe.usage")) {
return transferRect(gui, recipe, true);
}
@@ -411,8 +411,9 @@ public class RecipeChainMath {
final ContainerItemResult result = getToolsContainerItems(itemStack, steps);
if (result.stack == null) {
multiplier = steps / (steps - result.leftSteps);
steps = steps % (steps - result.leftSteps);
final long stepsPerReplacement = steps - result.leftSteps;
multiplier = Math.min(steps / stepsPerReplacement, maxAmount - shiftAmount);
steps -= multiplier * stepsPerReplacement;
} else {
steps = result.leftSteps;
}