當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。