Java Code Examples for net.minecraftforge.common.util.ForgeDirection#UNKNOWN
The following examples show how to use
net.minecraftforge.common.util.ForgeDirection#UNKNOWN .
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: TileEntityPoweredInventoryFluid.java From BigReactors with MIT License | 6 votes |
/** * Return the tank that this tank container desired to be used for the specified fluid type from the specified direction * * @param direction the direction * @param type the fluid type, null is always an acceptable value * @return a tank or null for no such tank */ public IFluidTank getTank(ForgeDirection direction, FluidStack type) { if(direction == ForgeDirection.UNKNOWN) { return null; } else { int tankIdx = getExposedTankFromSide(direction.ordinal()); if(tankIdx == FLUIDTANK_NONE) { return null; } IFluidTank t = tanks[tankIdx]; if(type == null || isFluidValidForTank(tankIdx, type)) { return t; } return null; } }
Example 2
Source File: TileEntityPoweredInventoryFluid.java From BigReactors with MIT License | 6 votes |
/** * Returns true if the given fluid can be inserted into the given direction. * * More formally, this should return true if fluid is able to enter from the given direction. */ public boolean canFill(ForgeDirection from, Fluid fluid) { int tankIdx = 0; if(from != ForgeDirection.UNKNOWN) { tankIdx = getExposedTankFromSide(from.ordinal()); } if(tankIdx == FLUIDTANK_NONE) { return false; } IFluidTank tank = tanks[tankIdx]; if(tank.getFluidAmount() <= 0) { return true; } else { return tank.getFluid().fluidID == fluid.getID(); } }
Example 3
Source File: TileEntityPoweredInventoryFluid.java From BigReactors with MIT License | 6 votes |
/** * Fills fluid into internal tanks, distribution is left to the ITankContainer. * @param from Orientation the fluid is pumped in from. * @param resource FluidStack representing the maximum amount of fluid filled into the ITankContainer * @param doFill If false filling will only be simulated. * @return Amount of resource that was filled into internal tanks. */ public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { int tankToFill = FLUIDTANK_NONE; if(from != ForgeDirection.UNKNOWN) { tankToFill = getExposedTankFromSide(from.ordinal()); } else { tankToFill = getDefaultTankForFluid(resource.getFluid()); } if(tankToFill <= FLUIDTANK_NONE) { return 0; } else { return fill(tankToFill, resource, doFill); } }
Example 4
Source File: TileEntityPoweredInventoryFluid.java From BigReactors with MIT License | 6 votes |
/** * Drains fluid out of internal tanks, distribution is left entirely to the IFluidHandler. * * @param from * Orientation the Fluid is drained to. * @param resource * FluidStack representing the Fluid and maximum amount of fluid to be drained. * @param doDrain * If false, drain will only be simulated. * @return FluidStack representing the Fluid and amount that was (or would have been, if * simulated) drained. */ public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) { int tankToDrain = 0; if(from != ForgeDirection.UNKNOWN) { tankToDrain = getExposedTankFromSide(from.ordinal()); } if(tankToDrain == FLUIDTANK_NONE) { return null; } else { // Can't drain that fluid from that side. if(!resource.isFluidEqual( tanks[tankToDrain].getFluid() )) { return null; } return drain(tankToDrain, resource.amount, doDrain); } }
Example 5
Source File: BlockReactorRedstonePort.java From BigReactors with MIT License | 5 votes |
/** * A randomly called display update to be able to add particles or other items for display */ @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random par5Random) { TileEntity te = world.getTileEntity(x, y, z); if (te instanceof TileEntityReactorRedstonePort) { TileEntityReactorRedstonePort port = (TileEntityReactorRedstonePort)te; if(port.isRedstoneActive()) { ForgeDirection out = port.getOutwardsDir(); if(out != ForgeDirection.UNKNOWN) { double particleX, particleY, particleZ; particleY = y + 0.45D + par5Random.nextFloat() * 0.1D; if(out.offsetX > 0) particleX = x + par5Random.nextFloat() * 0.1D + 1.1D; else particleX = x + 0.45D + par5Random.nextFloat() * 0.1D; if(out.offsetZ > 0) particleZ = z + par5Random.nextFloat() * 0.1D + 1.1D; else particleZ = z + 0.45D + par5Random.nextFloat() * 0.1D; world.spawnParticle("reddust", particleX, particleY, particleZ, 0.0D, par5Random.nextFloat() * 0.1D, 0.0D); } } } }
Example 6
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 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: BlockPressureTube.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z){ if(target.hitInfo == ForgeDirection.UNKNOWN) { return super.getPickBlock(target, world, x, y, z); } else { TileEntityPressureTube tube = (TileEntityPressureTube)world.getTileEntity(x, y, z); return new ItemStack(ModuleRegistrator.getModuleItem(tube.modules[((ForgeDirection)target.hitInfo).ordinal()].getType())); } }
Example 9
Source File: BlockPressureTube.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static TubeModule getLookedModule(World world, int x, int y, int z, EntityPlayer player){ Pair<Vec3, Vec3> vecs = PneumaticCraftUtils.getStartAndEndLookVec(player); MovingObjectPosition mop = Blockss.pressureTube.collisionRayTrace(world, x, y, z, vecs.getLeft(), vecs.getRight()); if(mop != null && mop.hitInfo instanceof ForgeDirection && (ForgeDirection)mop.hitInfo != ForgeDirection.UNKNOWN) { TileEntityPressureTube tube = ModInteractionUtils.getInstance().getTube(world.getTileEntity(x, y, z)); return tube.modules[((ForgeDirection)mop.hitInfo).ordinal()]; } return null; }
Example 10
Source File: TileEntityPressureTube.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override protected int getMaxDispersion(ForgeDirection side){ if(side != ForgeDirection.UNKNOWN) { int intSide = side/*.getOpposite()*/.ordinal(); if(modules[intSide] instanceof IInfluenceDispersing) { return ((IInfluenceDispersing)modules[intSide]).getMaxDispersion(); } } return Integer.MAX_VALUE; }
Example 11
Source File: MultiblockTurbine.java From BigReactors with MIT License | 5 votes |
public ForgeDirection getRotorDirection() { if(attachedRotorBearings.size() < 1) { return ForgeDirection.UNKNOWN; } if(!this.isAssembled()) { return ForgeDirection.UNKNOWN; } TileEntityTurbineRotorBearing rotorBearing = attachedRotorBearings.iterator().next(); return rotorBearing.getOutwardsDir().getOpposite(); }
Example 12
Source File: MultiblockTurbineSimulator.java From reactor_simulator with MIT License | 5 votes |
public ForgeDirection getRotorDirection() { if (attachedRotorBearings.size() < 1) { return ForgeDirection.UNKNOWN; } if (!this.isAssembled()) { return ForgeDirection.UNKNOWN; } TileEntityTurbineRotorBearing rotorBearing = attachedRotorBearings.iterator().next(); return rotorBearing.getOutwardsDir().getOpposite(); }
Example 13
Source File: Position.java From Framez with GNU General Public License v3.0 | 5 votes |
public Position(double ci, double cj, double ck, ForgeDirection corientation) { x = ci; y = cj; z = ck; orientation = corientation; if (orientation == null) { orientation = ForgeDirection.UNKNOWN; } }
Example 14
Source File: TileEntityPoweredInventoryFluid.java From BigReactors with MIT License | 5 votes |
/** * @param direction tank side: UNKNOWN for default tank set * @return Array of {@link FluidTank}s contained in this ITankContainer for this direction */ public IFluidTank[] getTanks(ForgeDirection direction) { if(direction == ForgeDirection.UNKNOWN) { return tanks; } else { int exposure = getExposedTankFromSide(direction.ordinal()); if(exposure == FLUIDTANK_NONE) { return kEmptyFluidTankList; } return tankExposureCache[exposure]; } }
Example 15
Source File: TileEntityInventory.java From BigReactors with MIT License | 4 votes |
public boolean canConduitConnect(ForgeDirection from) { return from != ForgeDirection.UNKNOWN; }
Example 16
Source File: RectangularMultiblockTileEntityBase.java From BeefCore with MIT License | 4 votes |
public RectangularMultiblockTileEntityBase() { super(); position = PartPosition.Unknown; outwards = ForgeDirection.UNKNOWN; }
Example 17
Source File: Position.java From Framez with GNU General Public License v3.0 | 4 votes |
public Position(TileEntity tile) { x = tile.xCoord; y = tile.yCoord; z = tile.zCoord; orientation = ForgeDirection.UNKNOWN; }
Example 18
Source File: BlockPressureTube.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction){ MovingObjectPosition bestMOP = null; AxisAlignedBB bestAABB = null; setBlockBounds(BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MIN_POS, BBConstants.PRESSURE_PIPE_MAX_POS, BBConstants.PRESSURE_PIPE_MAX_POS, BBConstants.PRESSURE_PIPE_MAX_POS); MovingObjectPosition mop = super.collisionRayTrace(world, x, y, z, origin, direction); if(isCloserMOP(origin, bestMOP, mop)) { bestMOP = mop; bestAABB = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } TileEntityPressureTube tube = ModInteractionUtils.getInstance().getTube(world.getTileEntity(x, y, z)); for(int i = 0; i < 6; i++) { if(tube.sidesConnected[i]) { setBlockBounds(boundingBoxes[i]); mop = super.collisionRayTrace(world, x, y, z, origin, direction); if(isCloserMOP(origin, bestMOP, mop)) { bestMOP = mop; bestAABB = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } } } if(bestMOP != null) bestMOP.hitInfo = ForgeDirection.UNKNOWN;//unknown indicates we hit the tube. TubeModule[] modules = tube.modules; for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { if(modules[dir.ordinal()] != null) { setBlockBounds(modules[dir.ordinal()].boundingBoxes[dir.ordinal()]); mop = super.collisionRayTrace(world, x, y, z, origin, direction); if(isCloserMOP(origin, bestMOP, mop)) { mop.hitInfo = dir; bestMOP = mop; bestAABB = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } } } if(bestAABB != null) setBlockBounds(bestAABB); return bestMOP; }
Example 19
Source File: Position.java From Framez with GNU General Public License v3.0 | 4 votes |
public Position(double ci, double cj, double ck) { x = ci; y = cj; z = ck; orientation = ForgeDirection.UNKNOWN; }
Example 20
Source File: TileEntitySidedEnvironment.java From Framez with GNU General Public License v3.0 | 4 votes |
@Override public Node sidedNode(final ForgeDirection side) { return side == ForgeDirection.UNKNOWN ? null : nodes[side.ordinal()]; }