Skip to content

Commit

Permalink
Update: 1.20.3-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
Wesley1808 committed Nov 30, 2023
1 parent 74b0c46 commit 1574c6d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 44 deletions.
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'io.github.juuxel.loom-vineflower' version '1.11.0'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -42,10 +41,6 @@ dependencies {

// Vanish
modCompileOnly("maven.modrinth:vanish:${project.vanish_version}")

// Mixin Extras
implementation(include("com.github.LlamaLad7:MixinExtras:${mixin_extras}"))
annotationProcessor("com.github.LlamaLad7:MixinExtras:${mixin_extras}")
}

processResources {
Expand Down
15 changes: 7 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
org.gradle.jvmargs=-Xmx2G

# Fabric Properties
minecraft_version=1.20.2
loader_version=0.14.22
minecraft_version=1.20.3-rc1
loader_version=0.15.0

# Mod Properties
mod_version=1.3
mod_version=1.4
maven_group=me.wesley1808
archives_base_name=advancedchat

# API dependencies
fabric_version=0.89.0+1.20.2
placeholder_api_version=2.2.0+1.20.2
fabric_version=0.91.1+1.20.3
placeholder_api_version=2.3.0+1.20.3
playerdata_api_version=0.3.0+1.20.2
predicate_api_version=0.3.0+1.20.2
permission_api_version=0.2-SNAPSHOT
permission_api_version=0.3-SNAPSHOT

# Other dependencies
styledchat_version=2.3.0+1.20.2
vanish_version=1.4.2+1.20
mixin_extras=0.1.1
vanish_version=1.4.3+1.20.2
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-8.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
@@ -1,8 +1,6 @@
package me.wesley1808.advancedchat.impl.predicates;

import com.google.gson.JsonElement;
import com.mojang.datafixers.util.Pair;
import com.mojang.serialization.*;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import eu.pb4.predicate.api.PredicateResult;
import me.wesley1808.advancedchat.api.AbstractChatPredicate;
Expand All @@ -11,12 +9,10 @@
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.phys.Vec3;

import java.util.Optional;

public class CustomDistancePredicate extends AbstractChatPredicate {
public static final ResourceLocation ID = new ResourceLocation("advancedchat", "distance");
public static final MapCodec<CustomDistancePredicate> CODEC = RecordCodecBuilder.mapCodec(instance -> instance
.group(DistancePredicateCodec.INSTANCE.fieldOf("value").forGetter((inst) -> inst.predicate))
.group(DistancePredicate.CODEC.fieldOf("value").forGetter((inst) -> inst.predicate))
.apply(instance, CustomDistancePredicate::new)
);

Expand All @@ -33,25 +29,4 @@ public PredicateResult<?> test(ServerPlayer sender, ServerPlayer target) {
Vec3 pos2 = target.position();
return PredicateResult.ofBoolean(sender.level() == target.level() && this.predicate.matches(pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z));
}

private static class DistancePredicateCodec implements Codec<DistancePredicate> {
private static final DistancePredicateCodec INSTANCE = new DistancePredicateCodec();

@Override
public <T> DataResult<Pair<DistancePredicate, T>> decode(DynamicOps<T> ops, T input) {
Optional<DistancePredicate> optional = DistancePredicate.fromJson(input instanceof JsonElement jsonElement ? jsonElement : ops.convertTo(JsonOps.INSTANCE, input));
if (optional.isPresent()) {
return DataResult.success(new Pair<>(optional.get(), input));
} else {
return DataResult.error(() -> "Distance predicate JSON object is null");
}
}

@Override
public <T> DataResult<T> encode(DistancePredicate input, DynamicOps<T> ops, T prefix) {
// noinspection unchecked
T encoded = ops instanceof JsonOps ? (T) input.serializeToJson() : JsonOps.INSTANCE.convertTo(ops, input.serializeToJson());
return ops.getMap(encoded).flatMap(map -> ops.mergeToMap(prefix, map));
}
}
}
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"advancedchat.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.18",
"minecraft": ">=1.20"
"fabricloader": ">=0.15.0",
"minecraft": ">=1.20.3-"
},
"suggests": {
"styledchat": "*"
Expand Down

0 comments on commit 1574c6d

Please sign in to comment.