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


Java IBehaviorDispenseItem类代码示例

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


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

示例1: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的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

示例2: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的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

示例3: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的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

示例4: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
/**
 * pulled from BlockDispenser
 * 
 * @param worldIn
 * @param pos
 */
protected void dispense(World worldIn, BlockPos pos) {
  if (this.timeSinceDropped > 0) {
    this.timeSinceDropped--;
    return;
  }
  BlockSourceImpl source = new BlockSourceImpl(worldIn, pos);
  int i = this.getDispenseSlot(worldIn.rand);
  if (i < 0) {
    world.playEvent(1001, pos, 0);
    this.timeSinceDropped = TIME_BTW_DROPS;
  }
  else {
    ItemStack itemstack = this.getStackInSlot(i);
    IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);
    //    ModCyclic.logger.info("BEHAVIOR "+ibehaviordispenseitem);
    try {
      ItemStack result = ibehaviordispenseitem.dispense(source, itemstack);
      this.setInventorySlotContents(i, result);
      this.timeSinceDropped = TIME_BTW_DROPS;
    }
    catch (Exception e) {
      ModCyclic.logger.error(e.getMessage());
    }
  }
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:32,代码来源:EntityGoldMinecartDispenser.java

示例5: func_149941_e

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的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

示例6: func_149941_e

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

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.func_146017_i();

        if (l < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.func_149940_a(itemstack);

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

示例7: func_82526_n

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
protected void func_82526_n(World p_82526_1_, int p_82526_2_, int p_82526_3_, int p_82526_4_) {
   BlockSourceImpl var5 = new BlockSourceImpl(p_82526_1_, p_82526_2_, p_82526_3_, p_82526_4_);
   TileEntityDispenser var6 = (TileEntityDispenser)var5.func_82619_j();
   if(var6 != null) {
      int var7 = var6.func_70361_i();
      if(var7 < 0) {
         p_82526_1_.func_72926_e(1001, p_82526_2_, p_82526_3_, p_82526_4_, 0);
      } else {
         ItemStack var8 = var6.func_70301_a(var7);
         IBehaviorDispenseItem var9 = this.func_96472_a(var8);
         if(var9 != IBehaviorDispenseItem.field_82483_a) {
            ItemStack var10 = var9.func_82482_a(var5, var8);
            var6.func_70299_a(var7, var10.field_77994_a == 0?null:var10);
         }
      }

   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:19,代码来源:BlockDispenser.java

示例8: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
protected void dispense(World par1World, int par2, int par3, int par4)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(par1World, par2, par3, par4);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.getRandomStackFromInventory();

        if (l < 0)
        {
            par1World.playAuxSFX(1001, par2, par3, par4, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehaviorForItemStack(itemstack);

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

示例9: ItemSpellPage

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
public ItemSpellPage(String id) {
	super(id);
	this.setMaxStackSize(1);
	this.setHasSubtypes(true);

	BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, new IBehaviorDispenseItem() {

		@Override
		public ItemStack dispense(IBlockSource source, ItemStack stack) {
			Spell s = ItemSpellPage.getSpellFromItemStack(stack);
			if (s != null) {
				EnumFacing enumfacing = source.getBlockState().getValue(BlockDispenser.FACING);
				Vec3d lookVect = new Vec3d(enumfacing.getDirectionVec());
				if (s.canBeUsed(source.getWorld(), source.getBlockPos().offset(enumfacing), null)) {
					if (s.getType() == EnumSpellType.INSTANT)
						s.performEffect(new RayTraceResult(Type.MISS, lookVect, EnumFacing.UP, source.getBlockPos()), null, source.getWorld());
					else {
						EntitySpellCarrier car = new EntitySpellCarrier(source.getWorld(), source.getBlockPos().getX() + 1.5 * lookVect.x + 0.5, source.getBlockPos().getY() + 0.5d + lookVect.y, source.getBlockPos().getZ() + 1.5 * lookVect.z + 0.5);
						car.setSpell(s);
						car.setCaster(null);
						car.shoot(car, 0, enumfacing.getHorizontalAngle(), 0, 1f, 0);
						source.getWorld().spawnEntity(car);
					}
					return ItemStack.EMPTY;
				}
			}
			return stack;
		}
	});

}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:32,代码来源:ItemSpellPage.java

示例10: dispense

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的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)
            {
            	try{
            	    IPosition iposition = BlockDispenser.getDispensePosition(blocksourceimpl);
            	    BlockPos pos1 = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ());
            		Block block = Block.getBlockFromItem(itemstack.getItem());
            		if (worldIn.canBlockBePlaced(block,pos1,true,BlockPistonBase.getFacing(1),en,itemstack)){
            	ItemStack itemstack1 = this.dispenseStack(blocksourceimpl, itemstack, worldIn);
            	worldIn.playSoundEffect(iposition.getX(), iposition.getY(), iposition.getZ(), block.stepSound.getPlaceSound(), 1.0f, 1.0f);
                if (block.getStateFromMeta(itemstack1.getMetadata())==worldIn.getBlockState(pos1))tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize == 0 ? null : itemstack1);
            	    }}
            	    catch (Exception e) {}
            }
        }
    }
}
 
开发者ID:ORCHARD-Minecraft-Mod-Class,项目名称:RandomMine,代码行数:35,代码来源:BlockPlacer.java

示例11: callMethod

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws LuaException, InterruptedException {
	if (!Config.enableFlingingTurtle)
		throw new LuaException("Flinging turtles have been disabled");
	if (arguments.length > 0 && !(arguments[0] instanceof Double))
		throw new LuaException("Bad argument #1 (expected number)");
	int slot = 1;
	int direction;
	if (method == 1)
		direction = ForgeDirection.DOWN.flag; //Why these are reversed, idk. Dispensers be dum
	else if (method == 2)
		direction = ForgeDirection.UP.flag;
	else
		direction = turtle.getDirection();
	turtle.getDirection();
	if (arguments.length > 0)
		slot += (int)(double)(Double)arguments[0];
	else
		slot = turtle.getSelectedSlot();
	
	synchronized (this) {
		ItemStack stack = turtle.getInventory().getStackInSlot(slot);
		if (stack != null) {
			IBehaviorDispenseItem behavior = (IBehaviorDispenseItem) BlockDispenser.dispenseBehaviorRegistry.getObject(stack.getItem());
			if (behavior != IBehaviorDispenseItem.itemDispenseBehaviorProvider) {
				BlockSourceTurtle blockSource = new BlockSourceTurtle(direction);
				ItemStack newStack = behavior.dispense(blockSource, stack);
				turtle.getInventory().setInventorySlotContents(slot, newStack.stackSize == 0 ? null : newStack);
				turtle.getInventory().markDirty();
			}
		}
	}
	return new Object[0];
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:35,代码来源:PeripheralDispenser.java

示例12: func_149941_e

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
public void func_149941_e(World p_149941_1_, int p_149941_2_, int p_149941_3_, int p_149941_4_)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(p_149941_1_, p_149941_2_, p_149941_3_, p_149941_4_);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int l = tileentitydispenser.func_146017_i();

        if (l < 0)
        {
            p_149941_1_.playAuxSFX(1001, p_149941_2_, p_149941_3_, p_149941_4_, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(l);
            IBehaviorDispenseItem ibehaviordispenseitem = this.func_149940_a(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                eventFired = false; // CraftBukkit - reset event status
                tileentitydispenser.setInventorySlotContents(l, itemstack1.stackSize == 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:28,代码来源:BlockDispenser.java

示例13: getBehavior

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
protected IBehaviorDispenseItem getBehavior(ItemStack stack)
{
    return (IBehaviorDispenseItem)dispenseBehaviorRegistry.getObject(stack == null ? null : stack.getItem());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockDispenser.java

示例14: getBehavior

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
protected IBehaviorDispenseItem getBehavior(ItemStack stack)
{
    return this.dropBehavior;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockDropper.java

示例15: getBehavior

import net.minecraft.dispenser.IBehaviorDispenseItem; //导入依赖的package包/类
protected IBehaviorDispenseItem getBehavior(ItemStack stack)
{
    return (IBehaviorDispenseItem)DISPENSE_BEHAVIOR_REGISTRY.getObject(stack.getItem());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BlockDispenser.java


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