Because we forget things too often.

This commit is contained in:
GJ 2013-05-16 08:41:57 -04:00
parent b6c4d2b4ad
commit c9ae6436bd

View File

@ -19,59 +19,7 @@ public final class BlockUtils {
* @return true if the block awards XP, false otherwise * @return true if the block awards XP, false otherwise
*/ */
public static boolean shouldBeWatched(BlockState blockState) { public static boolean shouldBeWatched(BlockState blockState) {
switch (blockState.getType()) { return affectedByGigaDrillBreaker(blockState) || affectedByGreenTerra(blockState) || affectedBySuperBreaker(blockState) || isLog(blockState);
case BROWN_MUSHROOM:
case CACTUS:
case CLAY:
case COAL_ORE:
case DIAMOND_ORE:
case DIRT:
case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE:
case GOLD_ORE:
case GRASS:
case GRAVEL:
case HUGE_MUSHROOM_1:
case HUGE_MUSHROOM_2:
case IRON_ORE:
case LAPIS_ORE:
case LOG:
case MELON_BLOCK:
case MOSSY_COBBLESTONE:
case MYCEL:
case NETHERRACK:
case OBSIDIAN:
case PUMPKIN:
case QUARTZ_ORE:
case RED_MUSHROOM:
case RED_ROSE:
case REDSTONE_ORE:
case SAND:
case SANDSTONE:
case SOUL_SAND:
case STONE:
case SUGAR_CANE_BLOCK:
case VINE:
case WATER_LILY:
case YELLOW_FLOWER:
case EMERALD_ORE:
return true;
case CARROT:
case CROPS:
case POTATO:
return blockState.getRawData() == CropState.RIPE.getData();
case NETHER_WARTS:
return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;
case COCOA:
return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;
default:
return ModUtils.getCustomBlock(blockState) != null;
}
} }
/** /**
@ -111,17 +59,7 @@ public final class BlockUtils {
return false; return false;
default: default:
int blockId = blockState.getTypeId(); return !isMcMMOAnvil(blockState) && !ModUtils.isCustomAbilityBlock(blockState);
if (blockId == Config.getInstance().getRepairAnvilId() || blockId == Config.getInstance().getSalvageAnvilId()) {
return false;
}
if (ModUtils.isCustomAbilityBlock(blockState)) {
return false;
}
return true;
} }
} }
@ -214,26 +152,17 @@ public final class BlockUtils {
*/ */
public static Boolean affectedBySuperBreaker(BlockState blockState) { public static Boolean affectedBySuperBreaker(BlockState blockState) {
switch (blockState.getType()) { switch (blockState.getType()) {
case COAL_ORE:
case DIAMOND_ORE:
case ENDER_STONE: case ENDER_STONE:
case GLOWING_REDSTONE_ORE:
case GLOWSTONE: case GLOWSTONE:
case GOLD_ORE:
case IRON_ORE:
case LAPIS_ORE:
case MOSSY_COBBLESTONE: case MOSSY_COBBLESTONE:
case NETHERRACK: case NETHERRACK:
case OBSIDIAN: case OBSIDIAN:
case QUARTZ_ORE:
case REDSTONE_ORE:
case SANDSTONE: case SANDSTONE:
case STONE: case STONE:
case EMERALD_ORE:
return true; return true;
default: default:
return ModUtils.isCustomMiningBlock(blockState); return isOre(blockState) || ModUtils.isCustomMiningBlock(blockState);
} }
} }
@ -266,16 +195,7 @@ public final class BlockUtils {
* @return true if the block should affected by Tree Feller, false otherwise * @return true if the block should affected by Tree Feller, false otherwise
*/ */
public static boolean affectedByTreeFeller(BlockState blockState) { public static boolean affectedByTreeFeller(BlockState blockState) {
switch (blockState.getType()) { return isLog(blockState) || isLeaves(blockState);
case LOG:
case LEAVES:
case HUGE_MUSHROOM_1:
case HUGE_MUSHROOM_2:
return true;
default:
return ModUtils.isCustomWoodcuttingBlock(blockState);
}
} }
/** /**
@ -379,4 +299,16 @@ public final class BlockUtils {
return false; return false;
} }
} }
/**
* Determine if a given block is an mcMMO anvil
*
* @param blockState The {@link BlockState} of the block to check
* @return true if the block is an mcMMO anvil, false otherwise
*/
private static boolean isMcMMOAnvil(BlockState blockState) {
int blockId = blockState.getTypeId();
return blockId == Config.getInstance().getRepairAnvilId() || blockId == Config.getInstance().getSalvageAnvilId();
}
} }