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


Java IPosition.getZ方法代码示例

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


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

示例1: dispenseStack

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

示例2: doDispense

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public static void doDispense(World worldIn, ItemStack stack, int speed, EnumFacing facing, IPosition position) {
  double d0 = position.getX();
  double d1 = position.getY();
  double d2 = position.getZ();
  if (facing.getAxis() == EnumFacing.Axis.Y) {
    d1 = d1 - 0.125D;
  }
  else {
    d1 = d1 - 0.15625D;
  }
  EntityItem entityitem = new EntityItem(worldIn, d0, d1, d2, stack);
  double d3 = worldIn.rand.nextDouble() * 0.1D + 0.2D;
  entityitem.motionX = (double) facing.getFrontOffsetX() * d3;
  entityitem.motionY = 0.20000000298023224D;
  entityitem.motionZ = (double) facing.getFrontOffsetZ() * d3;
  entityitem.motionX += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
  entityitem.motionY += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
  entityitem.motionZ += worldIn.rand.nextGaussian() * 0.007499999832361937D * (double) speed;
  worldIn.spawnEntity(entityitem);
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:21,代码来源:BehaviorMinecartDropItem.java

示例3: dispenseStack

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

示例4: dispenseStack

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockTrap.getFacing(par1IBlockSource.getBlockMetadata());
    IPosition iposition = BlockTrap.getIPositionFromBlockSource(par1IBlockSource);
    double d0 = iposition.getX() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d1 = iposition.getY() + (double)((float)enumfacing.getFrontOffsetX() * 0.3F);
    double d2 = iposition.getZ() + (double)((float)enumfacing.getFrontOffsetZ() * 0.3F);
    World world = par1IBlockSource.getWorld();
    Random random = world.rand;
    double d3 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetX();
    double d4 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetY();
    double d5 = random.nextGaussian() * 0.05D + (double)enumfacing.getFrontOffsetZ();
    world.spawnEntityInWorld(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5));
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
开发者ID:Draco18s,项目名称:Artifacts,代码行数:20,代码来源:DispenserBehaviorFireball.java

示例5: dispense

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

示例6: dispenseStack

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
protected ItemStack dispenseStack(IBlockSource source, ItemStack stack,World worldIn)
{ 
	try{
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    ItemStack itemstack1 = stack.splitStack(1);
    BlockPos pos = new BlockPos(iposition.getX(), iposition.getY(), iposition.getZ());
	Block block;
	block = Block.getBlockFromItem(itemstack1.getItem());
    if( worldIn.canBlockBePlaced(block,pos,true,BlockPistonBase.getFacing(1),en,itemstack1)){
    worldIn.setBlockState(pos, block.getStateFromMeta(itemstack1.getMetadata()));
    }}
	catch (Exception e) {return stack;}

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

示例7: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
	EntityArrowMF arrow = new EntityArrowMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
	
	arrow.canBePickedUp = 1;
	return arrow;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:11,代码来源:DispenseArrowMF.java

示例8: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World world, IPosition pos, int meta)
{
	EntityBoltMF bolt = new EntityBoltMF(world, pos.getX(), pos.getY(), pos.getZ(), meta);
	bolt.canBePickedUp = 1;
	return bolt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:10,代码来源:DispenseBoltMF.java

示例9: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
/**
 * Return the projectile entity spawned by this dispense behavior.
 */
protected IProjectile getProjectileEntity(World par1World, IPosition par2IPosition)
{
    /*EntityArrow entityarrow = new EntityArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ());
    entityarrow.canBePickedUp = 1;
    entityarrow.setDamage(6);
    return entityarrow;*/
	EntitySpecialArrow entityarrow = new EntitySpecialArrow(par1World, par2IPosition.getX(), par2IPosition.getY(), par2IPosition.getZ(), 2);
	entityarrow.canBePickedUp = 1;
	return entityarrow;
}
 
开发者ID:Draco18s,项目名称:Artifacts,代码行数:14,代码来源:DispenserBehaviorArrow.java

示例10: EntityYa

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public EntityYa(World worldIn, IPosition pos) {
    super(worldIn, pos.getX(), pos.getY(), pos.getZ());
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:4,代码来源:EntityYa.java

示例11: EntityGreatarrow

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public EntityGreatarrow(World worldIn, IPosition pos) {
    super(worldIn, pos.getX(), pos.getY(), pos.getZ());
}
 
开发者ID:DaedalusGame,项目名称:BetterWithAddons,代码行数:4,代码来源:EntityGreatarrow.java

示例12: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World world, IPosition position, ItemStack stackIn) {
	return new EntityTomato(world, position.getX(), position.getY(), position.getZ());
}
 
开发者ID:elytra,项目名称:Engination,代码行数:5,代码来源:ItemTomato.java

示例13: convertIposToBlockpos

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
public static BlockPos convertIposToBlockpos(IPosition here) {
  return new BlockPos(here.getX(), here.getY(), here.getZ());
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:4,代码来源:UtilWorld.java

示例14: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World worldIn, IPosition pos)
{
	return new EntityIceball(worldIn, pos.getX(), pos.getY(), pos.getZ(), 0, 0, 0.1);
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:6,代码来源:DispenserIceBall.java

示例15: getProjectileEntity

import net.minecraft.dispenser.IPosition; //导入方法依赖的package包/类
@Override
protected IProjectile getProjectileEntity(World worldIn, IPosition pos)
{
	return new EntityMudBall(worldIn, pos.getX(), pos.getY(), pos.getZ());
}
 
开发者ID:MinestrapTeam,项目名称:Minestrappolation-4,代码行数:6,代码来源:DispenserMudBall.java


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