Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Made books less powerful, though you should still read them!

  • Loading branch information...
commit 040961ac14ed628f60c3e75e5ade3b4f5995a63f 1 parent 06c9f8a
Warren authored October 27, 2012
10  src/main/java/net/minecraft/server/ItemStack.java
@@ -329,4 +329,14 @@ public void addEnchantment(Enchantment enchantment, int i) {
329 329
     public boolean hasEnchantments() {
330 330
         return this.tag != null && this.tag.hasKey("ench");
331 331
     }
  332
+
  333
+    // CraftBukkit start - temporary method for book fix
  334
+    public void a(String s, NBTBase nbtbase) {
  335
+        if (this.tag == null) {
  336
+            this.setTag(new NBTTagCompound());
  337
+        }
  338
+
  339
+        this.tag.set(s, nbtbase);
  340
+    }
  341
+    // CraftBukkit end
332 342
 }
6  src/main/java/net/minecraft/server/NetServerHandler.java
@@ -1426,7 +1426,11 @@ public void a(Packet250CustomPayload packet250custompayload) {
1426 1426
 
1427 1427
                 itemstack1 = this.player.inventory.getItemInHand();
1428 1428
                 if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) {
1429  
-                    itemstack1.setTag(itemstack.getTag());
  1429
+                    // CraftBukkit start
  1430
+                    itemstack1.a("author", new NBTTagString("author", this.player.name));
  1431
+                    itemstack1.a("title", new NBTTagString("title", itemstack.getTag().getString("title")));
  1432
+                    itemstack1.a("pages", itemstack.getTag().getList("pages"));
  1433
+                    // CraftBukkit end
1430 1434
                     itemstack1.id = Item.WRITTEN_BOOK.id;
1431 1435
                 }
1432 1436
             } catch (Exception exception1) {

3 notes on commit 040961a

worstboy32

Thanks a lot seph for fixing this :)

Starbuck Johnson

Thanks good job. Although i loved the powerful books :)

Please sign in to comment.
Something went wrong with that request. Please try again.