-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
113 additions
and
33 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
...rc/main/java/fr/denisd3d/mc2discord/minecraft/mixin/CommandFunctionCommandEntryMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fr.denisd3d.mc2discord.minecraft.mixin; | ||
|
||
import com.mojang.brigadier.ParseResults; | ||
import fr.denisd3d.mc2discord.minecraft.Mc2DiscordMinecraft; | ||
import net.minecraft.commands.CommandFunction; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.server.ServerFunctionManager; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(CommandFunction.CommandEntry.class) | ||
public class CommandFunctionCommandEntryMixin { | ||
@Final | ||
@Shadow | ||
private ParseResults<CommandSourceStack> parse; | ||
|
||
@Inject(method = "execute(Lnet/minecraft/server/ServerFunctionManager;Lnet/minecraft/commands/CommandSourceStack;)I", at = @At("HEAD")) | ||
private void execute(ServerFunctionManager pFunctionManager, CommandSourceStack pSource, CallbackInfoReturnable<Integer> cir) { | ||
Mc2DiscordMinecraft.onCommand(new ParseResults<>(this.parse.getContext().withSource(pSource), this.parse.getReader(), this.parse.getExceptions())); | ||
} | ||
} |
23 changes: 12 additions & 11 deletions
23
mc2discord-1.18.x/common/src/main/resources/mc2discord.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"CommandFunctionCommandEntryMixin", | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
...rc/main/java/fr/denisd3d/mc2discord/minecraft/mixin/CommandFunctionCommandEntryMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package fr.denisd3d.mc2discord.minecraft.mixin; | ||
|
||
import com.mojang.brigadier.ParseResults; | ||
import fr.denisd3d.mc2discord.minecraft.Mc2DiscordMinecraft; | ||
import net.minecraft.commands.CommandFunction; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
import net.minecraft.server.ServerFunctionManager; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(CommandFunction.CommandEntry.class) | ||
public class CommandFunctionCommandEntryMixin { | ||
@Final | ||
@Shadow | ||
private ParseResults<CommandSourceStack> parse; | ||
|
||
@Inject(method = "execute(Lnet/minecraft/server/ServerFunctionManager;Lnet/minecraft/commands/CommandSourceStack;)I", at = @At("HEAD")) | ||
private void execute(ServerFunctionManager pFunctionManager, CommandSourceStack pSource, CallbackInfoReturnable<Integer> cir) { | ||
Mc2DiscordMinecraft.onCommand(Commands.mapSource(this.parse, (ignored) -> pSource)); | ||
} | ||
} |
23 changes: 12 additions & 11 deletions
23
mc2discord-1.19.x/common/src/main/resources/mc2discord.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"CommandFunctionCommandEntryMixin", | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} | ||
|
26 changes: 26 additions & 0 deletions
26
...rc/main/java/fr/denisd3d/mc2discord/minecraft/mixin/CommandFunctionCommandEntryMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package fr.denisd3d.mc2discord.minecraft.mixin; | ||
|
||
import com.mojang.brigadier.ParseResults; | ||
import fr.denisd3d.mc2discord.minecraft.Mc2DiscordMinecraft; | ||
import net.minecraft.commands.CommandFunction; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
import net.minecraft.server.ServerFunctionManager; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(CommandFunction.CommandEntry.class) | ||
public class CommandFunctionCommandEntryMixin { | ||
@Final | ||
@Shadow | ||
private ParseResults<CommandSourceStack> parse; | ||
|
||
@Inject(method = "execute(Lnet/minecraft/server/ServerFunctionManager;Lnet/minecraft/commands/CommandSourceStack;)I", at = @At("HEAD")) | ||
private void execute(ServerFunctionManager pFunctionManager, CommandSourceStack pSource, CallbackInfoReturnable<Integer> cir) { | ||
Mc2DiscordMinecraft.onCommand(Commands.mapSource(this.parse, (ignored) -> pSource)); | ||
} | ||
} |
23 changes: 12 additions & 11 deletions
23
mc2discord-1.20.x/common/src/main/resources/mc2discord.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
"required": true, | ||
"minVersion": "0.8", | ||
"package": "fr.denisd3d.mc2discord.minecraft.mixin", | ||
"compatibilityLevel": "JAVA_17", | ||
"refmap": "${modId}.refmap.json", | ||
"mixins": [ | ||
"CommandFunctionCommandEntryMixin", | ||
"PlayerListMixin" | ||
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} | ||
|