use of net.tslat.aoa3.item.minionslab.BaseSlab in project Advent-Of-Ascension by Tslat.
the class CreationForge method onBlockActivated.
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote && player.getHeldItem(hand).getItem() instanceof BaseSlab) {
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
BaseSlab slab = (BaseSlab) player.getHeldItem(hand).getItem();
if (plData.stats().getLevel(Enums.Skills.CREATION) >= slab.sacrificeLvl) {
if (!player.capabilities.isCreativeMode)
player.getHeldItem(hand).shrink(1);
plData.stats().addXp(Enums.Skills.CREATION, slab.sacrificeXp, false, false);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundsRegister.CREATION_FORGE_USE, SoundCategory.BLOCKS, 1.0f, 1.0f);
player.inventoryContainer.detectAndSendChanges();
} else {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.CREATION, slab.sacrificeLvl);
}
}
return true;
}
Aggregations