1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-24 18:37:38 +00:00

Udpate to latest Neo, Fabric and Parchment

- Update to latest NeoForge, fixing issues with config API changes.
   Closes #1903.
 - Update to latest Fabric, switching to the ender pearl conventional
   tag, and new loot API.
This commit is contained in:
Jonathan Coates
2024-07-28 16:47:41 +01:00
parent 2c740bb904
commit 2765abf971
14 changed files with 31 additions and 30 deletions

View File

@@ -0,0 +1,7 @@
{
"type": "minecraft:crafting_shaped",
"category": "redstone",
"key": {"#": {"item": "minecraft:stone"}, "E": {"tag": "c:ender_pearls"}},
"pattern": ["###", "#E#", "###"],
"result": {"count": 1, "id": "computercraft:wireless_modem_normal"}
}

View File

@@ -31,7 +31,7 @@ abstract class ItemStackComponentizationFixMixin extends DataFix {
}
@Inject(method = "fixItemStack", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private static void fixItemStack(ItemStackComponentizationFix.ItemStackData data, Dynamic<?> ops, CallbackInfo ci) {
ComponentizationFixers.fixItemComponents(data, ops);
}

View File

@@ -69,6 +69,13 @@ class AddressRuleConfig {
);
}
public static UnmodifiableConfig newRule() {
return makeRule(config -> {
config.add("host", "example.com");
config.add("action", Action.DENY.name().toLowerCase(Locale.ROOT));
});
}
private static UnmodifiableConfig makeRule(Consumer<CommentedConfig> setup) {
var config = InMemoryCommentedFormat.defaultInstance().createConfig(LinkedHashMap::new);
setup.accept(config);

View File

@@ -126,7 +126,7 @@ public interface ConfigFile {
public abstract ConfigFile.Value<Integer> defineInRange(String path, int defaultValue, int min, int max);
public abstract <T> ConfigFile.Value<List<? extends T>> defineList(String path, List<? extends T> defaultValue, Predicate<Object> elementValidator);
public abstract <T> ConfigFile.Value<List<? extends T>> defineList(String path, List<? extends T> defaultValue, Supplier<T> newValue, Predicate<Object> elementValidator);
public abstract <V extends Enum<V>> ConfigFile.Value<V> defineEnum(String path, V defaultValue);

View File

@@ -145,7 +145,7 @@ public final class ConfigSpec {
or a single method (computercraft:inventory#pushItems).
""")
.worldRestart()
.defineList("disabled_generic_methods", List.of(), x -> x instanceof String);
.defineList("disabled_generic_methods", List.of(), () -> "", x -> x instanceof String);
}
{
@@ -214,7 +214,7 @@ public final class ConfigSpec {
- "max_websocket_message" (optional): The maximum size (in bytes) that a computer can send or
receive in one websocket packet.
- "use_proxy" (optional): Enable use of the HTTP/SOCKS proxy if it is configured.""")
.defineList("rules", AddressRuleConfig.defaultRules(), x -> x instanceof UnmodifiableConfig);
.defineList("rules", AddressRuleConfig.defaultRules(), AddressRuleConfig::newRule, x -> x instanceof UnmodifiableConfig);
httpMaxRequests = builder
.comment("""

View File

@@ -15,17 +15,17 @@ import java.util.function.Function;
* A custom version of {@link ShapedRecipe}, which can be converted to and from a {@link ShapedRecipeSpec}.
*/
public abstract class CustomShapedRecipe extends ShapedRecipe {
private final ShapedRecipePattern pattern;
private final ShapedRecipePattern shapedPattern;
private final ItemStack result;
public CustomShapedRecipe(ShapedRecipeSpec recipe) {
super(recipe.properties().group(), recipe.properties().category(), recipe.pattern(), recipe.result(), recipe.properties().showNotification());
this.pattern = recipe.pattern();
this.shapedPattern = recipe.pattern();
this.result = recipe.result();
}
public final ShapedRecipeSpec toSpec() {
return new ShapedRecipeSpec(RecipeProperties.of(this), pattern, result);
return new ShapedRecipeSpec(RecipeProperties.of(this), shapedPattern, result);
}
@Override