Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ private static RegistryOps<Tag> getOps() {

private static void saveStorages() {
for (int index = 0; index < STORAGE_SIZE; ++index) {
if (storages[index] != null && storages[index].dirty) {
Storage storage = storages[index];
if (storage != null && storage.dirty) {
saveStorage(index);
}
}
Expand Down Expand Up @@ -148,8 +149,9 @@ public static boolean extractPreview(GuiGraphicsExtractor graphics, Screen scree
else if (index >= 27 && index < 45) index -= 18;
else return false;

if (storages[index] == null) return false;
int rows = (storages[index].size() - 9) / 9;
Storage storage = storages[index];
if (storage == null) return false;
int rows = (storage.size() - 9) / 9;

int x = mouseX + 184 >= screen.width ? mouseX - 188 : mouseX + 8;
int y = Math.max(0, mouseY - 16);
Expand All @@ -158,10 +160,10 @@ public static boolean extractPreview(GuiGraphicsExtractor graphics, Screen scree
graphics.blit(RenderPipelines.GUI_TEXTURED, TEXTURE, x, y + rows * 18 + 17, 0, 215, 176, 7, 256, 256);

Font textRenderer = Minecraft.getInstance().font;
graphics.text(textRenderer, storages[index].name(), x + 8, y + 6, 0xFF404040, false);
graphics.text(textRenderer, storage.name(), x + 8, y + 6, 0xFF404040, false);

for (int i = 9; i < storages[index].size(); ++i) {
ItemStack currentStack = storages[index].getStack(i);
for (int i = 9; i < storage.size(); ++i) {
ItemStack currentStack = storage.getStack(i);
int itemX = x + (i - 9) % 9 * 18 + 8;
int itemY = y + (i - 9) / 9 * 18 + 18;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ private record AfterImportTask(Runnable runnable, boolean async) {}
/**
* Consumers must check this field when accessing `items` and `itemsMap`, or else thread safety is not guaranteed.
*/
private static boolean itemsImported = false;
private static volatile boolean itemsImported = false;
/**
* Consumers must check this field when accessing `recipes`, or else thread safety is not guaranteed.
*/
private static boolean filesImported = false;
private static volatile boolean filesImported = false;

@Init
public static void init() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ public class ProfileViewerScreen extends Screen {
private static Map<String, List<Collection>> collections = Map.of();

private String playerName;
private JsonObject hypixelProfile;
private JsonObject playerProfile;
private boolean profileNotFound = false;
private String errorMessage = "No Profile";
private volatile JsonObject hypixelProfile;
private volatile JsonObject playerProfile;
private volatile boolean profileNotFound = false;
private volatile String errorMessage = "No Profile";

private int activePage = 0;
private static final String[] PAGE_NAMES = {"Skills", "Slayers", "Dungeons", "Inventories", "Collections"};
private final ProfileViewerPage[] profileViewerPages = new ProfileViewerPage[PAGE_NAMES.length];
private final List<ProfileViewerNavButton> profileViewerNavButtons = new ArrayList<>();
private @Nullable RemotePlayer entity;
private volatile @Nullable RemotePlayer entity;
private ProfileViewerTextWidget textWidget;

public ProfileViewerScreen(String username) {
Expand Down
Loading