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


Java Entity.isRiding方法代码示例

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


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

示例1: removeEntity

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Schedule the entity for removal during the next tick. Marks the entity dead in anticipation.
 */
public void removeEntity(Entity entityIn)
{
    if (entityIn.isBeingRidden())
    {
        entityIn.removePassengers();
    }

    if (entityIn.isRiding())
    {
        entityIn.dismountRidingEntity();
    }

    entityIn.setDead();

    if (entityIn instanceof EntityPlayer)
    {
        this.playerEntities.remove(entityIn);
        this.updateAllPlayersSleepingFlag();
        this.onEntityRemoved(entityIn);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:World.java

示例2: func_191324_b

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public static Predicate<Entity> func_191324_b(final Entity p_191324_0_)
{
    return new Predicate<Entity>()
    {
        public boolean apply(@Nullable Entity p_apply_1_)
        {
            while (true)
            {
                if (p_apply_1_.isRiding())
                {
                    p_apply_1_ = p_apply_1_.getRidingEntity();

                    if (p_apply_1_ != p_191324_0_)
                    {
                        continue;
                    }

                    return false;
                }

                return true;
            }
        }
    };
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:EntitySelectors.java

示例3: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss())
    {
        entityIn.setPortal(pos);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:BlockPortal.java

示例4: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    if (!entityIn.isRiding() && !entityIn.isBeingRidden() && entityIn.isNonBoss() && !worldIn.isRemote && entityIn.getEntityBoundingBox().intersectsWith(state.getBoundingBox(worldIn, pos).offset(pos)))
    {
        entityIn.changeDimension(1);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:BlockEndPortal.java

示例5: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
	super.onEntityCollidedWithBlock(world, pos, state, entity);
	
	if (entity instanceof EntityBoat) {
		entity.motionY += 0.007;
		//entity.motionY -= 0.2;
		//entity.setVelocity(entity.motionX, 0.01, entity.motionZ);
		return;
	}
	
	if (!world.isRemote) {
		//Immune creatures
		if (entity instanceof EntityPigZombie) return;
		if (entity instanceof EntityMagmaCube) return;
		if (entity instanceof EntityGhast) return;
	}
	if (entity instanceof EntityItem) {
		if (liftsItems) {
			if (entity.motionY < 0) entity.motionY *= 0.98;
			entity.motionY += 0.08 + 0.02;
		}
		return;
	} else {
		//slows everything else down - disables because atm it messes with upwards swimming and creative flight
		/*
		if (entity instanceof EntityPlayer) {
			//Do the slowdown clientside-only
			if (world.isRemote) {
				applyFluidPhysics(entity);
			}
		} else {
			applyFluidPhysics(entity);
		}*/
	}
	
	if (world.isRemote) return;
	if (fluidDamage!=null && !entity.isRiding()) {
		entity.attackEntityFrom(fluidDamage, 1.0f);
		entity.velocityChanged = false;
	}
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:43,代码来源:BlockFluidSimple.java

示例6: fire

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
private synchronized boolean fire() {
    Entity itemShot = getCloseEntityIfUpgraded();
    if (getPressure() >= PneumaticValues.MIN_PRESSURE_AIR_CANNON && (itemShot != null || !inventory.getStackInSlot(CANNON_SLOT).isEmpty())) {
        double[] velocity = getVelocityVector(heightAngle, rotationAngle, getForce());
        addAir((int) (-500 * getForce()));
        boolean shootingInventory = false;
        if (itemShot == null) {
            shootingInventory = true;
            itemShot = getPayloadEntity();
            if (itemShot instanceof EntityItem) {
                inventory.setStackInSlot(CANNON_SLOT, ItemStack.EMPTY);
                if (getUpgrades(EnumUpgrade.BLOCK_TRACKER) > 0) {
                    trackedItems.add((EntityItem) itemShot);
                }
            } else {
                inventory.extractItem(CANNON_SLOT, 1, false);
            }
        } else if (itemShot instanceof EntityPlayer) {
            EntityPlayerMP entityplayermp = (EntityPlayerMP) itemShot;
            if (entityplayermp.connection.getNetworkManager().isChannelOpen()) {
                
                //This is a nasty hack to get around "player moved wrongly!" messages, which can be caused if player movement
                // triggers a player teleport (e.g. player moves onto pressure plate, triggers air cannon with an entity tracker).
                entityplayermp.invulnerableDimensionChange = true;
                
                entityplayermp.setPositionAndUpdate(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
            }
        }

        if (itemShot.isRiding()) {
            itemShot.dismountRidingEntity();
        }

        itemShot.setPosition(getPos().getX() + 0.5D, getPos().getY() + 1.8D, getPos().getZ() + 0.5D);
        NetworkHandler.sendToAllAround(new PacketSetEntityMotion(itemShot, velocity[0], velocity[1], velocity[2]),
                new TargetPoint(getWorld().provider.getDimension(), getPos().getX(), getPos().getY(), getPos().getZ(), 64));

        if (itemShot instanceof EntityFireball) {
            velocity[0] *= 0.05D;
            velocity[1] *= 0.05D;
            velocity[2] *= 0.05D;
        }

        itemShot.motionX = velocity[0];
        itemShot.motionY = velocity[1];
        itemShot.motionZ = velocity[2];

        itemShot.onGround = false;
        itemShot.collided = false;
        itemShot.collidedHorizontally = false;
        itemShot.collidedVertically = false;
        if (itemShot instanceof EntityLivingBase) ((EntityLivingBase) itemShot).setJumping(true);

        if (shootingInventory && !getWorld().isRemote) getWorld().spawnEntity(itemShot);

        for (int i = 0; i < 10; i++) {
            double velX = velocity[0] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            double velY = velocity[1] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            double velZ = velocity[2] * 0.4D + (rand.nextGaussian() - 0.5D) * 0.05D;
            NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, getPos().getX() + 0.5D, getPos().getY() + 0.7D, getPos().getZ() + 0.5D, velX, velY, velZ), getWorld());
        }
        NetworkHandler.sendToAllAround(new PacketPlaySound(Sounds.CANNON_SOUND, SoundCategory.BLOCKS, getPos().getX(), getPos().getY(), getPos().getZ(), 1.0F, rand.nextFloat() / 4F + 0.75F, true), getWorld());
        return true;
    } else {
        return false;
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:68,代码来源:TileEntityAirCannon.java

示例7: render

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Override
    public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
        this.isSneak = entity.isSneaking();
        this.isRiding = entity.isRiding();
//        if (entity instanceof EntityLivingBase) {
//            this.isChild = ((EntityLivingBase) entity).isChild();
//            this.rightArmPose = (((EntityLivingBase) entity).getHeldItem(EnumHand.MAIN_HAND) != null ? ArmPose.BOW_AND_ARROW : ArmPose.EMPTY);
//            // TODO possibly check if it can be completely removed? 1.9 thing
//        }

        this.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale, entity);
        if (this.isChild) {
            float f6 = 2.0F;
            GlStateManager.pushMatrix();
            GlStateManager.scale(1.5F / f6, 1.5F / f6, 1.5F / f6);
            GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
            GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GlStateManager.enableBlend();
            this.bipedHead.render(scale);
            GlStateManager.disableBlend();
            GlStateManager.popMatrix();
            GlStateManager.pushMatrix();
            GlStateManager.scale(1.0F / f6, 1.0F / f6, 1.0F / f6);
            GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
            this.bipedBody.render(scale);
            this.bipedRightArm.render(scale);
            this.bipedLeftArm.render(scale);
            this.bipedRightLeg.render(scale);
            this.bipedLeftLeg.render(scale);
            GlStateManager.popMatrix();
        } else {
            GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
            GlStateManager.enableBlend();
            this.bipedHead.render(scale);
            GlStateManager.disableBlend();
            this.bipedBody.render(scale);
            this.bipedRightArm.render(scale);
            this.bipedLeftArm.render(scale);
            this.bipedRightLeg.render(scale);
            this.bipedLeftLeg.render(scale);
        }
    }
 
开发者ID:McJty,项目名称:needtobreath,代码行数:43,代码来源:HazmatSuitModel.java

示例8: apply

import net.minecraft.entity.Entity; //导入方法依赖的package包/类
public boolean apply(@Nullable Entity p_apply_1_)
{
    return p_apply_1_.isEntityAlive() && !p_apply_1_.isBeingRidden() && !p_apply_1_.isRiding();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:EntitySelectors.java


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