Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.19.3 #59

Merged
merged 4 commits into from
Dec 11, 2022
Merged
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
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.2
loader_version=0.14.11

# Mod Properties
mod_version = 1.1.5
Expand All @@ -14,8 +14,8 @@ org.gradle.jvmargs=-Xmx1G

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.55.2+1.19
modmenu_version=4.0.0
fabric_version=0.68.1+1.19.3
modmenu_version=5.0.2

# Publishing metadata
modrinth_id=kYq5qkSL
Expand Down
32 changes: 8 additions & 24 deletions src/main/java/link/infra/borderlessmining/config/ConfigScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.client.gui.widget.ElementListWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.option.SimpleOption;
import net.minecraft.client.util.OrderableTooltip;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Style;
Expand All @@ -23,6 +22,7 @@
import java.util.function.Predicate;
import java.util.function.Supplier;


public abstract class ConfigScreen extends Screen {
private final Screen parent;
private ConfigListWidget entries;
Expand All @@ -37,10 +37,11 @@ protected final void init() {
entries = new ConfigListWidget(client, width, height, 32, height - 32, 25);
addElements();
addDrawableChild(entries);
addDrawableChild(new ButtonWidget(width / 2 - 100, height - 27, 200, 20, ScreenTexts.DONE, (button) -> {
save();
client.setScreen(parent);
}));
addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> {save(); client.setScreen(parent);})
.position(this.width / 2 - 100, this.height - 27)
.size(200, 20)
.build()
);
}

private static class ConfigListWidget extends ElementListWidget<ConfigListEntry> {
Expand All @@ -67,19 +68,6 @@ protected int getScrollbarPositionX() {
return super.getScrollbarPositionX() + 32;
}

public Element getHoveredButton(int mouseX, int mouseY) {
Optional<Element> hovered = hoveredElement(mouseX, mouseY);
if (hovered.isPresent()) {
List<? extends Element> buttons = ((ConfigListEntry)hovered.get()).children();
for (Element button : buttons) {
if (button.isMouseOver(mouseX, mouseY)) {
return button;
}
}
}
return null;
}

public Style getHoveredStyle(int mouseX, int mouseY) {
Optional<Element> hovered = hoveredElement(mouseX, mouseY);
//noinspection OptionalIsPresent
Expand All @@ -100,7 +88,7 @@ public ConfigListEntry(List<ClickableWidget> buttons) {
@Override
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
for (ClickableWidget widget : buttons) {
widget.y = y;
widget.setY(y);
widget.render(matrices, mouseX, mouseY, tickDelta);
}
}
Expand Down Expand Up @@ -139,10 +127,6 @@ public final void removed() {
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
Element hoveredButton = entries.getHoveredButton(mouseX, mouseY);
if (hoveredButton instanceof OrderableTooltip) {
renderOrderedTooltip(matrices, ((OrderableTooltip)hoveredButton).getOrderedTooltip(), mouseX, mouseY);
}
Style hoveredStyle = entries.getHoveredStyle(mouseX, mouseY);
if (hoveredStyle != null) {
renderTextHoverEffect(matrices, hoveredStyle, mouseX, mouseY);
Expand Down Expand Up @@ -253,7 +237,7 @@ public ConfigListTextField(TextRenderer textRenderer, int x, int y, int width, i
private static TextFieldWidget makeField(TextRenderer textRenderer, int x, int y, int width, int height, Text description) {
return new TextFieldWidget(textRenderer, x + (width / 2) + 7, y, (width / 2) - 8, height, description) {
@Override
public void appendNarrations(NarrationMessageBuilder builder) {
public void appendClickableNarrations(NarrationMessageBuilder builder) {
builder.put(NarrationPart.TITLE, getNarrationMessage()); // Use the narration message which includes the description
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public abstract class FullScreenOptionMixin {
// Modify the constructor call to add an extra option for Borderless Fullscreen
@ModifyArgs(method = "init",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;<init>(Ljava/lang/String;Lnet/minecraft/client/option/SimpleOption$TooltipFactoryGetter;Lnet/minecraft/client/option/SimpleOption$ValueTextGetter;Lnet/minecraft/client/option/SimpleOption$Callbacks;Ljava/lang/Object;Ljava/util/function/Consumer;)V"))
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/SimpleOption;<init>(Ljava/lang/String;Lnet/minecraft/client/option/SimpleOption$TooltipFactory;Lnet/minecraft/client/option/SimpleOption$ValueTextGetter;Lnet/minecraft/client/option/SimpleOption$Callbacks;Ljava/lang/Object;Ljava/util/function/Consumer;)V"))
private void modifyOption(Args args) {
if (!ConfigHandler.getInstance().addToVanillaVideoSettings) {
return;
Expand Down