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


Java IBlockSource类代码示例

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


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

示例1: dispense

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
@Override
public ItemStack dispense(IBlockSource block, final ItemStack stack) {
	return new BehaviorProjectileDispense() {

		@Override
		protected IProjectile getProjectileEntity(World world, IPosition pos) {
			return new EntityLingeringPotion(world, pos.getX(), pos.getY(), pos.getZ(), stack.copy());
		}

		@Override
		protected float func_82498_a() {
			return super.func_82498_a() * 0.5F;
		}

		@Override
		protected float func_82500_b() {
			return super.func_82500_b() * 1.25F;
		}
	}.dispense(block, stack);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:21,代码来源:DispenserBehaviourLingeringPotion.java

示例2: dispenseArmor

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase> and (EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return ItemStack.field_190927_a;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.splitStack(1);
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        return stack;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:ItemArmor.java

示例3: fillContainer

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

示例4: dispenseArmor

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.getBlockState().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase>and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.copy();
        itemstack.stackSize = 1;
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

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

示例5: dispenseStack

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
       World world = source.getWorld();
       BlockPos pos = source.getBlockPos();
       Vec3d pos2 = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
       Vec3d dir = this.getNearestTargetDirection(world, pos);
       if(dir == null) return null;
       IPosition ipos = new PositionImpl(pos2.x + dir.x * .75, pos2.y + dir.y * .75, pos2.z + dir.z * .75);
          double d0 = ipos.getX();
          double d1 = ipos.getY();
          double d2 = ipos.getZ();
          Random random = world.rand;
          double d3 = random.nextGaussian() * 0.05D + dir.x;
          double d4 = random.nextGaussian() * 0.05D + dir.y;
          double d5 = random.nextGaussian() * 0.05D + dir.z;
          world.spawnEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
          stack.splitStack(1);
          return stack;
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:20,代码来源:TrackingDispenserBehavior.java

示例6: dispenseStack

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource dispenser, ItemStack cartItemStack)
{
	EntityMinecartBase entityMinecartBase;
	World world = dispenser.getWorld();
	boolean cartSpawned = false;
	if(ItemStackUtils.isItemInstanceOf(cartItemStack, ItemMinecartBase.class))
	{
		ItemMinecartBase itemMinecartBase = (ItemMinecartBase)cartItemStack.getItem();
		entityMinecartBase = itemMinecartBase.getEntityFromItem(world, cartItemStack);

		if(entityMinecartBase != null)
		{
			EnumFacing enumfacing = BlockDispenser.getFacing(dispenser.getBlockMetadata());
			BlockPos blockpos = dispenser.getBlockPos().offset(enumfacing);
			cartSpawned = itemMinecartBase.placeCart(cartItemStack, world, blockpos, entityMinecartBase);
		}
	}

	if(!cartSpawned)
	{
		cartItemStack = super.dispenseStack(dispenser, cartItemStack);
	}

	return cartItemStack;
}
 
开发者ID:BrassGoggledCoders,项目名称:MoarCarts,代码行数:26,代码来源:CartDispenserBehavior.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) {
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    ItemStack stack = par2ItemStack.splitStack(1);
    if (matchesItem(par2ItemStack)) {
        // dispense item as projectile because the item matches
        IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
        iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        world.spawnEntityInWorld((Entity) iprojectile);
    } else {
        // dispense item as item because it doesn't match
        BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
    }
    return par2ItemStack;
}
 
开发者ID:meew0,项目名称:AdvancedPotions,代码行数:20,代码来源:BehaviorAdvancedProjectileDispense.java

示例8: dispenseStack

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing var5 = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile var6 = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(var6 != null)
      {
      	var6.setThrowableHeading((double)var5.getFrontOffsetX(), 0.10000000149011612D*y, (double)var5.getFrontOffsetY(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)var6);
      	stack.splitStack(1);
      }
      return stack;
  }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:17,代码来源:DispenseBombMF.java

示例9: dispenseStack

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
      	iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)iprojectile);
      	stack.splitStack(1);
      }
      return stack;
  }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:17,代码来源:DispenseArrowMF.java

示例10: 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

示例11: dispenseStack

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource blockSource, ItemStack stack) {
	if (NBTHelper.hasTag(stack, "identifier")) {
		World world = blockSource.getWorld();
		IPosition iposition = BlockDispenser.func_149939_a(blockSource);
		EnumFacing enumfacing = BlockDispenser.func_149937_b(blockSource.getBlockMetadata());
		EntityNanoBotSwarm iprojectile = new EntityNanoBotSwarm(world, iposition.getX(), iposition.getY(), iposition.getZ());
		iprojectile.antennaIdentifier = UUID.fromString(NBTHelper.getString(stack, "identifier"));
		if (NBTHelper.hasTag(stack, "label"))
			iprojectile.label = NBTHelper.getString(stack, "label");
		iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY()+0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
		world.spawnEntityInWorld(iprojectile);
		stack.splitStack(1);
	} else {
		return super.dispenseStack(blockSource, stack);
	}
	return stack;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:18,代码来源:ItemNanoSwarm.java

示例12: dispenseArmor

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public static ItemStack dispenseArmor(IBlockSource blockSource, ItemStack stack)
{
    BlockPos blockpos = blockSource.getBlockPos().offset((EnumFacing)blockSource.func_189992_e().getValue(BlockDispenser.FACING));
    List<EntityLivingBase> list = blockSource.getWorld().<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(blockpos), Predicates.<EntityLivingBase>and(EntitySelectors.NOT_SPECTATING, new EntitySelectors.ArmoredMob(stack)));

    if (list.isEmpty())
    {
        return null;
    }
    else
    {
        EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0);
        EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(stack);
        ItemStack itemstack = stack.copy();
        itemstack.stackSize = 1;
        entitylivingbase.setItemStackToSlot(entityequipmentslot, itemstack);

        if (entitylivingbase instanceof EntityLiving)
        {
            ((EntityLiving)entitylivingbase).setDropChance(entityequipmentslot, 2.0F);
        }

        --stack.stackSize;
        return stack;
    }
}
 
开发者ID:BlazeAxtrius,项目名称:ExpandedRailsMod,代码行数:27,代码来源:ItemArmor.java

示例13: func_82487_b

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   int var4 = p_82487_1_.func_82623_d() + var3.func_82601_c();
   int var5 = p_82487_1_.func_82622_e() + var3.func_96559_d();
   int var6 = p_82487_1_.func_82621_f() + var3.func_82599_e();
   AxisAlignedBB var7 = AxisAlignedBB.func_72332_a().func_72299_a((double)var4, (double)var5, (double)var6, (double)(var4 + 1), (double)(var5 + 1), (double)(var6 + 1));
   List var8 = p_82487_1_.func_82618_k().func_82733_a(EntityLivingBase.class, var7, new EntitySelectorArmoredMob(p_82487_2_));
   if(var8.size() > 0) {
      EntityLivingBase var9 = (EntityLivingBase)var8.get(0);
      int var10 = var9 instanceof EntityPlayer?1:0;
      int var11 = EntityLiving.func_82159_b(p_82487_2_);
      ItemStack var12 = p_82487_2_.func_77946_l();
      var12.field_77994_a = 1;
      var9.func_70062_b(var11 - var10, var12);
      if(var9 instanceof EntityLiving) {
         ((EntityLiving)var9).func_96120_a(var11, 2.0F);
      }

      --p_82487_2_.field_77994_a;
      return p_82487_2_;
   } else {
      return super.func_82487_b(p_82487_1_, p_82487_2_);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:BehaviorDispenseArmor.java

示例14: func_82487_b

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
protected ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   if(p_82487_2_.func_77960_j() == 15) {
      EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
      World var4 = p_82487_1_.func_82618_k();
      int var5 = p_82487_1_.func_82623_d() + var3.func_82601_c();
      int var6 = p_82487_1_.func_82622_e() + var3.func_96559_d();
      int var7 = p_82487_1_.func_82621_f() + var3.func_82599_e();
      if(ItemDye.func_96604_a(p_82487_2_, var4, var5, var6, var7)) {
         if(!var4.field_72995_K) {
            var4.func_72926_e(2005, var5, var6, var7, 0);
         }
      } else {
         this.field_96461_b = false;
      }

      return p_82487_2_;
   } else {
      return super.func_82487_b(p_82487_1_, p_82487_2_);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:21,代码来源:DispenserBehaviorDye.java

示例15: func_82487_b

import net.minecraft.dispenser.IBlockSource; //导入依赖的package包/类
public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
   EnumFacing var3 = BlockDispenser.func_100009_j_(p_82487_1_.func_82620_h());
   World var4 = p_82487_1_.func_82618_k();
   double var5 = p_82487_1_.func_82615_a() + (double)((float)var3.func_82601_c() * 1.125F);
   double var7 = p_82487_1_.func_82617_b() + (double)((float)var3.func_96559_d() * 1.125F);
   double var9 = p_82487_1_.func_82616_c() + (double)((float)var3.func_82599_e() * 1.125F);
   int var11 = p_82487_1_.func_82623_d() + var3.func_82601_c();
   int var12 = p_82487_1_.func_82622_e() + var3.func_96559_d();
   int var13 = p_82487_1_.func_82621_f() + var3.func_82599_e();
   Material var14 = var4.func_72803_f(var11, var12, var13);
   double var15;
   if(Material.field_76244_g.equals(var14)) {
      var15 = 1.0D;
   } else {
      if(!Material.field_76249_a.equals(var14) || !Material.field_76244_g.equals(var4.func_72803_f(var11, var12 - 1, var13))) {
         return this.field_96464_b.func_82482_a(p_82487_1_, p_82487_2_);
      }

      var15 = 0.0D;
   }

   EntityBoat var17 = new EntityBoat(var4, var5, var7 + var15, var9);
   var4.func_72838_d(var17);
   p_82487_2_.func_77979_a(1);
   return p_82487_2_;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:27,代码来源:DispenserBehaviorBoat.java


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