[Bukkit Bug] Clear flower pots on drop so that they are not dropped twice.

Dieser Commit ist enthalten in:
md_5 2013-12-03 11:08:07 +11:00
Ursprung 4db9634b23
Commit dcb5fc4b1a
5 geänderte Dateien mit 233 neuen und 25 gelöschten Zeilen

@ -1 +1 @@
Subproject commit 68d0e5756b60bd53828fae1d6e3fb7335b1fded1
Subproject commit 378718ef2e56c541cf4b4cbff3b831ae1620190e

Datei anzeigen

@ -1,4 +1,4 @@
From 0439b094fea65440e752f067b26a77ff7acff240 Mon Sep 17 00:00:00 2001
From 820960f77326fbb326aeab226fc1a3859e3eb274 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 15:10:48 +1100
Subject: [PATCH] mc-dev imports
@ -119,6 +119,207 @@ index 0000000..3287d77
+ return Container.b((IInventory) world.getTileEntity(i, j, k));
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java
new file mode 100644
index 0000000..ef909f7
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java
@@ -0,0 +1,195 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockFlowerPot extends BlockContainer {
+
+ public BlockFlowerPot() {
+ super(Material.ORIENTABLE);
+ this.g();
+ }
+
+ public void g() {
+ float f = 0.375F;
+ float f1 = f / 2.0F;
+
+ this.a(0.5F - f1, 0.0F, 0.5F - f1, 0.5F + f1, f, 0.5F + f1);
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ public int b() {
+ return 33;
+ }
+
+ public boolean d() {
+ return false;
+ }
+
+ public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock) {
+ if (world.getData(i, j, k) != 0) {
+ return false;
+ } else {
+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k);
+
+ if (tileentityflowerpot != null) {
+ Block block = Block.a(itemstack.getItem());
+
+ if (!this.a(block, itemstack.getData())) {
+ return false;
+ } else {
+ tileentityflowerpot.a(itemstack.getItem(), itemstack.getData());
+ tileentityflowerpot.update();
+ if (!world.setData(i, j, k, itemstack.getData(), 2)) {
+ world.notify(i, j, k);
+ }
+
+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count <= 0) {
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
+ }
+
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ }
+
+ private boolean a(Block block, int i) {
+ return block != Blocks.YELLOW_FLOWER && block != Blocks.RED_ROSE && block != Blocks.CACTUS && block != Blocks.BROWN_MUSHROOM && block != Blocks.RED_MUSHROOM && block != Blocks.SAPLING && block != Blocks.DEAD_BUSH ? block == Blocks.LONG_GRASS && i == 2 : true;
+ }
+
+ public int getDropData(World world, int i, int j, int k) {
+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k);
+
+ return tileentityflowerpot != null && tileentityflowerpot.a() != null ? tileentityflowerpot.b() : 0;
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return super.canPlace(world, i, j, k) && World.a((IBlockAccess) world, i, j - 1, k);
+ }
+
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!World.a((IBlockAccess) world, i, j - 1, k)) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ }
+ }
+
+ public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
+ super.dropNaturally(world, i, j, k, l, f, i1);
+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k);
+
+ if (tileentityflowerpot != null && tileentityflowerpot.a() != null) {
+ this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b()));
+ }
+ }
+
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k);
+
+ if (tileentityflowerpot != null && tileentityflowerpot.a() != null) {
+ this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b()));
+ }
+
+ super.remove(world, i, j, k, block, l);
+ }
+
+ public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
+ super.a(world, i, j, k, l, entityhuman);
+ if (entityhuman.abilities.canInstantlyBuild) {
+ TileEntityFlowerPot tileentityflowerpot = this.e(world, i, j, k);
+
+ if (tileentityflowerpot != null) {
+ tileentityflowerpot.a(Item.d(0), 0);
+ }
+ }
+ }
+
+ public Item getDropType(int i, Random random, int j) {
+ return Items.FLOWER_POT;
+ }
+
+ private TileEntityFlowerPot e(World world, int i, int j, int k) {
+ TileEntity tileentity = world.getTileEntity(i, j, k);
+
+ return tileentity != null && tileentity instanceof TileEntityFlowerPot ? (TileEntityFlowerPot) tileentity : null;
+ }
+
+ public TileEntity a(World world, int i) {
+ Object object = null;
+ byte b0 = 0;
+
+ switch (i) {
+ case 1:
+ object = Blocks.RED_ROSE;
+ b0 = 0;
+ break;
+
+ case 2:
+ object = Blocks.YELLOW_FLOWER;
+ break;
+
+ case 3:
+ object = Blocks.SAPLING;
+ b0 = 0;
+ break;
+
+ case 4:
+ object = Blocks.SAPLING;
+ b0 = 1;
+ break;
+
+ case 5:
+ object = Blocks.SAPLING;
+ b0 = 2;
+ break;
+
+ case 6:
+ object = Blocks.SAPLING;
+ b0 = 3;
+ break;
+
+ case 7:
+ object = Blocks.RED_MUSHROOM;
+ break;
+
+ case 8:
+ object = Blocks.BROWN_MUSHROOM;
+ break;
+
+ case 9:
+ object = Blocks.CACTUS;
+ break;
+
+ case 10:
+ object = Blocks.DEAD_BUSH;
+ break;
+
+ case 11:
+ object = Blocks.LONG_GRASS;
+ b0 = 2;
+ break;
+
+ case 12:
+ object = Blocks.SAPLING;
+ b0 = 4;
+ break;
+
+ case 13:
+ object = Blocks.SAPLING;
+ b0 = 5;
+ }
+
+ return new TileEntityFlowerPot(Item.getItemOf((Block) object), b0);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
new file mode 100644
index 0000000..6d5090b

Datei anzeigen

@ -1,22 +0,0 @@
From 7b66998011a3a50f29342d263f72653bbff269bf Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Mon, 2 Dec 2013 14:54:00 +1100
Subject: [PATCH] Fix experience drops
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index e24d4b5..5be0467 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -315,7 +315,7 @@ public class PlayerInteractManager {
// CraftBukkit start - Drop event experience
if (flag && event != null) {
- block.c(this.world, i, j, k, event.getExpToDrop());
+ block.dropExperience(this.world, i, j, k, event.getExpToDrop()); // Spigot
}
// CraftBukkit end
--
1.8.3.2

Datei anzeigen

@ -1,4 +1,4 @@
From 1bf86fb2eea33af84ad747deb174a2b3a14e0305 Mon Sep 17 00:00:00 2001
From 0cbb25b5699b0b1aa771a4f7b06d4f61f71ee785 Mon Sep 17 00:00:00 2001
From: toastedtruth <brammero@gmail.com>
Date: Sun, 1 Dec 2013 23:18:16 +0000
Subject: [PATCH] Fix some recipe book bugs

Datei anzeigen

@ -0,0 +1,29 @@
From ca5f15289441bb09a433e1fc6560626ffb144b06 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Tue, 3 Dec 2013 11:07:48 +1100
Subject: [PATCH] Clear Flower Pot on Drop
diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java
index ef909f7..734dcb4 100644
--- a/src/main/java/net/minecraft/server/BlockFlowerPot.java
+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java
@@ -91,6 +91,7 @@ public class BlockFlowerPot extends BlockContainer {
if (tileentityflowerpot != null && tileentityflowerpot.a() != null) {
this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b()));
+ tileentityflowerpot.a( null, 0 ); // Spigot
}
}
@@ -99,6 +100,7 @@ public class BlockFlowerPot extends BlockContainer {
if (tileentityflowerpot != null && tileentityflowerpot.a() != null) {
this.a(world, i, j, k, new ItemStack(tileentityflowerpot.a(), 1, tileentityflowerpot.b()));
+ tileentityflowerpot.a( null, 0 ); // Spigot
}
super.remove(world, i, j, k, block, l);
--
1.8.3.2