本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent类的典型用法代码示例。如果您正苦于以下问题:Java LivingUpdateEvent类的具体用法?Java LivingUpdateEvent怎么用?Java LivingUpdateEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LivingUpdateEvent类属于net.minecraftforge.event.entity.living.LivingEvent包,在下文中一共展示了LivingUpdateEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: livingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event) {
World world = event.getEntity().getEntityWorld();
if (world.isRemote) {
return;
}
if (world.getTotalWorldTime() % 20 != 0) {
return;
}
if (!(event.getEntity() instanceof EntityLiving)) {
return;
}
if (event.getEntity().getTags().contains(NemesisSystem.TAG_BODY_GUARD)) {
handleBodyGuardUpdate(event);
}
}
示例2: livingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void livingUpdate(LivingUpdateEvent event)
{
/*if (!event.entityLiving.worldObj.isRemote)
{
if (event.entityLiving instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (player.dimension == ModDimensions.CUBE_ID)
{
CubeManager manager;
if ((manager = CubeManager.getInstance()) != null)
{
manager.checkPosition((EntityPlayerMP) player);
}
}
}
}*/
}
示例3: 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;
}
}
}
}
}
示例4: onEntityUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
}
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion2)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
}
}
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion3)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
}
}
if (event.entityLiving.isPotionActive(ItemRegistry1.customPotion4)) {
if (event.entityLiving.worldObj.rand.nextInt(20) == 0) {
}
}
}
}
示例5: onZombieVillagerDeath
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onZombieVillagerDeath(LivingUpdateEvent event) {
if (!event.getEntity().getEntityWorld().isRemote && event.getEntity().isDead && event.getEntity() instanceof EntityZombieVillager) {
EntityLiving convertTo = null;
if (hasRoyalEffect(event)) {
convertTo = new EntityVillageLord(event.getEntity().world);
} else if (hasLoyalEffect(event)) {
convertTo = new EntityGuard(event.getEntity().world);
}
if (convertTo == null) {
return;
}
if (handlePossibleConversion((EntityLiving) event.getEntity(), convertTo)) {
removeVillager(event);
}
}
}
示例6: 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;
}
}
}
示例7: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
if (!(event.entityLiving instanceof EntityPlayer)) {
return;
}
EntityPlayer player = (EntityPlayer) event.entityLiving;
int i = 0;
for (int j = 0; j < player.inventory.armorInventory.length; ++j) {
if (player.inventory.armorInventory[j] != null && player.inventory.armorInventory[j].getItem() instanceof ItemTeambattleArmor) {
int k = ((ItemTeambattleArmor) player.inventory.armorInventory[j].getItem()).damageReduceAmount;
i += k;
}
}
player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(20.0F + i);
if (player.getHealth() > player.getMaxHealth()) {
player.setHealth(player.getMaxHealth());
}
}
示例8: 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);
}
}
}
示例9: onPlayerUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
/** Handle all player updates */
@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent e) {
if(e.getEntity() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer)e.getEntity();
// serverside things
if (!player.worldObj.isRemote) {
EntityPlayerMP mp = (EntityPlayerMP)player;
// repair tools and armor
handleRepair(mp);
// handle potion things
handleServerPotionEffects(mp);
// handle portal things
handleTeleportation(mp);
}
// common things
onStepBootsWear(player);
}
}
示例10: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event)
{
if (event.entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer)event.entity;
ItemStack itemstack = player.getHeldItem();
if (player.ticksExisted % 2 == 0)
{
if (mc.getSoundHandler().isSoundPlaying(FNAFSoundHandler.deathStatic) && !(mc.currentScreen instanceof GuiGameOver))
{
mc.getSoundHandler().stopSound(FNAFSoundHandler.deathStatic);
}
}
}
}
示例11: onLivingUpdateEvent
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
// Previously had event.entityLiving (uses EntityLivingBase) instead of Entity
public void onLivingUpdateEvent(LivingUpdateEvent event) {
// if (event.entity != null && event.entity instanceof EntityPlayer) {
// EntityPlayer player = (EntityPlayer) event.entity;
if (event.entityLiving != null && event.entityLiving instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entityLiving;
if (DragonPlayer.get(player).isDragon()) {
if (!event.entityLiving.worldObj.isRemote) {
player.capabilities.allowFlying = true;
ItemDragonEgg.applyAbilities(player, false);
// player.sendPlayerAbilities(); // 7/2/15 Removed as a test, don't think this is needed!
}
else {
player.capabilities.allowFlying = true;
ItemDragonEgg.applyAbilities(player, true);
}
}
}
}
示例12: onLivingUpdate
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent livingUpdate) {
Entity ent = livingUpdate.entityLiving;
if(!ent.getEntityData().hasKey(KEY_DESPAWN_TIME)) {
return;
}
if(fieldpersistenceRequired == null) {
ent.getEntityData().removeTag(KEY_DESPAWN_TIME);
return;
}
long despawnTime = ent.getEntityData().getLong(KEY_DESPAWN_TIME);
if(despawnTime <= livingUpdate.entity.worldObj.getTotalWorldTime() ) {
try {
fieldpersistenceRequired.setBoolean(livingUpdate.entityLiving, false);
ent.getEntityData().removeTag(KEY_DESPAWN_TIME);
} catch (Exception e) {
Log.warn("BlockPoweredSpawner.onLivingUpdate: Error occured allowing entity to despawn: " + e);
ent.getEntityData().removeTag(KEY_DESPAWN_TIME);
}
}
}
示例13: 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)
}
}
示例14: 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.
}
示例15: 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);
}
}
}
}
}