mirror of
https://github.com/GTNewHorizons/JustEnoughCalculation.git
synced 2026-11-14 01:04:06 +00:00
fix: remove the overlay on ore dict label and item label
This commit is contained in:
1 parent
e44678bc82
commit
a89ea6b2b9
7 files changed
+30
-33
No files matched your search
@@ -267,10 +267,6 @@ public interface ILabel {
|
||||
return guess.isEmpty() ? labels.get(0) : guess.get(0);
|
||||
}
|
||||
|
||||
public ILabel first(List<ILabel> labels) {
|
||||
return first(labels, null);
|
||||
}
|
||||
|
||||
// to test if the labels can be converted to other labels (like oreDict)
|
||||
public Pair<List<ILabel>, List<ILabel>> guess(List<ILabel> labels) {
|
||||
return guess(labels, null);
|
||||
@@ -467,7 +463,7 @@ public interface ILabel {
|
||||
return (int) (amount ^ (percent ? 1 : 0));
|
||||
}
|
||||
|
||||
protected static Merger.MergerFunction form(Class a, Class b, BiPredicate<ILabel, ILabel> p) {
|
||||
protected static Merger.MergerFunction form(Class<?> a, Class<?> b, BiPredicate<ILabel, ILabel> p) {
|
||||
return (c, d) -> {
|
||||
if (a.isInstance(d) && b.isInstance(c)) {
|
||||
ILabel tmp = c;
|
||||
|
||||
@@ -6,7 +6,6 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import me.towdium.jecalculation.data.label.ILabel;
|
||||
import me.towdium.jecalculation.gui.JecaGui;
|
||||
import me.towdium.jecalculation.gui.Resource;
|
||||
import me.towdium.jecalculation.utils.ItemStackHelper;
|
||||
import me.towdium.jecalculation.utils.Utilities;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -52,10 +51,10 @@ public class LItemStack extends ILabel.Impl {
|
||||
public LItemStack(NBTTagCompound tag) {
|
||||
super(tag);
|
||||
final String strId = tag.getString(KEY_ITEM);
|
||||
if(!tag.hasKey("id"))
|
||||
if (!tag.hasKey("id"))
|
||||
tag.setShort("id", (short) GameData.getItemRegistry().getId(strId));
|
||||
tag.setByte("Count", (byte)1);
|
||||
tag.setShort("Damage", tag.hasKey(KEY_META) ? (short)tag.getInteger(KEY_META) : 0);
|
||||
tag.setByte("Count", (byte) 1);
|
||||
tag.setShort("Damage", tag.hasKey(KEY_META) ? (short) tag.getInteger(KEY_META) : 0);
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag);
|
||||
|
||||
if (ItemStackHelper.isEmpty(stack))
|
||||
@@ -233,12 +232,13 @@ public class LItemStack extends ILabel.Impl {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawLabel(JecaGui gui) {
|
||||
gui.drawItemStack(0, 0, temp, false);
|
||||
if (fNbt || fMeta)
|
||||
gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
if (fNbt)
|
||||
gui.drawResource(Resource.LBL_FR_UL, 0, 0);
|
||||
if (fMeta)
|
||||
gui.drawResource(Resource.LBL_FR_UR, 0, 0);
|
||||
// TODO some item won't render correctly with overlay
|
||||
// if (fNbt || fMeta)
|
||||
// gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
// if (fNbt)
|
||||
// gui.drawResource(Resource.LBL_FR_UL, 0, 0);
|
||||
// if (fMeta)
|
||||
// gui.drawResource(Resource.LBL_FR_UR, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -191,7 +191,8 @@ public class LOreDict extends ILabel.Impl {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawLabel(JecaGui gui) {
|
||||
gui.drawItemStack(0, 0, getRepresentation(), false);
|
||||
gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
// TODO some item won't render correctly if has this overlay
|
||||
// gui.drawResource(Resource.LBL_FRAME, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,8 +37,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.renderEngine;
|
||||
|
||||
/**
|
||||
* Author: towdium
|
||||
* Date: 8/12/17.
|
||||
@@ -204,9 +202,7 @@ public class JecaGui extends GuiContainer {
|
||||
|
||||
@Nullable
|
||||
public ILabel getLabelUnderMouse() {
|
||||
int xMouse = Mouse.getEventX() * width / mc.displayWidth - guiLeft;
|
||||
int yMouse = height - Mouse.getEventY() * height / mc.displayHeight - 1 - guiTop;
|
||||
return root.getLabelUnderMouse(xMouse, yMouse);
|
||||
return root.getLabelUnderMouse(getMouseX(), getMouseY());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,8 +435,11 @@ public class JecaGui extends GuiContainer {
|
||||
float zLevel = itemRender.zLevel += 100F;
|
||||
GlStateManager.enableDepth();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, renderEngine, is, xPos, yPos);
|
||||
itemRender.renderItemOverlayIntoGUI(fontRendererObj, renderEngine, is, xPos, yPos);
|
||||
FontRenderer font = is.getItem().getFontRenderer(is);
|
||||
if (font == null)
|
||||
font = this.fontRendererObj;
|
||||
itemRender.renderItemAndEffectIntoGUI(font, Minecraft.getMinecraft().renderEngine, is, xPos, yPos);
|
||||
itemRender.renderItemOverlayIntoGUI(font, Minecraft.getMinecraft().renderEngine, is, xPos, yPos);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.disableDepth();
|
||||
itemRender.zLevel = zLevel - 100F;
|
||||
|
||||
@@ -176,7 +176,6 @@ public class Utilities {
|
||||
public long getTime() {
|
||||
return running ? System.currentTimeMillis() - time : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
@@ -196,7 +195,6 @@ public class Utilities {
|
||||
return current + 1 == total ? 0 : current + 1;
|
||||
}
|
||||
|
||||
|
||||
public int prev() {
|
||||
return current == 0 ? total - 1 : current - 1;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,13 @@ public class Pair<K, V> {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Pair) {
|
||||
Pair p = (Pair) obj;
|
||||
if (obj instanceof Pair<?, ?>) {
|
||||
Pair<?, ?> p = (Pair<?, ?>) obj;
|
||||
return one.equals(p.one) && two.equals(p.two);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean swap(Class<? extends K> ke, Class<? extends V> ve) {
|
||||
if (ke.isInstance(one) && ve.isInstance(two)) return true;
|
||||
else if (!(ke.isInstance(two) && ve.isInstance(one))) return false;
|
||||
|
||||
Reference in new issue
Block a user