Java Code Examples for net.minecraftforge.common.util.ForgeDirection#UP
The following examples show how to use
net.minecraftforge.common.util.ForgeDirection#UP .
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: BlockLattice.java From GardenCollection with MIT License | 6 votes |
private boolean isNeighborHardConnection (IBlockAccess world, int x, int y, int z, Block block, ForgeDirection side) { if (block.getMaterial().isOpaque() && block.renderAsNormalBlock()) return true; if (block.isSideSolid(world, x, y, z, side.getOpposite())) return true; if (block == this) return true; if (side == ForgeDirection.DOWN || side == ForgeDirection.UP) { if (block instanceof BlockFence || block instanceof net.minecraft.block.BlockFence) return true; } return false; }
Example 2
Source File: BlockStickyJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
public void onBlockPlacedOn(TileStickyJar tile, EntityLivingBase player) { if (tile.placedOn != ForgeDirection.UP && tile.placedOn != ForgeDirection.DOWN) { float pitch = player.rotationPitch; float yaw = MathHelper.wrapAngleTo180_float(player.rotationYaw); switch (tile.placedOn) { case WEST: yaw -= 90; break; case NORTH: yaw = (180 - Math.abs(yaw)) * (yaw < 0 ? 1 : -1); break; case EAST: yaw += 90; break; } if (Math.abs(yaw) < Math.abs(pitch)) { tile.facing = pitch < 0 ? ForgeDirection.SOUTH.ordinal() : ForgeDirection.NORTH.ordinal(); } else { tile.facing = yaw < 0 ? ForgeDirection.EAST.ordinal() : ForgeDirection.WEST.ordinal(); } } }
Example 3
Source File: TileEntityPresent.java From Chisel-2 with GNU General Public License v2.0 | 6 votes |
public void findConnections() { if (!isConnected()) { if (cachedDir != null) { if (connectTo(cachedDir)) { return; } } for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) { if (connectTo(dir)) { return; } } } } }
Example 4
Source File: RotorSimpleRenderer.java From BigReactors with MIT License | 6 votes |
/** * @param world * @param x * @param y * @param z * @param block * @return The major axis of the rotor. This is always one of the positive directions. */ private static ForgeDirection findRotorMajorAxis(IBlockAccess world, int x, int y, int z, Block block) { ForgeDirection retDir = ForgeDirection.UP; for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == block && BlockTurbineRotorPart.isRotorShaft(world.getBlockMetadata(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))) { retDir = dir; break; } } if(retDir == ForgeDirection.DOWN || retDir == ForgeDirection.NORTH || retDir == ForgeDirection.WEST) { retDir = retDir.getOpposite(); } return retDir; // Defaults to up if there's no neighbors of the same type }
Example 5
Source File: CoordTriplet.java From BeefCore with MIT License | 5 votes |
public ForgeDirection getDirectionFromSourceCoords(int x, int y, int z) { if(this.x < x) { return ForgeDirection.WEST; } else if(this.x > x) { return ForgeDirection.EAST; } else if(this.y < y) { return ForgeDirection.DOWN; } else if(this.y > y) { return ForgeDirection.UP; } else if(this.z < z) { return ForgeDirection.SOUTH; } else if(this.z > z) { return ForgeDirection.NORTH; } else { return ForgeDirection.UNKNOWN; } }
Example 6
Source File: ModelKeroseneLamp.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void renderStatic(float size, TileEntity te){ ForgeDirection sideConnected = ForgeDirection.DOWN; if(te != null) { sideConnected = ((TileEntityKeroseneLamp)te).getSideConnected(); } Tank.render(size); Holder1.render(size); Holder2.render(size); Base.render(size); Top.render(size); if(sideConnected != ForgeDirection.DOWN) { Support1.render(size); if(sideConnected != ForgeDirection.UP) { SupportSide.rotateAngleY = 0; ForgeDirection rotation = ((TileEntityKeroseneLamp)te).getRotation(); if(rotation != ForgeDirection.UP && rotation != ForgeDirection.DOWN) { while(sideConnected != rotation.getOpposite()) { sideConnected = sideConnected.getRotation(ForgeDirection.DOWN); SupportSide.rotateAngleY += Math.toRadians(90); } } SupportSide2.rotateAngleY = SupportSide.rotateAngleY; SupportSide.render(size); SupportSide2.render(size); } } if(te != null) { FluidTankInfo info = ((TileEntityKeroseneLamp)te).getTankInfo(null)[0]; if(info.fluid != null && info.fluid.amount > 10) { float percentageFull = (float)info.fluid.amount / info.capacity; RenderInfo renderInfo = new RenderInfo(-3 / 16F + 0.01F, 23 / 16F - percentageFull * 2.999F / 16F, -3 / 16F + 0.01F, 3 / 16F - 0.01F, 22.99F / 16F, 3 / 16F - 0.01F); RenderUtils.INSTANCE.renderLiquid(info, renderInfo, te.getWorldObj()); } } }
Example 7
Source File: TileEntityAssemblyRobot.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public ForgeDirection[] getPlatformDirection(){ for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) { if(worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ) instanceof TileEntityAssemblyPlatform) return new ForgeDirection[]{dir, ForgeDirection.UNKNOWN}; } } if(canMoveToDiagonalNeighbours()) { if(worldObj.getTileEntity(xCoord + ForgeDirection.NORTH.offsetX + ForgeDirection.WEST.offsetX, yCoord, zCoord + ForgeDirection.NORTH.offsetZ + ForgeDirection.WEST.offsetZ) instanceof TileEntityAssemblyPlatform) return new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.WEST}; if(worldObj.getTileEntity(xCoord + ForgeDirection.NORTH.offsetX + ForgeDirection.EAST.offsetX, yCoord, zCoord + ForgeDirection.NORTH.offsetZ + ForgeDirection.EAST.offsetZ) instanceof TileEntityAssemblyPlatform) return new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.EAST}; if(worldObj.getTileEntity(xCoord + ForgeDirection.SOUTH.offsetX + ForgeDirection.WEST.offsetX, yCoord, zCoord + ForgeDirection.SOUTH.offsetZ + ForgeDirection.WEST.offsetZ) instanceof TileEntityAssemblyPlatform) return new ForgeDirection[]{ForgeDirection.SOUTH, ForgeDirection.WEST}; if(worldObj.getTileEntity(xCoord + ForgeDirection.SOUTH.offsetX + ForgeDirection.EAST.offsetX, yCoord, zCoord + ForgeDirection.SOUTH.offsetZ + ForgeDirection.EAST.offsetZ) instanceof TileEntityAssemblyPlatform) return new ForgeDirection[]{ForgeDirection.SOUTH, ForgeDirection.EAST}; } return null; }
Example 8
Source File: TileEntityPressureChamberValve.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public boolean isConnectedTo(ForgeDirection side){ switch(ForgeDirection.getOrientation(getBlockMetadata())){ case UP: case DOWN: return side == ForgeDirection.UP || side == ForgeDirection.DOWN; case NORTH: case SOUTH: return side == ForgeDirection.NORTH || side == ForgeDirection.SOUTH; case EAST: case WEST: return side == ForgeDirection.EAST || side == ForgeDirection.WEST; } return false; }
Example 9
Source File: WorldCoord.java From Framez with GNU General Public License v3.0 | 5 votes |
/** * Will Return NULL if it's at some diagonal! */ public ForgeDirection directionTo(WorldCoord loc) { int ox = x - loc.x; int oy = y - loc.y; int oz = z - loc.z; int xlen = Math.abs( ox ); int ylen = Math.abs( oy ); int zlen = Math.abs( oz ); if ( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) ) return ForgeDirection.EAST; if ( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) ) return ForgeDirection.WEST; if ( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) ) return ForgeDirection.NORTH; if ( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) ) return ForgeDirection.SOUTH; if ( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) ) return ForgeDirection.UP; if ( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) ) return ForgeDirection.DOWN; return null; }
Example 10
Source File: EndRod.java From Et-Futurum with The Unlicense | 5 votes |
@Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F); else if (dir == ForgeDirection.WEST || dir == ForgeDirection.EAST) setBlockBounds(0.0F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F); else if (dir == ForgeDirection.NORTH || dir == ForgeDirection.SOUTH) setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F); }
Example 11
Source File: RotorSimpleRenderer.java From BigReactors with MIT License | 5 votes |
public static void renderBlade(RenderBlocks renderer, int x, int y, int z, Block block, int metadata, ForgeDirection rotorDir) { if(rotorDir == ForgeDirection.UNKNOWN) { rotorDir = ForgeDirection.UP; } double xMin, yMin, zMin, xMax, yMax, zMax; xMin = yMin = zMin = 0D; xMax = yMax = zMax = 1D; if(rotorDir.offsetX != 0) { xMin = 0.45D; xMax = 0.55D; } else if(rotorDir.offsetY != 0) { yMin = 0.45D; yMax = 0.55D; } else if(rotorDir.offsetZ != 0) { zMin = 0.45D; zMax = 0.55D; } Tessellator.instance.setColorRGBA(255, 255, 255, 255); renderer.setRenderBoundsFromBlock(block); renderer.setOverrideBlockTexture(null); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceYNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceYPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceZNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceZPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceXNeg(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); renderer.setRenderBounds(xMin, yMin, zMin, xMax, yMax, zMax); renderer.renderFaceXPos(block, x, y, z, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); renderer.setRenderBounds(0D, 0D, 0D, 1D, 1D, 1D); }
Example 12
Source File: TileEntityAssemblyController.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private void getMachines(List<IAssemblyMachine> machineList, int x, int y, int z){ for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(dir == ForgeDirection.UP || dir == ForgeDirection.DOWN) continue; TileEntity te = worldObj.getTileEntity(x + dir.offsetX, y, z + dir.offsetZ); if(te instanceof IAssemblyMachine && !machineList.contains(te)) { machineList.add((IAssemblyMachine)te); getMachines(machineList, te.xCoord, te.yCoord, te.zCoord); } } }
Example 13
Source File: TileStickyJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public ForgeDirection changeDirection(ForgeDirection face) { if(placedOn == ForgeDirection.UP) { if(face == ForgeDirection.UP || face == ForgeDirection.DOWN) { return face.getOpposite(); } return face; } if(placedOn == ForgeDirection.DOWN) { return face; } if(face == ForgeDirection.UP) { return ForgeDirection.NORTH; } if(face == ForgeDirection.DOWN) { return ForgeDirection.SOUTH; } if(face == placedOn) { return ForgeDirection.DOWN; } if(face == placedOn.getOpposite()) { return ForgeDirection.UP; } switch (placedOn) { case EAST: return face == ForgeDirection.NORTH ? ForgeDirection.WEST : ForgeDirection.EAST; case SOUTH: return face.getOpposite(); case WEST: return face == ForgeDirection.SOUTH ? ForgeDirection.WEST : ForgeDirection.EAST; } return face; }
Example 14
Source File: GenericSlab.java From Et-Futurum with The Unlicense | 4 votes |
@Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { int meta = world.getBlockMetadata(x, y, z); return meta == 2 || side == ForgeDirection.UP && meta == 1 || side == ForgeDirection.DOWN && meta == 0; }
Example 15
Source File: TileEntityElevatorBase.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isConnectedTo(ForgeDirection side){ return side != ForgeDirection.UP && side != ForgeDirection.DOWN || worldObj.getBlock(xCoord, yCoord + side.offsetY, zCoord) != Blockss.elevatorBase; }
Example 16
Source File: TileEntityElectricCompressor.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction){ //ForgeDirection facing = ForgeDirection.getOrientation(getBlockMetadata()).getOpposite(); return direction == ForgeDirection.UP; }
Example 17
Source File: WorldCoord.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
/** * Will Return NULL if it's at some diagonal! */ public ForgeDirection directionTo( WorldCoord loc ) { int ox = this.x - loc.x; int oy = this.y - loc.y; int oz = this.z - loc.z; int xlen = Math.abs( ox ); int ylen = Math.abs( oy ); int zlen = Math.abs( oz ); if( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) ) { return ForgeDirection.EAST; } if( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) ) { return ForgeDirection.WEST; } if( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) ) { return ForgeDirection.NORTH; } if( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) ) { return ForgeDirection.SOUTH; } if( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) ) { return ForgeDirection.UP; } if( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) ) { return ForgeDirection.DOWN; } return null; }
Example 18
Source File: TileEntityAssemblyController.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isConnectedTo(ForgeDirection side){ return side != ForgeDirection.UP; }
Example 19
Source File: TileEntityElectrostaticCompressor.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isConnectedTo(ForgeDirection dir){ return dir != ForgeDirection.UP; }
Example 20
Source File: TileEntityPneumaticPump.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean canWork(ForgeDirection dir){ return getPressure(dir) > PneumaticValues.MIN_PRESSURE_PNEUMATIC_PUMP && ForgeDirection.UP == dir; }