Update command registration API to reflect 1.19 vanilla changes (#2227)

* Update command registration API to reflect vanilla changes

* Allow module versions in impl+mixin packages

* Use v2 module, keeping v1 for server commands at least

* update, address review

Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
Player
2022-05-20 17:39:10 +00:00
committed by GitHub
parent 51821d6d14
commit f71b366fb1
47 changed files with 209 additions and 85 deletions

View File

@@ -6,7 +6,7 @@ moduleDependencies(project, [
])
dependencies {
testmodImplementation project(path: ':fabric-command-api-v1', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-command-api-v2', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-networking-api-v1', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-registry-sync-v0', configuration: 'namedElements')
testmodImplementation project(path: ':fabric-rendering-v1', configuration: 'namedElements')

View File

@@ -40,7 +40,7 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.EntityElytraEvents;
import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityCombatEvents;
@@ -169,7 +169,7 @@ public final class EntityEventTests implements ModInitializer {
return wakeUpPos;
});
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> {
dispatcher.register(CommandManager.literal("addsleeptestwools").executes(context -> {
addSleepWools(context.getSource().getPlayer());
return 0;

View File

@@ -7,7 +7,7 @@
"license": "Apache-2.0",
"depends": {
"fabric-entity-events-v1": "*",
"fabric-command-api-v1": "*",
"fabric-command-api-v2": "*",
"fabric-registry-sync-v0": "*"
},
"entrypoints": {