use of net.minecraft.potion.PotionEffect in project Waystones by blay09.
the class WaystoneManager method transferPlayerToDimension.
/**
* Taken from CoFHCore's EntityHelper (https://github.com/CoFH/CoFHCore/blob/1.12/src/main/java/cofh/core/util/helpers/EntityHelper.java)
*/
private static void transferPlayerToDimension(EntityPlayerMP player, int dimension, PlayerList manager) {
int oldDim = player.dimension;
WorldServer oldWorld = manager.getServerInstance().getWorld(player.dimension);
player.dimension = dimension;
WorldServer newWorld = manager.getServerInstance().getWorld(player.dimension);
player.connection.sendPacket(new SPacketRespawn(player.dimension, newWorld.getDifficulty(), newWorld.getWorldInfo().getTerrainType(), player.interactionManager.getGameType()));
oldWorld.removeEntityDangerously(player);
if (player.isBeingRidden()) {
player.removePassengers();
}
if (player.isRiding()) {
player.dismountRidingEntity();
}
player.isDead = false;
transferEntityToWorld(player, oldWorld, newWorld);
manager.preparePlayer(player, oldWorld);
player.connection.setPlayerLocation(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
player.interactionManager.setWorld(newWorld);
manager.updateTimeAndWeatherForPlayer(player, newWorld);
manager.syncPlayerInventory(player);
for (PotionEffect potioneffect : player.getActivePotionEffects()) {
player.connection.sendPacket(new SPacketEntityEffect(player.getEntityId(), potioneffect));
}
FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldDim, dimension);
}
use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.
the class VampireAbilityHandler method abilityHandler.
@SubscribeEvent
public void abilityHandler(PlayerTickEvent evt) {
if (evt.phase == Phase.START && !evt.player.world.isRemote) {
PotionEffect nv = evt.player.getActivePotionEffect(MobEffects.NIGHT_VISION);
if ((nv == null || nv.getDuration() <= 220) && evt.player.getCapability(CapabilityTransformationData.CAPABILITY, null).isNightVisionActive()) {
if (BewitchmentAPI.getAPI().addVampireBlood(evt.player, -2)) {
evt.player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 300, 0, true, false));
} else {
evt.player.sendStatusMessage(new TextComponentTranslation("vampire.nightvision.low_blood"), true);
evt.player.getCapability(CapabilityTransformationData.CAPABILITY, null).setNightVision(false);
}
}
}
}
use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.
the class MarsWaterBrew method onStart.
@Override
public void onStart(World world, BlockPos pos, EntityLivingBase entity, int amplifier) {
entity.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 1500, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1500, 0));
}
use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.
the class NotchedBrew method apply.
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 400, 1));
entity.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 6000, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 6000, 0));
entity.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 2400, 3));
}
use of net.minecraft.potion.PotionEffect in project Bewitchment by Um-Mitternacht.
the class EntityBrew method doSplash.
private void doSplash() {
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D);
List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (!list.isEmpty()) {
Tuple<List<BrewEffect>, List<PotionEffect>> tuple = BrewUtils.deSerialize(NBTHelper.fixNBT(getBrew()));
for (EntityLivingBase entity : list) {
double distance = this.getDistanceSq(entity);
if (distance < 16.0D) {
for (BrewEffect effect : tuple.getFirst()) {
BrewStorageHandler.addEntityBrewEffect(entity, effect.copy());
}
for (PotionEffect potioneffect : tuple.getSecond()) {
entity.addPotionEffect(new PotionEffect(potioneffect));
}
}
}
}
}
Aggregations