Advertisement
TNT_Block

BanArmorStand xD

Jun 10th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. package de.tnt_block_unkown.tntmod.commands.list;
  2.  
  3. import java.awt.Color;
  4. import java.util.Random;
  5.  
  6. import de.tnt_block_unkown.tntmod.commands.Command;
  7. import de.tnt_block_unkown.tntmod.main.TNTMod;
  8. import net.minecraft.init.Items;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.nbt.NBTTagCompound;
  11. import net.minecraft.nbt.NBTTagList;
  12.  
  13. public class ArmorStandKick extends Command {
  14.  
  15. public ArmorStandKick() {
  16. super(new String[] { "ArmorStandKick", "KickArmorStand" }, null,
  17. "gibt dir einen ArmorStand der dich immer kickt!");
  18. }
  19.  
  20. public static int generateCrashColor() {
  21. Random randomGenerator = new Random();
  22. int red = randomGenerator.nextInt(255);
  23. int green = randomGenerator.nextInt(255);
  24. int blue = randomGenerator.nextInt(255);
  25. Color randomColour = new Color(red, green, blue);
  26. return randomColour.getRGB();
  27. }
  28.  
  29. @Override
  30. public void onCommand(String[] args) {
  31. if (mc.thePlayer.capabilities.isCreativeMode) {
  32. ItemStack itm = new ItemStack(Items.armor_stand, 1, 0);
  33.  
  34. NBTTagCompound base = new NBTTagCompound();
  35. base.setByte("HideFlags", (byte) 63);
  36.  
  37. NBTTagCompound entityTag = new NBTTagCompound();
  38. entityTag.setInteger("Invulnerable", 1);
  39. entityTag.setInteger("NoBasePlate", 1);
  40. entityTag.setInteger("NoGravity", 1);
  41. entityTag.setInteger("ShowArms", 1);
  42.  
  43. NBTTagCompound crashdisplay = new NBTTagCompound();
  44. crashdisplay.setInteger("color", generateCrashColor());
  45.  
  46. NBTTagCompound crashTag = new NBTTagCompound();
  47. crashTag.setTag("display", crashdisplay);
  48.  
  49. NBTTagList equipment = new NBTTagList();
  50. equipment.appendTag(new NBTTagCompound());
  51.  
  52. NBTTagCompound foot = new NBTTagCompound();
  53. foot.setString("id", "leather_boots");
  54. foot.setInteger("Count", 1);
  55. foot.setTag("tag", crashTag);
  56.  
  57. NBTTagCompound leggings = new NBTTagCompound();
  58. leggings.setString("id", "leather_leggings");
  59. leggings.setInteger("Count", 1);
  60. leggings.setTag("tag", crashTag);
  61.  
  62. NBTTagCompound chestplate = new NBTTagCompound();
  63. chestplate.setString("id", "leather_chestplate");
  64. chestplate.setInteger("Count", 1);
  65. chestplate.setTag("tag", crashTag);
  66.  
  67. NBTTagCompound head = new NBTTagCompound();
  68. head.setString("id", "leather_helmet");
  69. head.setInteger("Count", 1);
  70. head.setTag("tag", crashTag);
  71.  
  72. equipment.appendTag(foot);
  73. equipment.appendTag(leggings);
  74. equipment.appendTag(chestplate);
  75. equipment.appendTag(head);
  76.  
  77. entityTag.setTag("Equipment", equipment);
  78. base.setTag("EntityTag", entityTag);
  79. itm.setTagCompound(base);
  80. TNTMod.giveItem(itm);
  81. TNTMod.addMessage("Du hast den KickArmorStand erhalten!");
  82. } else {
  83. TNTMod.addMessage("Du musst im Kreativmodus sein!");
  84. }
  85. }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement