當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityBoat類代碼示例

本文整理匯總了Java中net.minecraft.entity.item.EntityBoat的典型用法代碼示例。如果您正苦於以下問題:Java EntityBoat類的具體用法?Java EntityBoat怎麽用?Java EntityBoat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EntityBoat類屬於net.minecraft.entity.item包,在下文中一共展示了EntityBoat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onAddCollisionBox

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
@SubscribeEvent
public void onAddCollisionBox(AddCollisionBoxToListEvent event) {
    if (getLocalPlayer() != null
            && (event.getBlock() instanceof BlockLiquid)
            && (EntityUtils.isDrivenByPlayer(event.getEntity()) || EntityUtils.isLocalPlayer(event.getEntity()))
            && !(event.getEntity() instanceof EntityBoat)
            && !getLocalPlayer().isSneaking()
            && getLocalPlayer().fallDistance < 3
            && !isInWater(getLocalPlayer())
            && (isAboveWater(getLocalPlayer(), false) || isAboveWater(getRidingEntity(), false))
            && isAboveBlock(getLocalPlayer(), event.getPos())) {
        AxisAlignedBB axisalignedbb = WATER_WALK_AA.offset(event.getPos());
        if (event.getEntityBox().intersects(axisalignedbb)) event.getCollidingBoxes().add(axisalignedbb);
        // cancel event, which will stop it from calling the original code
        event.setCanceled(true);
    }

}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:19,代碼來源:Jesus.java

示例2: startRiding

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
public boolean startRiding(Entity entityIn, boolean force)
{
    if (!super.startRiding(entityIn, force))
    {
        return false;
    }
    else
    {
        if (entityIn instanceof EntityMinecart)
        {
            this.mc.getSoundHandler().playSound(new MovingSoundMinecartRiding(this, (EntityMinecart)entityIn));
        }

        if (entityIn instanceof EntityBoat)
        {
            this.prevRotationYaw = entityIn.rotationYaw;
            this.rotationYaw = entityIn.rotationYaw;
            this.setRotationYawHead(entityIn.rotationYaw);
        }

        return true;
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:24,代碼來源:EntityPlayerSP.java

示例3: onUpdate

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    if (Config.isSmoothWorld() && this.canSkipUpdate())
    {
        this.onUpdateMinimal();
    }
    else
    {
        super.onUpdate();

        if (!this.world.isRemote)
        {
            this.updateLeashedState();

            if (this.ticksExisted % 5 == 0)
            {
                boolean flag = !(this.getControllingPassenger() instanceof EntityLiving);
                boolean flag1 = !(this.getRidingEntity() instanceof EntityBoat);
                this.tasks.setControlFlag(1, flag);
                this.tasks.setControlFlag(4, flag && flag1);
                this.tasks.setControlFlag(2, flag);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:EntityLiving.java

示例4: handleWaterMovement

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Returns if this entity is in water and will end up adding the waters velocity to the entity
 */
public boolean handleWaterMovement()
{
    if (this.getRidingEntity() instanceof EntityBoat)
    {
        this.inWater = false;
    }
    else if (this.world.handleMaterialAcceleration(this.getEntityBoundingBox().expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D), Material.WATER, this))
    {
        if (!this.inWater && !this.firstUpdate)
        {
            this.resetHeight();
        }

        this.fallDistance = 0.0F;
        this.inWater = true;
        this.extinguish();
    }
    else
    {
        this.inWater = false;
    }

    return this.inWater;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:Entity.java

示例5: isInsideOfMaterial

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Checks if the current block the entity is within of the specified material type
 */
public boolean isInsideOfMaterial(Material materialIn)
{
    if (this.getRidingEntity() instanceof EntityBoat)
    {
        return false;
    }
    else
    {
        double d0 = this.posY + (double)this.getEyeHeight();
        BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
        IBlockState iblockstate = this.world.getBlockState(blockpos);

        if (iblockstate.getMaterial() == materialIn)
        {
            float f = BlockLiquid.getLiquidHeightPercent(iblockstate.getBlock().getMetaFromState(iblockstate)) - 0.11111111F;
            float f1 = (float)(blockpos.getY() + 1) - f;
            boolean flag = d0 < (double)f1;
            return !flag && this instanceof EntityPlayer ? false : flag;
        }
        else
        {
            return false;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:Entity.java

示例6: doRender

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Renders the desired {@code T} type Entity.
 */
public void doRender(EntityBoat entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.pushMatrix();
    this.setupTranslation(x, y, z);
    this.setupRotation(entity, entityYaw, partialTicks);
    this.bindEntityTexture(entity);

    if (this.renderOutlines)
    {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    this.modelBoat.render(entity, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

    if (this.renderOutlines)
    {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }

    GlStateManager.popMatrix();
    super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:28,代碼來源:RenderBoat.java

示例7: setupRotation

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
public void setupRotation(EntityBoat p_188311_1_, float p_188311_2_, float p_188311_3_)
{
    GlStateManager.rotate(180.0F - p_188311_2_, 0.0F, 1.0F, 0.0F);
    float f = (float)p_188311_1_.getTimeSinceHit() - p_188311_3_;
    float f1 = p_188311_1_.getDamageTaken() - p_188311_3_;

    if (f1 < 0.0F)
    {
        f1 = 0.0F;
    }

    if (f > 0.0F)
    {
        GlStateManager.rotate(MathHelper.sin(f) * f * f1 / 10.0F * (float)p_188311_1_.getForwardDirection(), 1.0F, 0.0F, 0.0F);
    }

    GlStateManager.scale(-1.0F, -1.0F, 1.0F);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:RenderBoat.java

示例8: onUpdate

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
    super.onUpdate();

    if (!this.worldObj.isRemote)
    {
        this.updateLeashedState();

        if (this.ticksExisted % 5 == 0)
        {
            boolean flag = !(this.getControllingPassenger() instanceof EntityLiving);
            boolean flag1 = !(this.getRidingEntity() instanceof EntityBoat);
            this.tasks.setControlFlag(1, flag);
            this.tasks.setControlFlag(4, flag && flag1);
            this.tasks.setControlFlag(2, flag);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:EntityLiving.java

示例9: handleWaterMovement

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Returns if this entity is in water and will end up adding the waters velocity to the entity
 */
public boolean handleWaterMovement()
{
    if (this.getRidingEntity() instanceof EntityBoat)
    {
        this.inWater = false;
    }
    else if (this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox().expand(0.0D, -0.4000000059604645D, 0.0D).contract(0.001D), Material.WATER, this))
    {
        if (!this.inWater && !this.firstUpdate)
        {
            this.resetHeight();
        }

        this.fallDistance = 0.0F;
        this.inWater = true;
        this.fire = 0;
    }
    else
    {
        this.inWater = false;
    }

    return this.inWater;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:Entity.java

示例10: isInsideOfMaterial

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
/**
 * Checks if the current block the entity is within of the specified material type
 */
public boolean isInsideOfMaterial(Material materialIn)
{
    if (this.getRidingEntity() instanceof EntityBoat)
    {
        return false;
    }
    else
    {
        double d0 = this.posY + (double)this.getEyeHeight();
        BlockPos blockpos = new BlockPos(this.posX, d0, this.posZ);
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos);

        Boolean result = iblockstate.getBlock().isEntityInsideMaterial(this.worldObj, blockpos, iblockstate, this, d0, materialIn, true);
        if (result != null) return result;

        if (iblockstate.getMaterial() == materialIn)
        {
            return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(materialIn, this, blockpos);
        }
        else
        {
            return false;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:29,代碼來源:Entity.java

示例11: getBoatStatus

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
private EntityBoat.Status getBoatStatus() {
    EntityBoat.Status status = this.getUnderwaterStatus();

    if (status != null) {
        this.waterLevel = this.getEntityBoundingBox().maxY;
        return status;
    } else if (this.checkInWater()) {
        return EntityBoat.Status.IN_WATER;
    } else {
        float f = this.getFollower() == null ? 0 : this.getFollower().getBoatGlide();
        if (f > 0.0F) {
            this.boatGlide = f;
            return EntityBoat.Status.ON_LAND;
        } else {
            return EntityBoat.Status.IN_AIR;
        }
    }
}
 
開發者ID:InfinityRaider,項目名稱:Boatifull,代碼行數:19,代碼來源:EntityBoatLink.java

示例12: performBoatLinkAction

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
private void performBoatLinkAction(EntityPlayer player, EntityBoat boat, ItemStack stack, IBoatLinker boatLinker) {
    EnumBoatLinkResult startResult = boatLinker.startBoatLink(player, boat);
    if(!startResult.isOk()) {
        EnumBoatLinkResult finishResult = boatLinker.finishBoatLink(player, boat);
        if(!finishResult.isOk()) {
            if(startResult.isOk()) {
                player.sendStatusMessage(new TextComponentTranslation("boatifull.message." + startResult.toString().toLowerCase()), false);
            } else {
                player.sendStatusMessage(new TextComponentTranslation("boatifull.message." + finishResult.toString().toLowerCase()), false);
            }
        } else {
            player.sendStatusMessage(new TextComponentTranslation("boatifull.message." + finishResult.toString().toLowerCase()), false);
            this.reduceStackSize(player, stack);
        }
    } else {
        player.sendStatusMessage(new TextComponentTranslation("boatifull.message." + startResult.toString().toLowerCase()), false);
    }
}
 
開發者ID:InfinityRaider,項目名稱:Boatifull,代碼行數:19,代碼來源:InteractionHandler.java

示例13: onEntityLeaveWorld

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
@Override
public void onEntityLeaveWorld(Entity entity) {
    if(!entity.getEntityWorld().isRemote) {
        if(entity instanceof EntityBoat) {
            EntityBoat boat = (EntityBoat) entity;
            if(linkingBoatToPlayer.containsKey(boat)) {
                removeLinkingProgress(boat);
            }
            if(this.boatLinks.containsKey(boat)) {
                this.unlinkBoat(boat);
            }
            getBoatsLinkedToBoat(boat).forEach(this::unlinkBoat);
        } else if(entity instanceof EntityPlayer) {
            this.removeLinkingProgress((EntityPlayer) entity);
        }
    }
}
 
開發者ID:InfinityRaider,項目名稱:Boatifull,代碼行數:18,代碼來源:BoatLinker.java

示例14: onTick

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
@Override
public void onTick(ItemStack stack, EntityPlayer entityIn) {
  if (!this.canTick(stack)) {
    return;
  }
  if (entityIn.getRidingEntity() instanceof EntityBoat) {
    EntityBoat boat = (EntityBoat) entityIn.getRidingEntity();
    if (entityIn.moveForward > 0) {
      float reduce = 0.08F;
      //pulled from private EntityBoat.controlBoat() fn
      boat.motionX += net.minecraft.util.math.MathHelper.sin(-boat.rotationYaw * 0.017453292F) * reduce;
      boat.motionZ += net.minecraft.util.math.MathHelper.cos(boat.rotationYaw * 0.017453292F) * reduce;
      if (entityIn.getEntityWorld().rand.nextDouble() < 0.1) {
        super.damageCharm(entityIn, stack);
      }
    }
  }
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:19,代碼來源:ItemCharmBoat.java

示例15: doRender

import net.minecraft.entity.item.EntityBoat; //導入依賴的package包/類
public void doRender(EntityBoat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
    GL11.glPushMatrix();
    GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
    GL11.glRotatef(180.0F - p_76986_8_, 0.0F, 1.0F, 0.0F);
    float f2 = (float)p_76986_1_.getTimeSinceHit() - p_76986_9_;
    float f3 = p_76986_1_.getDamageTaken() - p_76986_9_;

    if (f3 < 0.0F)
    {
        f3 = 0.0F;
    }

    if (f2 > 0.0F)
    {
        GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float)p_76986_1_.getForwardDirection(), 1.0F, 0.0F, 0.0F);
    }

    float f4 = 0.75F;
    GL11.glScalef(f4, f4, f4);
    GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4);
    this.bindEntityTexture(p_76986_1_);
    GL11.glScalef(-1.0F, -1.0F, 1.0F);
    this.modelBoat.render(p_76986_1_, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
    GL11.glPopMatrix();
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:27,代碼來源:RenderBoat.java


注:本文中的net.minecraft.entity.item.EntityBoat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。