Skip to content

Commit

Permalink
Merge branch 'update/1.20.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
AsoDesu committed Nov 1, 2023
2 parents 2b640d5 + d1c1b1b commit 037a935
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 48 deletions.
15 changes: 12 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ repositories {
maven { url "https://maven.terraformersmc.com/releases/" }
maven { url = "https://maven.isxander.dev/releases" }
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url = uri("https://maven.noxcrew.com/public") }
exclusiveContent {
forRepository {
maven {
Expand All @@ -45,12 +46,16 @@ dependencies {

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi "dev.isxander.yacl:yet-another-config-lib-fabric:3.1.0+1.20"
modApi("dev.isxander.yacl:yet-another-config-lib-fabric:3.2.1+1.20.2") {
exclude(group: "org.quiltmc.parsers")
exclude(group: "com.twelvemonkeys.common")
exclude(group: "com.twelvemonkeys.imageio")
}

modApi("com.terraformersmc:modmenu:7.0.1")
modApi("com.terraformersmc:modmenu:8.0.0")

implementation include('com.github.JnCrMx:discord-game-sdk4j:v0.5.5')
modCompileOnly "maven.modrinth:noxesium:1.0.1"
modApi("com.noxcrew.noxesium:fabric:1.0.5")
}

processResources {
Expand Down Expand Up @@ -90,4 +95,8 @@ jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}

loom {
accessWidenerPath = file("src/main/resources/islandutils.accesswidener")
}
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.2
loader_version=0.14.21
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.22
# Mod Properties
mod_version=1.6.2
maven_group=net.asodev
archives_base_name=islandutils
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.85.0+1.20.1
fabric_version=0.89.3+1.20.2

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
import net.asodev.islandutils.util.ChatUtils;
import net.asodev.islandutils.util.MusicUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.multiplayer.ClientSuggestionProvider;
import net.minecraft.client.multiplayer.*;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextColor;
Expand All @@ -52,14 +51,16 @@
import static net.asodev.islandutils.modules.FriendsInGame.TRANSACTION_ID;

@Mixin(ClientPacketListener.class)
public abstract class PacketListenerMixin {
public abstract class PacketListenerMixin extends ClientCommonPacketListenerImpl {

// I should really separate these mixins...

@Shadow @Final private Minecraft minecraft; // I love minecraft

@Shadow private CommandDispatcher<CommandSourceStack> commands;

protected PacketListenerMixin(Minecraft minecraft, Connection connection, CommonListenerCookie commonListenerCookie) {
super(minecraft, connection, commonListenerCookie);
}

@Inject(method = "handleSetExperience", at = @At("TAIL")) // Get our faction level
public void handleSetExperience(ClientboundSetExperiencePacket clientboundSetExperiencePacket, CallbackInfo ci) {
if (!MccIslandState.isOnline()) return; // We must be online!
Expand Down Expand Up @@ -189,7 +190,7 @@ private void handleRespawn(ClientboundRespawnPacket clientboundRespawnPacket, Ca
ClientLevel clientLevel = this.minecraft.level; // Get our player
if (clientLevel == null) return; // minecraft is a good game.

ResourceKey<Level> resourceKey = clientboundRespawnPacket.getDimension(); // Get the key of this world
ResourceKey<Level> resourceKey = clientboundRespawnPacket.commonPlayerSpawnInfo().dimension(); // Get the key of this world
if (resourceKey != clientLevel.dimension()) { // If we have changed worlds...
MusicUtil.stopMusic(); // ...stop the music
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ protected ChatScreenMixin(Component component) {
}

private final List<PlainTextButtonNoShadow> buttons = new ArrayList<>();
private int nextPress = 0;
private long lastPress = 0;

@Unique
private static final int BUTTON_WIDTH = 43;
@Unique
private static final int BUTTON_HEIGHT = 9;

@Unique
private static final int BUTTON_WIDTH = 43;
Expand Down Expand Up @@ -71,18 +76,14 @@ private void render(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo
}
}

@Inject(method = "tick", at = @At("HEAD"))
private void tick(CallbackInfo ci) {
if (nextPress > 0) nextPress--;
}

@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
private void mouseClicked(double d, double e, int i, CallbackInfoReturnable<Boolean> cir) {
if (nextPress > 0) return;
long timeNow = System.currentTimeMillis();
if ((timeNow - lastPress) < 1000) return;
for (PlainTextButtonNoShadow button : buttons) {
if (button.isHoveredOrFocused()) {
button.onPress();
nextPress = 20;
lastPress = System.currentTimeMillis();
cir.setReturnValue(true);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.PauseScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -22,7 +23,6 @@
@Mixin(PauseScreen.class)
public class PauseScreenMixin extends Screen {

@Final @Shadow private static Component DISCONNECT;
@Mutable @Shadow private void onDisconnect() {}

protected PauseScreenMixin(Component component) {
Expand All @@ -38,7 +38,7 @@ protected PauseScreenMixin(Component component) {
)
private Button.Builder createPause(Component component, Button.OnPress onPress) {
if (!MccIslandState.isOnline() || !IslandOptions.getMisc().isPauseConfirm()) return Button.builder(component, onPress);
if (component == DISCONNECT) {
if (component == CommonComponents.GUI_DISCONNECT) {
Component message = Component.literal("Are you sure you want to leave?").withStyle(ChatFormatting.AQUA);
Component no = Component.literal("Cancel");
Component yes = Component.literal("Disconnect").withStyle(ChatFormatting.RED);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/asodev/islandutils/util/Sidebar.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.world.scores.DisplaySlot;
import net.minecraft.world.scores.Objective;
import net.minecraft.world.scores.PlayerTeam;
import net.minecraft.world.scores.Scoreboard;
Expand Down Expand Up @@ -63,7 +64,7 @@ private static Objective getSidebar() {

@Nullable
private static Objective getSidebar(Scoreboard scoreboard) {
return scoreboard.getDisplayObjective(Scoreboard.DISPLAY_SLOT_SIDEBAR);
return scoreboard.getDisplayObjective(DisplaySlot.SIDEBAR);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.server.packs.FilePackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackCompatibility;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.util.HttpUtil;
import net.minecraft.world.flag.FeatureFlagSet;
Expand All @@ -23,6 +24,7 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;

Expand Down Expand Up @@ -63,14 +65,12 @@ public void downloadAndApply() throws Exception {
public void apply(File file, Boolean save) {
getting = false;
state = null;
int version = SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES);
pack = Pack.create(
"island_utils",
title,
true,
(d) -> new FilePackResources("IslandUtils", file, true),
new Pack.Info(desc, version, FeatureFlagSet.of()),
PackType.CLIENT_RESOURCES,
new FilePackResources.FileResourcesSupplier(file, true),
new Pack.Info(desc, PackCompatibility.COMPATIBLE, FeatureFlagSet.of(), List.of()),
Pack.Position.BOTTOM,
true,
PackSource.BUILT_IN
Expand Down
6 changes: 2 additions & 4 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"icon": "assets/island/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"net.asodev.islandutils.IslandUtilsClient"
],
"client": [ "net.asodev.islandutils.IslandUtilsClient" ],
"main": [ "net.asodev.islandutils.IslandUtils" ],
"modmenu": [ "net.asodev.islandutils.options.ModMenuIntegration" ]
},
Expand All @@ -30,7 +28,7 @@
}
},
"depends": {
"noxesium": ">=1.0.0",
"noxesium": ">=1.0.5",
"fabricloader": ">=0.14.8",
"fabric": "*",
"minecraft": "1.20.x",
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/islandutils.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessWidener v1 named

accessible method net/minecraft/server/packs/FilePackResources <init> (Ljava/lang/String;Lnet/minecraft/server/packs/FilePackResources$SharedZipFileAccess;ZLjava/lang/String;)V
accessible method net/minecraft/server/packs/FilePackResources$SharedZipFileAccess <init> (Ljava/io/File;)V
1 change: 0 additions & 1 deletion src/main/resources/islandutils.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"accessors.ContainerScreenAccessor",
"accessors.SoundEngineAccessor",
"accessors.SoundManagerAccessor",
"accessors.TabListAccessor",
"cosmetics.UIMixin",
"crafting.CraftingPacketMixin",
"crafting.ScavengingScreenMixin",
Expand Down

0 comments on commit 037a935

Please sign in to comment.