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