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


Java TileEntityDispenser类代码示例

本文整理汇总了Java中net.minecraft.tileentity.TileEntityDispenser的典型用法代码示例。如果您正苦于以下问题:Java TileEntityDispenser类的具体用法?Java TileEntityDispenser怎么用?Java TileEntityDispenser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: generateDispenserContents

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
    {
        worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:StructureComponent.java

示例2: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:BlockDispenser.java

示例3: generateDispenserContents

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
public static void generateDispenserContents(Random random, List<WeightedRandomChestContent> listIn, TileEntityDispenser dispenser, int max)
{
    for (int i = 0; i < max; ++i)
    {
        WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(random, listIn);
        int j = weightedrandomchestcontent.minStackSize + random.nextInt(weightedrandomchestcontent.maxStackSize - weightedrandomchestcontent.minStackSize + 1);

        if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= j)
        {
            ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
            itemstack1.stackSize = j;
            dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack1);
        }
        else
        {
            for (int k = 0; k < j; ++k)
            {
                ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
                itemstack.stackSize = 1;
                dispenser.setInventorySlotContents(random.nextInt(dispenser.getSizeInventory()), itemstack);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:25,代码来源:WeightedRandomChestContent.java

示例4: onRender

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
@EventTarget
private void onRender(final Render3DEvent event) {
    GlStateManager.pushMatrix();
    for (final Object o : this.mc.theWorld.loadedTileEntityList) {
    	final TileEntity ent = (TileEntity)o;
        if (!(ent instanceof TileEntityChest) && !(ent instanceof TileEntityDispenser) && !(ent instanceof TileEntityEnderChest)) {
            continue;
        }
        if (ent instanceof TileEntityChest && !StorageEsp.chest) {
            continue;
        }
        if (ent instanceof TileEntityDispenser && !StorageEsp.dispenser) {
            continue;
        }
        if (ent instanceof TileEntityEnderChest && !StorageEsp.enderChest) {
            continue;
        }
        this.drawEsp(ent, event.partialTicks);
    }
    GlStateManager.popMatrix();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:StorageEsp.java

示例5: createDispenser

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected boolean createDispenser(World p_189419_1_, StructureBoundingBox p_189419_2_, Random p_189419_3_, int p_189419_4_, int p_189419_5_, int p_189419_6_, EnumFacing p_189419_7_, ResourceLocation p_189419_8_)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(p_189419_4_, p_189419_6_), this.getYWithOffset(p_189419_5_), this.getZWithOffset(p_189419_4_, p_189419_6_));

    if (p_189419_2_.isVecInside(blockpos) && p_189419_1_.getBlockState(blockpos).getBlock() != Blocks.DISPENSER)
    {
        this.setBlockState(p_189419_1_, Blocks.DISPENSER.getDefaultState().withProperty(BlockDispenser.FACING, p_189419_7_), p_189419_4_, p_189419_5_, p_189419_6_, p_189419_2_);
        TileEntity tileentity = p_189419_1_.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            ((TileEntityDispenser)tileentity).setLootTable(p_189419_8_, p_189419_3_.nextLong());
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:StructureComponent.java

示例6: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.DEFAULT_BEHAVIOR)
            {
                tileentitydispenser.setInventorySlotContents(i, ibehaviordispenseitem.dispense(blocksourceimpl, itemstack));
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:26,代码来源:BlockDispenser.java

示例7: fillContainer

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
/**
 * Picks up fluid in front of a Dispenser and fills a container with it.
 */
private ItemStack fillContainer(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    EnumFacing dispenserFacing = source.getBlockState().getValue(BlockDispenser.FACING);
    BlockPos blockpos = source.getBlockPos().offset(dispenserFacing);

    ItemStack result = FluidUtil.tryPickUpFluid(stack, null, world, blockpos, dispenserFacing.getOpposite());
    if (result == null)
    {
        return super.dispenseStack(source, stack);
    }

    if (--stack.stackSize == 0)
    {
        stack.deserializeNBT(result.serializeNBT());
    }
    else if (((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(result) < 0)
    {
        this.dispenseBehavior.dispense(source, result);
    }

    return stack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:DispenseFluidContainer.java

示例8: dispense

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playEvent(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.DEFAULT_BEHAVIOR)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:27,代码来源:BlockDispenser.java

示例9: onBlockActivated

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityDispenser)
        {
            playerIn.displayGUIChest((TileEntityDispenser)tileentity);
        }

        return true;
    }
}
 
开发者ID:ORCHARD-Minecraft-Mod-Class,项目名称:RandomMine,代码行数:19,代码来源:RedStoneSword.java

示例10: onBlockActivated

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
	
    if (worldIn.isRemote)
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);
        BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
        TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();
        tileentitydispenser.setCustomName("Block Placer");
        if (tileentity instanceof TileEntityDispenser)
        {
            playerIn.displayGUIChest((TileEntityDispenser)tileentity);
        }

        return true;
    }
}
 
开发者ID:ORCHARD-Minecraft-Mod-Class,项目名称:RandomMine,代码行数:22,代码来源:BlockPlacer.java

示例11: generateStructureDispenserContents

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
/**
 * Used to generate dispenser contents for structures. ex: Jungle Temples.
 */
protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9)
{
    int var10 = this.getXWithOffset(par4, par6);
    int var11 = this.getYWithOffset(par5);
    int var12 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(var10, var11, var12) && par1World.getBlock(var10, var11, var12) != Blocks.dispenser)
    {
        par1World.setBlock(var10, var11, var12, Blocks.dispenser, this.func_151555_a(Blocks.dispenser, par7), 2);
        TileEntityDispenser var13 = (TileEntityDispenser)par1World.getTileEntity(var10, var11, var12);

        if (var13 != null)
        {
            WeightedRandomChestContent.func_150706_a(par3Random, par8ArrayOfWeightedRandomChestContent, var13, par9);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:StructureComponent.java

示例12: onBlockActivated

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
/**
 * Called upon block activation (right click on the block.)
 */
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
    if (p_149727_1_.isClient)
    {
        return true;
    }
    else
    {
        TileEntityDispenser var10 = (TileEntityDispenser)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_);

        if (var10 != null)
        {
            p_149727_5_.func_146102_a(var10);
        }

        return true;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:22,代码来源:BlockDispenser.java

示例13: func_149941_e

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
    BlockSourceImpl var5 = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
    TileEntityDispenser var6 = (TileEntityDispenser)var5.getBlockTileEntity();

    if (var6 != null)
    {
        int var7 = var6.func_146017_i();

        if (var7 < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack var8 = var6.getStackInSlot(var7);
            IBehaviorDispenseItem var9 = this.func_149940_a(var8);

            if (var9 != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack var10 = var9.dispense(var5, var8);
                var6.setInventorySlotContents(var7, var10.stackSize == 0 ? null : var10);
            }
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:27,代码来源:BlockDispenser.java

示例14: func_150706_a

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
public static void func_150706_a(Random p_150706_0_, WeightedRandomChestContent[] p_150706_1_, TileEntityDispenser p_150706_2_, int p_150706_3_)
{
    for (int var4 = 0; var4 < p_150706_3_; ++var4)
    {
        WeightedRandomChestContent var5 = (WeightedRandomChestContent)WeightedRandom.getRandomItem(p_150706_0_, p_150706_1_);
        int var6 = var5.theMinimumChanceToGenerateItem + p_150706_0_.nextInt(var5.theMaximumChanceToGenerateItem - var5.theMinimumChanceToGenerateItem + 1);

        if (var5.theItemId.getMaxStackSize() >= var6)
        {
            ItemStack var7 = var5.theItemId.copy();
            var7.stackSize = var6;
            p_150706_2_.setInventorySlotContents(p_150706_0_.nextInt(p_150706_2_.getSizeInventory()), var7);
        }
        else
        {
            for (int var9 = 0; var9 < var6; ++var9)
            {
                ItemStack var8 = var5.theItemId.copy();
                var8.stackSize = 1;
                p_150706_2_.setInventorySlotContents(p_150706_0_.nextInt(p_150706_2_.getSizeInventory()), var8);
            }
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:25,代码来源:WeightedRandomChestContent.java

示例15: generateStructureDispenserContents

import net.minecraft.tileentity.TileEntityDispenser; //导入依赖的package包/类
protected boolean generateStructureDispenserContents(World p_74869_1_, StructureBoundingBox p_74869_2_, Random p_74869_3_, int p_74869_4_, int p_74869_5_, int p_74869_6_, int p_74869_7_, WeightedRandomChestContent[] p_74869_8_, int p_74869_9_)
{
    int j1 = this.getXWithOffset(p_74869_4_, p_74869_6_);
    int k1 = this.getYWithOffset(p_74869_5_);
    int l1 = this.getZWithOffset(p_74869_4_, p_74869_6_);

    if (p_74869_2_.isVecInside(j1, k1, l1) && p_74869_1_.getBlock(j1, k1, l1) != Blocks.dispenser)
    {
        p_74869_1_.setBlock(j1, k1, l1, Blocks.dispenser, this.getMetadataWithOffset(Blocks.dispenser, p_74869_7_), 2);
        TileEntityDispenser tileentitydispenser = (TileEntityDispenser)p_74869_1_.getTileEntity(j1, k1, l1);

        if (tileentitydispenser != null)
        {
            WeightedRandomChestContent.generateDispenserContents(p_74869_3_, p_74869_8_, tileentitydispenser, p_74869_9_);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:24,代码来源:StructureComponent.java


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