-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tsl): include metadata in DROP action
- Loading branch information
Showing
5 changed files
with
62 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
39 changes: 39 additions & 0 deletions
39
src/main/java/net/programmer/igoodie/twitchspawn/command/ItemDataCommand.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,39 @@ | ||
package net.programmer.igoodie.twitchspawn.command; | ||
|
||
import net.minecraft.command.CommandBase; | ||
import net.minecraft.command.CommandException; | ||
import net.minecraft.command.ICommandSender; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.server.MinecraftServer; | ||
|
||
public class ItemDataCommand extends CommandBase { | ||
|
||
@Override | ||
public String getName() { | ||
return "itemdata"; | ||
} | ||
|
||
@Override | ||
public String getUsage(ICommandSender sender) { | ||
return "/itemdata"; | ||
} | ||
|
||
/* ------------------------------------------------- */ | ||
|
||
@Override | ||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { | ||
if (!(sender instanceof EntityPlayerMP)) { | ||
System.out.printf("Sender's type is a(n) %s\n", sender.getClass().getSimpleName()); | ||
return; | ||
} | ||
|
||
EntityPlayerMP player = (EntityPlayerMP) sender.getCommandSenderEntity(); | ||
ItemStack heldItemstack = player.inventory.mainInventory.get(player.inventory.currentItem); | ||
|
||
System.out.printf("Holding: %s, %s\n", | ||
heldItemstack.getDisplayName(), | ||
heldItemstack.serializeNBT()); | ||
} | ||
|
||
} |
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