[DEV] New Cloth Config GUIs, new nojang apis, and bug fixes
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/ClothConfigScreenBuilder.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/ClothConfigScreenBuilder.java
|
||||
@@ -390,9 +390,9 @@
|
||||
config.saveConfig(config);
|
||||
Files.deleteIfExists(backupPath);
|
||||
} catch (Exception e) {
|
||||
- Minecraft.getInstance().getToastManager().addToast(
|
||||
+ Minecraft.getInstance().getToasts().addToast(
|
||||
new SystemToast(
|
||||
- SystemToast.SystemToastId.PACK_LOAD_FAILURE,
|
||||
+ SystemToast.SystemToastIds.PACK_LOAD_FAILURE,
|
||||
Component.literal("Failed To Save Config"),
|
||||
Component.literal("Restoring Backup Copy. Check log for details"))
|
||||
);
|
@@ -8,7 +8,7 @@
|
||||
import net.minecraft.client.gui.screens.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
@@ -158,7 +157,7 @@
|
||||
@@ -159,7 +158,7 @@
|
||||
return new TextConfigOption<>(Objects::toString, BigDecimal::new);
|
||||
}
|
||||
if (value instanceof ResourceLocation) {
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
if (isSubConfig) {
|
||||
return new SubConfigWidget<>(config, this, value);
|
||||
@@ -177,19 +176,19 @@
|
||||
@@ -178,19 +177,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
int y = (int) (TOP + 4 - Math.round(scrollerAmount));
|
||||
for (Option<?> option : options) {
|
||||
@@ -216,23 +215,24 @@
|
||||
@@ -217,23 +216,24 @@
|
||||
int maxY = this.height - BOTTOM;
|
||||
//RenderSystem.disableTexture();
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
@@ -89,7 +89,7 @@
|
||||
RenderSystem.disableBlend();
|
||||
//RenderSystem.enableTexture();
|
||||
}
|
||||
@@ -240,21 +240,22 @@
|
||||
@@ -241,21 +241,22 @@
|
||||
|
||||
private void renderShadow(PoseStack matrices) {
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
@@ -123,7 +123,7 @@
|
||||
//RenderSystem.enableTexture();
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
@@ -265,15 +266,16 @@
|
||||
@@ -266,15 +267,16 @@
|
||||
|
||||
protected void overlayBackground(Matrix4f matrix, int minX, int minY, int maxX, int maxY, int red, int green, int blue, int startAlpha, int endAlpha) {
|
||||
Tesselator tesselator = Tesselator.getInstance();
|
||||
@@ -148,7 +148,7 @@
|
||||
}
|
||||
|
||||
public int scrollHeight() {
|
||||
@@ -331,12 +333,12 @@
|
||||
@@ -332,12 +334,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +163,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -375,7 +377,7 @@
|
||||
@@ -376,7 +378,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
if (mouseX > startX && mouseX < startX + sizeX) {
|
||||
if (mouseY > startY && mouseY < startY + sizeY) {
|
||||
List<Component> list = new ArrayList<>();
|
||||
@@ -383,7 +385,7 @@
|
||||
@@ -384,7 +386,7 @@
|
||||
for (String desc : description) {
|
||||
list.add(Component.translatable(desc));
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
@@ -18,7 +18,7 @@
|
||||
public W widget;
|
||||
|
||||
@Override
|
||||
|
@@ -11,7 +11,7 @@
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
@@ -39,7 +39,7 @@
|
||||
@@ -40,7 +40,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -20,7 +20,7 @@
|
||||
MutableComponent text = Component.literal(this.text.getString());
|
||||
boolean edited = isEdited() || hasErrors;
|
||||
if (edited) {
|
||||
@@ -50,7 +50,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
} else {
|
||||
text.withStyle(ChatFormatting.GRAY);
|
||||
}
|
||||
|
@@ -0,0 +1,34 @@
|
||||
--- a/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/widgets/ClothConfigButtonEntry.java
|
||||
+++ b/Common/src/main/java/com/hypherionmc/craterlib/client/gui/config/widgets/ClothConfigButtonEntry.java
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.hypherionmc.craterlib.client.gui.config.widgets;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
+import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import me.shedaniel.clothconfig2.api.AbstractConfigListEntry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
-import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
@@ -59,17 +59,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void render(GuiGraphics matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
|
||||
+ public void render(PoseStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean isHovered, float delta) {
|
||||
Window window = Minecraft.getInstance().getWindow();
|
||||
Component displayedFieldName = displayName;
|
||||
if (Minecraft.getInstance().font.isBidirectional()) {
|
||||
- matrices.drawString(Minecraft.getInstance().font, displayedFieldName.getVisualOrderText(), window.getGuiScaledWidth() - x - Minecraft.getInstance().font.width(displayedFieldName), y + 6, 16777215);
|
||||
+ drawString(matrices, Minecraft.getInstance().font, displayedFieldName.getVisualOrderText(), window.getGuiScaledWidth() - x - Minecraft.getInstance().font.width(displayedFieldName), y + 6, 16777215);
|
||||
this.button.setX(x);
|
||||
if (hasDeleteButton) {
|
||||
this.deleteButton.setX(x + this.button.getWidth() + 4);
|
||||
}
|
||||
} else {
|
||||
- matrices.drawString(Minecraft.getInstance().font, displayedFieldName.getVisualOrderText(), x, y + 6, this.getPreferredTextColor());
|
||||
+ drawString(matrices, Minecraft.getInstance().font, displayedFieldName.getVisualOrderText(), x, y + 6, this.getPreferredTextColor());
|
||||
if (hasDeleteButton) {
|
||||
this.button.setX(x + entryWidth - this.button.getWidth() - 24);
|
||||
this.deleteButton.setX(x + entryWidth - 20);
|
@@ -14,7 +14,7 @@
|
||||
|
||||
/**
|
||||
* @author HypherionSA
|
||||
@@ -22,7 +23,7 @@
|
||||
@@ -23,7 +24,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -23,7 +23,7 @@
|
||||
if (cancel) {
|
||||
setMessage(Component.translatable(screen.isEdited() ? "t.clc.cancel_discard" : "gui.cancel"));
|
||||
} else {
|
||||
@@ -30,7 +31,7 @@
|
||||
@@ -31,7 +32,7 @@
|
||||
active = screen.isEdited() && !hasErrors;
|
||||
setMessage(Component.translatable(hasErrors ? "t.clc.error" : "t.clc.save"));
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
import net.minecraft.client.gui.components.events.AbstractContainerEventHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -34,7 +34,7 @@
|
||||
@@ -35,7 +35,7 @@
|
||||
@Getter
|
||||
private List<String> langKeys = new ArrayList<>();
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -27,7 +27,7 @@
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user