Java Code Examples for net.minecraftforge.common.util.ForgeDirection#DOWN
The following examples show how to use
net.minecraftforge.common.util.ForgeDirection#DOWN .
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: RenderTileStickyJar.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
private void rotateJar(ForgeDirection placedOn, ForgeDirection facing) { if(placedOn == ForgeDirection.UP) { GL11.glTranslatef(Math.abs(facing.offsetZ), 1, Math.abs(facing.offsetX)); GL11.glRotatef(180, facing.offsetX, 0, facing.offsetZ); } else if(placedOn != ForgeDirection.DOWN) { GL11.glTranslatef(0.5f, 0.5f, 0.5f); GL11.glRotatef(90, placedOn.offsetZ * -1, 0, placedOn.offsetX); switch (placedOn) { case NORTH: GL11.glRotatef(0, 0, 1, 0); break; case EAST: GL11.glRotatef(-90, 0, 1, 0); break; case SOUTH: GL11.glRotatef(180, 0, 1, 0); break; case WEST: GL11.glRotatef(90, 0, 1, 0); break; } GL11.glTranslatef(-0.5f, -0.5f, -0.5f); } }
Example 2
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 3
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 4
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 5
Source File: RenderTileArcaneDropper.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5, y - 0.5, z + 0.5); int metadata = tile.getBlockMetadata(); ForgeDirection side = ForgeDirection.getOrientation(metadata & 7); if(side == ForgeDirection.UP) { GL11.glRotatef(180, 1, 0, 0); GL11.glTranslatef(0, -2, 0); } else if(side != ForgeDirection.DOWN) { GL11.glRotatef(-90, side.offsetZ, 0, -1*side.offsetX); GL11.glTranslatef(side.offsetX, -1, side.offsetZ); } boolean flipped = (metadata & 8) == 8; if(side == ForgeDirection.WEST || side == ForgeDirection.EAST) { flipped = !flipped; } if(flipped) { GL11.glRotatef(90, 0, 1, 0); } bindTexture(RESOURCE); MODEL.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); renderBellow(); GL11.glRotatef(180, 0, 1, 0); renderBellow(); GL11.glPopMatrix(); }
Example 6
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 7
Source File: RectangularMultiblockTileEntityBase.java From BeefCore with MIT License | 5 votes |
public void recalculateOutwardsDirection(CoordTriplet minCoord, CoordTriplet maxCoord) { outwards = ForgeDirection.UNKNOWN; position = PartPosition.Unknown; int facesMatching = 0; if(maxCoord.x == this.xCoord || minCoord.x == this.xCoord) { facesMatching++; } if(maxCoord.y == this.yCoord || minCoord.y == this.yCoord) { facesMatching++; } if(maxCoord.z == this.zCoord || minCoord.z == this.zCoord) { facesMatching++; } if(facesMatching <= 0) { position = PartPosition.Interior; } else if(facesMatching >= 3) { position = PartPosition.FrameCorner; } else if(facesMatching == 2) { position = PartPosition.Frame; } else { // 1 face matches if(maxCoord.x == this.xCoord) { position = PartPosition.EastFace; outwards = ForgeDirection.EAST; } else if(minCoord.x == this.xCoord) { position = PartPosition.WestFace; outwards = ForgeDirection.WEST; } else if(maxCoord.z == this.zCoord) { position = PartPosition.SouthFace; outwards = ForgeDirection.SOUTH; } else if(minCoord.z == this.zCoord) { position = PartPosition.NorthFace; outwards = ForgeDirection.NORTH; } else if(maxCoord.y == this.yCoord) { position = PartPosition.TopFace; outwards = ForgeDirection.UP; } else { position = PartPosition.BottomFace; outwards = ForgeDirection.DOWN; } } }
Example 8
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 9
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 10
Source File: Sponge.java From Et-Futurum with The Unlicense | 5 votes |
@Override @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random rand) { if (world.getBlockMetadata(x, y, z) == 1) { ForgeDirection dir = getRandomDirection(rand); if (dir != ForgeDirection.UP && !World.doesBlockHaveSolidTopSurface(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) { double d0 = x; double d1 = y; double d2 = z; if (dir == ForgeDirection.DOWN) { d1 -= 0.05D; d0 += rand.nextDouble(); d2 += rand.nextDouble(); } else { d1 += rand.nextDouble() * 0.8D; if (dir == ForgeDirection.EAST || dir == ForgeDirection.WEST) { d2 += rand.nextDouble(); if (dir == ForgeDirection.EAST) d0++; else d0 += 0.05D; } else { d0 += rand.nextDouble(); if (dir == ForgeDirection.SOUTH) d2++; else d2 += 0.05D; } } world.spawnParticle("dripWater", d0, d1, d2, 0.0D, 0.0D, 0.0D); } } }
Example 11
Source File: BlockElevatorCaller.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
private void updateElevatorButtons(World world, int x, int y, int z){ for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) { TileEntityElevatorBase elevator = getElevatorBase(world, x + dir.offsetX, y - 2, z + dir.offsetZ); if(elevator != null) { elevator.updateFloors(); } } } }
Example 12
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 13
Source File: GrassPath.java From Et-Futurum with The Unlicense | 4 votes |
@Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { return side == ForgeDirection.DOWN; }
Example 14
Source File: TileAuraPylon.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public boolean canInputFrom(ForgeDirection face) { return isInputTile() && face == ForgeDirection.DOWN; }
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: BlockSensor.java From OpenPeripheral-Addons with MIT License | 4 votes |
@Override public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) { return side == ForgeDirection.DOWN; }
Example 17
Source File: TileBlockProtector.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
@Override public boolean isConnectable(ForgeDirection face) { return face == ForgeDirection.DOWN; }
Example 18
Source File: TileEntityGasLift.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public boolean suckLiquid(){ Block block = worldObj.getBlock(xCoord, yCoord - currentDepth - 1, zCoord); Fluid fluid = FluidRegistry.lookupFluidForBlock(block); if(fluid != null) { if(fill(ForgeDirection.UNKNOWN, new FluidStack(fluid, 1000), false) == 1000) { if(pumpingLake == null) { pumpingLake = new ArrayList<ChunkPosition>(); Stack<ChunkPosition> pendingPositions = new Stack<ChunkPosition>(); ChunkPosition thisPos = new ChunkPosition(xCoord, yCoord - currentDepth - 1, zCoord); pendingPositions.add(thisPos); pumpingLake.add(thisPos); while(!pendingPositions.empty()) { ChunkPosition checkingPos = pendingPositions.pop(); for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) { if(d == ForgeDirection.DOWN) continue; ChunkPosition newPos = new ChunkPosition(checkingPos.chunkPosX + d.offsetX, checkingPos.chunkPosY + d.offsetY, checkingPos.chunkPosZ + d.offsetZ); if(PneumaticCraftUtils.distBetween(newPos, xCoord + 0.5, yCoord - currentDepth - 1, zCoord + 0.5) <= MAX_PUMP_RANGE && worldObj.getBlock(newPos.chunkPosX, newPos.chunkPosY, newPos.chunkPosZ) == block && !pumpingLake.contains(newPos)) { pendingPositions.add(newPos); pumpingLake.add(newPos); } } } Collections.sort(pumpingLake, new ChunkPositionSorter(xCoord + 0.5, yCoord - currentDepth - 1, zCoord + 0.5)); Collections.reverse(pumpingLake); } ChunkPosition curPos = null; boolean foundSource = false; while(pumpingLake.size() > 0) { curPos = pumpingLake.get(0); if(worldObj.getBlock(curPos.chunkPosX, curPos.chunkPosY, curPos.chunkPosZ) == block && worldObj.getBlockMetadata(curPos.chunkPosX, curPos.chunkPosY, curPos.chunkPosZ) == 0) { foundSource = true; break; } pumpingLake.remove(0); } if(pumpingLake.size() == 0) { pumpingLake = null; } else if(foundSource) { worldObj.setBlockToAir(curPos.chunkPosX, curPos.chunkPosY, curPos.chunkPosZ); fill(ForgeDirection.UNKNOWN, new FluidStack(fluid, 1000), true); addAir(-100, ForgeDirection.UNKNOWN); status = 1; } } return true; } else { pumpingLake = null; return false; } }
Example 19
Source File: TileEntityGasLift.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isConnectedTo(ForgeDirection d){ return d != ForgeDirection.DOWN; }
Example 20
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; }