Added extended name tooltips when sneaking, closes #19
This commit is contained in:
parent
d312fecc2a
commit
d6ed8a5c67
|
@ -96,7 +96,7 @@ dependencies {
|
|||
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.5.3.143")
|
||||
//runtimeOnly fg.deobf("curse.maven:refined-storage-243076:3569563")
|
||||
implementation fg.deobf("curse.maven:the-one-probe-245211:3586969")
|
||||
implementation fg.deobf("curse.maven:the-one-probe-245211:3671753")
|
||||
//runtimeOnly fg.deobf("curse.maven:create-328085:3600402")
|
||||
//runtimeOnly fg.deobf("curse.maven:flywheel-486392:3600401")
|
||||
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
|
||||
|
|
|
@ -22,11 +22,18 @@ public class CustomElementItemStack implements IElement {
|
|||
private final ItemStack itemStack;
|
||||
private final IItemStyle style;
|
||||
private final String display;
|
||||
private boolean displayName;
|
||||
|
||||
public CustomElementItemStack(ItemStack itemStack, String display, IItemStyle style) {
|
||||
this.itemStack = itemStack;
|
||||
this.style = style;
|
||||
this.display = display;
|
||||
this.displayName = false;
|
||||
}
|
||||
|
||||
public CustomElementItemStack(ItemStack itemStack, String display, IItemStyle style, boolean displayName) {
|
||||
this(itemStack, display, style);
|
||||
this.displayName = true;
|
||||
}
|
||||
|
||||
public CustomElementItemStack(FriendlyByteBuf buf) {
|
||||
|
@ -38,6 +45,7 @@ public class CustomElementItemStack implements IElement {
|
|||
|
||||
this.style = (new ItemStyle()).width(buf.readInt()).height(buf.readInt());
|
||||
this.display = buf.readUtf();
|
||||
this.displayName = buf.readBoolean();
|
||||
}
|
||||
|
||||
public void render(PoseStack matrixStack, int x, int y) {
|
||||
|
@ -50,12 +58,16 @@ public class CustomElementItemStack implements IElement {
|
|||
ChatFormatting var10004 = ChatFormatting.RED;
|
||||
RenderHelper.renderText(var10000, matrixStack, x, y, var10004 + "ERROR: " + itemStack.getHoverName());
|
||||
}
|
||||
if (this.displayName){
|
||||
RenderHelper.renderText(Minecraft.getInstance(), matrixStack, x + 22, y + 7, itemStack.getHoverName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return this.style.getWidth();
|
||||
return this.style.getWidth() + (this.displayName ? Minecraft.getInstance().font.width(itemStack.getHoverName().getString()) : 0) ;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
|
@ -73,6 +85,7 @@ public class CustomElementItemStack implements IElement {
|
|||
buf.writeInt(this.style.getWidth());
|
||||
buf.writeInt(this.style.getHeight());
|
||||
buf.writeUtf(this.display);
|
||||
buf.writeBoolean(this.displayName);
|
||||
}
|
||||
|
||||
public ResourceLocation getID() {
|
||||
|
|
|
@ -56,17 +56,30 @@ public class FunctionalDrawerProvider implements IProbeInfoProvider {
|
|||
iProbeInfo.getElements().removeIf(iElement -> iElement instanceof ElementVertical);
|
||||
ElementVertical vertical = new ElementVertical();
|
||||
if (blockEntity instanceof DrawerTile) {
|
||||
ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7));
|
||||
abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB());
|
||||
BigInventoryHandler handler = ((DrawerTile) blockEntity).getHandler();
|
||||
for (int i = 0; i < handler.getStoredStacks().size(); i++) {
|
||||
BigInventoryHandler.BigStack storedStack = handler.getStoredStacks().get(i);
|
||||
if (storedStack.getAmount() > 0 || (handler.isLocked() && !storedStack.getStack().isEmpty())) {
|
||||
abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(handler.getSlotLimit(i)), iProbeInfo.defaultItemStyle()));
|
||||
if (handler.getSlots() == 1 || player.isShiftKeyDown() || probeMode == ProbeMode.EXTENDED){
|
||||
ElementVertical elementVertical = new ElementVertical(iProbeInfo.defaultLayoutStyle().spacing(2).leftPadding(7).rightPadding(7));
|
||||
elementVertical.getStyle().borderColor(Color.CYAN.darker().getRGB());
|
||||
for (int i = 0; i < handler.getStoredStacks().size(); i++) {
|
||||
BigInventoryHandler.BigStack storedStack = handler.getStoredStacks().get(i);
|
||||
if (storedStack.getAmount() > 0 || (handler.isLocked() && !storedStack.getStack().isEmpty())) {
|
||||
elementVertical.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(handler.getSlotLimit(i)), iProbeInfo.defaultItemStyle(), true));
|
||||
}
|
||||
}
|
||||
if (elementVertical.getElements().size() > 0) vertical.element(elementVertical);
|
||||
vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4)));
|
||||
} else {
|
||||
ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7));
|
||||
abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB());
|
||||
for (int i = 0; i < handler.getStoredStacks().size(); i++) {
|
||||
BigInventoryHandler.BigStack storedStack = handler.getStoredStacks().get(i);
|
||||
if (storedStack.getAmount() > 0 || (handler.isLocked() && !storedStack.getStack().isEmpty())) {
|
||||
abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(handler.getSlotLimit(i)), iProbeInfo.defaultItemStyle()));
|
||||
}
|
||||
}
|
||||
if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel);
|
||||
vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4)));
|
||||
}
|
||||
if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel);
|
||||
vertical.element(new ElementVertical(iProbeInfo.defaultLayoutStyle().topPadding(4)));
|
||||
}
|
||||
if (blockEntity instanceof EnderDrawerTile) {
|
||||
ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7));
|
||||
|
@ -75,7 +88,7 @@ public class FunctionalDrawerProvider implements IProbeInfoProvider {
|
|||
for (int i = 0; i < savedData.getStoredStacks().size(); i++) {
|
||||
BigInventoryHandler.BigStack storedStack = savedData.getStoredStacks().get(i);
|
||||
if (storedStack.getAmount() > 0 || (savedData.isLocked() && !storedStack.getStack().isEmpty())) {
|
||||
abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(savedData.getSlotLimit(i)), iProbeInfo.defaultItemStyle()));
|
||||
abstractElementPanel.element(new CustomElementItemStack(storedStack.getStack(), NumberUtils.getFormatedBigNumber(storedStack.getAmount()) + "/" + NumberUtils.getFormatedBigNumber(savedData.getSlotLimit(i)), iProbeInfo.defaultItemStyle(), player.isShiftKeyDown() || probeMode == ProbeMode.EXTENDED));
|
||||
}
|
||||
}
|
||||
if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel);
|
||||
|
@ -94,11 +107,11 @@ public class FunctionalDrawerProvider implements IProbeInfoProvider {
|
|||
if (blockEntity instanceof CompactingDrawerTile) {
|
||||
CompactingInventoryHandler inventoryHandler = ((CompactingDrawerTile) blockEntity).getHandler();
|
||||
if (player.isShiftKeyDown() || probeMode == ProbeMode.EXTENDED) {
|
||||
ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(12).leftPadding(7).rightPadding(7));
|
||||
ElementVertical abstractElementPanel = new ElementVertical(iProbeInfo.defaultLayoutStyle().spacing(2).leftPadding(7).rightPadding(7));
|
||||
abstractElementPanel.getStyle().borderColor(Color.CYAN.darker().getRGB());
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(2).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(2).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(2)), iProbeInfo.defaultItemStyle()));
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(1).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(1)), iProbeInfo.defaultItemStyle()));
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(0).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(0)), iProbeInfo.defaultItemStyle()));
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(2).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(2).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(2)), iProbeInfo.defaultItemStyle(), true));
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(1).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(1).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(1)), iProbeInfo.defaultItemStyle(), true));
|
||||
abstractElementPanel.element(new CustomElementItemStack(inventoryHandler.getResultList().get(0).getResult(), NumberUtils.getFormatedBigNumber(inventoryHandler.getStackInSlot(0).getCount()) + "/" + NumberUtils.getFormatedBigNumber(inventoryHandler.getSlotLimit(0)), iProbeInfo.defaultItemStyle(), true));
|
||||
if (abstractElementPanel.getElements().size() > 0) vertical.element(abstractElementPanel);
|
||||
} else {
|
||||
ElementHorizontal abstractElementPanel = new ElementHorizontal(iProbeInfo.defaultLayoutStyle().spacing(8).leftPadding(7).rightPadding(7));
|
||||
|
|
Loading…
Reference in New Issue
Block a user