use of net.minecraft.potion.PotionEffect in project Gaia-Dimension by Andromander.
the class GDGeodeJuice method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityLivingBase entityLiving) {
EntityPlayer player = (EntityPlayer) entityLiving;
ItemStack cup = new ItemStack(GDItems.agate_cup);
super.onItemUseFinish(stack, worldIn, entityLiving);
switch(juiceType) {
case JUICE:
entityLiving.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 100));
break;
case TEA:
entityLiving.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 100));
break;
case ALE:
entityLiving.addPotionEffect(new PotionEffect(MobEffects.SPEED, 100));
break;
case SODA:
entityLiving.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 100));
break;
case ELIXIR:
entityLiving.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 100));
break;
}
if (!player.inventory.addItemStackToInventory(cup.copy())) {
player.dropItem(cup, false);
}
return stack;
}
use of net.minecraft.potion.PotionEffect in project EnderIO by SleepyTrousers.
the class MoltenRedstone method onEntityCollidedWithBlock.
@Override
public void onEntityCollidedWithBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, @Nonnull Entity entity) {
if (!world.isRemote && entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.HASTE, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SPEED, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 20 * 60, 0, true, true));
}
super.onEntityCollidedWithBlock(world, pos, state, entity);
}
use of net.minecraft.potion.PotionEffect in project EnderIO by SleepyTrousers.
the class ClientProxy method setInstantConfusionOnPlayer.
@Override
public void setInstantConfusionOnPlayer(@Nonnull EntityPlayer ent, int duration) {
ent.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, duration, 1, true, true));
Minecraft.getMinecraft().player.timeInPortal = 1;
}
use of net.minecraft.potion.PotionEffect in project minecolonies by Minecolonies.
the class EntityCitizen method onLivingUpdate.
/**
* Called frequently so the entity can update its state every tick as
* required. For example, zombies and skeletons. use this to react to
* sunlight and start to burn.
*/
@Override
public void onLivingUpdate() {
if (recentlyHit > 0) {
citizenData.markDirty();
}
if (CompatibilityUtils.getWorld(this).isRemote) {
updateColonyClient();
} else {
if (getOffsetTicks() % TICKS_20 == 0) {
this.setAlwaysRenderNameTag(Configurations.gameplay.alwaysRenderNameTag);
pickupItems();
cleanupChatMessages();
updateColonyServer();
}
if (getColonyJob() != null || !CompatibilityUtils.getWorld(this).isDaytime()) {
if (ticksExisted % TICKS_20 == 0) {
checkIfStuck();
if (ticksExisted % (MAX_STUCK_TIME * 2 + TICKS_20) == 0) {
triedMovingAway = false;
}
}
} else {
setLatestStatus(new TextComponentTranslation("com.minecolonies.coremod.status.waitingForWork"));
}
if (CompatibilityUtils.getWorld(this).isDaytime() && !CompatibilityUtils.getWorld(this).isRaining() && citizenData != null) {
SoundUtils.playRandomSound(CompatibilityUtils.getWorld(this), this, citizenData.getSaturation());
} else if (CompatibilityUtils.getWorld(this).isRaining() && 1 >= rand.nextInt(RANT_ABOUT_WEATHER_CHANCE) && this.getColonyJob() != null) {
SoundUtils.playSoundAtCitizenWithChance(CompatibilityUtils.getWorld(this), this.getPosition(), this.getColonyJob().getBadWeatherSound(), 1);
}
}
if (isEntityInsideOpaqueBlock() || isInsideOfMaterial(Material.LEAVES)) {
getNavigator().moveAwayFromXYZ(this.getPosition(), MOVE_AWAY_RANGE, MOVE_AWAY_SPEED);
}
gatherXp();
if (citizenData != null) {
if (citizenData.getSaturation() <= 0) {
this.addPotionEffect(new PotionEffect(Potion.getPotionFromResourceLocation("slowness")));
} else {
this.removeActivePotionEffect(Potion.getPotionFromResourceLocation("slowness"));
}
if (citizenData.getSaturation() < HIGH_SATURATION) {
tryToEat();
}
if ((distanceWalkedModified + 1.0) % ACTIONS_EACH_BLOCKS_WALKED == 0) {
decreaseSaturationForAction();
}
}
if (dataBackup != null) {
final NBTTagList nbttaglist = dataBackup.getTagList("Inventory", 10);
this.getCitizenData().getInventory().readFromNBT(nbttaglist);
this.getCitizenData().getInventory().setHeldItem(dataBackup.getInteger(TAG_HELD_ITEM_SLOT));
dataBackup = null;
}
checkHeal();
super.onLivingUpdate();
}
use of net.minecraft.potion.PotionEffect in project OpenModularTurrets by OpenModularTurretsTeam.
the class RelativisticTurretTileEntity method update.
@SuppressWarnings("ConstantConditions")
@Override
public void update() {
setSide();
this.base = getBaseFromWorld();
if (this.getWorld().isRemote) {
if (rotationAnimation >= 360F) {
rotationAnimation = 0F;
}
rotationAnimation = rotationAnimation + 0.03F;
return;
}
ticks++;
// BASE IS OKAY
if (base == null || base.getTier() < this.turretTier) {
this.getWorld().destroyBlock(this.pos, true);
} else {
concealmentChecks();
TurretHeadUtil.updateSolarPanelAddon(base);
// turret tick rate;
if (target == null && targetingTicks < OMTConfigHandler.getTurretTargetSearchTicks()) {
targetingTicks++;
return;
}
targetingTicks = 0;
int power_required = Math.round(this.getTurretPowerUsage() * (1 - TurretHeadUtil.getEfficiencyUpgrades(base)) * (1 + TurretHeadUtil.getScattershotUpgrades(base)));
// power check
if ((base.getEnergyLevel(EnumFacing.DOWN) < power_required) || (!base.isActive())) {
return;
}
// is there a target, and Has it died in the previous tick?
if (target == null || target.isDead || this.getWorld().getEntityByID(target.getEntityId()) == null || ((EntityLivingBase) target).getHealth() <= 0.0F) {
target = getTargetWithoutEffect();
}
// did we even get a target previously?
if (target == null) {
return;
}
this.yaw = TurretHeadUtil.getAimYaw(target, this.pos) + 3.2F;
this.pitch = TurretHeadUtil.getAimPitch(target, this.pos);
// has cooldown passed?
if (ticks < (this.getTurretFireRate() * (1 - TurretHeadUtil.getFireRateUpgrades(base)))) {
return;
}
// Can the turret still see the target? (It's moving)
if (target != null) {
if (!TurretHeadUtil.canTurretSeeTarget(this, (EntityLivingBase) target)) {
target = null;
return;
}
}
if (target != null && target instanceof EntityPlayerMP) {
EntityPlayerMP entity = (EntityPlayerMP) target;
if (isPlayerTrusted(entity, base)) {
target = null;
return;
}
}
if (target != null) {
if (chebyshevDistance(target, base)) {
target = null;
return;
}
}
// Consume energy
base.setEnergyStored(base.getEnergyLevel(EnumFacing.DOWN) - power_required);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.getPotionById(2), 200, 5, false, false));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.getPotionById(18), 200, 5, false, false));
target = null;
}
this.getWorld().playSound(null, this.getPos(), this.getLaunchSoundEffect(), SoundCategory.BLOCKS, 0.6F, 1.0F);
ticks = 0;
}
Aggregations