Skip to content

Commit

Permalink
Update for 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinrobot committed Jun 29, 2024
1 parent af37118 commit 9702b96
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 57 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
21, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-22.04, windows-2022]
Expand All @@ -35,7 +35,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -72,7 +72,7 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
it.options.release = 21
}

java {
Expand All @@ -81,8 +81,8 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Minecraft Properties
minecraft_version=1.20
yarn_mappings=1.20+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.7

# Mod Properties
mod_version=1.1.1
Expand All @@ -13,10 +13,10 @@ archives_base_name=mcemote

# Fabric Properties
# check these on https://fabricmc.net/develop
fabric_loader_version=0.14.21
fabric_api_version=0.83.0+1.20
fabric_loader_version=0.15.11
fabric_api_version=0.100.4+1.21

# Dependencies versions
modmenu_version=7.2.1
modmenu_version=11.0.1
webpdecoderjn_version=1.4
httpcomponents_version=4.5.14
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.font.BuiltinEmptyGlyph;
import net.minecraft.client.font.Font;
import net.minecraft.client.font.FontFilterType;
import net.minecraft.client.font.FontStorage;
import net.minecraft.client.font.Glyph;
import net.minecraft.client.font.GlyphRenderer;
Expand All @@ -10,6 +11,7 @@
import net.minecraft.util.Identifier;

import java.util.List;
import java.util.Set;

public abstract class CustomFontStorage extends FontStorage {
public static final float GLYPH_HEIGHT = TextRenderer.ARABIC_SHAPING_LETTERS_SHAPE;
Expand Down Expand Up @@ -37,7 +39,7 @@ protected TextureManager getTextureManager() {
}

@Override
public void setFonts(final List<Font> fonts) {
public void setFonts(List<Font.FontFilterPair> allFonts, Set<FontFilterType> activeFilters) {
throw new UnsupportedOperationException();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.concurrent.TimeUnit;

public class EmoteFontStorage extends CustomFontStorage {
public static final Identifier IDENTIFIER = new Identifier("mcemote.fonts", "emotes");
public static final Identifier IDENTIFIER = Identifier.of("mcemote.fonts", "emotes");

private final EmotesManager emotesManager;
private final Map<Integer, Future<AnimatedGlyph>> framesCache = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@Mixin(ChatHud.class)
@Environment(EnvType.CLIENT)
public class ChatHudMixin {
@ModifyVariable(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", ordinal = 0)
@ModifyVariable(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", ordinal = 0)
private Text addMessage(Text message) {
return EmoteParser.wrapText(message, MinecraftEmoteModClient.EMOTES_MANAGER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public void renderBackground(final DrawContext context, final int marginTop, fin

// Background (Middle)
context.setShaderColor(0.125F, 0.125F, 0.125F, 1.0F);
context.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, 0, marginTop, this.width, bottom, this.width, bottom - marginTop, 32, 32);
context.drawTexture(Screen.MENU_BACKGROUND_TEXTURE, 0, marginTop, this.width, bottom, this.width, bottom - marginTop, 32, 32);
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

// Background (Top & Bottom), based on Screen.renderBackgroundTexture(DrawContext)
context.setShaderColor(0.25F, 0.25F, 0.25F, 1.0F);
context.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, 0, 0, 0.0F, 0.0F, this.width, marginTop, 32, 32);
context.drawTexture(Screen.OPTIONS_BACKGROUND_TEXTURE, 0, bottom, 0.0F, bottom, this.width, this.height - bottom, 32, 32);
context.drawTexture(Screen.MENU_BACKGROUND_TEXTURE, 0, 0, 0.0F, 0.0F, this.width, marginTop, 32, 32);
context.drawTexture(Screen.MENU_BACKGROUND_TEXTURE, 0, bottom, 0.0F, bottom, this.width, this.height - bottom, 32, 32);
context.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);

// Gradients
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
import net.vinrobot.mcemote.config.Configuration;
Expand All @@ -23,28 +24,22 @@ public class ConfigurationScreen extends BaseScreen {
private final ConfigurationManager configManager;

private ButtonWidget doneButton;
private CustomTextFieldWidget twitchIdField;
private TextFieldWidget twitchIdField;
private SliderFieldWidget emoteScalingField;

public ConfigurationScreen(final Screen parent, final ConfigurationManager configManager) {
super(parent, MENU_TITLE);
this.configManager = configManager;
}

@Override
public void tick() {
super.tick();
this.twitchIdField.tick();
}

@Override
protected void init() {
final int widgetWidth = 200;
final int widgetHeight = 20;
final int widgetX = (this.width - widgetWidth) / 2;
final Configuration config = this.configManager.getConfig();

this.twitchIdField = new CustomTextFieldWidget(this.textRenderer, widgetX, 75, widgetWidth, widgetHeight, TWITCH_ID_LABEL);
this.twitchIdField = new TextFieldWidget(this.textRenderer, widgetX, 75, widgetWidth, widgetHeight, TWITCH_ID_LABEL);
this.twitchIdField.setMaxLength(32);
this.twitchIdField.setText(config.twitchId().get());
this.twitchIdField.setChangedListener((value) -> this.validateInputs());
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
],
"depends": {
"fabricloader": ">=0.14.21",
"minecraft": "~1.20",
"java": ">=17"
"minecraft": "~1.21",
"java": ">=21"
},
"suggests": {
"another-mod": "*"
Expand Down

0 comments on commit 9702b96

Please sign in to comment.