Skip to content

Commit

Permalink
Update to 1.20.4 (#49)
Browse files Browse the repository at this point in the history
* Update to 1.20.4

* Don't use Access Wideners
  • Loading branch information
Patbox authored Dec 10, 2023
1 parent 5073512 commit 99c3ad9
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 24 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G

minecraft_version=1.20.2
minecraft_version=1.20.4
quilt_mappings=1
loader_version=0.14.21
loader_version=0.15.1

# Mod Properties
mod_version=5.0.3
Expand All @@ -12,5 +12,5 @@ archives_base_name=spruceui

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version=0.89.1+1.20.2
modmenu_version=8.0.0-beta.2
fabric_api_version=0.91.1+1.20.4
modmenu_version=9.0.0-pre.1
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.widget.ClickableWidgetStateTextures;
import net.minecraft.text.Text;
import net.minecraft.unmapped.C_fajlgudl;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
import org.jetbrains.annotations.Nullable;
Expand All @@ -41,9 +41,10 @@ public abstract class AbstractSpruceButtonWidget extends AbstractSpruceWidget im
protected float alpha = 1.f;

/**
* @see net.minecraft.client.gui.widget.PressableWidget#field_45339
* @see net.minecraft.client.gui.widget.PressableWidget#TEXTURES
*/
protected static final C_fajlgudl BUTTON_TEXTURES = new C_fajlgudl(
protected static final ClickableWidgetStateTextures
BUTTON_TEXTURES = new ClickableWidgetStateTextures(
new Identifier("widget/button"), new Identifier("widget/button_disabled"), new Identifier("widget/button_highlighted")
);

Expand Down Expand Up @@ -139,7 +140,7 @@ protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY
/* Rendering */

protected Identifier getTexture() {
return BUTTON_TEXTURES.method_52729(this.isActive(), this.isFocusedOrHovered());
return BUTTON_TEXTURES.getTexture(this.isActive(), this.isFocusedOrHovered());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ public VanillaButtonWrapper(AbstractSpruceButtonWidget widget) {
}

@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
public void drawWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
this.widget.getPosition().setRelativeY(this.getY());
this.widget.render(graphics, mouseX, mouseY, delta);
}

@Override
public void drawWidget(GuiGraphics graphics, int mouseX, int mouseY, float delta) {}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
return this.widget.mouseClicked(mouseX, mouseY, button);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"fabric-lifecycle-events-v1": "*",
"fabric-rendering-v1": "*",
"fabric-resource-loader-v0": ">=0.4.7",
"minecraft": ">=1.20.2",
"minecraft": ">=1.20.3",
"java": ">=17"
},
"custom": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public SpruceUITest() {
this.actionOption = SpruceSimpleActionOption.of("spruceui_test.option.action",
btn -> {
MinecraftClient client = MinecraftClient.getInstance();
SystemToast toast = SystemToast.create(client, SystemToast.Type.TUTORIAL_HINT,
SystemToast toast = SystemToast.create(client, SystemToast.C_ozahoshp.field_47586,
Text.literal("Action button pressed!"), Text.literal("I'm a result of the action"));
client.getToastManager().add(toast);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ protected void init() {
super.init();

int startY = this.height / 4 + 48;
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY), 200, 20, Text.literal("Option Test"),
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY), 200, 20, Text.literal("Option Test"),
btn -> this.client.setScreen(new SpruceOptionScreen(this))));
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY += 25), 200, 20, Text.literal("Text Area Test"),
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY += 25), 200, 20, Text.literal("Text Area Test"),
btn -> this.client.setScreen(new SpruceTextAreaScreen(this))));
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY += 25), 200, 20, Text.literal("Tabbed Screen Test"),
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 100, startY += 25), 200, 20, Text.literal("Tabbed Screen Test"),
btn -> this.client.setScreen(new SpruceTabbedTestScreen(this))));

// Add done button.
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 75, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 75, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
btn -> this.client.setScreen(this.parent)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ protected void init() {
this.init(this.client, this.client.getWindow().getScaledWidth(), this.client.getWindow().getScaledHeight());
};

this.addDrawableChild(this.list);
this.addDrawableSelectableElement(this.list);

// Add reset button. You can add option buttons outside a button list widget. GameOptions instance is required because of Vanilla limitations.
//this.addButton(this.resetOption.createButton(this.client.options, this.width / 2 - 155, this.height - 29, 150));
// Add done button.
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155 + 160, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155 + 160, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
btn -> this.client.setScreen(this.parent)).asVanilla());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ protected void init() {
(width, height) -> SpruceUITest.buildTextAreaContainer(Position.origin(), width, height,
textArea -> {
}, null));
this.addDrawableChild(this.tabbedWidget);
this.addDrawableSelectableElement(this.tabbedWidget);

// Add done button.
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 75, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(this, this.width / 2 - 75, this.height - 29), 150, 20, SpruceTexts.GUI_DONE,
btn -> this.client.setScreen(this.parent)).asVanilla());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void init() {
}
this.textArea = textArea;
}, btn -> this.client.setScreen(this.parent));
this.addDrawableChild(containerWidget);
this.addDrawableSelectableElement(containerWidget);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected TitleScreenMixin(Text title) {

@Inject(method = "init", at = @At("RETURN"))
private void onInit(CallbackInfo ci) {
this.addDrawableChild(new SpruceButtonWidget(Position.of(0, 0), 150, 20, Text.literal("SpruceUI Test Menu"),
this.addDrawableSelectableElement(new SpruceButtonWidget(Position.of(0, 0), 150, 20, Text.literal("SpruceUI Test Menu"),
btn -> this.client.setScreen(new SpruceMainMenuScreen(this))).asVanilla());
}
}

0 comments on commit 99c3ad9

Please sign in to comment.