Some of these should not have been blockdata, also this should check age of crops.

This commit is contained in:
t00thpick1
2018-10-09 21:48:47 -04:00
parent 2a43bce849
commit 5663b71387
10 changed files with 104 additions and 95 deletions

View File

@ -7,6 +7,8 @@ import com.gmail.nossr50.skills.repair.Repair;
import com.gmail.nossr50.skills.salvage.Salvage;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.Ageable;
import org.bukkit.block.data.BlockData;
import java.util.HashSet;
@ -134,7 +136,7 @@ public final class BlockUtils {
* @return true if the block is an ore, false otherwise
*/
public static boolean isOre(BlockState blockState) {
return MaterialUtils.isOre(blockState.getBlockData());
return MaterialUtils.isOre(blockState.getType());
}
/**
@ -170,7 +172,7 @@ public final class BlockUtils {
* @return true if the block should affected by Green Terra, false otherwise
*/
public static boolean affectedByGreenTerra(BlockState blockState) {
if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getBlockData())) {
if (ExperienceConfig.getInstance().isSkillBlock(SkillType.HERBALISM, blockState.getType())) {
return true;
}
@ -352,4 +354,16 @@ public final class BlockUtils {
return transparentBlocks;
}
public static boolean isHarvestable(BlockState blockState) {
BlockData data = blockState.getBlockData();
if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE)
return true;
if (data instanceof Ageable)
{
Ageable ageable = (Ageable) data;
return ageable.getAge() == ageable.getMaximumAge();
}
return true;
}
}