add ReloadCommandMixin

This commit is contained in:
dfsek 2022-06-04 01:15:53 -07:00
parent f870dab568
commit b4bee3a65d
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.dfsek.terra.fabric.mixin;
import com.dfsek.terra.fabric.FabricEntryPoint;
import net.minecraft.server.command.ReloadCommand;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.text.Text;
import org.checkerframework.checker.units.qual.A;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Collection;
@Mixin(ReloadCommand.class)
public class ReloadCommandMixin {
@Inject(method = "tryReloadDataPacks", at = @At("HEAD"))
private static void inject(Collection<String> dataPacks, ServerCommandSource source, CallbackInfo ci) {
source.sendFeedback(Text.literal("Reloading Terra..."), true);
FabricEntryPoint.getPlatform().reload();
source.sendFeedback(Text.literal("Done."), true);
}
}

View File

@ -4,6 +4,7 @@
"package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"ReloadCommandMixin",
"access.MobSpawnerLogicAccessor",
"access.StateAccessor",
"access.StructureAccessorAccessor",