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


Java IBlockSource.getZInt方法代碼示例

本文整理匯總了Java中net.minecraft.dispenser.IBlockSource.getZInt方法的典型用法代碼示例。如果您正苦於以下問題:Java IBlockSource.getZInt方法的具體用法?Java IBlockSource.getZInt怎麽用?Java IBlockSource.getZInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.dispenser.IBlockSource的用法示例。


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

示例1: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();

    if (par2ItemStack.hasTagCompound() && par2ItemStack.stackTagCompound.hasKey("ownerName")) {
        EntitySoulFragment soul = new EntitySoulFragment(world);
        soul.setPlayerName(par2ItemStack.stackTagCompound.getString("ownerName"));
        soul.setLocationAndAngles(i,j,k,0,0);
        world.spawnEntityInWorld(soul);
        System.err.println(soul);
        System.err.println(soul.playerName);
    }

    return par2ItemStack;
}
 
開發者ID:MagiciansArtificeTeam,項目名稱:Magicians-Artifice,代碼行數:20,代碼來源:DispenserSoulBehavior.java

示例2: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing var3 = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World var4 = par1IBlockSource.getWorld();
    double var5 = par1IBlockSource.getX() + (double)((float)var3.getFrontOffsetX() * 1.125F);
    double var7 = par1IBlockSource.getY() + (double)((float)var3.getFrontOffsetY() * 1.125F);
    double var9 = par1IBlockSource.getZ() + (double)((float)var3.getFrontOffsetZ() * 1.125F);
    int var11 = par1IBlockSource.getXInt() + var3.getFrontOffsetX();
    int var12 = par1IBlockSource.getYInt() + var3.getFrontOffsetY();
    int var13 = par1IBlockSource.getZInt() + var3.getFrontOffsetZ();
    Block var14 = var4.getBlock(var11, var12, var13);
    double var15;

    if (BlockRailBase.func_150051_a(var14))
    {
        var15 = 0.0D;
    }
    else
    {
        if (var14.getMaterial() != Material.air || !BlockRailBase.func_150051_a(var4.getBlock(var11, var12 - 1, var13)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        var15 = -1.0D;
    }

    EntityMinecart var17 = EntityMinecart.createMinecart(var4, var5, var7 + var15, var9, ((ItemMinecart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        var17.setMinecartName(par2ItemStack.getDisplayName());
    }

    var4.spawnEntityInWorld(var17);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:39,代碼來源:ItemMinecart.java

示例3: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
@Override
public ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemStack) {
    if (itemStack.getItemDamage() > GelsPlus.proxy.getRegistry().getRegistry().size())
        return this.defaultBehavior.dispense(blockSource, itemStack);
    World worldObj = blockSource.getWorld();
    EnumFacing face = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());
    int xCoord = blockSource.getXInt(), yCoord = blockSource.getYInt(), zCoord = blockSource.getZInt(), gelType = itemStack.getItemDamage();
    if (itemStack.getItem() instanceof ItemGelBlob) {
        if (TileDispenser.fireGel(worldObj, xCoord, yCoord, zCoord, face.ordinal(), gelType, false))
            itemStack.stackSize--;
    }
    return itemStack;
}
 
開發者ID:Lomeli12,項目名稱:GelsPlus,代碼行數:14,代碼來源:BehaviorGel.java

示例4: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
public ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(p_82487_1_.getBlockMetadata());
    World world = p_82487_1_.getWorld();
    double d0 = p_82487_1_.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = p_82487_1_.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = p_82487_1_.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = p_82487_1_.getXInt() + enumfacing.getFrontOffsetX();
    int j = p_82487_1_.getYInt() + enumfacing.getFrontOffsetY();
    int k = p_82487_1_.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(p_82487_1_, p_82487_2_);
        }

        d3 = -1.0D;
    }

    EntityMinecart entityminecart = EntityMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemMinecart)p_82487_2_.getItem()).minecartType);

    if (p_82487_2_.hasDisplayName())
    {
        entityminecart.setMinecartName(p_82487_2_.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    p_82487_2_.splitStack(1);
    return p_82487_2_;
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:39,代碼來源:ItemMinecart.java

示例5: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyChestcart entityminecart = (EntitySpeedyChestcart) EntitySpeedyChestcart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyChestcart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemSpeedyChestcart.java

示例6: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyTankCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemSpeedyTankCart.java

示例7: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyMinecart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemSpeedyMinecart.java

示例8: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemChunkTankCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemChunkTankCart.java

示例9: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyChunkTankCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemSpeedyChunkTankCart.java

示例10: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyMinecart entityminecart = (EntitySpeedyMinecart) EntitySpeedyMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemTankCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemTankCart.java

示例11: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntitySpeedyChunkChestCart entityminecart = (EntitySpeedyChunkChestCart) EntitySpeedyChunkChestCart.createMinecart(world, d0, d1 + d3, d2, ((ItemSpeedyChunkChestCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemSpeedyChunkChestCart.java

示例12: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    Block block = world.getBlock(i, j, k);
    double d3;

    if (BlockRailBase.func_150051_a(block))
    {
        d3 = 0.0D;
    }
    else
    {
        if (block.getMaterial() != Material.air || !BlockRailBase.func_150051_a(world.getBlock(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntityChunkChestCart entityminecart = (EntityChunkChestCart) EntityChunkChestCart.createMinecart(world, d0, d1 + d3, d2, ((ItemChunkChestCart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:Sudwood,項目名稱:AdvancedUtilities,代碼行數:42,代碼來源:ItemChunkChestCart.java

示例13: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    World world = par1IBlockSource.getWorld();
    double d0 = par1IBlockSource.getX() + (double)((float)enumfacing.getFrontOffsetX() * 1.125F);
    double d1 = par1IBlockSource.getY() + (double)((float)enumfacing.getFrontOffsetY() * 1.125F);
    double d2 = par1IBlockSource.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 1.125F);
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    int l = world.getBlockId(i, j, k);
    double d3;

    if (BlockRailBase.isRailBlock(l))
    {
        d3 = 0.0D;
    }
    else
    {
        if (l != 0 || !BlockRailBase.isRailBlock(world.getBlockId(i, j - 1, k)))
        {
            return this.behaviourDefaultDispenseItem.dispense(par1IBlockSource, par2ItemStack);
        }

        d3 = -1.0D;
    }

    EntityMinecart entityminecart = EntityMinecart.createMinecart(world, d0, d1 + d3, d2, ((ItemMinecart)par2ItemStack.getItem()).minecartType);

    if (par2ItemStack.hasDisplayName())
    {
        entityminecart.setMinecartName(par2ItemStack.getDisplayName());
    }

    world.spawnEntityInWorld(entityminecart);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:42,代碼來源:BehaviorDispenseMinecart.java

示例14: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1));
    List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack));

    if (list.size() > 0)
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        int l = entitylivingbase instanceof EntityPlayer ? 1 : 0;
        int i1 = EntityLiving.getArmorPosition(par2ItemStack);
        ItemStack itemstack1 = par2ItemStack.copy();
        itemstack1.stackSize = 1;
        entitylivingbase.setCurrentItemOrArmor(i1, itemstack1);  //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F);
        }

        --par2ItemStack.stackSize;
        return par2ItemStack;
    }
    else
    {
        return super.dispenseStack(par1IBlockSource, par2ItemStack);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:35,代碼來源:BehaviorDispenseArmor.java

示例15: dispenseStack

import net.minecraft.dispenser.IBlockSource; //導入方法依賴的package包/類
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata());
    int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
    int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
    int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
    AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1));
    @SuppressWarnings("rawtypes")
    List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLiving.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack));

    if (list.size() > 0)
    {
        EntityLiving entityliving = (EntityLiving)list.get(0);
        int l = entityliving instanceof EntityPlayer ? 1 : 0;
        int i1 = EntityLiving.getArmorPosition(par2ItemStack);
        ItemStack itemstack1 = par2ItemStack.copy();
        itemstack1.stackSize = 1;
        entityliving.setCurrentItemOrArmor(i1, itemstack1); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
        entityliving.func_96120_a(i1, 2.0F);
        --par2ItemStack.stackSize;
        return par2ItemStack;
    }
    else
    {
        return super.dispenseStack(par1IBlockSource, par2ItemStack);
    }
}
 
開發者ID:beats16,項目名稱:ObsidiCraft,代碼行數:31,代碼來源:BehaviorDispenseArmorObsidian.java


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