Java Code Examples for net.minecraft.util.EnumFacing#getHorizontal()

The following examples show how to use net.minecraft.util.EnumFacing#getHorizontal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockFuton.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
	EnumFacing enumfacing = EnumFacing.getHorizontal(meta);
	return (meta & 8) > 0
			? this.getDefaultState().withProperty(PART, EnumPartType.HEAD).withProperty(FACING, enumfacing)
					.withProperty(OCCUPIED, Boolean.valueOf((meta & 4) > 0))
			: this.getDefaultState().withProperty(PART, EnumPartType.FOOT).withProperty(FACING, enumfacing);
}
 
Example 2
Source File: Diffuser.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 3
Source File: Shredder.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 4
Source File: Wind.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 5
Source File: AlgaeBioreactor.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 6
Source File: Cooker.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 7
Source File: Battery.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 8
Source File: Piezoelectric.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 9
Source File: Injector.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 10
Source File: Processor.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 11
Source File: BiomassGenerator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 12
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * (abstract) Helper method to read subclass data from NBT
 */
protected void readStructureFromNBT(NBTTagCompound tagCompound, TemplateManager p_143011_2_) {
    super.readStructureFromNBT(tagCompound, p_143011_2_);
    this.isMultipleFloors = tagCompound.getBoolean("tf");
    this.corridorDirection = EnumFacing.getHorizontal(tagCompound.getInteger("D"));
}
 
Example 13
Source File: WrapperEnumFacing.java    From ClientBase with MIT License 4 votes vote down vote up
public static WrapperEnumFacing getHorizontal(int var0) {
    return new WrapperEnumFacing(EnumFacing.getHorizontal(var0));
}
 
Example 14
Source File: BlockUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static EnumFacing get2dOrientation(double yaw) {
	return EnumFacing.getHorizontal(MathHelper.floor((yaw * 4.0 / 360.0) + 0.5) & 3);
}
 
Example 15
Source File: Fabricator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 16
Source File: Scaffolder.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 17
Source File: Scrubber.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 18
Source File: Optimiser.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 19
Source File: TidalGenerator.java    From EmergingTechnology with MIT License 4 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta) {
    EnumFacing facing = EnumFacing.getHorizontal(meta);
    return this.getDefaultState().withProperty(FACING, facing);
}
 
Example 20
Source File: ItemAstroBed.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn,
		BlockPos pos, EnumHand hand, EnumFacing facing, float hitX,
		float hitY, float hitZ)
{
	if (worldIn.isRemote)
	{
		return EnumActionResult.SUCCESS;
	}
	else if (facing != EnumFacing.UP)
	{
		return EnumActionResult.FAIL;
	}
	else
	{
		ItemStack stack = playerIn.getHeldItem(hand);
		IBlockState iblockstate = worldIn.getBlockState(pos);
		Block block = iblockstate.getBlock();
		boolean flag = block.isReplaceable(worldIn, pos);

		if (!flag)
		{
			pos = pos.up();
		}

		int i = MathHelper.floor((double)(playerIn.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
		EnumFacing enumfacing = EnumFacing.getHorizontal(i);
		BlockPos blockpos = pos.offset(enumfacing);

		if (playerIn.canPlayerEdit(pos, facing, stack) && playerIn.canPlayerEdit(blockpos, facing, stack))
		{
			boolean flag1 = worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
			boolean flag2 = flag || worldIn.isAirBlock(pos);
			boolean flag3 = flag1 || worldIn.isAirBlock(blockpos);

			if (flag2 && flag3 && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && worldIn.getBlockState(blockpos.down()).isSideSolid(worldIn, blockpos.down(), EnumFacing.UP))
			{
				IBlockState iblockstate1 = AdvancedRocketryBlocks.blockAstroBed.getDefaultState().withProperty(BlockBed.OCCUPIED, Boolean.valueOf(false)).withProperty(BlockBed.FACING, enumfacing).withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);

				if (worldIn.setBlockState(pos, iblockstate1, 11))
				{
					IBlockState iblockstate2 = iblockstate1.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
					worldIn.setBlockState(blockpos, iblockstate2, 11);
				}

				SoundType soundtype = iblockstate1.getBlock().getSoundType();
				worldIn.playSound((EntityPlayer)null, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
				stack.setCount(stack.getCount() - 1);
				return EnumActionResult.SUCCESS;
			}
			else
			{
				return EnumActionResult.FAIL;
			}
		}
		else
		{
			return EnumActionResult.FAIL;
		}
	}
}