Search in sources :

Example 1 with ToolSkillDigger

use of net.silentchaos512.gems.skills.ToolSkillDigger in project SilentGems by SilentChaos512.

the class GemsCommonEvents method onGetBreakSpeed.

@SubscribeEvent
public void onGetBreakSpeed(PlayerEvent.BreakSpeed event) {
    EntityPlayer player = event.getEntityPlayer();
    ItemStack mainHand = player.getHeldItem(EnumHand.MAIN_HAND);
    if (StackHelper.isValid(mainHand)) {
        // Shears on Fluffy Blocks
        if (event.getState() == ModBlocks.fluffyBlock) {
            ModBlocks.fluffyBlock.onGetBreakSpeed(event);
        }
        // Gravity enchantment.
        int gravityLevel = EnchantmentHelper.getEnchantmentLevel(ModEnchantments.gravity, mainHand);
        if (gravityLevel > 0)
            ModEnchantments.gravity.onGetBreakSpeed(event, mainHand, gravityLevel);
        // Reduce speed for Area Miner and Lumberjack.
        ToolSkill skill = ToolHelper.getSuperSkill(mainHand);
        if (skill instanceof ToolSkillDigger && ToolHelper.isSpecialAbilityEnabled(mainHand))
            ((ToolSkillDigger) skill).onGetBreakSpeed(event);
    }
}
Also used : ToolSkill(net.silentchaos512.gems.skills.ToolSkill) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) ToolSkillDigger(net.silentchaos512.gems.skills.ToolSkillDigger) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 ToolSkill (net.silentchaos512.gems.skills.ToolSkill)1 ToolSkillDigger (net.silentchaos512.gems.skills.ToolSkillDigger)1