diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 37 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java | 4 |
2 files changed, 8 insertions, 33 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 16fbf732..944595a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -292,39 +292,14 @@ public class CraftWorld implements World { return new CraftItem(world.getServer(), entity); } - private static void randomLocationWithinBlock(Location loc, double xs, double ys, double zs) { - double prevX = loc.getX(); - double prevY = loc.getY(); - double prevZ = loc.getZ(); - loc.add(xs, ys, zs); - if (loc.getX() < Math.floor(prevX)) { - loc.setX(Math.floor(prevX)); - } - if (loc.getX() >= Math.ceil(prevX)) { - loc.setX(Math.ceil(prevX - 0.01)); - } - if (loc.getY() < Math.floor(prevY)) { - loc.setY(Math.floor(prevY)); - } - if (loc.getY() >= Math.ceil(prevY)) { - loc.setY(Math.ceil(prevY - 0.01)); - } - if (loc.getZ() < Math.floor(prevZ)) { - loc.setZ(Math.floor(prevZ)); - } - if (loc.getZ() >= Math.ceil(prevZ)) { - loc.setZ(Math.ceil(prevZ - 0.01)); - } - } - public org.bukkit.entity.Item dropItemNaturally(Location loc, ItemStack item) { - double xs = world.random.nextFloat() * 0.7F - 0.35D; - double ys = world.random.nextFloat() * 0.7F - 0.35D; - double zs = world.random.nextFloat() * 0.7F - 0.35D; + double xs = (world.random.nextFloat() * 0.5F) + 0.25D; + double ys = (world.random.nextFloat() * 0.5F) + 0.25D; + double zs = (world.random.nextFloat() * 0.5F) + 0.25D; loc = loc.clone(); - // Makes sure the new item is created within the block the location points to. - // This prevents item spill in 1-block wide farms. - randomLocationWithinBlock(loc, xs, ys, zs); + loc.setX(loc.getX() + xs); + loc.setY(loc.getY() + ys); + loc.setZ(loc.getZ() + zs); return dropItem(loc, item); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 4e69ccc7..df8e99f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -438,7 +438,7 @@ public class CraftEventFactory { for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue; - world.dropItemNaturally(entity.getLocation(), stack); + world.dropItem(entity.getLocation(), stack); } return event; @@ -464,7 +464,7 @@ public class CraftEventFactory { for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { if (stack == null || stack.getType() == Material.AIR) continue; - world.dropItemNaturally(entity.getLocation(), stack); + world.dropItem(entity.getLocation(), stack); } return event; |