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


Java EntityHorse.isHorseSaddled方法代码示例

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


在下文中一共展示了EntityHorse.isHorseSaddled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: moveToAttackTarget

import net.minecraft.entity.passive.EntityHorse; //导入方法依赖的package包/类
private void moveToAttackTarget(EntityMinionWarrior minion)
{
	final EntityLiving entityPathController = (EntityLiving) (minion.getRidingEntity() instanceof EntityHorse ? minion.getRidingEntity() : minion);
	float speed = entityPathController instanceof EntityHorse ? MinionConstants.SPEED_HORSE_RUN :  MinionConstants.SPEED_WALK;
	if (entityPathController instanceof EntityHorse)
	{
		final EntityHorse horse = (EntityHorse) entityPathController;

		//This makes the horse move properly.
		if (horse.isHorseSaddled())
		{
			horse.setHorseSaddled(false);
		}
	}
	
	if(minion.getNavigator().noPath())
	entityPathController.getNavigator().tryMoveToEntityLiving(attackTarget, speed);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:19,代码来源:MinionAICombat.java

示例2: doTheZorroThing

import net.minecraft.entity.passive.EntityHorse; //导入方法依赖的package包/类
@SubscribeEvent
public void doTheZorroThing(EntityInteractEvent event) {
    EntityPlayer player = event.entityPlayer;
    if (player.worldObj.isRemote) return;
    if (player.isRiding()) return;
    if (!(event.target instanceof EntityHorse)) return;
    EntityHorse horse = (EntityHorse) event.target;
    if (player.fallDistance <= 2) return;
    if (!horse.isHorseSaddled()) return;
    if (horse.getLeashed()) {
        if (!(horse.getLeashedToEntity() instanceof EntityLeashKnot)) return;
        horse.getLeashedToEntity().interactFirst(player);
    }
    boolean awesome = false;
    if (player.fallDistance > 5 && player.getHeldItem() != null) {
        Item held = player.getHeldItem().getItem();
        boolean has_baby = false;
        if (player.riddenByEntity instanceof EntityAgeable) {
            EntityAgeable ea = (EntityAgeable) player.riddenByEntity;
            has_baby = ea.isChild();
        }
        awesome = held instanceof ItemSword || held instanceof ItemAxe || held instanceof ItemBow || player.riddenByEntity instanceof EntityPlayer || has_baby;
    }
    if (awesome) {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 40, 2, false, false));
        horse.addPotionEffect(new PotionEffect(Potion.resistance.id, 20 * 40, 1, true, true));
        horse.addPotionEffect(new PotionEffect(Potion.jump.id, 20 * 40, 1, true, true));
    } else {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 8, 1, false, false));
    }
    horse.playLivingSound();
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:33,代码来源:MiscellaneousNonsense.java

示例3: onUpdateServer

import net.minecraft.entity.passive.EntityHorse; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public void onUpdateServer(EntityMinionWarrior minion) 
{
	if (minion.getMovementState() == EnumMovementState.FOLLOW)
	{
		
		EntityLivingBase target = null;
		
		MinionAICombat combatAI = minion.getAIManager().getAI(MinionAICombat.class);
		if(combatAI !=null){
			target = combatAI.getAttackTarget();
		}
		if(target !=null)return;
		
		final EntityLiving entityPathController = (EntityLiving) (minion.getRidingEntity() instanceof EntityHorse ? minion.getRidingEntity() : minion);
		final EntityPlayer entityPlayer = (EntityPlayer) minion.getOwner();

		if (entityPathController instanceof EntityHorse)
		{
			final EntityHorse horse = (EntityHorse) entityPathController;

			//This makes the horse move properly.
			if (horse.isHorseSaddled())
			{
				horse.setHorseSaddled(false);
			}
		}
		
		if (entityPlayer != null)
		{
			entityPathController.getLookHelper().setLookPositionWithEntity(entityPlayer, 10.0F, minion.getVerticalFaceSpeed());
			
			final double distanceToPlayer = EntityUtil.getDistanceToEntity(minion, entityPlayer);

			//Crash was reported where bounding box ended up being null.
			if (distanceToPlayer >= 10.0D && entityPlayer.getEntityBoundingBox() != null)
			{
				final int playerX = net.minecraft.util.math.MathHelper.floor(entityPlayer.posX) - 2;
				final int playerY = net.minecraft.util.math.MathHelper.floor(entityPlayer.getEntityBoundingBox().minY);
				final int playerZ = net.minecraft.util.math.MathHelper.floor(entityPlayer.posZ) - 2;

				for (int i = 0; i <= 4; ++i)
				{
					for (int i2 = 0; i2 <= 4; ++i2)
					{
						BlockPos below = new BlockPos(playerX + i, playerY - 1, playerZ + i2);
						BlockPos pos = new BlockPos(playerX + i, playerY, playerZ + i2);
						IBlockState posState = minion.getEntityWorld().getBlockState(pos);
						BlockPos above = new BlockPos(playerX + i, playerY + 1, playerZ + i2);
						IBlockState aboveState = minion.getEntityWorld().getBlockState(above);
						if ((i < 1 || i2 < 1 || i > 3 || i2 > 3) && minion.getEntityWorld().getBlockState(below).isSideSolid(minion.getEntityWorld(), below, EnumFacing.UP) && !posState.getBlock().isNormalCube(posState) && !aboveState.getBlock().isNormalCube(aboveState))
						{
							entityPathController.setLocationAndAngles(playerX + i + 0.5F, playerY, playerZ + i2 + 0.5F, entityPlayer.rotationYaw, entityPlayer.rotationPitch);
							entityPathController.getNavigator().clearPathEntity();
						}
					}
				}
			}

			else if (distanceToPlayer >= 4.5D && minion.getNavigator().noPath())
			{
				float speed = entityPathController instanceof EntityHorse ? MinionConstants.SPEED_HORSE_RUN :  entityPlayer.isSprinting() ? MinionConstants.SPEED_SPRINT : MinionConstants.SPEED_WALK;
				entityPathController.getNavigator().tryMoveToEntityLiving(entityPlayer, speed);
			}

			else if (distanceToPlayer <= 2.0D || (entityPathController instanceof EntityHorse && distanceToPlayer <= 3.0D)) //To avoid crowding the player.
			{
				entityPathController.getNavigator().clearPathEntity();
			}
		}

		else
		{
			//minion.setMovementState(EnumMovementState.MOVE);
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:79,代码来源:MinionAIFollow.java


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