当前位置: 首页>>代码示例>>Java>>正文


Java LivingUpdateEvent.getEntity方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent.getEntity方法的典型用法代码示例。如果您正苦于以下问题:Java LivingUpdateEvent.getEntity方法的具体用法?Java LivingUpdateEvent.getEntity怎么用?Java LivingUpdateEvent.getEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent的用法示例。


在下文中一共展示了LivingUpdateEvent.getEntity方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:21,代码来源:UpdateHandler.java

示例2: 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);
		}
	}
}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:22,代码来源:EntitySpawning.java

示例3: 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);
	}
}
 
开发者ID:sblectric,项目名称:LightningCraft,代码行数:25,代码来源:PlayerEvents.java

示例4: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  if (event.getEntity() instanceof EntityPlayer) {
    EntityPlayer p = (EntityPlayer) event.getEntity();
    ItemStack armor = p.getItemStackFromSlot(EntityEquipmentSlot.FEET);
    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) {
      setLiquidWalk(p);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:17,代码来源:EnchantWaterwalking.java

示例5: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  if (event.getEntity() instanceof EntityPlayer) {
    EntityPlayer p = (EntityPlayer) event.getEntity();
    ItemStack armorStack = getFirstArmorStackWithEnchant(p);
    if (armorStack.isEmpty()) {
      return;
    }
    //if you are on the ground (or not airborne, should be same thing
    if ((p.isAirBorne == false || p.onGround) &&
        UtilNBT.getItemStackNBTVal(armorStack, NBT_USES) > 0) {
      //you have landed on the ground, dont count previous jumps
      UtilNBT.setItemStackNBTVal(armorStack, NBT_USES, 0);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:17,代码来源:EnchantLaunch.java

示例6: PlayerMovement

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
	  public void PlayerMovement(LivingUpdateEvent evt) {
		if(!Main.logged.contains(evt.getEntity().getName()) && evt.getEntity() instanceof EntityPlayer){
			if(Main.debug==1)System.out.println(evt.getEntity().getName() + " called MovementEvent  " + evt.getEntity().toString());
			String name = evt.getEntity().getName();
			

			if(evt.getEntity().posX != (Double)Main.posX.get(name)&&evt.getEntity().posY != (Double)Main.posY.get(name)&&evt.getEntity().posZ != (Double)Main.posZ.get(name)){
Double diffex = evt.getEntity().posX - (Double)Main.posX.get(name);
Double diffey = evt.getEntity().posY - (Double)Main.posY.get(name);
Double diffez = evt.getEntity().posZ - (Double)Main.posZ.get(name);

Double dx = Double.parseDouble(diffex.toString().replaceAll("-", ""));
Double dy = Double.parseDouble(diffey.toString().replaceAll("-", ""));
Double dz = Double.parseDouble(diffez.toString().replaceAll("-", ""));


if((dx > 5 | dy > 5 | dz > 5) && Integer.parseInt((String) Main.config.get("allowtp")) == 1){
	Main.posX.put(evt.getEntity().getName(), evt.getEntity().posX);
	Main.posY.put(evt.getEntity().getName(), evt.getEntity().posY);
	Main.posZ.put(evt.getEntity().getName(), evt.getEntity().posZ);
}
				Double x = (Double)Main.posX.get(name);
				Double y = (Double)Main.posY.get(name);
				Double z = (Double)Main.posZ.get(name);
				evt.getEntity().setPositionAndUpdate(x,y,z);
				if(Main.passwords.containsKey(evt.getEntity().getName())){
					evt.getEntity().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("loginmessage")));
				} else {
				evt.getEntity().addChatMessage(new TextComponentString(TextFormatting.RED + (String)Main.config.get("registermessage")));
				}
			}
			}
			}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:35,代码来源:PlayerMovement.java

示例7: handleBodyGuardUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
private void handleBodyGuardUpdate(LivingUpdateEvent event) {
	if (!(event.getEntity() instanceof EntityCreature)) {
		return;
	}

	EntityCreature bodyGuard = (EntityCreature) event.getEntity();
	World world = bodyGuard.world;

	if (bodyGuard.getTags().contains(DeathHandler.TAG_RONIN)) {
		flee(bodyGuard);
		return;
	}

	UUID id = bodyGuard.getEntityData().getUniqueId(NemesisSystem.NBT_NEMESIS_ID);

	if (id == null) {
		bodyGuard.addTag(DeathHandler.TAG_RONIN);
		return;
	}

	EntityLiving nemesisEntity = NemesisUtil.findNemesisAround(world, id, bodyGuard.getPosition(), 100);

	if (nemesisEntity == null) {
		bodyGuard.addTag(DeathHandler.TAG_RONIN);
		return;
	}

	followNemesisBoss(bodyGuard, nemesisEntity);
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:30,代码来源:UpdateHandler.java

示例8: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate (LivingUpdateEvent event) {

    if (this.harvestablePearls && event.getEntity() instanceof EntityShulker) {

        final ICustomData data = ShulkerDataHandler.getData(event.getEntity());
        final int current = data.getCooldown();

        if (data != null && current > 0) {
            data.setCooldown(current - 1);
        }
    }
}
 
开发者ID:Darkhax-Minecraft,项目名称:Dark-Utilities,代码行数:14,代码来源:FeatureShulkerPearlItem.java

示例9: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event){
	Entity ent = event.getEntity();
	if(ent instanceof EntityLiving == false){
		return;
	}
	EntityLivingBase living = (EntityLivingBase) event.getEntity();
	if(living == null){
		return;
	}
	if(living.worldObj.getBlockState(living.getPosition()).getBlock() == Blocks.torch){
		float oddsWillBreak = 0.01F;// TODO: in config or something? or make this 1/100
		boolean playerCancelled = false;
		if(living instanceof EntityPlayer){
			EntityPlayer p = (EntityPlayer) living;
			if(p.isSneaking()){
				playerCancelled = true;// torches are safe from breaking
			}
		}

		if(playerCancelled == false // if its a player, then the player is not sneaking
				&& living.worldObj.rand.nextDouble() < oddsWillBreak && living.worldObj.isRemote == false){

			living.worldObj.destroyBlock(living.getPosition(), true);
		}
	}
}
 
开发者ID:LothrazarMinecraftMods,项目名称:FragileTorches,代码行数:28,代码来源:ModFragileTorches.java

示例10: onEntityUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
  if (fragileTorches) {
    Entity ent = event.getEntity();
    World world = ent.getEntityWorld();
    if (world.isRemote) {
      return;
    } //we only need to break block on server, it gets propogated for us
    if (world.rand.nextDouble() > oddsWillBreak) {
      return;
    } //no chance of breaking anyway, just stop
    //ok the dice roll passed
    if (ent instanceof EntityLiving == false) {
      return;
    }
    EntityLivingBase living = (EntityLivingBase) event.getEntity();
    if (living == null) {
      return;
    }
    if (living instanceof EntityPlayer && ((EntityPlayer) living).isSneaking()) {
      return;
    } //if you are a player, then cancel if sneaking
    if (world.getGameRules().getBoolean("mobGriefing") == false) {
      return;
    }
    if (UtilWorld.isBlockTorch(world, living.getPosition())) {
      world.destroyBlock(living.getPosition(), true);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:31,代码来源:FragileTorchesModule.java

示例11: onPlayerUpdate

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onPlayerUpdate(LivingUpdateEvent event) {
  if (event.getEntity() instanceof EntityPlayer) {
    EntityPlayer player = (EntityPlayer) event.getEntity();
    if (getCurrentLevelTool(player) < 0) {
      return;
    }
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
    if (!heldItem.isEmpty() && heldItem.getItem() instanceof ItemBow
        && player.isHandActive()) {
      this.tickHeldBow(player);
      this.tickHeldBow(player);
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:16,代码来源:EnchantQuickdraw.java

示例12: makeWater

import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void makeWater(LivingUpdateEvent event) {
	Entity entity = event.getEntity();
	World world = entity.worldObj;
	int x = (int) Math.floor(entity.posX);
	int y = (int) Math.floor(entity.posY);
	int z = (int) Math.floor(entity.posZ);

	if (!world.isRaining()) {
		return;
	}

	for (int i = y; i < 256; i++) {
		if (world.getBlockState(new BlockPos(x, i, z)) != Blocks.AIR
				.getBlockState().getBaseState()) {
			return;
		}
	}

	if (world.isRemote
			|| !world.getBlockState(new BlockPos(x, y - 1, z)).isFullCube()) {
		return;
	}

	world.setBlockState(new BlockPos(x, y, z), Blocks.WATER.getBlockState()
			.getBaseState());
}
 
开发者ID:jarryDk,项目名称:MineCraft,代码行数:28,代码来源:RainWater.java


注:本文中的net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent.getEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。