Fixed bug relating to "empty" ItemStacks. Fixes #807

This commit is contained in:
GJ 2013-03-08 07:40:25 -05:00
parent 9618e45a11
commit bd45fff1b4
4 changed files with 14 additions and 12 deletions

View File

@ -9,6 +9,8 @@ Key:
Version 1.4.03-dev Version 1.4.03-dev
+ Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker + Added option to advanced.yml to determine the # of enchant levels used when buffing Super Breaker & Giga Drill Breaker
= Fixed bug with Blast Mining not dropping blocks correctly
= Fixed bug with custom blocks not working
= Fixed bug where triple drops would award twice the amount of experience in Herbalism and Mining = Fixed bug where triple drops would award twice the amount of experience in Herbalism and Mining
= Fixed bug where Green Thumb would consume wheat instead of seeds = Fixed bug where Green Thumb would consume wheat instead of seeds
= Fixed bug where Green Terra would consume twice the amount of seed when used on crops = Fixed bug where Green Terra would consume twice the amount of seed when used on crops

View File

@ -72,7 +72,7 @@ public class Mining {
default: default:
if (ModUtils.isCustomMiningBlock(blockState)) { if (ModUtils.isCustomMiningBlock(blockState)) {
Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack()); Misc.dropItem(blockState.getLocation(), blockState.getData().toItemStack(1));
} }
return; return;
} }

View File

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

View File

@ -52,7 +52,7 @@ public final class ModUtils {
*/ */
public static CustomBlock getCustomBlock(BlockState blockState) { public static CustomBlock getCustomBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customItems.contains(item)) { if (CustomBlockConfig.getInstance().customItems.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -88,7 +88,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomWoodcuttingBlock(BlockState blockState) { public static boolean isCustomWoodcuttingBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customWoodcuttingBlocks.contains(item)) { if (CustomBlockConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -110,7 +110,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomAbilityBlock(BlockState blockState) { public static boolean isCustomAbilityBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customAbilityBlocks.contains(item)) { if (CustomBlockConfig.getInstance().customAbilityBlocks.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -132,7 +132,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomMiningBlock(BlockState blockState) { public static boolean isCustomMiningBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customMiningBlocks.contains(item)) { if (CustomBlockConfig.getInstance().customMiningBlocks.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -154,7 +154,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomExcavationBlock(BlockState blockState) { public static boolean isCustomExcavationBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customExcavationBlocks.contains(item)) { if (CustomBlockConfig.getInstance().customExcavationBlocks.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -176,7 +176,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomHerbalismBlock(BlockState blockState) { public static boolean isCustomHerbalismBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customHerbalismBlocks.contains(item)) { if (CustomBlockConfig.getInstance().customHerbalismBlocks.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -198,7 +198,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomLeafBlock(BlockState blockState) { public static boolean isCustomLeafBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customLeaves.contains(item)) { if (CustomBlockConfig.getInstance().customLeaves.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -220,7 +220,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomLogBlock(BlockState blockState) { public static boolean isCustomLogBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customLogs.contains(item)) { if (CustomBlockConfig.getInstance().customLogs.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {
@ -242,7 +242,7 @@ public final class ModUtils {
*/ */
public static boolean isCustomOreBlock(BlockState blockState) { public static boolean isCustomOreBlock(BlockState blockState) {
if (customBlocksEnabled) { if (customBlocksEnabled) {
ItemStack item = blockState.getData().toItemStack(); ItemStack item = blockState.getData().toItemStack(1);
if (CustomBlockConfig.getInstance().customOres.contains(item)) { if (CustomBlockConfig.getInstance().customOres.contains(item)) {
for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) { for (CustomBlock block : CustomBlockConfig.getInstance().customBlocks) {