Fixed not rendering some tooltips correctly, fixes #1106
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
- Fire playerCrafting event when shift clicking in the grid (way2muchnoise)
|
- Fire playerCrafting event when shift clicking in the grid (way2muchnoise)
|
||||||
- Fixed controller model warning during launch (raoulvdberge)
|
- Fixed controller model warning during launch (raoulvdberge)
|
||||||
- Improved memory usage of some models (raoulvdberge)
|
- Improved memory usage of some models (raoulvdberge)
|
||||||
|
- Fixed not rendering some tooltips correctly (raoulvdberge)
|
||||||
|
|
||||||
### 1.4.1
|
### 1.4.1
|
||||||
- Added Storage Monitor (raoulvdberge)
|
- Added Storage Monitor (raoulvdberge)
|
||||||
|
@@ -20,6 +20,7 @@ import net.minecraftforge.fml.client.config.GuiUtils;
|
|||||||
import net.minecraftforge.items.SlotItemHandler;
|
import net.minecraftforge.items.SlotItemHandler;
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -293,14 +294,22 @@ public abstract class GuiBase extends GuiContainer {
|
|||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, String message) {
|
public void drawTooltip(@Nonnull ItemStack stack, int x, int y, String lines) {
|
||||||
drawTooltip(x, y, Arrays.asList(message.split("\n")));
|
drawTooltip(stack, x, y, Arrays.asList(lines.split("\n")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawTooltip(int x, int y, String lines) {
|
||||||
|
drawTooltip(ItemStack.EMPTY, x, y, lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawTooltip(@Nonnull ItemStack stack, int x, int y, List<String> lines) {
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GuiUtils.drawHoveringText(stack, lines, x, y, width - guiLeft, height, -1, fontRendererObj);
|
||||||
|
GlStateManager.enableLighting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTooltip(int x, int y, List<String> lines) {
|
public void drawTooltip(int x, int y, List<String> lines) {
|
||||||
GlStateManager.disableLighting();
|
drawTooltip(ItemStack.EMPTY, x, y, lines);
|
||||||
GuiUtils.drawHoveringText(null, lines, x, y, width - guiLeft, height, -1, fontRendererObj);
|
|
||||||
GlStateManager.enableLighting();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height) {
|
public void drawTexture(int x, int y, int textureX, int textureY, int width, int height) {
|
||||||
|
@@ -145,7 +145,7 @@ public class GuiCraftingPreview extends GuiBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hoveringStack != null) {
|
if (hoveringStack != null) {
|
||||||
drawTooltip(mouseX, mouseY, hoveringStack.getTooltip(Minecraft.getMinecraft().player, false));
|
drawTooltip(hoveringStack, mouseX, mouseY, hoveringStack.getTooltip(Minecraft.getMinecraft().player, false));
|
||||||
} else if (hoveringFluid != null) {
|
} else if (hoveringFluid != null) {
|
||||||
drawTooltip(mouseX, mouseY, hoveringFluid.getLocalizedName());
|
drawTooltip(mouseX, mouseY, hoveringFluid.getLocalizedName());
|
||||||
}
|
}
|
||||||
|
@@ -73,16 +73,16 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
private int slotNumber;
|
private int slotNumber;
|
||||||
|
|
||||||
private Deque<Integer> konami = new ArrayDeque<>(Arrays.asList(
|
private Deque<Integer> konami = new ArrayDeque<>(Arrays.asList(
|
||||||
Keyboard.KEY_UP,
|
Keyboard.KEY_UP,
|
||||||
Keyboard.KEY_UP,
|
Keyboard.KEY_UP,
|
||||||
Keyboard.KEY_DOWN,
|
Keyboard.KEY_DOWN,
|
||||||
Keyboard.KEY_DOWN,
|
Keyboard.KEY_DOWN,
|
||||||
Keyboard.KEY_LEFT,
|
Keyboard.KEY_LEFT,
|
||||||
Keyboard.KEY_RIGHT,
|
Keyboard.KEY_RIGHT,
|
||||||
Keyboard.KEY_LEFT,
|
Keyboard.KEY_LEFT,
|
||||||
Keyboard.KEY_RIGHT,
|
Keyboard.KEY_RIGHT,
|
||||||
Keyboard.KEY_B,
|
Keyboard.KEY_B,
|
||||||
Keyboard.KEY_A
|
Keyboard.KEY_A
|
||||||
));
|
));
|
||||||
|
|
||||||
private int[] konamiOffsetsX;
|
private int[] konamiOffsetsX;
|
||||||
@@ -170,9 +170,9 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
stacks.addAll(grid.getType() == GridType.FLUID ? FLUIDS.values() : ITEMS.values());
|
stacks.addAll(grid.getType() == GridType.FLUID ? FLUIDS.values() : ITEMS.values());
|
||||||
|
|
||||||
List<Predicate<IGridStack>> filters = GridFilterParser.getFilters(
|
List<Predicate<IGridStack>> filters = GridFilterParser.getFilters(
|
||||||
grid,
|
grid,
|
||||||
searchField.getText(),
|
searchField.getText(),
|
||||||
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters()
|
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters()
|
||||||
);
|
);
|
||||||
|
|
||||||
Iterator<IGridStack> t = stacks.iterator();
|
Iterator<IGridStack> t = stacks.iterator();
|
||||||
@@ -284,7 +284,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isOverSlotWithItem() {
|
private boolean isOverSlotWithStack() {
|
||||||
return grid.isActive() && isOverSlot() && slotNumber < STACKS.size();
|
return grid.isActive() && isOverSlot() && slotNumber < STACKS.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,8 +470,10 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOverSlotWithItem()) {
|
if (isOverSlotWithStack()) {
|
||||||
drawTooltip(mouseX, mouseY, STACKS.get(slotNumber).getTooltip());
|
IGridStack stack = STACKS.get(slotNumber);
|
||||||
|
|
||||||
|
drawTooltip(stack instanceof GridStackItem ? ((GridStackItem) stack).getStack() : ItemStack.EMPTY, mouseX, mouseY, stack.getTooltip());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOverClear(mouseX, mouseY)) {
|
if (isOverClear(mouseX, mouseY)) {
|
||||||
@@ -533,7 +535,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
|||||||
RS.INSTANCE.network.sendToServer(grid.getType() == GridType.FLUID ? new MessageGridFluidInsertHeld() : new MessageGridItemInsertHeld(clickedButton == 1));
|
RS.INSTANCE.network.sendToServer(grid.getType() == GridType.FLUID ? new MessageGridFluidInsertHeld() : new MessageGridItemInsertHeld(clickedButton == 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOverSlotWithItem()) {
|
if (isOverSlotWithStack()) {
|
||||||
if (grid.getType() != GridType.FLUID && (held.isEmpty() || (!held.isEmpty() && clickedButton == 2))) {
|
if (grid.getType() != GridType.FLUID && (held.isEmpty() || (!held.isEmpty() && clickedButton == 2))) {
|
||||||
GridStackItem stack = (GridStackItem) STACKS.get(slotNumber);
|
GridStackItem stack = (GridStackItem) STACKS.get(slotNumber);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user