flewkey
/
mc.2a03.party
Archived
1
0
Fork 0

Add /hat command

This commit is contained in:
Ryan Fox (flewkey) 2019-12-30 03:17:48 +00:00 committed by Ryan Fox
parent ac81dc1e18
commit 99369dc8f3
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 28 additions and 2 deletions

View File

@ -1,21 +1,23 @@
--- a/net/minecraft/command/Commands.java
+++ b/net/minecraft/command/Commands.java
@@ -96,6 +96,9 @@
@@ -96,6 +96,10 @@
import net.minecraft.util.text.event.HoverEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import party._2a03.mc.command.SpawnCommand; //Patched
+import party._2a03.mc.command.HomeCommand; //Patched
+import party._2a03.mc.command.HatCommand; //Patched
+import party._2a03.mc.command.ConfigCommand; //Patched
public class Commands {
private static final Logger field_197061_a = LogManager.getLogger();
@@ -156,6 +159,9 @@
@@ -156,6 +160,10 @@
TriggerCommand.func_198852_a(this.field_197062_b);
WeatherCommand.func_198862_a(this.field_197062_b);
WorldBorderCommand.func_198894_a(this.field_197062_b);
+ SpawnCommand.register(this.field_197062_b); //Patched
+ HomeCommand.register(this.field_197062_b); //Patched
+ HatCommand.register(this.field_197062_b); //Patched
+ ConfigCommand.register(this.field_197062_b); //Patched
if (SharedConstants.field_206244_b) {
TestCommand.func_229613_a_(this.field_197062_b);

View File

@ -0,0 +1,24 @@
package party._2a03.mc.command;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TranslationTextComponent;
public class HatCommand {
public static void register(CommandDispatcher<CommandSource> dispatcher) {
dispatcher.register(Commands.func_197057_a("hat").executes((source) -> {
ServerPlayerEntity serverplayerentity = source.getSource().func_197035_h();
ItemStack mainhand = serverplayerentity.func_184582_a(EquipmentSlotType.MAINHAND);
ItemStack head = serverplayerentity.func_184582_a(EquipmentSlotType.HEAD);
serverplayerentity.func_184201_a(EquipmentSlotType.MAINHAND, head);
serverplayerentity.func_184201_a(EquipmentSlotType.HEAD, mainhand);
source.getSource().func_197030_a(new TranslationTextComponent("Swapped items between main hand and head"), true);
return 1;
}));
}
}