Skip to content

Commit

Permalink
1.19 port
Browse files Browse the repository at this point in the history
  • Loading branch information
techno-sam committed Aug 12, 2022
1 parent dd7c01f commit cecf23d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
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

0 comments on commit cecf23d

Please sign in to comment.