Moving the center of block drops to block center. Fixes #2544.

This commit is contained in:
Sid Shakal
2016-03-16 11:47:40 -05:00
parent 1488946fc5
commit 123a139e43
9 changed files with 26 additions and 21 deletions

View File

@@ -51,7 +51,7 @@ public class Mining {
case GLOWING_REDSTONE_ORE:
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
Misc.dropItem(blockState.getLocation(), new ItemStack(Material.REDSTONE_ORE));
Misc.dropItem(Misc.getBlockCenter(blockState), new ItemStack(Material.REDSTONE_ORE));
}
return;
@@ -65,12 +65,12 @@ public class Mining {
case REDSTONE_ORE:
case STONE:
case PRISMARINE:
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1));
return;
default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1));
}
return;
}
@@ -101,18 +101,18 @@ public class Mining {
case STAINED_CLAY:
case STONE:
case QUARTZ_ORE:
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
return;
case GLOWING_REDSTONE_ORE:
if (Config.getInstance().getDoubleDropsEnabled(SkillType.MINING, Material.REDSTONE_ORE)) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
}
return;
default:
if (mcMMO.getModManager().isCustomMiningBlock(blockState)) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
}
return;
}

View File

@@ -148,7 +148,7 @@ public class MiningManager extends SkillManager {
xp += Mining.getBlockXp(blockState);
}
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1)); // Initial block that would have been dropped
Misc.dropItem(Misc.getBlockCenter(blockState), blockState.getData().toItemStack(1)); // Initial block that would have been dropped
if (!mcMMO.getPlaceStore().isTrue(blockState)) {
for (int i = 1; i < dropMultiplier; i++) {
@@ -161,7 +161,7 @@ public class MiningManager extends SkillManager {
if (debrisYield > 0) {
for (BlockState blockState : debris) {
if (Misc.getRandom().nextFloat() < debrisYield) {
Misc.dropItems(blockState.getLocation(), blockState.getBlock().getDrops());
Misc.dropItems(Misc.getBlockCenter(blockState), blockState.getBlock().getDrops());
}
}
}