Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.TNT_Block_Unkown.modules;
- import de.TNT_Block_Unkown.ChatManager;
- import de.TNT_Block_Unkown.Utils;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.JsonToNBT;
- import net.minecraft.util.ResourceLocation;
- public class give {
- public static void execute(String[] args) {
- if (args.length == 1) {
- ChatManager.addMessage("#give <Item> [<Anzahl>] [<Meta>] [<NBT>]");
- }else {
- if (args.length == 2) {
- ItemStack itm = new ItemStack(Utils.getItem(new ResourceLocation(args[1])));
- Utils.giveItem(itm);
- }else {
- if (args.length == 3) {
- ItemStack itm = new ItemStack(Utils.getItem(new ResourceLocation(args[1])),Integer.valueOf(args[2]));
- Utils.giveItem(itm);
- }else {
- if (args.length == 4) {
- ItemStack itm = new ItemStack(Utils.getItem(new ResourceLocation(args[1])),Integer.valueOf(args[2]),Integer.valueOf(args[3]));
- Utils.giveItem(itm);
- }else {
- if (args.length >= 5) {
- String nbt = "";
- for(int i = 4; i < args.length; i++) {
- nbt += args[i];
- if(i != args.length - 1) {
- nbt += " ";
- }
- }
- ItemStack itm = new ItemStack(Utils.getItem(new ResourceLocation(args[1])),Integer.valueOf(args[2]),Integer.valueOf(args[3]));
- try {
- itm.setTagCompound(JsonToNBT.func_180713_a(nbt));
- Utils.giveItem(itm);
- }catch (Exception e) {
- ChatManager.addMessage("Ungültige NBT-Daten!");
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement