Compare commits
2
Commits
b0d75af8c4
...
653738568a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
653738568a | ||
|
|
a6a324a61a |
@@ -1,7 +1,11 @@
|
|||||||
package org.saturnclient.common.ref.game;
|
package org.saturnclient.common.ref.game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An item stack. Its methods are implemented in ItemStackMixin, so their names must not match any of
|
||||||
|
* ItemStack's own methods.
|
||||||
|
*/
|
||||||
public interface ItemStackRef {
|
public interface ItemStackRef {
|
||||||
public boolean isEmpty();
|
public boolean isEmptyStack();
|
||||||
public int getMaxDamage();
|
public int getMaxItemDamage();
|
||||||
public int getDamage();
|
public int getItemDamage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
package org.saturnclient.common.ref.render;
|
package org.saturnclient.common.ref.render;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The game window. Its methods are implemented in WindowMixin, so their names must not match any of
|
||||||
|
* Window's own methods.
|
||||||
|
*/
|
||||||
public interface WindowRef {
|
public interface WindowRef {
|
||||||
public int getWidth();
|
/** The window's width in screen coordinates */
|
||||||
|
public int getWindowWidth();
|
||||||
|
|
||||||
public int getHeight();
|
/** The window's height in screen coordinates */
|
||||||
|
public int getWindowHeight();
|
||||||
|
|
||||||
public int getFramebufferWidth();
|
public int getFramebufferWidth();
|
||||||
|
|
||||||
|
|||||||
@@ -75,16 +75,16 @@ public class ArmorDisplayMod extends Mod implements HudMod {
|
|||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
if (useMainHand.value && !mainHand.isEmpty()) {
|
if (useMainHand.value && !mainHand.isEmptyStack()) {
|
||||||
row = renderSlot(scope, mainHand, row);
|
row = renderSlot(scope, mainHand, row);
|
||||||
}
|
}
|
||||||
if (!helmet.isEmpty())
|
if (!helmet.isEmptyStack())
|
||||||
row = renderSlot(scope, helmet, row);
|
row = renderSlot(scope, helmet, row);
|
||||||
if (!chestplate.isEmpty())
|
if (!chestplate.isEmptyStack())
|
||||||
row = renderSlot(scope, chestplate, row);
|
row = renderSlot(scope, chestplate, row);
|
||||||
if (!leggings.isEmpty())
|
if (!leggings.isEmptyStack())
|
||||||
row = renderSlot(scope, leggings, row);
|
row = renderSlot(scope, leggings, row);
|
||||||
if (!boots.isEmpty())
|
if (!boots.isEmptyStack())
|
||||||
row = renderSlot(scope, boots, row);
|
row = renderSlot(scope, boots, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,8 +94,8 @@ public class ArmorDisplayMod extends Mod implements HudMod {
|
|||||||
private int renderSlot(RenderScope scope, ItemStackRef item, int row) {
|
private int renderSlot(RenderScope scope, ItemStackRef item, int row) {
|
||||||
scope.drawItem(item, 0, 15 * row);
|
scope.drawItem(item, 0, 15 * row);
|
||||||
|
|
||||||
if (item.getMaxDamage() > 0) {
|
if (item.getMaxItemDamage() > 0) {
|
||||||
int remaining = item.getMaxDamage() - item.getDamage();
|
int remaining = item.getMaxItemDamage() - item.getItemDamage();
|
||||||
scope.drawText(0.5f, String.valueOf(remaining),
|
scope.drawText(0.5f, String.valueOf(remaining),
|
||||||
17, (15 * row) + 3,
|
17, (15 * row) + 3,
|
||||||
layout.font.value, layout.fgColor.value);
|
layout.font.value, layout.fgColor.value);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ public class ImageTexture extends Element {
|
|||||||
if (sprite.toString().endsWith(".svg")) {
|
if (sprite.toString().endsWith(".svg")) {
|
||||||
MinecraftClientRef client = Providers.saturn.getClient();
|
MinecraftClientRef client = Providers.saturn.getClient();
|
||||||
|
|
||||||
int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWidth());
|
int renderWidth = (int) (width * client.getWindow().getFramebufferWidth() / client.getWindow().getWindowWidth());
|
||||||
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
int renderHeight = (int) (height * client.getWindow().getFramebufferHeight()
|
||||||
/ client.getWindow().getHeight());
|
/ client.getWindow().getWindowHeight());
|
||||||
|
|
||||||
IdentifierRef pngId = SvgTexture.getSvg(sprite, renderWidth * 2, renderHeight * 2);
|
IdentifierRef pngId = SvgTexture.getSvg(sprite, renderWidth * 2, renderHeight * 2);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user