use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.
the class ExtractionDevice 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 (!full)
return false;
if (!world.isRemote && player.getHeldItem(hand).getItem() instanceof InfusionBowl) {
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
ItemStack heldStack = player.getHeldItem(hand);
if (world.getBlockState(pos.down()).getMaterial().isReplaceable() || world.isOutsideBuildHeight(pos.down())) {
int lvl = plData.stats().getLevel(Enums.Skills.EXTRACTION);
world.setBlockState(pos, BlockRegister.EXTRACTION_DEVICE.getDefaultState());
if (plData.equipment().getCurrentFullArmourSet() != Enums.ArmourSets.EXTRACTION)
world.setBlockState(pos.down(), Blocks.OBSIDIAN.getDefaultState());
if (ExtractionUtil.shouldGetLoot(lvl)) {
if (!player.capabilities.isCreativeMode)
heldStack.damageItem(1, player);
List<ItemStack> loot = ExtractionUtil.getLoot(player);
for (ItemStack stack : loot) {
if (!stack.isEmpty()) {
player.sendMessage(StringUtil.getLocale("message.feedback.extraction").appendSibling(new TextComponentTranslation(stack.getTranslationKey() + ".name")));
} else {
player.sendMessage(StringUtil.getLocale("message.feedback.extraction.nothing"));
}
ItemHandlerHelper.giveItemToPlayer(player, stack);
}
player.addStat(StatList.getObjectUseStats(heldStack.getItem()));
plData.stats().addXp(Enums.Skills.EXTRACTION, PlayerUtil.getXpRequiredForNextLevel(lvl) / ExtractionUtil.getXpDenominator(lvl), false, false);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundsRegister.EXTRACTION_SUCCESS, SoundCategory.BLOCKS, 1.0f, 1.0f);
if (player.dimension == 0)
plData.stats().addTribute(Enums.Deities.PLUTON, 4);
} else {
player.sendMessage(StringUtil.getLocale("message.feedback.extraction.fail"));
}
} else {
player.sendMessage(StringUtil.getColourLocale("message.feedback.extraction.noSpace", TextFormatting.RED));
}
}
return true;
}
use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.
the class GoldAccumulator 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.IMPURE_GOLD) {
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
if (!player.capabilities.isCreativeMode)
player.getHeldItem(hand).shrink(1);
plData.stats().addTribute(Enums.Deities.PLUTON, Math.min(100 - plData.stats().getTribute(Enums.Deities.PLUTON), 20));
if (plData.stats().getTribute(Enums.Deities.PLUTON) >= 100)
plData.sendThrottledChatMessage("message.feedback.immortallisProgression.goldEnd", player.getDisplayNameString());
}
return true;
}
use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.
the class InfusionTable 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) {
ItemStack stack = player.getHeldItem(hand);
Item item = stack.getItem();
if (item instanceof InfusionStone) {
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
InfusionStone stone = (InfusionStone) item;
int count = stack.getCount();
if (player.capabilities.isCreativeMode || plData.stats().getLevel(Enums.Skills.INFUSION) >= stone.getLvl()) {
plData.stats().addXp(Enums.Skills.INFUSION, stone.getXp() * count, false, false);
world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundsRegister.INFUSION_SUCCESS, SoundCategory.BLOCKS, 1.0f, 1.0f);
int chanceMod = plData.equipment().getCurrentFullArmourSet() == Enums.ArmourSets.INFUSION ? 33 : 100;
int powerStoneCount = 0;
for (int i = 0; i < count; i++) {
if (AdventOfAscension.rand.nextInt(chanceMod) == 0)
powerStoneCount++;
}
if (!player.capabilities.isCreativeMode) {
if (powerStoneCount > 0) {
player.setHeldItem(hand, new ItemStack(stone.getPowerStone(), powerStoneCount));
} else {
player.setHeldItem(hand, ItemStack.EMPTY);
}
} else {
ItemUtil.givePlayerItemOrDrop(player, new ItemStack(stone.getPowerStone(), powerStoneCount));
}
}
} else {
player.openGui(AdventOfAscension.instance(), Enums.ModGuis.INFUSION_TABLE.guiId, world, pos.getX(), pos.getY(), pos.getZ());
}
}
return true;
}
use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.
the class AncientCavernShrine 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.isSneaking() && world.provider.getDimension() == ConfigurationUtil.MainConfig.dimensionIds.ancientCavern && player.hasCapability(AdventPlayerProvider.ADVENT_PLAYER, null)) {
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
BlockPos teleportPos = new BlockPos(0, 17, 0);
switch(deity) {
case EREBON:
if (pos.getX() > -20 || pos.getZ() < 60) {
teleportPos = new BlockPos(-70, 18, 80);
if (!player.capabilities.isCreativeMode) {
if (/*plData.stats().getLevel(Enums.Skills.AUGURY) < 70 || */
plData.stats().getLevel(Enums.Skills.HUNTER) < 70) {
if (player instanceof EntityPlayerMP) {
// PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP)player, Enums.Skills.AUGURY, 70);
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.HUNTER, 70);
}
return true;
}
if (plData.stats().getTribute(Enums.Deities.EREBON) < 200) {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientTribute((EntityPlayerMP) player, Enums.Deities.EREBON, 200);
return true;
} else {
plData.stats().addTribute(Enums.Deities.EREBON, -20);
}
}
EntityPenumbra penumbra = new EntityPenumbra(world);
penumbra.setLocationAndAngles(-51, 18, 92, 0, 0);
world.spawnEntity(penumbra);
}
break;
case LUXON:
if (pos.getX() < 60 || pos.getZ() > -20) {
teleportPos = new BlockPos(80, 18, -70);
if (!player.capabilities.isCreativeMode) {
if (/*plData.stats().getLevel(Enums.Skills.AUGURY) < 70 || */
plData.stats().getLevel(Enums.Skills.RUNATION) < 70) {
if (player instanceof EntityPlayerMP) {
// PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP)player, Enums.Skills.AUGURY, 70);
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.RUNATION, 70);
}
return true;
}
if (plData.stats().getTribute(Enums.Deities.LUXON) < 200) {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientTribute((EntityPlayerMP) player, Enums.Deities.LUXON, 200);
return true;
} else {
plData.stats().addTribute(Enums.Deities.LUXON, -20);
}
}
EntityHoron horon = new EntityHoron(world);
horon.setLocationAndAngles(80, 18, -70, 0, 0);
world.spawnEntity(horon);
}
break;
case PLUTON:
if (pos.getX() < 60 || pos.getZ() < 60) {
teleportPos = new BlockPos(80, 18, 80);
if (!player.capabilities.isCreativeMode) {
if (/*plData.stats().getLevel(Enums.Skills.AUGURY) < 70 || */
plData.stats().getLevel(Enums.Skills.FORAGING) < 70) {
if (player instanceof EntityPlayerMP) {
// PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP)player, Enums.Skills.AUGURY, 70);
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.FORAGING, 70);
}
return true;
}
if (plData.stats().getTribute(Enums.Deities.PLUTON) < 200) {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientTribute((EntityPlayerMP) player, Enums.Deities.PLUTON, 200);
return true;
} else {
plData.stats().addTribute(Enums.Deities.PLUTON, -20);
}
}
EntityGoldorth goldorth = new EntityGoldorth(world);
goldorth.setLocationAndAngles(80, 18, 80, 0, 0);
world.spawnEntity(goldorth);
}
break;
case SELYAN:
if (pos.getX() > -20 || pos.getZ() > -20) {
teleportPos = new BlockPos(-60, 18, -65);
if (!player.capabilities.isCreativeMode) {
if (/*plData.stats().getLevel(Enums.Skills.AUGURY) < 70 || */
plData.stats().getLevel(Enums.Skills.INFUSION) < 70) {
if (player instanceof EntityPlayerMP) {
// PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP)player, Enums.Skills.AUGURY, 70);
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.INFUSION, 70);
}
return true;
}
if (plData.stats().getTribute(Enums.Deities.SELYAN) < 200) {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientTribute((EntityPlayerMP) player, Enums.Deities.SELYAN, 200);
return true;
} else {
plData.stats().addTribute(Enums.Deities.SELYAN, -20);
}
}
EntityConiferon coniferon = new EntityConiferon(world);
coniferon.setLocationAndAngles(-60, 18, -65, 0, 0);
world.spawnEntity(coniferon);
}
break;
}
player.setPositionAndUpdate(teleportPos.getX(), teleportPos.getY(), teleportPos.getZ());
}
return true;
}
use of net.tslat.aoa3.utils.player.PlayerDataManager in project Advent-Of-Ascension by Tslat.
the class RuneRandomizer 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 (player.isSneaking())
return false;
if (world.isRemote)
return true;
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem.getItem() != ItemRegister.UNPOWERED_RUNE && heldItem.getItem() != ItemRegister.CHARGED_RUNE)
return true;
PlayerDataManager plData = PlayerUtil.getAdventPlayer(player);
if (!player.capabilities.isCreativeMode && plData.stats().getLevel(Enums.Skills.RUNATION) < 20) {
if (player instanceof EntityPlayerMP)
PlayerUtil.notifyPlayerOfInsufficientLevel((EntityPlayerMP) player, Enums.Skills.RUNATION, 20);
return false;
}
if (!player.capabilities.isCreativeMode)
heldItem.shrink(1);
LootUtil.generateAndProvideLootDirectly((EntityPlayerMP) player, LootSystemRegister.blockRuneRandomizer);
if (plData.equipment().getCurrentFullArmourSet() == Enums.ArmourSets.RUNATION)
LootUtil.generateAndProvideLootDirectly((EntityPlayerMP) player, LootSystemRegister.blockRuneRandomizer);
plData.stats().addXp(Enums.Skills.RUNATION, 5, false, false);
player.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundsRegister.RUNE_RANDOMIZER_USE, SoundCategory.BLOCKS, 1.0f, 1.0f);
return true;
}
Aggregations