本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent.getEntityLiving方法的典型用法代码示例。如果您正苦于以下问题:Java LivingUpdateEvent.getEntityLiving方法的具体用法?Java LivingUpdateEvent.getEntityLiving怎么用?Java LivingUpdateEvent.getEntityLiving使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent
的用法示例。
在下文中一共展示了LivingUpdateEvent.getEntityLiving方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void entityUpdate(LivingUpdateEvent event){
if(event.getEntityLiving() !=null){
if(event.getEntityLiving() instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)event.getEntityLiving();
updateWings(player);
ExtendedPlayer exPlayer = ExtendedPlayerProvider.getExtendedPlayer(player);
if(exPlayer !=null){
if(exPlayer.hasFailed && player.isEntityAlive()){
ItemUtil.givePlayerItem(player, new ItemStack(ModBlocks.failureBlock));
exPlayer.hasFailed = false;
}
}
}
}
}
示例2: onLivingTick
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingTick(LivingUpdateEvent event)
{
PotionEffect effect = event.getEntityLiving().getActivePotionEffect(PotionRegistry.REDSTONE_NEEDLE);
if (effect == null)
return;
if (effect.getAmplifier() >= 4)
{
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (player.capabilities.isFlying && !player.isCreative())
player.capabilities.isFlying = false;
}
}
}
示例3: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate (LivingUpdateEvent event) {
final EntityLivingBase entity = event.getEntityLiving();
if (entity instanceof EntitySheep) {
final ModifiableAttributeInstance instance = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.ARMOR);
final boolean hasModifier = instance.hasModifier(sheepArmor);
final boolean isSheared = ((EntitySheep) entity).getSheared();
if (!isSheared && !hasModifier) {
instance.applyModifier(sheepArmor);
}
else if (isSheared && hasModifier) {
instance.removeModifier(sheepArmor);
}
}
}
示例4: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {//some of the items need an off switch
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
final IPlayerExtendedProperties data = CapabilityRegistry.getPlayerProperties(player);
if (data.isStepHeightOn()) {
if (player.isSneaking()) {
//make sure that, when sneaking, dont fall off!!
player.stepHeight = 0.9F;
}
else {
player.stepHeight = 1.0F + (1F / 16F);//PATH BLOCKS etc are 1/16th downif MY feature turns this on, then do it
}
}
else if (data.doForceStepOff()) {
//otherwise, dont automatically force it off. only force it off the once if player is toggling FROM on TO off with my feature
player.stepHeight = 0.5F;
}
//else leave it alone (allows other mods to turn it on without me disrupting)
}
}
示例5: onPlayerUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer == false) {
return;
}
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
IPlayerExtendedProperties props = CapabilityRegistry.getPlayerProperties(player);
int flyingTicks = props.getFlyingTimer();//TICKS NOT SECONDS
if (flyingTicks > 1) {//it decays at 1 not zero so that we only set flying False once, not constantly. avoids having boolean flag
props.setFlyingTimer(props.getFlyingTimer() - 1);
setFlying(player);
}
else if (flyingTicks == 1) { //times up! only 1/20 of a second left
props.setFlyingTimer(0);//skip ahead to zero
setNonFlying(player);
}
//else it is zero. so this is the same as null/undefined/ so player has never eaten or it wore off.
}
示例6: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
EntityLivingBase playerRider = event.getEntityLiving();
if (playerRider != null && playerRider instanceof EntityPlayer && playerRider.getEntityData().hasKey(KEY_MOUNTENTITY)
&& playerRider.isRiding() == false) {
World world = playerRider.getEntityWorld();
int eid = playerRider.getEntityData().getInteger(KEY_MOUNTENTITY);
if (eid >= 0) {
Entity maybeHorse = world.getEntityByID(eid);
if (maybeHorse != null && maybeHorse.isDead == false) {
//if we were dismounted from an ender pearl, get and consume this entity id, wiping it out for next time
if (playerRider.startRiding(maybeHorse, true)) {
playerRider.getEntityData().removeTag(KEY_MOUNTENTITY);//.setInteger(KEY_MOUNTENTITY, -1);
}
}
}
}
}
示例7: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
//check if NOT holding this harm
if (event.getEntityLiving() instanceof EntityPlayer == false) {
return;
}
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
//Ticking
ItemStack armor = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
int level = 0;
if (armor.isEmpty() == false && EnchantmentHelper.getEnchantments(armor) != null
&& EnchantmentHelper.getEnchantments(armor).containsKey(this)) {
//todo: maybe any armor?
level = EnchantmentHelper.getEnchantments(armor).get(this);
}
if (level > 0) {
turnReachOn(player);
}
else {
//was it on before, do we need to do an off hit
if (player.getEntityData().hasKey(NBT_REACH_ON) && player.getEntityData().getBoolean(NBT_REACH_ON)) {
turnReachOff(player);
}
}
}
示例8: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
if (event.getEntityLiving() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
float step = PlayerTracker.getPlayerData(player).getAbilities().getStepAssist();
float steps = 0.5F * (step + 1);
if (steps > player.stepHeight) {
player.stepHeight = steps;
player.getEntityData().setBoolean("HasRewardStepAssist", true);
}
if (step == 0.5F && player.getEntityData().hasKey("HasRewardStepAssist")) {
player.getEntityData().removeTag("HasRewardStepAssist");
player.stepHeight = 0.5F;
}
}
}
示例9: darkRealm
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void darkRealm(LivingUpdateEvent event){
if(event.getEntityLiving() instanceof EntityPlayerMP){
WorldServer worldServer = (WorldServer)event.getEntityLiving().world;
EntityPlayerMP player = (EntityPlayerMP)event.getEntityLiving();
if(player.dimension == ACLib.omothol_id && player.posY <= 0){
player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 80, 255));
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 20));
player.mcServer.getPlayerList().transferPlayerToDimension(player, ACLib.dark_realm_id, new TeleporterDarkRealm(worldServer));
// player.addStat(ACAchievements.enter_dark_realm, 1);
}
}
if(event.getEntityLiving().dimension == ACLib.dark_realm_id && !(event.getEntityLiving() instanceof EntityPlayer)){
Random rand = new Random();
if(ACConfig.particleEntity)
event.getEntityLiving().world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, event.getEntityLiving().posX + (rand.nextDouble() - 0.5D) * event.getEntityLiving().width,
event.getEntityLiving().posY + rand.nextDouble() * event.getEntityLiving().height,
event.getEntityLiving().posZ + (rand.nextDouble() - 0.5D) * event.getEntityLiving().width, 0,0,0);
}
}
示例10: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent livingUpdate) {
Entity ent = livingUpdate.getEntityLiving();
if (!ent.getEntityData().hasKey(KEY_SPAWNED_BY_POWERED_SPAWNER)) {
return;
}
if (fieldpersistenceRequired == null) {
ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
return;
}
long spawnTime = ent.getEntityData().getLong(KEY_SPAWNED_BY_POWERED_SPAWNER);
long livedFor = livingUpdate.getEntity().world.getTotalWorldTime() - spawnTime;
if (livedFor > SpawnerConfig.poweredSpawnerDespawnTimeSeconds.get() * 20) {
try {
fieldpersistenceRequired.setBoolean(livingUpdate.getEntityLiving(), false);
ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
} catch (Exception e) {
Log.warn("BlockPoweredSpawner.onLivingUpdate: Error occured allowing entity to despawn: " + e);
ent.getEntityData().removeTag(KEY_SPAWNED_BY_POWERED_SPAWNER);
}
}
}
示例11: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event)
{
EntityLivingBase living = event.getEntityLiving();
if(living instanceof IBurnInDay && living.world.isDaytime() && !living.world.isRemote && !living.isChild() && ((IBurnInDay)living).shouldBurn() && living.getBrightness() > 0.5F &&
living.getRNG().nextFloat() * 30.0F < (living.getBrightness() - 0.4F) * 2.0F && living.world.canSeeSky(new BlockPos(living.posX, living.posY + (double)living.getEyeHeight(), living.posZ)))
{
boolean flag = true;
ItemStack itemstack = living.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (!itemstack.isEmpty())
{
if (itemstack.isItemStackDamageable())
{
itemstack.setItemDamage(itemstack.getItemDamage() + living.getRNG().nextInt(2));
if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
{
living.renderBrokenItemStack(itemstack);
living.setItemStackToSlot(EntityEquipmentSlot.HEAD, ItemStack.EMPTY);
}
}
flag = false;
}
if (flag)
{
living.setFire(8);
}
}
}
示例12: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent e) {
EntityLivingBase entity = e.getEntityLiving();
if(!entity.world.isRemote && ObsidianAPIUtil.isAnimatedEntity(entity)) {
EntityAnimationProperties animationProps = EntityAnimationProperties.get(entity);
if(animationProps != null) {
animationProps.updateActiveAnimation();
animationProps.runAnimationTick();
}
}
if(entity.world.isRemote && entity instanceof EntityPlayer)
AnimationNetworkHandler.network.sendToServer(new MessagePlayerLimbSwing(entity));
}
示例13: onEntityTick
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityTick(LivingUpdateEvent e) {
EntityLivingBase entity = e.getEntityLiving();
if (entity.hasCapability(CAPABILITY_WEAPONSKILL, null)) {
IWeaponSkillInfo skillInfo = entity.getCapability(CAPABILITY_WEAPONSKILL, null);
skillInfo.setCooldown(Math.max(skillInfo.getCooldown()-1,0));
}
}
示例14: livingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event) {
EntityLivingBase living = event.getEntityLiving();
if(living.hasCapability(RIG.RIG_ITEM, null)) {
ItemStack rig = living.getCapability(RIG.RIG_ITEM, null).getStackInSlot(0);
if(rig.hasTagCompound() && living.isInWater()) {
int extraair = 100 + RIGUpgrade.upgradesMap.get("Air").getAttributeValue(rig) * 100;
if (living.getRNG().nextInt(300+extraair)>=300) {
living.setAir(living.getAir()+1);
}
}
}
}
示例15: resetStatus
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
/** Reset some stuff every tick */
@SubscribeEvent
public void resetStatus(LivingUpdateEvent e) {
EntityLivingBase guy = e.getEntityLiving();
if(!guy.world.isRemote) {
// nether fortress stuff
IAttributeInstance inst = guy.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE);
if(inst.getModifier(knockbackID) != null) inst.removeModifier(knockbackID);
}
}