Skip to content

Commit

Permalink
new config option for autohost to force resource pack to be optional (#…
Browse files Browse the repository at this point in the history
…162)

* Added ModOverride config option for autohost, allowing the resourcepack to be forced as optional

* oops renamed modOverride to mod_override

---------

Co-authored-by: podium868909 <[email protected]>
  • Loading branch information
podium868909 and podium868909 authored Dec 8, 2024
1 parent f9c94f5 commit d27f57a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ static <T> void register(Identifier identifier, Supplier<ResourcePackDataProvide
Collection<MinecraftServer.ServerResourcePackProperties> getProperties(ClientConnection connection);

static MinecraftServer.ServerResourcePackProperties createProperties(@Nullable UUID uuid, String address, @Nullable String hash) {
return new MinecraftServer.ServerResourcePackProperties(uuid != null
? uuid : UUID.nameUUIDFromBytes(address.getBytes(StandardCharsets.UTF_8)),
return new MinecraftServer.ServerResourcePackProperties(
uuid != null ? uuid : UUID.nameUUIDFromBytes(address.getBytes(StandardCharsets.UTF_8)),
address,
hash != null ? hash : "",
AutoHost.config.require || PolymerResourcePackUtils.isRequired(), AutoHost.message);
AutoHost.config.require || (AutoHost.config.modOverride && PolymerResourcePackUtils.isRequired()),
AutoHost.message
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ public class AutoHostConfig {
public String _c2 = "Marks resource pack as required";
@SerializedName("required")
public boolean require = false;
public String _c3 = "Type of resource pack provider. Default: 'polymer:automatic'";
public String _c3 = "Mods may override the above setting and make the resource pack required, set this to false to disable that.";
@SerializedName("mod_override")
public boolean modOverride = true;
public String _c4 = "Type of resource pack provider. Default: 'polymer:automatic'";
public String type = "polymer:automatic";
public String _c4 = "Configuration of type, see provider's source for more details";
public String _c5 = "Configuration of type, see provider's source for more details";
@SerializedName("settings")
public JsonElement providerSettings = new JsonObject();
public String _c5 = "Message sent to clients before pack is loaded";
public String _c6 = "Message sent to clients before pack is loaded";
public JsonElement message = new JsonPrimitive("This server uses resource pack to enhance gameplay with custom textures and models. It might be unplayable without them.");
public String _c6 = "Disconnect message in case of failure";
public String _c7 = "Disconnect message in case of failure";
@SerializedName("disconnect_message")
public JsonElement disconnectMessage = new JsonPrimitive("Couldn't apply server resourcepack!");

Expand All @@ -39,4 +42,4 @@ public static class ExternalResourcePack {
public String url;
public String hash;
}
}
}

0 comments on commit d27f57a

Please sign in to comment.