Search in sources :

Example 1 with PlayerDataManager

use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.

the class ImmortallisProgressor 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) {
        PlayerDataManager plData;
        switch(place) {
            case 1:
                if (ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.PROGRESS_COIN0), true, 1)) {
                    if (!player.addItemStackToInventory(new ItemStack(ItemRegister.RETURN_CRYSTAL))) {
                        plData = PlayerUtil.getAdventPlayer(player);
                        plData.sendThrottledChatMessage("message.feedback.item.returnCrystal.noSpace");
                        plData.stats().resetAllTribute();
                        player.entityDropItem(new ItemStack(ItemRegister.PROGRESS_COIN0), 0.5f);
                    } else {
                        player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.goldStart.0", TextFormatting.GOLD));
                        player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.goldStart.1", TextFormatting.GOLD));
                        player.setPositionAndUpdate(28, 20, 2);
                    }
                    return true;
                }
                break;
            case 2:
                if (PlayerUtil.getAdventPlayer(player).stats().getTribute(Enums.Deities.PLUTON) >= 100) {
                    EntityKlobber klobber = new EntityKlobber(world);
                    klobber.setPositionAndUpdate(69, 21, 4);
                    world.spawnEntity(klobber);
                    player.setPositionAndUpdate(67, 21, 2);
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.klobberStart", TextFormatting.DARK_AQUA));
                    return true;
                }
                break;
            case 3:
                if (ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.PROGRESS_COIN1), true, 1)) {
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.skeletalSpiritsStart", TextFormatting.RED));
                    player.setPositionAndUpdate(81, 21, 2);
                    return true;
                }
                break;
            case 4:
                if (PlayerUtil.getAdventPlayer(player).stats().getTribute(Enums.Deities.EREBON) >= 100) {
                    EntityProshield proshield = new EntityProshield(world);
                    proshield.setPositionAndUpdate(123, 21, 6);
                    world.spawnEntity(proshield);
                    player.setPositionAndUpdate(122, 21, 2);
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.proshieldStart", TextFormatting.DARK_AQUA));
                    return true;
                }
                break;
            case 5:
                if (ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.PROGRESS_COIN2), true, 1)) {
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.pureGoldStart.0", TextFormatting.GOLD));
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.pureGoldStart.1", TextFormatting.GOLD));
                    player.setPositionAndUpdate(141, 24, 2);
                    return true;
                }
                break;
            case 6:
                if (PlayerUtil.getAdventPlayer(player).stats().getTribute(Enums.Deities.PLUTON) == 200) {
                    EntityMirage mirage = new EntityMirage(world);
                    mirage.setPositionAndUpdate(177, 24, -2);
                    world.spawnEntity(mirage);
                    player.setPositionAndUpdate(168, 24, 7);
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.mirageStart", TextFormatting.DARK_AQUA));
                    return true;
                }
                break;
            case 7:
                if (ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.PROGRESS_COIN3), true, 1)) {
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.evilSpiritsStart", TextFormatting.RED));
                    player.setPositionAndUpdate(189, 20, 2);
                    return true;
                }
                break;
            case 8:
                if (PlayerUtil.getAdventPlayer(player).stats().getTribute(Enums.Deities.EREBON) == 200) {
                    EntityFlash flash = new EntityFlash(world);
                    flash.setPositionAndUpdate(235, 22, 10);
                    world.spawnEntity(flash);
                    player.setPositionAndUpdate(233, 21, 3);
                    player.sendMessage(StringUtil.getColourLocale("message.feedback.immortallisProgression.flashStart", TextFormatting.DARK_AQUA));
                    return true;
                }
                break;
            case 9:
                if (ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.PROGRESS_COIN4), true, 1)) {
                    player.setPositionAndUpdate(0, 20, 0);
                    ItemUtil.findInventoryItem(player, new ItemStack(ItemRegister.RETURN_CRYSTAL), true, 1);
                    PlayerUtil.getAdventPlayer(player).stats().resetAllTribute();
                    return true;
                }
                break;
        }
    }
    return true;
}
Also used : EntityProshield(net.tslat.aoa3.entity.boss.proshield.EntityProshield) EntityKlobber(net.tslat.aoa3.entity.boss.klobber.EntityKlobber) EntityMirage(net.tslat.aoa3.entity.boss.mirage.EntityMirage) EntityFlash(net.tslat.aoa3.entity.boss.flash.EntityFlash) ItemStack(net.minecraft.item.ItemStack) PlayerDataManager(net.tslat.aoa3.utils.player.PlayerDataManager)

Example 2 with PlayerDataManager

use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.

the class PureGoldAccumulator 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() == ItemRegister.PURE_GOLD) {
        PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
        if (!player.capabilities.isCreativeMode)
            player.getHeldItem(hand).shrink(1);
        plData.stats().addTribute(Enums.Deities.PLUTON, 20);
        if (plData.stats().getTribute(Enums.Deities.PLUTON) == 200)
            plData.sendThrottledChatMessage("message.feedback.immortallisProgression.pureGoldEnd", player.getDisplayNameString());
    }
    return true;
}
Also used : PlayerDataManager(net.tslat.aoa3.utils.player.PlayerDataManager)

Example 3 with PlayerDataManager

use of net.tslat.aoa3.utils.player.PlayerDataManager 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;
}
Also used : BaseSlab(net.tslat.aoa3.item.minionslab.BaseSlab) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) PlayerDataManager(net.tslat.aoa3.utils.player.PlayerDataManager)

Example 4 with PlayerDataManager

use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.

the class BaseVulcane method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (world.isRemote)
        return ActionResult.newResult(EnumActionResult.FAIL, stack);
    PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
    if (!plData.isRevengeActive())
        return ActionResult.newResult(EnumActionResult.FAIL, stack);
    return activate(plData, stack);
}
Also used : ItemStack(net.minecraft.item.ItemStack) PlayerDataManager(net.tslat.aoa3.utils.player.PlayerDataManager)

Example 5 with PlayerDataManager

use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.

the class EntityNatura method doMeleeEffect.

@Override
protected void doMeleeEffect(Entity target) {
    if (target instanceof EntityLivingBase) {
        heal(15);
        if (target instanceof EntityPlayer) {
            PlayerDataManager plData = PlayerUtil.getAdventPlayer((EntityPlayer) target);
            plData.stats().consumeResource(Enums.Resources.ENERGY, 50, true);
            plData.sendThrottledChatMessage("message.mob.natura.attack");
        }
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) PlayerDataManager(net.tslat.aoa3.utils.player.PlayerDataManager)

Aggregations

PlayerDataManager (net.tslat.aoa3.utils.player.PlayerDataManager)49 EntityPlayer (net.minecraft.entity.player.EntityPlayer)20 ItemStack (net.minecraft.item.ItemStack)18 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)7 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)7 BlockPos (net.minecraft.util.math.BlockPos)6 Entity (net.minecraft.entity.Entity)5 EntityTameable (net.minecraft.entity.passive.EntityTameable)4 Block (net.minecraft.block.Block)3 Item (net.minecraft.item.Item)3 CapabilityBaseMiscStackSerializable (net.tslat.aoa3.capabilities.interfaces.CapabilityBaseMiscStackSerializable)3 Enums (net.tslat.aoa3.library.Enums)3 PortalCoordinatesContainer (net.tslat.aoa3.library.misc.PortalCoordinatesContainer)3 IBlockState (net.minecraft.block.state.IBlockState)2 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 PotionEffect (net.minecraft.potion.PotionEffect)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 WorldServer (net.minecraft.world.WorldServer)2 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1