Advertisement
TNT_Block

bugitem

Apr 17th, 2019
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. package de.TNT_Block_Unkown.commands.list;
  2.  
  3. import de.TNT_Block_Unkown.commands.Command;
  4. import net.minecraft.client.Minecraft;
  5. import net.minecraft.item.Item;
  6. import net.minecraft.item.ItemStack;
  7. import net.minecraft.nbt.NBTTagCompound;
  8. import net.minecraft.nbt.NBTTagList;
  9. import net.minecraft.network.play.client.C10PacketCreativeInventoryAction;
  10. import net.minecraft.util.ResourceLocation;
  11.  
  12. public class BugItem extends Command{
  13.  
  14. public BugItem() {
  15. super("bugitem", "man glitch durch den boden lol");
  16. // TODO Auto-generated constructor stub
  17. }
  18.  
  19. @Override
  20. public void onBefehl(String[] args) {
  21. String block = args[0];
  22. Item crashitem = getItem(new ResourceLocation(block));
  23.  
  24.  
  25. //itemstack
  26. ItemStack itm = new ItemStack(crashitem);
  27. //hide flags
  28. NBTTagCompound base = new NBTTagCompound();
  29. base.setByte("HideFlags", (byte) 63);
  30. //glitchtag
  31. NBTTagList attributeModifiers = new NBTTagList();
  32.  
  33. NBTTagCompound glitch = new NBTTagCompound();
  34. glitch.setDouble("Amount", Double.NaN);
  35. glitch.setString("AttributeName", "generic.movementSpeed");
  36. glitch.setString("Name", "GetRektM8");
  37. glitch.setInteger("Operation", 0);
  38. glitch.setString("Slot", "mainhand");
  39. glitch.setInteger("UUIDLeast", 1);
  40. glitch.setInteger("UUIDMost", 1);
  41. //set tags
  42. attributeModifiers.appendTag(glitch);
  43. base.setTag("AttributeModifiers",attributeModifiers);
  44. itm.setTagCompound(base);
  45. giveItem(itm);
  46.  
  47. }
  48. public static Item getItem(ResourceLocation loc) {
  49. return (Item)Item.itemRegistry.getObject(loc);
  50. }
  51. public static void giveItem(ItemStack stack) {
  52. Integer errorint = 0;
  53. for (int i = 0; i < 9; i++) {
  54. if (Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(i) == null)
  55. {
  56. Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C10PacketCreativeInventoryAction(36 + i, stack));
  57. return;
  58. }else {
  59. if (errorint==8) {
  60. sendMessage("Bitte mache deine Schnellzugriffsleiste frei!");
  61.  
  62. }else {
  63. errorint = errorint + 1;
  64. }
  65.  
  66. }
  67. }
  68. }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement