Skip to content

Commit

Permalink
1.20.4 -> 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Sollace committed Apr 24, 2024
1 parent 905ef8c commit af65d85
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21
- name: Build Gradle
uses: eskatos/gradle-command-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21
- name: Build Gradle
uses: eskatos/gradle-command-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21
- name: Publish Maven Jar
env:
ACCESS_KEY: ${{ secrets.ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
}
}
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id 'com.modrinth.minotaur' version '2.+'
id 'org.ajoberstar.reckon' version '0.13.0'
Expand All @@ -13,7 +13,7 @@ apply plugin: 'dex.plugins.outlet'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
}
withSourcesJar()
}
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ org.gradle.daemon=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.1
loader_version=0.15.1
fabric_version=0.91.2+1.20.4
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.15.7
fabric_version=0.97.5+1.20.5

# Mod Properties
group=com.minelittlepony
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 1 addition & 17 deletions src/main/java/com/minelittlepony/common/client/gui/Tooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.joml.Vector2i;
import com.google.common.base.Splitter;
import com.minelittlepony.common.client.gui.style.IStyled;
import com.minelittlepony.common.mixin.MixinTooltip;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Narratable;
import net.minecraft.client.gui.ScreenRect;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.gui.tooltip.TooltipPositioner;
import net.minecraft.client.gui.tooltip.WidgetTooltipPositioner;
import net.minecraft.text.MutableText;
import net.minecraft.text.StringVisitable;
import net.minecraft.text.Style;
Expand Down Expand Up @@ -49,19 +45,7 @@ default Stream<Text> stream() {
}

default net.minecraft.client.gui.tooltip.Tooltip toTooltip(IStyled<?> element) {
var tooltip = new net.minecraft.client.gui.tooltip.Tooltip(Text.empty(), Text.literal(getString().toString())) {
@Override
protected TooltipPositioner createPositioner(boolean hovered, boolean focused, ScreenRect focus) {
TooltipPositioner original = super.createPositioner(hovered, focused, focus);
if (!(original instanceof WidgetTooltipPositioner)) {
return original;
}
return (int screenWidth, int screenHeight, int x, int y, int width, int height) -> {
return original.getPosition(screenWidth, screenHeight, x, y, width, height)
.add(element.getStyle().toolTipX, element.getStyle().toolTipY, new Vector2i());
};
}
};
var tooltip = net.minecraft.client.gui.tooltip.Tooltip.of(Text.empty(), Text.literal(getString().toString()));
((MixinTooltip)tooltip).setLines(stream().map(Text::asOrderedText).toList());
return tooltip;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joml.Vector2i;

import com.minelittlepony.common.client.gui.ITextContext;
import com.minelittlepony.common.client.gui.ITickableElement;
import com.minelittlepony.common.client.gui.Tooltip;
Expand All @@ -17,8 +19,11 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.ScreenRect;
import net.minecraft.client.gui.screen.ButtonTextures;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.tooltip.TooltipPositioner;
import net.minecraft.client.gui.tooltip.TooltipState;
import net.minecraft.client.gui.widget.PressableWidget;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.util.Identifier;
Expand Down Expand Up @@ -58,7 +63,24 @@ public Button(int x, int y) {

public Button(int x, int y, int width, int height) {
super(x, y, width, height, ScreenTexts.EMPTY);
tooltip = new TooltipState() {
@Override
public void render(boolean hovered, boolean focused, ScreenRect focus) {
getStyle().getTooltip().ifPresentOrElse(tooltip -> {
if (tooltip != prevTooltip) {
prevTooltip = tooltip;
setTooltip(tooltip.toTooltip(Button.this));
}
}, () -> setTooltip(null));
super.render(hovered, focused, focus);
}

@Override
public TooltipPositioner createPositioner(ScreenRect focus, boolean hovered, boolean focused) {
final TooltipPositioner positioner = super.createPositioner(focus, hovered, focused);
return (sw, sh, x, y, w, h) -> positioner.getPosition(sw, sh, x, y, w, h).add(getStyle().toolTipX, getStyle().toolTipY, new Vector2i());
}
};
bounds = new Bounds(y, x, width, height);
}

Expand Down Expand Up @@ -188,13 +210,6 @@ public boolean isMouseOver(double mouseX, double mouseY) {

@Override
public void renderWidget(DrawContext context, int mouseX, int mouseY, float tickDelta) {
getStyle().getTooltip().ifPresentOrElse(tooltip -> {
if (tooltip != prevTooltip) {
prevTooltip = tooltip;
setTooltip(tooltip.toTooltip(this));
}
}, () -> setTooltip(null));

MinecraftClient mc = MinecraftClient.getInstance();
context.setShaderColor(1, 1, 1, alpha);
RenderSystem.enableBlend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.mojang.blaze3d.systems.RenderSystem;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.DyedColorComponent;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;

Expand All @@ -24,7 +26,7 @@ public ItemStackSprite setStack(ItemStack stack) {
}

public ItemStackSprite setTint(int tint) {
stack.getOrCreateSubNbt("display").putInt("color", tint);
stack.set(DataComponentTypes.DYED_COLOR, new DyedColorComponent(tint, true));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import net.minecraft.client.MinecraftClient;

/**
* Callback for the first tick on the client. Call {@link Handler#register()}
* to register
* Callback for the first tick on the client. Call {@link Handler#register()} to register
*/
@Deprecated
public interface ClientReadyCallback {

Event<ClientReadyCallback> EVENT = EventFactory.createArrayBacked(ClientReadyCallback.class, listeners -> client -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

@FunctionalInterface
public interface ScreenInitCallback {

Event<ScreenInitCallback> EVENT = EventFactory.createArrayBacked(ScreenInitCallback.class, listeners -> (screen, buttons) -> {
for (ScreenInitCallback event : listeners) {
event.init(screen, buttons);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.client.texture.NativeImage;

public interface SkinFilterCallback {

Event<SkinFilterCallback> EVENT = EventFactory.createArrayBacked(SkinFilterCallback.class, listeners -> {
return new SkinFilterCallback() {
@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import net.minecraft.registry.*;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.registry.entry.RegistryEntryInfo;
import net.minecraft.util.Identifier;

public interface Registries {
Expand All @@ -25,9 +26,9 @@ static <T> Registry<T> createDefaulted(Identifier id, Function<T, Identifier> de
Registry.register(this, getDefaultId(), defaultValue);
}

public RegistryEntry.Reference<T> set(int i, RegistryKey<T> registryKey, T object, Lifecycle lifecycle) {
createEntry(object);
return super.set(i, registryKey, object, lifecycle);
public RegistryEntry.Reference<T> add(RegistryKey<T> key, T value, RegistryEntryInfo info) {
createEntry(value);
return super.add(key, value, info);
}
};
}
Expand Down
6 changes: 1 addition & 5 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@
"depends": {
"minecraft": "${minecraftVersion}",
"fabricloader": "${loaderVersion}",
"java": ">=17",
"java": ">=21",
"fabric-api": "${fabricVersion}"
},
"suggests": {
"fabric-key-binding-api-v1": ">=0.1.0",
"fabric-rendering-v1": ">=0.1.0"
},
"custom": {
"modmenu": {
"badges": [ "library" ],
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/kirin.aw
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
accessWidener v1 named
accessible method net/minecraft/client/gui/tooltip/Tooltip <init> (Lnet/minecraft/text/Text;Lnet/minecraft/text/Text;)V
accessible method net/minecraft/client/gui/tooltip/TooltipState createPositioner (Lnet/minecraft/client/gui/ScreenRect;ZZ)Lnet/minecraft/client/gui/tooltip/TooltipPositioner;
extendable method net/minecraft/client/gui/tooltip/TooltipState createPositioner (Lnet/minecraft/client/gui/ScreenRect;ZZ)Lnet/minecraft/client/gui/tooltip/TooltipPositioner;
accessible field net/minecraft/client/gui/widget/ClickableWidget tooltip Lnet/minecraft/client/gui/tooltip/TooltipState;
mutable field net/minecraft/client/gui/widget/ClickableWidget tooltip Lnet/minecraft/client/gui/tooltip/TooltipState;
3 changes: 1 addition & 2 deletions src/main/resources/kirin.mixin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"minVersion": "0.7",
"package": "com.minelittlepony.common.mixin",
"refmap": "kirin.mixin.refmap.json",
"compatibilityLevel": "JAVA_16",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinEntityRenderDispatcher",
"MixinMinecraftClient",
"MixinPlayerSkinTexture",
"MixinScreen",
Expand Down

0 comments on commit af65d85

Please sign in to comment.