Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package de.tnt_block_unkown.tntmod.commands.list;
- import java.awt.Color;
- import java.util.Random;
- import de.tnt_block_unkown.tntmod.commands.Command;
- import de.tnt_block_unkown.tntmod.main.TNTMod;
- import net.minecraft.init.Items;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.nbt.NBTTagList;
- public class ArmorStandKick extends Command {
- public ArmorStandKick() {
- super(new String[] { "ArmorStandKick", "KickArmorStand" }, null,
- "gibt dir einen ArmorStand der dich immer kickt!");
- }
- public static int generateCrashColor() {
- Random randomGenerator = new Random();
- int red = randomGenerator.nextInt(255);
- int green = randomGenerator.nextInt(255);
- int blue = randomGenerator.nextInt(255);
- Color randomColour = new Color(red, green, blue);
- return randomColour.getRGB();
- }
- @Override
- public void onCommand(String[] args) {
- if (mc.thePlayer.capabilities.isCreativeMode) {
- ItemStack itm = new ItemStack(Items.armor_stand, 1, 0);
- NBTTagCompound base = new NBTTagCompound();
- base.setByte("HideFlags", (byte) 63);
- NBTTagCompound entityTag = new NBTTagCompound();
- entityTag.setInteger("Invulnerable", 1);
- entityTag.setInteger("NoBasePlate", 1);
- entityTag.setInteger("NoGravity", 1);
- entityTag.setInteger("ShowArms", 1);
- NBTTagCompound crashdisplay = new NBTTagCompound();
- crashdisplay.setInteger("color", generateCrashColor());
- NBTTagCompound crashTag = new NBTTagCompound();
- crashTag.setTag("display", crashdisplay);
- NBTTagList equipment = new NBTTagList();
- equipment.appendTag(new NBTTagCompound());
- NBTTagCompound foot = new NBTTagCompound();
- foot.setString("id", "leather_boots");
- foot.setInteger("Count", 1);
- foot.setTag("tag", crashTag);
- NBTTagCompound leggings = new NBTTagCompound();
- leggings.setString("id", "leather_leggings");
- leggings.setInteger("Count", 1);
- leggings.setTag("tag", crashTag);
- NBTTagCompound chestplate = new NBTTagCompound();
- chestplate.setString("id", "leather_chestplate");
- chestplate.setInteger("Count", 1);
- chestplate.setTag("tag", crashTag);
- NBTTagCompound head = new NBTTagCompound();
- head.setString("id", "leather_helmet");
- head.setInteger("Count", 1);
- head.setTag("tag", crashTag);
- equipment.appendTag(foot);
- equipment.appendTag(leggings);
- equipment.appendTag(chestplate);
- equipment.appendTag(head);
- entityTag.setTag("Equipment", equipment);
- base.setTag("EntityTag", entityTag);
- itm.setTagCompound(base);
- TNTMod.giveItem(itm);
- TNTMod.addMessage("Du hast den KickArmorStand erhalten!");
- } else {
- TNTMod.addMessage("Du musst im Kreativmodus sein!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement