Skip to content

Commit

Permalink
Update to 1.20.3-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Nov 30, 2023
1 parent 39d634c commit f04a7d1
Show file tree
Hide file tree
Showing 27 changed files with 117 additions and 72 deletions.
5 changes: 1 addition & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.0+'
id 'fabric-loom' version '1.4.+'
id "com.modrinth.minotaur" version "2.+"
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
Expand Down Expand Up @@ -75,8 +75,6 @@ allprojects {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modCompileOnly "net.fabricmc:fabric-loader:${project.loader_version}"
modLocalRuntime "net.fabricmc:fabric-loader:${project.loader_version}"

annotationProcessor("io.github.llamalad7:mixinextras-fabric:${mixin_extras_version}")
}

loom {
Expand Down Expand Up @@ -113,7 +111,6 @@ subprojects {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = false
genSourcesWithCfr.enabled = false
unpickJar.enabled = false
}
}

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

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.3-pre2
yarn_mappings=1.20.3-pre2+build.1
loader_version=0.14.24
minecraft_version=1.20.3-rc1
yarn_mappings=1.20.3-rc1+build.1
loader_version=0.15.0

#Fabric api
fabric_version=0.90.10+1.20.3
fabric_version=0.90.11+1.20.3

maven_group = eu.pb4

mod_version = 0.7.0-dev
mod_version = 0.7.0

minecraft_version_supported = ">=1.20.3-"

packet_tweaker_version = 0.5.0+1.20.2-rc1
mixin_extras_version = 0.2.1

is_stable = true
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-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static void end(MinecraftServer server) {
public static void generateAndCall(MinecraftServer server, Consumer<Text> messageConsumer, Runnable runnable) {
Util.getIoWorkerExecutor().execute(() -> {
messageConsumer.accept(Text.literal("Starting resource pack generation..."));
boolean success = PolymerResourcePackUtils.build();
boolean success = PolymerResourcePackUtils.buildMain();

server.execute(() -> {
if (success) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public void serverStopped(MinecraftServer minecraftServer) {

private void updateHash() {
try {
hash = com.google.common.io.Files.asByteSource(PolymerResourcePackUtils.DEFAULT_PATH.toFile()).hash(Hashing.sha1()).toString();
size = Files.size(PolymerResourcePackUtils.DEFAULT_PATH);
lastUpdate = Files.getLastModifiedTime(PolymerResourcePackUtils.DEFAULT_PATH).toMillis();
hash = com.google.common.io.Files.asByteSource(PolymerResourcePackUtils.getMainPath().toFile()).hash(Hashing.sha1()).toString();
size = Files.size(PolymerResourcePackUtils.getMainPath());
lastUpdate = Files.getLastModifiedTime(PolymerResourcePackUtils.getMainPath()).toMillis();
this.fullAddress = this.baseAddress + this.hash + ".zip";
} catch (Exception e) {
hash = "";
Expand All @@ -99,14 +99,14 @@ private static InetSocketAddress createBindAddress(MinecraftServer server, Confi

public void handle(HttpExchange exchange) throws IOException {
if ("GET".equals(exchange.getRequestMethod())) {
if (Files.exists(PolymerResourcePackUtils.DEFAULT_PATH)) {
var updateTime = Files.getLastModifiedTime(PolymerResourcePackUtils.DEFAULT_PATH).toMillis();
if (Files.exists(PolymerResourcePackUtils.getMainPath())) {
var updateTime = Files.getLastModifiedTime(PolymerResourcePackUtils.getMainPath()).toMillis();
if (updateTime > lastUpdate) {
updateHash();
}

try (
var input = Files.newInputStream(PolymerResourcePackUtils.DEFAULT_PATH);
var input = Files.newInputStream(PolymerResourcePackUtils.getMainPath());
var output = exchange.getResponseBody()
) {
exchange.getResponseHeaders().add("Server", "polymer-autohost");
Expand Down
2 changes: 1 addition & 1 deletion polymer-autohost/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"depends": {
"polymer-resource-pack": ">=${version}",
"polymer-common": ">=${version}",
"fabricloader": ">=0.14.0"
"fabricloader": ">=0.15.0"
},
"entrypoints": {
"main": [
Expand Down
2 changes: 1 addition & 1 deletion polymer-blocks/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"depends": {
"polymer-core": ">=${version}",
"fabricloader": ">=0.14.0"
"fabricloader": ">=0.15.0"
},
"custom": {
"modmenu": {
Expand Down
2 changes: 0 additions & 2 deletions polymer-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies {
modApi include("xyz.nucleoid:packet-tweaker:${packet_tweaker_version}") {
transitive(false)
}
modApi(include(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${mixin_extras_version}")))
modCompileOnly "xyz.nucleoid:disguiselib-fabric:1.2.2"
modCompileOnly "org.geysermc.floodgate:api:2.2.0-SNAPSHOT"
}
Expand All @@ -20,7 +19,6 @@ afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import eu.pb4.polymer.common.impl.compat.FloodGateUtils;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.packet.s2c.play.PlaySoundFromEntityS2CPacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerCommonNetworkHandler;
import net.minecraft.server.network.ServerPlayNetworkHandler;
Expand All @@ -28,7 +29,7 @@ private PolymerCommonUtils(){}

public static final SimpleEvent<ResourcePackChangeCallback> ON_RESOURCE_PACK_STATUS_CHANGE = new SimpleEvent<>();
private static Path cachedClientPath;
private final static String SAFE_CLIENT_SHA1 = "8e9187433bab399843d78585e83bf812422a507d";
private final static String SAFE_CLIENT_SHA1 = "224c056f3cc6c6e1b5b90e63a0c621811f6a0681";
private final static String SAFE_CLIENT_URL = "https://piston-data.mojang.com/v1/objects/" + SAFE_CLIENT_SHA1 + "/client.jar";
private static Path cachedClientJarRoot;

Expand Down Expand Up @@ -209,6 +210,20 @@ public static void setHasResourcePack(ClientConnection player, UUID uuid, boolea
((CommonClientConnectionExt) player).polymerCommon$setResourcePack(uuid, status);
}

/**
* Creates instance of object by using unsafe, bypassing initializers.
* All of its fields will be set to null or similar.
*
* Useful for bad packet implementations™™
*
* @param clazz class to instantiate
* @return New instance
* @param <T> Anything you want
*/
public static <T> T createUnsafe(Class<T> clazz) {
return CommonImplUtils.createUnsafe(clazz);
}

public interface ResourcePackChangeCallback {
void onResourcePackChange(ServerCommonNetworkHandler handler, UUID uuid, boolean oldStatus, boolean newStatus);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract class ServerCommonNetworkHandlerMixin implements CommonNetworkHa
if (!CommonImplUtils.disableResourcePackCheck) {
if (!this.polymerCommon$ignoreNextStatus) {
((CommonClientConnectionExt) this.connection).polymerCommon$setResourcePack(packet.id(), switch (packet.status()) {
case SUCCESSFULLY_LOADED, ACCEPTED -> true;
case SUCCESSFULLY_LOADED, DOWNLOADED, ACCEPTED -> true;
case DECLINED, FAILED_DOWNLOAD, INVALID_URL, FAILED_RELOAD, DISCARDED -> false;
});
}
Expand Down
7 changes: 4 additions & 3 deletions polymer-common/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
"icon": "assets/iconm.png",
"environment": "*",
"depends": {
"minecraft": ">=1.20.2-",
"fabricloader": ">=0.14.4"
"minecraft": ">=1.20.3-",
"fabricloader": ">=0.15.0"
},
"conflicts": {
"banner": "*"
"banner": "*",
"cardboard": "*"
},
"custom": {
"modmenu": {
Expand Down
1 change: 0 additions & 1 deletion polymer-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,4 @@ afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}
2 changes: 1 addition & 1 deletion polymer-core/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

"depends": {
"polymer-common": ">=${version}",
"fabricloader": ">=0.14.0"
"fabricloader": ">=0.15.0"
},
"custom": {
"modmenu": {
Expand Down
1 change: 0 additions & 1 deletion polymer-networking/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion polymer-networking/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"environment": "*",
"depends": {
"polymer-common": ">=${version}",
"fabricloader": ">=0.14.0"
"fabricloader": ">=0.15.0"
},
"custom": {
"modmenu": {
Expand Down
1 change: 0 additions & 1 deletion polymer-reg-sync-manipulator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}


3 changes: 2 additions & 1 deletion polymer-resource-pack/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ dependencies {
modCompileOnly ('com.github.TheEpicBlock:PolyMc:5.4.0') {
exclude(group: "org.quiltmc", module: "quilt-loader")
}
modCompileOnly "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"

api include(project(path: ':polymer-common', configuration: 'namedElements'))
}

afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}

processResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.item.Item;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.Uuids;
import org.jetbrains.annotations.Nullable;

import java.nio.file.FileSystems;
Expand All @@ -25,7 +24,7 @@
* Global utilities allowing creation of single, polymer mod compatible resource pack
*/
public final class PolymerResourcePackUtils {
public static final Path DEFAULT_PATH = FabricLoader.getInstance().getGameDir().resolve("polymer-resourcepack.zip").toAbsolutePath().normalize();
private static final Path DEFAULT_PATH = FabricLoader.getInstance().getGameDir().resolve("polymer-resourcepack.zip").toAbsolutePath().normalize();

private PolymerResourcePackUtils() {
}
Expand Down Expand Up @@ -120,6 +119,10 @@ public static boolean hasMainPack(@Nullable ServerPlayerEntity player) {
return hasPack(player, getMainUuid());
}

public static Path getMainPath() {
return DEFAULT_PATH;
}

public static UUID getMainUuid() {
return PolymerResourcePackImpl.MAIN_UUID;
}
Expand Down Expand Up @@ -172,15 +175,15 @@ public static ResourcePackBuilder createBuilder(Path output) {
return new DefaultRPBuilder(output);
}

public static boolean build() {
return build(PolymerResourcePackUtils.DEFAULT_PATH);
public static boolean buildMain() {
return buildMain(PolymerResourcePackUtils.getMainPath());
}

public static boolean build(Path output) {
return build(output, (s) -> {});
public static boolean buildMain(Path output) {
return buildMain(output, (s) -> {});
}

public static boolean build(Path output, Consumer<String> status) {
public static boolean buildMain(Path output, Consumer<String> status) {
try {
return INSTANCE.build(output, status);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public static int generateResources(CommandContext<ServerCommandSource> context)

Util.getIoWorkerExecutor().execute(() -> {
context.getSource().sendFeedback(() -> Text.literal("Starting resource pack generation..."), true);
boolean success = PolymerResourcePackUtils.build();
boolean success = PolymerResourcePackUtils.buildMain();

context.getSource().getServer().execute(() -> {
if (success) {
context.getSource().sendFeedback(() ->
Text.literal("Resource pack created successfully! You can find it in game folder as ")
.append(Text.literal("polymer-resourcepack.zip")
.setStyle(Style.EMPTY.withUnderline(true).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(PolymerResourcePackUtils.DEFAULT_PATH.toAbsolutePath().toString()))))),
.setStyle(Style.EMPTY.withUnderline(true).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal(PolymerResourcePackUtils.getMainPath().toAbsolutePath().toString()))))),
true
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.SharedConstants;
import net.minecraft.resource.*;
import net.minecraft.resource.featuretoggle.FeatureSet;
import net.minecraft.text.Text;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

import java.io.File;
import java.nio.file.Path;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;

@ApiStatus.Internal
Expand All @@ -24,8 +21,8 @@ public class PolymerResourcePack {

@Nullable
public static ResourcePackProfile.PackFactory setup() {
Path outputPath = PolymerResourcePackUtils.DEFAULT_PATH;
if ((outputPath.toFile().exists() && generated) || PolymerResourcePackUtils.build(outputPath)) {
Path outputPath = PolymerResourcePackUtils.getMainPath();
if ((outputPath.toFile().exists() && generated) || PolymerResourcePackUtils.buildMain(outputPath)) {
generated = true;
return new ZipResourcePack.ZipBackedFactory(outputPath.toFile(), true);
} else {
Expand Down
4 changes: 2 additions & 2 deletions polymer-resource-pack/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
],

"depends": {
"minecraft": ">=1.20",
"fabricloader": ">=0.14.0"
"polymer-common": ">=${version}",
"fabricloader": ">=0.15.0"
},
"custom": {
"modmenu": {
Expand Down
1 change: 0 additions & 1 deletion polymer-virtual-entity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ afterEvaluate {
// Disable the gen sources task on sub projects
genSourcesWithFernFlower.enabled = true
genSourcesWithCfr.enabled = false
unpickJar.enabled = true
}

processResources {
Expand Down
Loading

0 comments on commit f04a7d1

Please sign in to comment.