aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-10-25 09:27:15 -0400
committerKevinthegreat <92656833+kevinthegreat1@users.noreply.github.com>2023-10-25 13:26:30 -0400
commit292567ff8a77dfb8bae100ab74bc77ab01f76482 (patch)
tree0e869a76cf001a413c640c7d982a74590adedb6f /src
parentfe1f8bc4c660c37e21db11bdb4c6d6f8cc5b6986 (diff)
downloadSkyblocker-292567ff8a77dfb8bae100ab74bc77ab01f76482.tar.gz
Skyblocker-292567ff8a77dfb8bae100ab74bc77ab01f76482.tar.bz2
Skyblocker-292567ff8a77dfb8bae100ab74bc77ab01f76482.zip
Update backpack preview background
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hysky/skyblocker/skyblock/item/BackpackPreview.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/item/BackpackPreview.java b/src/main/java/de/hysky/skyblocker/skyblock/item/BackpackPreview.java
index f856a255..79432bd4 100644
--- a/src/main/java/de/hysky/skyblocker/skyblock/item/BackpackPreview.java
+++ b/src/main/java/de/hysky/skyblocker/skyblock/item/BackpackPreview.java
@@ -1,7 +1,6 @@
package de.hysky.skyblocker.skyblock.item;
import com.mojang.blaze3d.systems.RenderSystem;
-import de.hysky.skyblocker.SkyblockerMod;
import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.Utils;
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
@@ -24,12 +23,13 @@ import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class BackpackPreview {
private static final Logger LOGGER = LoggerFactory.getLogger(BackpackPreview.class);
- private static final Identifier TEXTURE = new Identifier(SkyblockerMod.NAMESPACE, "textures/gui/inventory_background.png");
+ private static final Identifier TEXTURE = new Identifier("textures/gui/container/generic_54.png");
private static final Pattern ECHEST_PATTERN = Pattern.compile("Ender Chest.*\\((\\d+)/\\d+\\)");
private static final Pattern BACKPACK_PATTERN = Pattern.compile("Backpack.*\\(Slot #(\\d+)\\)");
private static final int STORAGE_SIZE = 27;
@@ -56,7 +56,7 @@ public class BackpackPreview {
// update save dir based on uuid and sb profile
String uuid = MinecraftClient.getInstance().getSession().getUuidOrNull().toString().replaceAll("-", "");
String profile = Utils.getProfile();
- if (profile != null && !profile.isEmpty()) {
+ if (!profile.isEmpty()) {
save_dir = FabricLoader.getInstance().getConfigDir().resolve("skyblocker/backpack-preview/" + uuid + "/" + profile);
save_dir.toFile().mkdirs();
if (loaded.equals(uuid + "/" + profile)) {
@@ -84,7 +84,7 @@ public class BackpackPreview {
if (file.isFile()) {
try {
NbtCompound root = NbtIo.read(file);
- storage[index] = new DummyInventory(root);
+ storage[index] = new DummyInventory(Objects.requireNonNull(root));
} catch (Exception e) {
LOGGER.error("Failed to load backpack preview file: " + file.getName(), e);
}
@@ -152,11 +152,8 @@ public class BackpackPreview {
matrices.translate(0f, 0f, 400f);
RenderSystem.enableDepthTest();
- context.drawTexture(TEXTURE, x, y, 0, 0, 176, 7);
- for (int i = 0; i < rows; ++i) {
- context.drawTexture(TEXTURE, x, y + i * 18 + 7, 0, 7, 176, 18);
- }
- context.drawTexture(TEXTURE, x, y + rows * 18 + 7, 0, 25, 176, 7);
+ context.drawTexture(TEXTURE, x, y, 0, 0, 176, rows * 18 + 17);
+ context.drawTexture(TEXTURE, x, y + rows * 18 + 17, 0, 126, 176, 96);
TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
for (int i = 9; i < storage[index].size(); ++i) {