net.minecraft.util.EnumFacing#getFrontOffsetX ( )源码实例Demo

下面列出了net.minecraft.util.EnumFacing#getFrontOffsetX ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GregTech   文件: RecipeLogicSteam.java
protected void tryDoVenting() {
    BlockPos machinePos = metaTileEntity.getPos();
    EnumFacing ventingSide = getVentingSide();
    BlockPos ventingBlockPos = machinePos.offset(ventingSide);
    IBlockState blockOnPos = metaTileEntity.getWorld().getBlockState(ventingBlockPos);
    if (blockOnPos.getCollisionBoundingBox(metaTileEntity.getWorld(), ventingBlockPos) == Block.NULL_AABB) {
        metaTileEntity.getWorld()
            .getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(ventingBlockPos), EntitySelectors.CAN_AI_TARGET)
            .forEach(entity -> entity.attackEntityFrom(DamageSources.getHeatDamage(), 6.0f));
        WorldServer world = (WorldServer) metaTileEntity.getWorld();
        double posX = machinePos.getX() + 0.5 + ventingSide.getFrontOffsetX() * 0.6;
        double posY = machinePos.getY() + 0.5 + ventingSide.getFrontOffsetY() * 0.6;
        double posZ = machinePos.getZ() + 0.5 + ventingSide.getFrontOffsetZ() * 0.6;

        world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, posX, posY, posZ,
            7 + world.rand.nextInt(3),
            ventingSide.getFrontOffsetX() / 2.0,
            ventingSide.getFrontOffsetY() / 2.0,
            ventingSide.getFrontOffsetZ() / 2.0, 0.1);
        world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f);
        setNeedsVenting(false);
    } else if (!ventingStuck) {
        setVentingStuck(true);
    }
}
 
源代码2 项目: Artifacts   文件: DispenserBehaviorMobEgg.java
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b/*getFacing*/(par1IBlockSource.getBlockMetadata());
    double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
    double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F) + enumfacing.getFrontOffsetY();
    double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
    Entity entity = ItemMonsterPlacer.spawnCreature(par1IBlockSource.getWorld(), par2ItemStack.getItemDamage(), d0, d1, d2);

    if (entity instanceof EntityLiving && par2ItemStack.hasDisplayName())
    {
        ((EntityLiving)entity).setCustomNameTag(par2ItemStack.getDisplayName());
    }

    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
源代码3 项目: Sakura_mod   文件: BlockFuton.java
@Nullable
public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries) {
	EnumFacing enumfacing = worldIn.getBlockState(pos).getValue(FACING);
	int i = pos.getX();
	int j = pos.getY();
	int k = pos.getZ();

	for (int l = 0; l <= 1; ++l) {
		int i1 = i - enumfacing.getFrontOffsetX() * l - 1;
		int j1 = k - enumfacing.getFrontOffsetZ() * l - 1;
		int k1 = i1 + 2;
		int l1 = j1 + 2;

		for (int i2 = i1; i2 <= k1; ++i2) {
			for (int j2 = j1; j2 <= l1; ++j2) {
				BlockPos blockpos = new BlockPos(i2, j, j2);

				if (hasRoomForPlayer(worldIn, blockpos)) {
					if (tries <= 0) {
						return blockpos;
					}

					--tries;
				}
			}
		}
	}

	return null;
}
 
源代码4 项目: GregTech   文件: MetaTileEntityBlockBreaker.java
private void addToInventoryOrDropItems(List<ItemStack> drops) {
    EnumFacing outputFacing = getOutputFacing();
    double itemSpawnX = getPos().getX() + 0.5 + outputFacing.getFrontOffsetX();
    double itemSpawnY = getPos().getX() + 0.5 + outputFacing.getFrontOffsetX();
    double itemSpawnZ = getPos().getX() + 0.5 + outputFacing.getFrontOffsetX();
    for(ItemStack itemStack : drops) {
        ItemStack remainStack = ItemHandlerHelper.insertItemStacked(exportItems, itemStack, false);
        if(!remainStack.isEmpty()) {
            EntityItem entityitem = new EntityItem(getWorld(), itemSpawnX, itemSpawnY, itemSpawnZ, remainStack);
            entityitem.setDefaultPickupDelay();
            getWorld().spawnEntity(entityitem);
        }
    }
}
 
源代码5 项目: GregTech   文件: ShapeModelGenerator.java
public static CCModel[] generateRotatedVariants(CCModel originalModel) {
    CCModel[] result = new CCModel[6];
    double modelHeight = originalModel.verts[2].vec.y;
    double translate = 1.0 - modelHeight;
    for (int i = 0; i < 3; i++) {
        EnumFacing side = EnumFacing.VALUES[i * 2 + 1];
        Transformation rotation = Rotation.sideRotations[i * 2].at(Vector3.center);
        Transformation translation = new Translation(side.getFrontOffsetX() * translate, side.getFrontOffsetY() * translate, side.getFrontOffsetZ() * translate);
        CCModel negativeModel = originalModel.copy().apply(rotation);
        CCModel positiveModel = negativeModel.copy().apply(translation);
        result[i * 2] = negativeModel;
        result[i * 2 + 1] = positiveModel;
    }
    return result;
}
 
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (facing != EnumFacing.UP) {
        return EnumActionResult.FAIL;
    } else {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (!block.isReplaceable(worldIn, pos)) {
            pos = pos.offset(facing);
        }

        ItemStack itemstack = player.getHeldItem(hand);

        if (player.canPlayerEdit(pos, facing, itemstack) && this.block.canPlaceBlockAt(worldIn, pos)) {
            EnumFacing enumfacing = EnumFacing.fromAngle((double) player.rotationYaw);
            int i = enumfacing.getFrontOffsetX();
            int j = enumfacing.getFrontOffsetZ();
            boolean flag = i < 0 && hitZ < 0.5F || i > 0 && hitZ > 0.5F || j < 0 && hitX > 0.5F || j > 0 && hitX < 0.5F;
            placeDoor(worldIn, pos, enumfacing, this.block, flag);
            SoundType soundtype = worldIn.getBlockState(pos).getBlock().getSoundType(worldIn.getBlockState(pos), worldIn, pos, player);
            worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
            itemstack.shrink(1);
            return EnumActionResult.SUCCESS;
        } else {
            return EnumActionResult.FAIL;
        }
    }
}
 
源代码7 项目: Cyberware   文件: ItemSurgeryChamber.java
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
	if (facing != EnumFacing.UP)
	{
		return EnumActionResult.FAIL;
	}
	else
	{
		IBlockState iblockstate = worldIn.getBlockState(pos);
		Block block = iblockstate.getBlock();

		if (!block.isReplaceable(worldIn, pos))
		{
			pos = pos.offset(facing);
		}

		if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos))
		{
			EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);
			int i = enumfacing.getFrontOffsetX();
			int j = enumfacing.getFrontOffsetZ();
			placeDoor(worldIn, pos, enumfacing, this.block);
			SoundType soundtype = this.block.getSoundType();
			worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
			--stack.stackSize;
			return EnumActionResult.SUCCESS;
		}
		else
		{
			return EnumActionResult.FAIL;
		}
	}
}
 
源代码8 项目: Cyberware   文件: ItemEngineeringTable.java
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
	if (facing != EnumFacing.UP)
	{
		return EnumActionResult.FAIL;
	}
	else
	{
		IBlockState iblockstate = worldIn.getBlockState(pos);
		Block block = iblockstate.getBlock();

		if (!block.isReplaceable(worldIn, pos))
		{
			pos = pos.offset(facing);
		}

		if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos))
		{
			EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);
			int i = enumfacing.getFrontOffsetX();
			int j = enumfacing.getFrontOffsetZ();
			placeDoor(worldIn, pos, enumfacing, this.block);
			SoundType soundtype = this.block.getSoundType();
			worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
			--stack.stackSize;
			return EnumActionResult.SUCCESS;
		}
		else
		{
			return EnumActionResult.FAIL;
		}
	}
}
 
源代码9 项目: Production-Line   文件: ItemPLTreetap.java
private static void ejectResin(World world, BlockPos pos, EnumFacing side, int quantity) {
    double ejectBias = 0.3D;
    double ejectX = (double) pos.getX() + 0.5D + (double) side.getFrontOffsetX() * 0.3D;
    double ejectY = (double) pos.getY() + 0.5D + (double) side.getFrontOffsetY() * 0.3D;
    double ejectZ = (double) pos.getZ() + 0.5D + (double) side.getFrontOffsetZ() * 0.3D;

    for (int i = 0; i < quantity; ++i) {
        EntityItem entityitem = new EntityItem(world, ejectX, ejectY, ejectZ, ItemName.misc_resource.getItemStack(MiscResourceType.resin));
        entityitem.setDefaultPickupDelay();
        world.spawnEntity(entityitem);
    }

}
 
源代码10 项目: Et-Futurum   文件: DispenserBehaviourSpawnEgg.java
@Override
public ItemStack dispenseStack(IBlockSource block, ItemStack stack) {
	EnumFacing enumfacing = BlockDispenser.func_149937_b(block.getBlockMetadata());
	double d0 = block.getX() + enumfacing.getFrontOffsetX();
	double d1 = block.getYInt() + 0.2F;
	double d2 = block.getZ() + enumfacing.getFrontOffsetZ();
	Entity entity = ItemEntityEgg.spawnEntity(block.getWorld(), stack.getItemDamage(), d0, d1, d2);

	if (entity instanceof EntityLivingBase && stack.hasDisplayName())
		((EntityLiving) entity).setCustomNameTag(stack.getDisplayName());

	stack.splitStack(1);
	return stack;
}
 
源代码11 项目: AdvancedRocketry   文件: TileCuttingMachine.java
@Override
public void update() {
	super.update();

	if(isRunning() && world.getTotalWorldTime() % 10 == 0) {
		EnumFacing back = RotatableBlock.getFront(world.getBlockState(pos)).getOpposite();

		float xCoord = this.getPos().getX() + (0.5f*back.getFrontOffsetX()); 
		float zCoord = this.getPos().getZ() + (0.5f*back.getFrontOffsetZ());

		for(Object entity : world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(xCoord, this.getPos().getY() + 1, zCoord, xCoord + 1, this.getPos().getY() + 1.5f, zCoord + 1))) {
			((EntityLivingBase)entity).attackEntityFrom(DamageSource.CACTUS, 1f);
		}
	}
}
 
源代码12 项目: Artifacts   文件: DispenserBehaviorFireworks.java
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack)
{
    EnumFacing enumfacing = BlockDispenser.func_149937_b/*getFacing*/(par1IBlockSource.getBlockMetadata());
    double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX();
    double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F);
    double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ();
    EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(par1IBlockSource.getWorld(), d0, d1, d2, par2ItemStack);
    par1IBlockSource.getWorld().spawnEntityInWorld(entityfireworkrocket);
    par2ItemStack.splitStack(1);
    return par2ItemStack;
}
 
源代码13 项目: ExtraCells1   文件: BlockMEDropper.java
public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource)
{
	EnumFacing enumfacing = getFacing(par0IBlockSource.getBlockMetadata());
	double d0 = par0IBlockSource.getX() + 0.7D * enumfacing.getFrontOffsetX();
	double d1 = par0IBlockSource.getY() + 0.7D * enumfacing.getFrontOffsetY();
	double d2 = par0IBlockSource.getZ() + 0.7D * enumfacing.getFrontOffsetZ();
	return new PositionImpl(d0, d1, d2);
}
 
源代码14 项目: Artifacts   文件: BlockTrap.java
public static IPosition getIPositionFromBlockSource(IBlockSource par0IBlockSource)
{
    EnumFacing enumfacing = getFacing(par0IBlockSource.getBlockMetadata());
    double d0 = par0IBlockSource.getX() + 0.7D * (double)enumfacing.getFrontOffsetX();
    double d1 = par0IBlockSource.getY() + 0.7D * (double)enumfacing.getFrontOffsetY();
    double d2 = par0IBlockSource.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ();
    return new PositionImpl(d0, d1, d2);
}
 
源代码15 项目: Signals   文件: BlockTeleportRail.java
private void teleport(EntityMinecart cart, MCPos destination){
    if(cart instanceof EntityMinecartContainer) {
        ((EntityMinecartContainer)cart).dropContentsWhenDead = false;
    }

    int dimensionIn = destination.getDimID();
    BlockPos destPos = destination.getPos();
    if(!ForgeHooks.onTravelToDimension(cart, destination.getDimID())) return;

    MinecraftServer minecraftserver = cart.getServer();
    int i = cart.dimension;
    WorldServer worldserver = minecraftserver.getWorld(i);
    WorldServer worldserver1 = minecraftserver.getWorld(dimensionIn);
    cart.dimension = dimensionIn;

    /*if (i == 1 && dimensionIn == 1)
    {
        worldserver1 = minecraftserver.getWorld(0);
        this.dimension = 0;
    }*/

    cart.world.removeEntity(cart);
    cart.isDead = false;
    BlockPos blockpos = destination.getPos();

    /* double moveFactor = worldserver.provider.getMovementFactor() / worldserver1.provider.getMovementFactor();
    double d0 = MathHelper.clamp(this.posX * moveFactor, worldserver1.getWorldBorder().minX() + 16.0D, worldserver1.getWorldBorder().maxX() - 16.0D);
    double d1 = MathHelper.clamp(this.posZ * moveFactor, worldserver1.getWorldBorder().minZ() + 16.0D, worldserver1.getWorldBorder().maxZ() - 16.0D);
    double d2 = 8.0D;*/

    cart.moveToBlockPosAndAngles(destPos, 90.0F, 0.0F);
    /*Teleporter teleporter = worldserver1.getDefaultTeleporter();
    teleporter.placeInExistingPortal(this, f);
    blockpos = new BlockPos(this);*/

    worldserver.updateEntityWithOptionalForce(cart, false);
    Entity entity = EntityList.newEntity(cart.getClass(), worldserver1);

    if(entity != null) {
        copyDataFromOld(entity, cart);

        entity.moveToBlockPosAndAngles(blockpos, entity.rotationYaw, entity.rotationPitch);

        IBlockState state = destination.getLoadedBlockState();
        if(state.getBlock() == ModBlocks.TELEPORT_RAIL) { //If the destination is a teleport track, use its rail direction to push the cart the right direction
            EnumFacing teleportDir = getTeleportDirection(state);
            double speed = 0.2;
            entity.motionX = teleportDir.getFrontOffsetX() * speed;
            entity.motionY = teleportDir.getFrontOffsetY() * speed;
            entity.motionZ = teleportDir.getFrontOffsetZ() * speed;
        } else {
            entity.motionX = entity.motionY = entity.motionZ = 0;
        }

        boolean flag = entity.forceSpawn;
        entity.forceSpawn = true;
        worldserver1.spawnEntity(entity);
        entity.forceSpawn = flag;
        worldserver1.updateEntityWithOptionalForce(entity, false);
    }

    cart.isDead = true;
    worldserver.resetUpdateEntityTick();
    worldserver1.resetUpdateEntityTick();
}
 
源代码16 项目: Et-Futurum   文件: BlockPos.java
public BlockPos offset(EnumFacing facing, int n) {
	return new BlockPos(getX() + facing.getFrontOffsetX() * n, getY() + facing.getFrontOffsetY() * n, getZ() + facing.getFrontOffsetZ() * n);
}
 
源代码17 项目: AdvancedRocketry   文件: TileRocketBuilder.java
/**
 * Does not make sure the structure is complete, only gets max bounds!
 * @param world the world
 * @param x coord to evaluate from
 * @param y coord to evaluate from
 * @param z coord to evaluate from
 * @return AxisAlignedBB bounds of structure if valid  otherwise null
 */
public AxisAlignedBB getRocketPadBounds(World world, BlockPos pos) {
	EnumFacing direction = RotatableBlock.getFront(world.getBlockState(pos)).getOpposite();
	int xMin, zMin, xMax, zMax;
	int yCurrent = pos.getY() -1;
	int xCurrent = pos.getX() + direction.getFrontOffsetX();
	int zCurrent = pos.getZ() + direction.getFrontOffsetZ();
	xMax = xMin = xCurrent;
	zMax = zMin = zCurrent;
	int xSize, zSize;

	BlockPos currPos = new BlockPos(xCurrent, yCurrent, zCurrent);
	
	if(world.isRemote)
		return null;

	//Get min and maximum Z/X bounds
	if(direction.getFrontOffsetX() != 0) {
		xSize = ZUtils.getContinuousBlockLength(world, direction, currPos, MAX_SIZE, viableBlocks);
		zMin = ZUtils.getContinuousBlockLength(world, EnumFacing.NORTH, currPos, MAX_SIZE, viableBlocks);
		zMax = ZUtils.getContinuousBlockLength(world, EnumFacing.SOUTH, currPos.add(0,0,1), MAX_SIZE - zMin, viableBlocks);
		zSize = zMin + zMax;
		
		zMin = zCurrent - zMin + 1;
		zMax = zCurrent + zMax;

		if(direction.getFrontOffsetX() > 0) {
			xMax = xCurrent + xSize-1;
		}

		if(direction.getFrontOffsetX() < 0) {
			xMin = xCurrent - xSize+1;
		}
	}
	else {
		zSize = ZUtils.getContinuousBlockLength(world, direction, currPos, MAX_SIZE, viableBlocks);
		xMin = ZUtils.getContinuousBlockLength(world, EnumFacing.WEST, currPos, MAX_SIZE, viableBlocks);
		xMax = ZUtils.getContinuousBlockLength(world, EnumFacing.EAST, currPos.add(1,0,0), MAX_SIZE - xMin, viableBlocks);
		xSize = xMin + xMax;

		xMin = xCurrent - xMin + 1;
		xMax = xCurrent + xMax;

		if(direction.getFrontOffsetZ() > 0) {
			zMax = zCurrent + zSize-1;
		}

		if(direction.getFrontOffsetZ() < 0) {
			zMin = zCurrent - zSize+1;
		}
	}


	int maxTowerSize = 0;
	//Check perimeter for structureBlocks and get the size
	for(int i = xMin; i <= xMax; i++) {
		if(world.getBlockState(new BlockPos(i, yCurrent, zMin-1)).getBlock() == AdvancedRocketryBlocks.blockStructureTower) {
			maxTowerSize = Math.max(maxTowerSize, ZUtils.getContinuousBlockLength(world, EnumFacing.UP, new BlockPos(i, yCurrent, zMin-1), MAX_SIZE_Y, AdvancedRocketryBlocks.blockStructureTower));
		}

		if(world.getBlockState(new BlockPos(i, yCurrent, zMax+1)).getBlock() == AdvancedRocketryBlocks.blockStructureTower) {
			maxTowerSize = Math.max(maxTowerSize, ZUtils.getContinuousBlockLength(world, EnumFacing.UP, new BlockPos(i, yCurrent, zMax+1), MAX_SIZE_Y, AdvancedRocketryBlocks.blockStructureTower));
		}
	}

	for(int i = zMin; i <= zMax; i++) {
		if(world.getBlockState(new BlockPos(xMin-1, yCurrent, i)).getBlock() == AdvancedRocketryBlocks.blockStructureTower) {
			maxTowerSize = Math.max(maxTowerSize, ZUtils.getContinuousBlockLength(world, EnumFacing.UP, new BlockPos(xMin-1, yCurrent, i), MAX_SIZE_Y, AdvancedRocketryBlocks.blockStructureTower));
		}

		if(world.getBlockState(new BlockPos(xMax+1, yCurrent, i)).getBlock() == AdvancedRocketryBlocks.blockStructureTower) {
			maxTowerSize = Math.max(maxTowerSize, ZUtils.getContinuousBlockLength(world, EnumFacing.UP, new BlockPos(xMax+1, yCurrent, i), MAX_SIZE_Y, AdvancedRocketryBlocks.blockStructureTower));
		}
	}

	//if tower does not meet criteria then reutrn null
	if(maxTowerSize < MIN_SIZE_Y || xSize < MIN_SIZE || zSize < MIN_SIZE) {
		return null;
	}

	return new AxisAlignedBB(new BlockPos(xMin, yCurrent+1, zMin), new BlockPos(xMax, yCurrent + maxTowerSize - 1, zMax));
}
 
源代码18 项目: Artifacts   文件: DispenserBehaviorSword.java
/**
   * Dispense the specified stack, play the dispense sound and spawn particles.
   */
  public ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemStack)
  {
      EnumFacing enumfacing = BlockDispenser.func_149937_b/*getFacing*/(blockSource.getBlockMetadata());
      double d0, d1, d2, d3, d4, d5;
      d0 = (int)blockSource.getX() - 1;
      d1 = (int)blockSource.getY() - 1;
      d2 = (int)blockSource.getZ() - 1;
      d3 = (int)blockSource.getX() + 1;
      d4 = (int)blockSource.getY() + 1;
      d5 = (int)blockSource.getZ() + 1;
      //System.out.println((int)par1IBlockSource.getX() + "," + (int)par1IBlockSource.getZ());
      d0 += 0.5 * d0/Math.abs(d0);
      d1 += 0.5 * d1/Math.abs(d1);
      d2 += 0.5 * d2/Math.abs(d2);
      d3 += 0.5 * d3/Math.abs(d3);
      d4 += 0.5 * d4/Math.abs(d4);
      d5 += 0.5 * d5/Math.abs(d5);
      
      d0 += enumfacing.getFrontOffsetX();
      d3 += enumfacing.getFrontOffsetX();
      d2 += enumfacing.getFrontOffsetZ();
      d5 += enumfacing.getFrontOffsetZ();
      
      if(enumfacing.getFrontOffsetX() != 0) {
      	d2 += 0.5;
      	d5 -= 0.5;
      }
      if(enumfacing.getFrontOffsetZ() != 0) {
      	d0 += 0.5;
      	d3 -= 0.5;
      }
      
      //Play sound.
      blockSource.getWorld().playAuxSFX(1002, blockSource.getXInt(), blockSource.getYInt(), blockSource.getZInt(), 0);
      
      AxisAlignedBB par2AxisAlignedBB = AxisAlignedBB.getBoundingBox(d0, d1, d2, d3, d4, d5);
      //System.out.println(par2AxisAlignedBB);
      List<EntityLivingBase> ents = blockSource.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, par2AxisAlignedBB);
      if(ents.size() > 0) {
      	for(int l=ents.size() - 1; l >= 0; l--) {
      		EntityLivingBase ent = ents.get(l);
      		ent.attackEntityFrom(DamageSourceSword.instance, damage);
      		itemStack.damageItem(1, ent);
      	}
      }
      TileEntity te = blockSource.getBlockTileEntity();
      if(te != null && te instanceof TileEntityTrap) {
      	TileEntityTrap tet = (TileEntityTrap) te;
	/*int a = par2ItemStack.getItem().itemID;
	int b = 0;
	switch(a) {
		case 11:
			b = 1;
			break;
		case 12:
			b = 2;
			break;
		case 16:
			b = 3;
			break;
		case 20:
			b = 4;
			break;
		case 27:
			b = 5;
			break;
	}*/
	tet.startSwordRender(blockSource.getWorld(), blockSource.getXInt()+enumfacing.getFrontOffsetX(), blockSource.getYInt()+enumfacing.getFrontOffsetY(), blockSource.getZInt()+enumfacing.getFrontOffsetZ(), blockSource.getBlockMetadata(), itemStack);
}
      else {
      	System.out.println("Tile Entity was null!");
      }
      
      /*EntitySword entsw = new EntitySword(par1IBlockSource.getWorld(), par1IBlockSource.getX(), par1IBlockSource.getY(), par1IBlockSource.getZ());
      par1IBlockSource.getWorld().spawnEntityInWorld((Entity)entsw);*/
      return itemStack;
  }
 
源代码19 项目: AdvancedRocketry   文件: TileSpaceElevator.java
public double getLandingLocationX() {
	EnumFacing facing = RotatableBlock.getFront(world.getBlockState(getPos()));
	return getPos().getX() + facing.getFrontOffsetX()*-3 - facing.getFrontOffsetZ() + 0.5;
}
 
源代码20 项目: AdvancedRocketry   文件: TileSpaceElevator.java
public double getLandingLocationZ() {
	EnumFacing facing = RotatableBlock.getFront(world.getBlockState(getPos()));
	return getPos().getZ() + facing.getFrontOffsetX()*1 + facing.getFrontOffsetZ()*-3 + 0.5;
}