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


Java Items.CHEST_MINECART属性代码示例

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


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

示例1: getCartItem

/**
 * This function returns an ItemStack that represents this cart.
 * This should be an ItemStack that can be used by the player to place the cart,
 * but is not necessary the item the cart drops when destroyed.
 * @return An ItemStack that can be used to place the cart.
 */
public ItemStack getCartItem()
{
    if (this instanceof EntityMinecartFurnace)
    {
        return new ItemStack(Items.FURNACE_MINECART);
    }
    else if (this instanceof EntityMinecartChest)
    {
        return new ItemStack(Items.CHEST_MINECART);
    }
    else if (this instanceof EntityMinecartTNT)
    {
        return new ItemStack(Items.TNT_MINECART);
    }
    else if (this instanceof EntityMinecartHopper)
    {
        return new ItemStack(Items.HOPPER_MINECART);
    }
    else if (this instanceof EntityMinecartCommandBlock)
    {
        return new ItemStack(Items.COMMAND_BLOCK_MINECART);
    }
    return new ItemStack(Items.MINECART);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:EntityMinecart.java

示例2: updateDestination

private void updateDestination() {
    doneTurning = false;
    // take dispenser upgrade in account
    double payloadFrictionY = 0.98D; // this value will differ when a dispenser upgrade is inserted.
    double payloadFrictionX = 0.98D;
    double payloadGravity = 0.04D;
    if (getUpgrades(EnumUpgrade.ENTITY_TRACKER) > 0) {
        payloadFrictionY = 0.98D;
        payloadFrictionX = 0.91D;
        payloadGravity = 0.08D;
    } else if (getUpgrades(EnumUpgrade.DISPENSER) > 0 && !inventory.getStackInSlot(CANNON_SLOT).isEmpty()) {
        Item item = inventory.getStackInSlot(CANNON_SLOT).getItem();
        if (item == Items.POTIONITEM || item == Items.EXPERIENCE_BOTTLE || item == Items.EGG || item == Items.SNOWBALL) {// EntityThrowable
            payloadFrictionY = 0.99D;
            payloadGravity = 0.03D;
        } else if (item == Items.ARROW) {
            payloadFrictionY = 0.99D;
            payloadGravity = 0.05D;
        } else if (item == Items.MINECART || item == Items.CHEST_MINECART || item == Items.HOPPER_MINECART || item == Items.TNT_MINECART || item == Items.FURNACE_MINECART) {
            payloadFrictionY = 0.95D;
        }
        // else if(itemID == Item.fireballCharge.itemID){
        // payloadGravity = 0.0D;
        // }

        // family items (throwable) which only differ in gravity.
        if (item == Items.POTIONITEM) {
            payloadGravity = 0.05D;
        } else if (item == Items.EXPERIENCE_BOTTLE) {
            payloadGravity = 0.07D;
        }

        payloadFrictionX = payloadFrictionY;

        // items which have different frictions for each axis.
        if (item == Items.BOAT) {
            payloadFrictionX = 0.99D;
            payloadFrictionY = 0.95D;
        }
        if (item == Items.SPAWN_EGG) {
            payloadFrictionY = 0.98D;
            payloadFrictionX = 0.91D;
            payloadGravity = 0.08D;
        }
    }

    // calculate the heading.
    double deltaX = gpsX - getPos().getX();
    double deltaZ = gpsZ - getPos().getZ();
    float calculatedRotationAngle;
    if (deltaX >= 0 && deltaZ < 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D);
    } else if (deltaX >= 0 && deltaZ >= 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 90;
    } else if (deltaX < 0 && deltaZ >= 0) {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaX / deltaZ)) / Math.PI * 180D) + 180;
    } else {
        calculatedRotationAngle = (float) (Math.atan(Math.abs(deltaZ / deltaX)) / Math.PI * 180D) + 270;
    }

    // calculate the height angle.
    double distance = Math.sqrt(deltaX * deltaX + deltaZ * deltaZ);
    double deltaY = gpsY - getPos().getY();
    float calculatedHeightAngle = calculateBestHeightAngle(distance, deltaY, getForce(), payloadGravity, payloadFrictionX, payloadFrictionY);

    setTargetAngles(calculatedRotationAngle, calculatedHeightAngle);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:67,代码来源:TileEntityAirCannon.java


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