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

The following examples show how to use net.minecraft.util.EnumFacing#getFront() . 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: BlockAdvancedAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 2
Source File: WorldGenAlienTree.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
private void generatePod(World world, Random random, int intitalDist, int x, int y, int z, int dirX, int dirZ) {
	int branchLength = random.nextInt(5) + intitalDist;

	EnumFacing direction = EnumFacing.getFront((dirX != 0 && dirZ != 0) ? Math.abs(dirX)*4 : Math.abs(dirX)*4 + Math.abs(dirZ)*8);

	boolean flag = true;

	for(int l = 0; l < branchLength && flag; l++) {
		int newX = x + (dirX*l);
		int newY = l >= branchLength/2 ? y + 2 : y;
		int newZ = z + (dirZ*l);

		flag = flag && this.replaceBlockWithWood(world, newX, newY, newZ, direction);
		flag = flag && this.replaceBlockWithWood(world, newX, newY - 1, newZ, direction);
		flag = flag && this.replaceBlockWithWood(world, newX + dirZ, newY, newZ + dirX, direction);
		flag = flag && this.replaceBlockWithWood(world, newX + dirZ, newY - 1, newZ + dirX, direction);
	}

	int radius = 4;

	for(int offX = -radius; offX < radius; offX++) {
		for(int offY = -radius; offY < radius; offY++) {
			for(int offZ = -radius; offZ < radius; offZ++) {
				if(offX*offX + offY*offY + offZ*offZ < radius*radius + 1)
					replaceAirWithLeaves(world, x + offX + (dirX*branchLength), y + offY + 1, z + offZ + (dirZ*branchLength));
			}
		}
	}

}
 
Example 3
Source File: TileFacing.java    From Production-Line with MIT License 5 votes vote down vote up
@Override
public void readFromNBT(NBTTagCompound nbt) {
    super.readFromNBT(nbt);
    this.facing = EnumFacing.getFront(nbt.getShort("facing"));
    this.active = nbt.getBoolean("active");

}
 
Example 4
Source File: BlockPL.java    From Production-Line with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta) {
    if (this instanceof IOrientableBlock) {
        EnumFacing enumfacing = EnumFacing.getFront(meta);
        if (enumfacing.getAxis() == EnumFacing.Axis.Y) {
            enumfacing = EnumFacing.NORTH;
        }
        return this.getDefaultState().withProperty(PROPERTY_FACING, enumfacing);
    }
    else {
        return super.getStateFromMeta(meta);
    }
}
 
Example 5
Source File: MessageBlockDisplayState.java    From Production-Line with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
protected IMessage handlerMessage(MessageBase message, MessageContext ctx) {
    WorldClient world = Minecraft.getMinecraft().world;
    BlockPos pos = BlockPos.fromLong(message.nbt.getLong("pos"));
    TileFacing tilePL = (TileFacing) world.getTileEntity(pos);
    if (tilePL != null) {
        tilePL.active = message.nbt.getBoolean("active");
        tilePL.facing = EnumFacing.getFront(message.nbt.getShort("facing"));
        world.scheduleUpdate(pos, world.getBlockState(pos).getBlock(), 0);
    }
    return null;
}
 
Example 6
Source File: TileGenericPipe.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
protected void network() {
	for(int i=0; i<6; i++) {
		EnumFacing direction = EnumFacing.getFront(i);
		
		if(getConnection(direction) == ConnectionTypes.PIPE) {
			TileGenericPipe target = ConnectionHelper.getAdjacentPipe(world, pos, direction);
			//First network contact
			if(target.hasNetwork() && !hasNetwork) {
				//LogisticsPipes2.logger.log(Level.INFO, String.format("Attempting to connect Generic Pipe %1$s %2$s to %3$s %4$s", nodeID.toString(), (hasNetwork ? " with network" : " without network"), target.getBlockType().toString(), (target.hasNetwork ? " with network." : " without network.")));
				nodeID = target.network.subscribeNode(this);//Subscribe to network
				LogisticsPipes2.logger.log(Level.INFO, "Added TileGenericPipe " + nodeID.toString() + " to Network: " + network.getName());
				hasNetwork=true;
				
				network.getNodeByID(target.nodeID).addNeighbor(network.getNodeByID(nodeID), direction.getOpposite().getIndex());//Tell target node he has a new neighbor
				network.getNodeByID(nodeID).addNeighbor(network.getNodeByID(target.nodeID), direction.getIndex());//Add the Target as my neighbor
				network.recalculateNetwork();
				continue;
			}
			//Notify other Neighbors of our presence
			if(target.hasNetwork && hasNetwork) {
				LogisticsPipes2.logger.log(Level.INFO, "Notified GenericPipe " + target.nodeID.toString() + " of presence of: " + nodeID.toString());
				network.getNodeByID(target.nodeID).addNeighbor(network.getNodeByID(nodeID), direction.getOpposite().getIndex());//Tell target node he has a new neighbor
				network.getNodeByID(nodeID).addNeighbor(network.getNodeByID(target.nodeID), direction.getIndex());//Add the Target as my neighbor
				network.recalculateNetwork();
				continue;
			}
		}
	}
}
 
Example 7
Source File: BlockBeacon.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta)
{
	EnumFacing enumfacing = EnumFacing.getFront(meta);

	if (enumfacing.getAxis() == EnumFacing.Axis.Y)
	{
		enumfacing = EnumFacing.NORTH;
	}

	return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 8
Source File: BlockComponentBox.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta)
{
	EnumFacing enumfacing = EnumFacing.getFront(meta);

	if (enumfacing.getAxis() == EnumFacing.Axis.Y)
	{
		enumfacing = EnumFacing.NORTH;
	}

	return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 9
Source File: BlockBeaconLarge.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta)
{
	EnumFacing enumfacing = EnumFacing.getFront(meta);

	if (enumfacing.getAxis() == EnumFacing.Axis.Y)
	{
		enumfacing = EnumFacing.NORTH;
	}

	return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 10
Source File: BlockBlueprintArchive.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
public IBlockState getStateFromMeta(int meta)
{
	EnumFacing enumfacing = EnumFacing.getFront(meta);

	if (enumfacing.getAxis() == EnumFacing.Axis.Y)
	{
		enumfacing = EnumFacing.NORTH;
	}

	return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 11
Source File: Ladder.java    From EmergingTechnology with MIT License 5 votes vote down vote up
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 12
Source File: BlockBarrel.java    From Sakura_mod with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);
	
    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }
	
    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 13
Source File: BlockBarrelDistillation.java    From Sakura_mod with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);
	
    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }
	
    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 14
Source File: BlockTFCompressor.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 15
Source File: BlockTFCrasher.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 16
Source File: BlockAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 17
Source File: BlockTofuStation.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public IBlockState getStateFromMeta(int meta) {
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y) {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example 18
Source File: WrapperEnumFacing.java    From ClientBase with MIT License 4 votes vote down vote up
public static WrapperEnumFacing getFront(int var0) {
    return new WrapperEnumFacing(EnumFacing.getFront(var0));
}
 
Example 19
Source File: BlockMEDropper.java    From ExtraCells1 with MIT License 4 votes vote down vote up
public static EnumFacing getFacing(int metadata)
{
	return EnumFacing.getFront(metadata);
}
 
Example 20
Source File: BlockTrap.java    From Artifacts with MIT License 4 votes vote down vote up
public static EnumFacing getFacing(int par0)
{
    return EnumFacing.getFront(par0 & 7);
}