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

1.19 port #3

Open
wants to merge 1 commit into
base: 1.18
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.3
loader_version=0.14.4
polymer_version=0.2.0-beta.40+1.18.2
fabric_version=0.51.1+1.18.2
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.3
loader_version=0.14.9
polymer_version=0.2.12+1.19.2
fabric_version=0.59.0+1.19.2

# Mod Properties
mod_version = 0.2.0
mod_version = 0.2.1
maven_group = com.github.aws404
archives_base_name = polypack-host
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import eu.pb4.polymer.api.resourcepack.PolymerRPUtils;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import net.minecraft.text.Text;

import java.io.*;
import java.math.BigInteger;
Expand All @@ -15,6 +17,7 @@
import java.nio.file.Path;
import java.security.MessageDigest;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -64,7 +67,15 @@ public static void start(MinecraftServer minecraftServer) {
.digest(new FileInputStream(POLYMER_PACK_FILE.toString()).readAllBytes()))
);

minecraftServer.setResourcePack(packIp, hash);
if (minecraftServer instanceof MinecraftDedicatedServer dedicatedServer) {
boolean required = false;
Text prompt = Text.empty();
if (dedicatedServer.getProperties().serverResourcePackProperties.isPresent()) {
required = dedicatedServer.getProperties().serverResourcePackProperties.get().isRequired();
prompt = dedicatedServer.getProperties().serverResourcePackProperties.get().prompt();
}
dedicatedServer.getProperties().serverResourcePackProperties = Optional.of(new MinecraftServer.ServerResourcePackProperties(packIp, hash, required, prompt));
}

PolypackHostMod.LOGGER.info("Polymer resource pack host started at {} (Hash: {})", packIp, hash);
} catch (Exception e) {
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 @@ -23,7 +23,7 @@

"depends": {
"fabricloader": ">=0.11.3",
"minecraft": "1.18.x",
"minecraft": "1.19.x",
"polymer": "*",
"fabric-lifecycle-events-v1": "*",
"java": ">=17"
Expand Down