Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mod to 1.20.4 #363

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4526096
In the push to update the mod to 1.20.4, the gradle.properties, build…
maghedo243 Dec 30, 2023
2830e71
Merge pull request #340 from maghedo243/rewrite
RUGMJ Dec 30, 2023
f747d7f
Deleted oldSrc
maghedo243 Dec 30, 2023
e9fcbca
Merge pull request #341 from maghedo243/rewrite
maghedo243 Dec 30, 2023
9c96550
AbstractFeature and a few related classes were updated based on Fabri…
maghedo243 Dec 31, 2023
dc84b76
Mistakenly deleted the resources folder with oldSrc, added back.
maghedo243 Dec 31, 2023
610719a
Merge remote-tracking branch 'origin/rewrite' into rewrite
maghedo243 Dec 31, 2023
94b59a5
Merge pull request #342 from maghedo243/rewrite
maghedo243 Dec 31, 2023
af6f921
adds registry access to CommandFeature
RUGMJ Dec 31, 2023
f2401b4
fixes block state argument serialiser
RUGMJ Dec 31, 2023
43c21b8
updates blockreadfeature
RUGMJ Dec 31, 2023
198d1c8
Merge pull request #343 from RUGMJ/rewrite
RUGMJ Dec 31, 2023
087b033
updates command sender in commandfeature
RUGMJ Dec 31, 2023
09b258d
Merge pull request #344 from RUGMJ/rewrite
RUGMJ Dec 31, 2023
f71fc09
removes weird import leftover from mappings updater
RUGMJ Dec 31, 2023
f888132
Merge pull request #345 from RUGMJ/rewrite
RUGMJ Dec 31, 2023
3ebf2ee
removes all weird imports left over
RUGMJ Dec 31, 2023
c21fa40
Merge pull request #346 from RUGMJ/rewrite
RUGMJ Dec 31, 2023
181d951
updates all utils
RUGMJ Dec 31, 2023
9d01295
Merge pull request #347 from RUGMJ/rewrite
RUGMJ Dec 31, 2023
5abac36
Deleted random ununsed imports and fixed all the LiteralText erros (n…
maghedo243 Dec 31, 2023
a373cd6
Merge branch 'rewrite' into rewrite
maghedo243 Dec 31, 2023
885d694
Merge pull request #348 from maghedo243/rewrite
maghedo243 Dec 31, 2023
a71f625
fixes some ui stuff
RUGMJ Jan 2, 2024
d1c5fdb
Merge pull request #349 from RUGMJ/rewrite
RUGMJ Jan 2, 2024
781f44b
fixes mixins and player.sendChatMessage
RUGMJ Jan 2, 2024
b97bf84
Merge pull request #350 from RUGMJ/rewrite
RUGMJ Jan 2, 2024
4752d7e
fixes various errors
RUGMJ Jan 2, 2024
fb2bf3f
Merge branch 'rewrite' of https://github.com/RUGMJ/rstools into rewrite
RUGMJ Jan 2, 2024
6e300a5
Merge pull request #351 from RUGMJ/rewrite
RUGMJ Jan 2, 2024
cc6724b
Fixed all the GUI errors
maghedo243 Jan 4, 2024
09dbb75
Merge pull request #352 from maghedo243/rewrite
maghedo243 Jan 4, 2024
3ea9fb7
reverts itembindmixin
RUGMJ Jan 4, 2024
61cdc1d
fixes CommandException errors
RUGMJ Jan 4, 2024
1428035
Merge pull request #353 from RUGMJ/rewrite
RUGMJ Jan 4, 2024
ced8b64
defines required interfaces for argument rewrite
RUGMJ Jan 6, 2024
64a7d47
Merge pull request #356 from RUGMJ/rewrite
RUGMJ Jan 6, 2024
10d9b82
Worked on switching some Serializer classes to ArgumentType classes a…
maghedo243 Jan 10, 2024
bf78b18
Merge pull request #357 from maghedo243/rewrite
maghedo243 Jan 10, 2024
3c4590a
implements the serializer for all remaining serializers and registers…
RUGMJ Jan 20, 2024
6a453ad
Merge pull request #358 from RUGMJ/rewrite
RUGMJ Jan 20, 2024
45a6f0b
fixes item bind
RUGMJ Jan 21, 2024
f0f04d7
Merge pull request #359 from RUGMJ/rewrite
RUGMJ Jan 21, 2024
09ff753
fix: updates the command suggestor mixin
RUGMJ Jan 23, 2024
ecc4e85
Merge pull request #361 from RUGMJ/rewrite
RUGMJ Jan 23, 2024
5379733
Ported macro GUI
MiranCZ Jan 26, 2024
09f0109
Merge pull request #362 from MiranCZ/rewrite
MiranCZ Jan 26, 2024
e9a5dd8
Discard changes to .factorypath
RUGMJ Jan 27, 2024
c1c3a03
includes javaassist
RUGMJ Jan 28, 2024
3f39e1d
Merge pull request #364 from RUGMJ/rewrite
RUGMJ Jan 28, 2024
8dd9edb
Use AutoService to detect Serializers, remove dependency on reflectio…
xtrm-en Jan 28, 2024
874c8f9
Merge pull request #365 from xtrm-en/rewrite
RUGMJ Jan 28, 2024
5584f6a
🐛 fix(ReflectionUtils): don't crash lol
xtrm-en Jan 28, 2024
4ddb177
Merge pull request #366 from xtrm-en/rewrite
RUGMJ Jan 28, 2024
995f8aa
fixes mod version
RUGMJ Jan 28, 2024
1673146
Merge pull request #367 from RUGMJ/rewrite
RUGMJ Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//file:noinspection GroovyAssignabilityCheck

plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.+'
}
Expand Down Expand Up @@ -50,7 +50,7 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")

// Worldedit API
modImplementation("com.sk89q.worldedit:worldedit-fabric-mc1.18.2:7.2.10")
modImplementation("com.sk89q.worldedit:worldedit-fabric-mc1.20.4:7.2.18-SNAPSHOT")
}

processResources {
Expand Down Expand Up @@ -102,4 +102,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.4
loader_version=0.14.6
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.3

# Mod Properties
mod_version = 1.18.2-2.0.0
mod_version = 1.20.4-2.0.0
maven_group = tools.redstone
archives_base_name = redstonetools

# Dependencies
fabric_version=0.53.0+1.18.2
fabric_version=0.92.0+1.20.4
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.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
package tools.redstone.redstonetools;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.command.v2.ArgumentTypeRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.command.argument.serialize.ArgumentSerializer;
import net.minecraft.util.Identifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rip.hippo.inject.Doctor;
import rip.hippo.inject.Injector;
import tools.redstone.redstonetools.utils.DependencyLookup;
import tools.redstone.redstonetools.utils.ReflectionUtils;

import java.lang.reflect.InvocationTargetException;
import java.nio.file.Path;

public class RedstoneToolsClient implements ClientModInitializer {

public static final String MOD_ID = "redstonetools";
public static final String MOD_VERSION = "v" + FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata().getVersion().getFriendlyString();
public static final String MOD_VERSION = "v" + FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow()
.getMetadata().getVersion().getFriendlyString();
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static final Path CONFIG_DIR = FabricLoader.getInstance().getConfigDir().resolve("redstonetools");
public static final Injector INJECTOR = Doctor.createInjector(ReflectionUtils.getModules());
Expand All @@ -27,12 +31,41 @@ public void onInitializeClient() {
// Register game rules
RedstoneToolsGameRules.register();

// Register arguments
ReflectionUtils.getAllArguments().forEach(argument -> {
var nestedClasses = (Class<ArgumentSerializer>[]) argument
.getDeclaredClasses();

if (nestedClasses.length == 0) {
LOGGER.error("Failed to register {} because no serializer nested class was found",
argument.getSimpleName());
return;
}

Identifier id = new Identifier(MOD_ID, argument.getSimpleName().toLowerCase());

try {
var serializer = nestedClasses[0].getDeclaredConstructor().newInstance();

ArgumentTypeRegistry.registerArgumentType(
id,
argument, serializer);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
LOGGER.error("Failed to register argument type {}. Skipping registration.",
argument.getName());
}
});

// Register features
ReflectionUtils.getFeatures().forEach(feature -> {
ReflectionUtils.getFeatures().forEach(feature ->

{
LOGGER.trace("Registering feature {}", feature.getClass().getName());

if (feature.requiresWorldEdit() && !DependencyLookup.WORLDEDIT_PRESENT) {
LOGGER.warn("Feature {} requires WorldEdit, but WorldEdit is not loaded. Skipping registration.", feature.getName());
LOGGER.warn("Feature {} requires WorldEdit, but WorldEdit is not loaded. Skipping registration.",
feature.getName());
return;
}
feature.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.auto.service.AutoService;
import rip.hippo.inject.DoctorModule;
import rip.hippo.inject.binding.Binder;
import tools.redstone.redstonetools.features.AbstractFeature;
import tools.redstone.redstonetools.utils.ReflectionUtils;

@AutoService(DoctorModule.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package tools.redstone.redstonetools.features;

import com.mojang.brigadier.CommandDispatcher;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.server.command.CommandManager.RegistrationEnvironment;
import net.minecraft.server.command.ServerCommandSource;

public abstract class AbstractFeature {
Expand Down Expand Up @@ -55,6 +57,6 @@ public void register() {
CommandRegistrationCallback.EVENT.register(this::registerCommands);
}

protected abstract void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated);
protected abstract void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, CommandRegistryAccess registryAccess, RegistrationEnvironment environment);

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package tools.redstone.redstonetools.features.arguments;

import tools.redstone.redstonetools.features.arguments.serializers.TypeSerializer;
import tools.redstone.redstonetools.features.arguments.serializers.GenericArgumentType;
import com.mojang.brigadier.context.CommandContext;

public class Argument<T> {
private String name;
private final TypeSerializer<T, ?> type;
private final GenericArgumentType<T, ?> type;
private boolean optional = false;
private volatile T value;
private T defaultValue;

private Argument(TypeSerializer<T, ?> type) {
private Argument(GenericArgumentType<T, ?> type) {
this.type = type;
}

public static <T> Argument<T> ofType(TypeSerializer<T, ?> type) {
public static <T> Argument<T> ofType(GenericArgumentType<T, ?> type) {
return new Argument<>(type);
}

Expand Down Expand Up @@ -48,7 +48,7 @@ public String getName() {
return name;
}

public TypeSerializer<T, ?> getType() {
public GenericArgumentType<T, ?> getType() {
return type;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package tools.redstone.redstonetools.features.arguments.serializers;

import com.google.auto.service.AutoService;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.argument.serialize.ArgumentSerializer;

import java.math.BigInteger;
import java.util.Optional;

@AutoService(GenericArgumentType.class)
public class BigIntegerArgumentType extends IntLikeArgumentType<BigInteger> {
private static final BigIntegerArgumentType INSTANCE = new BigIntegerArgumentType(null, null);

public static BigIntegerArgumentType bigInteger() {
return INSTANCE;
}

public static BigIntegerArgumentType bigInteger(BigInteger min) {
return new BigIntegerArgumentType(min, null);
}

public static BigIntegerArgumentType bigInteger(BigInteger min, BigInteger max) {
return new BigIntegerArgumentType(min, max);
}

private BigIntegerArgumentType(BigInteger min, BigInteger max) {
super(BigInteger.class, min, max);

}

@Override
protected Optional<BigInteger> tryParseOptional(String string, int radix) {
try {
return Optional.of(new BigInteger(string, radix));
} catch (NumberFormatException ignored) {
return Optional.empty();
}
}

public static class BigIntegerSerializer extends Serializer<BigIntegerArgumentType, ArgumentSerializer.ArgumentTypeProperties<BigIntegerArgumentType>>{

@Override
public ArgumentTypeProperties<BigIntegerArgumentType> getArgumentTypeProperties(BigIntegerArgumentType argumentType) {
return new Properties(argumentType.max,argumentType.min);
}

public final class Properties
implements ArgumentSerializer.ArgumentTypeProperties<BigIntegerArgumentType>{
final BigInteger max, min;

public Properties(BigInteger max, BigInteger min) {
this.max = max;
this.min = min;
}

@Override
public BigIntegerArgumentType createType(CommandRegistryAccess commandRegistryAccess) {
return new BigIntegerArgumentType(this.max,this.min);
}

@Override
public ArgumentSerializer<BigIntegerArgumentType, ?> getSerializer() {
return BigIntegerSerializer.this;
}
}
}




}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package tools.redstone.redstonetools.features.arguments.serializers;

import com.google.auto.service.AutoService;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.argument.serialize.ArgumentSerializer;
import tools.redstone.redstonetools.utils.BlockColor;

@AutoService(GenericArgumentType.class)
public class BlockColorSerializer extends EnumSerializer<BlockColor> {
private static final BlockColorSerializer INSTANCE = new BlockColorSerializer();

Expand All @@ -12,4 +16,27 @@ private BlockColorSerializer() {
public static BlockColorSerializer blockColor() {
return INSTANCE;
}

public static class Serializer
extends GenericArgumentType.Serializer<BlockColorSerializer, Serializer.Properties> {

public final class Properties
implements ArgumentSerializer.ArgumentTypeProperties<BlockColorSerializer> {

@Override
public BlockColorSerializer createType(CommandRegistryAccess var1) {
return blockColor();
}

@Override
public ArgumentSerializer<BlockColorSerializer, ?> getSerializer() {
return new Serializer();
}
}

@Override
public Properties getArgumentTypeProperties(BlockColorSerializer var1) {
return new Properties();
}
}
}

This file was deleted.

Loading
Loading