Fully remove scarpet commands when apps are unloaded (#1452)

Using new Loader 0.14+ features
This commit is contained in:
altrisi authored and GitHub committed 2022-10-02 13:32:27 +02:00
1 parent e9f1509a1d
commit f63c6acb05
7 files changed
+69 -3

No files matched your search

@@ -0,0 +1,22 @@
package carpet.mixins;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.tree.RootCommandNode;
import carpet.fakes.CommandDispatcherInterface;
import carpet.fakes.CommandNodeInterface;
@Mixin(CommandDispatcher.class)
public class CommandDispatcher_scarpetCommandsMixin<S> implements CommandDispatcherInterface {
@Shadow @Final
private RootCommandNode<S> root;
@Override
public void carpet$unregister(String node) {
((CommandNodeInterface)this.root).carpet$removeChild(node);
}
}