Java Code Examples for net.minecraft.util.EnumFacing#SOUTH
The following examples show how to use
net.minecraft.util.EnumFacing#SOUTH .
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: BiomassGenerator.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 2
Source File: Wind.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 3
Source File: Fabricator.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 4
Source File: PositionUtils.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private static EnumFacing getFacingFromPositions(int x1,int z1, int x2, int z2) { if (x2 == x1) { return z2 > z1 ? EnumFacing.SOUTH : EnumFacing.NORTH; } if (z2 == z1) { return x2 > x1 ? EnumFacing.EAST : EnumFacing.WEST; } if (x2 > x1) { return z2 > z1 ? EnumFacing.EAST : EnumFacing.NORTH; } return z2 > z1 ? EnumFacing.SOUTH : EnumFacing.WEST; }
Example 5
Source File: Bioreactor.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 6
Source File: Diffuser.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 7
Source File: Harvester.java From EmergingTechnology with MIT License | 6 votes |
@Override public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState north = worldIn.getBlockState(pos.north()); IBlockState east = worldIn.getBlockState(pos.east()); IBlockState south = worldIn.getBlockState(pos.south()); IBlockState west = worldIn.getBlockState(pos.west()); EnumFacing face = (EnumFacing) state.getValue(FACING); if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) { face = EnumFacing.SOUTH; } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) { face = EnumFacing.NORTH; } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) { face = EnumFacing.WEST; } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) { face = EnumFacing.EAST; } worldIn.setBlockState(pos, state.withProperty(FACING, face)); } }
Example 8
Source File: BlockBeaconLarge.java From Cyberware with MIT License | 5 votes |
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { EnumFacing face = state.getValue(FACING); if (face == EnumFacing.NORTH || face == EnumFacing.SOUTH) { return ew; } else { return ns; } }
Example 9
Source File: GTModelMortar.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
protected BlockPartFace createWallFaceNS(EnumFacing side) { if (side == EnumFacing.UP || side == EnumFacing.DOWN) { return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 12.0F, 2.0F }, 0)); } if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH) { return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 10.0F, 5.0F }, 0)); } return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 2.0F, 5.0F }, 0)); }
Example 10
Source File: PortalFormer.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
private EnumFacing.Axis getPortalAxisFromCorner(BlockPos posIn) { Block block; int numAdjacents = 0; EnumFacing adjacents[] = new EnumFacing[6]; for (EnumFacing side : EnumFacing.values()) { if (numAdjacents > 0 && adjacents[numAdjacents - 1] == side.getOpposite()) { continue; } block = this.world.getBlockState(posIn.offset(side)).getBlock(); if (block == this.blockFrame) { adjacents[numAdjacents] = side; numAdjacents++; } } if (numAdjacents >= 3 || (numAdjacents == 2 && adjacents[0] != adjacents[1].getOpposite())) { if (adjacents[0] == EnumFacing.DOWN || adjacents[0] == EnumFacing.UP) { if (adjacents[1] == EnumFacing.NORTH || adjacents[1] == EnumFacing.SOUTH) { return EnumFacing.Axis.X; } return EnumFacing.Axis.Z; } return EnumFacing.Axis.Y; } return null; }
Example 11
Source File: FacingHelper.java From EmergingTechnology with MIT License | 5 votes |
public static EnumFacing intToFacing(int id) { switch(id) { case 1: return EnumFacing.NORTH; case 2: return EnumFacing.EAST; case 3: return EnumFacing.SOUTH; case 4: return EnumFacing.WEST; default: return EnumFacing.NORTH; } }
Example 12
Source File: TeleportEntityNetherPortal.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
protected EnumFacing getPortalOrientation(World world, BlockPos portalPos) { if (world.getBlockState(portalPos.west()).getBlock() == Blocks.PORTAL || world.getBlockState(portalPos.east()).getBlock() == Blocks.PORTAL) { return EnumFacing.EAST; } else if (world.getBlockState(portalPos.north()).getBlock() == Blocks.PORTAL || world.getBlockState(portalPos.south()).getBlock() == Blocks.PORTAL) { return EnumFacing.SOUTH; } return EnumFacing.NORTH; }
Example 13
Source File: RoofGen.java From pycode-minecraft with MIT License | 5 votes |
public RoofGen(WorldServer world, BlockPos pos, EnumFacing actualFacing, String material, int aWidth, int aDepth, ArgParser spec) throws BlockTypeError { this.world = world; this.stair = this.getRoofStair(material); if (this.stair == null) { // not a stair material so go with just blocks this.stair = this.filler = this.slab = PyRegistry.getBlockVariant(spec, pos, actualFacing, world); } else { this.filler = this.getRoofFiller(material); this.slab = this.getSlabBlock(material); } this.north_south = actualFacing == EnumFacing.NORTH || actualFacing == EnumFacing.SOUTH; this.fill = spec.getBoolean("fill", true); // alter pos, width and depth based on orientation so that the // code which always generates in the EAST facing will work switch (actualFacing) { case EAST: this.width = aWidth; this.depth = aDepth; this.pos = pos.add(1, 0, 0); break; case WEST: this.width = aWidth; this.depth = aDepth; this.pos = pos.add(-aDepth, 0, -(aWidth-1)); break; case NORTH: this.width = aDepth; this.depth = aWidth; this.pos = pos.add(0, 0, -aDepth); break; case SOUTH: this.width = aDepth; this.depth = aWidth; this.pos = pos.add(-(aWidth-1), 0, 1); break; } }
Example 14
Source File: IslandData.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public PortalEnumType getPortalState(EnumFacing facing) { if(facing == EnumFacing.NORTH) return northPortalState; else if(facing == EnumFacing.SOUTH) return southPortalState; else if(facing == EnumFacing.EAST) return eastPortalState; else if(facing == EnumFacing.WEST) return westPortalState; return PortalEnumType.Disabled; }
Example 15
Source File: BlockNetworkRelay.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
/** * Convert the given metadata into a BlockState for this block */ @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing; switch (meta & 7) { case 0: enumfacing = EnumFacing.DOWN; break; case 1: enumfacing = EnumFacing.EAST; break; case 2: enumfacing = EnumFacing.WEST; break; case 3: enumfacing = EnumFacing.SOUTH; break; case 4: enumfacing = EnumFacing.NORTH; break; case 5: default: enumfacing = EnumFacing.UP; } return this.getDefaultState().withProperty(FACING, enumfacing); }
Example 16
Source File: BlockComponentBox.java From Cyberware with MIT License | 5 votes |
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { EnumFacing face = state.getValue(FACING); if (face == EnumFacing.NORTH || face == EnumFacing.SOUTH) { return ew; } else { return ns; } }
Example 17
Source File: BlockAdvancedAggregator.java From TofuCraftReload with MIT License | 5 votes |
private void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { IBlockState iblockstate = worldIn.getBlockState(pos.north()); IBlockState iblockstate1 = worldIn.getBlockState(pos.south()); IBlockState iblockstate2 = worldIn.getBlockState(pos.west()); IBlockState iblockstate3 = worldIn.getBlockState(pos.east()); EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock()) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock()) { enumfacing = EnumFacing.NORTH; } else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock()) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock()) { enumfacing = EnumFacing.WEST; } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2); } }
Example 18
Source File: BakedAnvilModel.java From TFC2 with GNU General Public License v3.0 | 5 votes |
protected IBakedModel getActualModel(IBlockState state, List<PropertyItem.PItem> items, EnumFacing facing) { IBakedModel bakedModel = standard; // add all the items to display on the table if(items != null && !items.isEmpty()) { BakedCompositeModel.Builder builder = new BakedCompositeModel.Builder(); builder.add(bakedModel, null, 0); EnumFacing anvilFacing = state.getValue(BlockAnvil.FACING); for(PropertyItem.PItem item : items) { float rot = 0; /*if(state.getValue(BlockAnvil.FACING) == EnumFacing.NORTH || state.getValue(BlockAnvil.FACING) == EnumFacing.SOUTH) builder.add(new TRSRBakedModel(item.model, item.x, item.y +0.15f, item.z, item.r, (float) (Math.PI), 0.7853981633974483f, item.s), null, 0); else builder.add(new TRSRBakedModel(item.model, item.x, item.y + 0.15f, item.z, item.r, (float) (Math.PI), -0.7853981633974483f, item.s), null, 0);*/ if(anvilFacing == EnumFacing.NORTH) rot = (float)Math.toRadians(0); else if(anvilFacing == EnumFacing.SOUTH) rot = (float)Math.toRadians(180); else if(anvilFacing == EnumFacing.EAST) rot = (float)Math.toRadians(270); else if(anvilFacing == EnumFacing.WEST) rot = (float)Math.toRadians(90); builder.add(new TRSRBakedModel(item.model, item.x, item.y + 0.15f, item.z, item.r, (float) (Math.PI), rot, item.s), null, 0); } bakedModel = builder.build(bakedModel); } if(facing != null) { bakedModel = new TRSRBakedModel(bakedModel, facing); } return bakedModel; }
Example 19
Source File: ObsidianReplaceModule.java From seppuku with GNU General Public License v3.0 | 4 votes |
private EnumFacing calculateFaceForPlacement(final BlockPos structurePosition, final BlockPos blockPosition) { final BiFunction<Integer, String, Integer> throwingClamp = (number, axis) -> { if (number < -1 || number > 1) throw new IllegalArgumentException( String.format("Difference in %s is illegal, " + "positions are too far apart.", axis)); return number; }; final int diffX = throwingClamp.apply( structurePosition.getX() - blockPosition.getX(), "x-axis"); switch (diffX) { case 1: return EnumFacing.WEST; case -1: return EnumFacing.EAST; default: break; } final int diffY = throwingClamp.apply( structurePosition.getY() - blockPosition.getY(), "y-axis"); switch (diffY) { case 1: return EnumFacing.DOWN; case -1: return EnumFacing.UP; default: break; } final int diffZ = throwingClamp.apply( structurePosition.getZ() - blockPosition.getZ(), "z-axis"); switch (diffZ) { case 1: return EnumFacing.NORTH; case -1: return EnumFacing.SOUTH; default: break; } return null; }
Example 20
Source File: TileGenericPipe.java From Logistics-Pipes-2 with MIT License | 4 votes |
@Override public boolean activate(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { ItemStack heldItem = player.getHeldItem(hand); if(heldItem.getItem()!=null) { if(heldItem.getItem() instanceof ItemWrench) { if (side == EnumFacing.UP || side == EnumFacing.DOWN){ if (Math.abs(hitX-0.75) > Math.abs(hitZ-0.75)){ if (hitX < 0.75){ this.west = forceConnection(west); } else { this.east = forceConnection(east); } } else { if (hitZ < 0.75){ this.north = forceConnection(north); } else { this.south = forceConnection(south); } } } if (side == EnumFacing.EAST || side == EnumFacing.WEST){ if (Math.abs(hitY-0.75) > Math.abs(hitZ-0.75)){ if (hitY < 0.75){ this.down = forceConnection(down); } else { this.up = forceConnection(up); } } else { if (hitZ < 0.75){ this.north = forceConnection(north); } else { this.south = forceConnection(south); } } } if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH){ if (Math.abs(hitX-0.75) > Math.abs(hitY-0.75)){ if (hitX < 0.75){ this.west = forceConnection(west); } else { this.east = forceConnection(east); } } else { if (hitY < 0.75){ this.down = forceConnection(down); } else { this.up = forceConnection(up); } } } getAdjacentPipes(world); markDirty(); return true; } } return false; }