本文整理汇总了Java中net.minecraftforge.common.util.ForgeDirection.ordinal方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeDirection.ordinal方法的具体用法?Java ForgeDirection.ordinal怎么用?Java ForgeDirection.ordinal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.util.ForgeDirection
的用法示例。
在下文中一共展示了ForgeDirection.ordinal方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBlockPlaced
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public int onBlockPlaced(final World par1World, final int par2, final int par3, final int par4, int par5, final float par6, final float par7, final float par8, final int par9) {
final int meta = par5 % 6;
final int flag = 0;
final ForgeDirection side = ForgeDirection.getOrientation(meta);
if (!par1World.isSideSolid(par2 - side.offsetX, par3 - side.offsetY, par4 - side.offsetZ, side.getOpposite())) {
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (side != dir) {
if (par1World.isSideSolid(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ, dir.getOpposite())) {
return flag + dir.ordinal();
}
if (par1World.getBlock(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ) == this) {
par5 = par1World.getBlockMetadata(par2 - dir.offsetX, par3 - dir.offsetY, par4 - dir.offsetZ) % 6;
}
}
}
}
return flag + par5;
}
示例2: modifyPositionFromSide
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public Vector3 modifyPositionFromSide(Vector3 vec, ForgeDirection side, double amount)
{
switch (side.ordinal())
{
case 0:
vec.y -= amount;
break;
case 1:
vec.y += amount;
break;
case 2:
vec.z -= amount;
break;
case 3:
vec.z += amount;
break;
case 4:
vec.x -= amount;
break;
case 5:
vec.x += amount;
break;
}
return vec;
}
示例3: canConnect
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public boolean canConnect(ForgeDirection direction, NetworkType type)
{
if (direction == null || direction.equals(ForgeDirection.UNKNOWN))
{
return false;
}
if (type == NetworkType.OXYGEN)
{
return this.getOxygenOutputDirection() == direction.ordinal();
}
if (type == NetworkType.HYDROGEN)
{
return this.getHydrogenOutputDirection() == direction.ordinal();
}
if (type == NetworkType.POWER)
{
return direction == this.getElectricInputDirection();
}
return false;
}
示例4: getConnectedAcceptors
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
/**
* Gets all the acceptors around a tile entity.
* @param tileEntity - center tile entity
* @return array of IGasAcceptors
*/
public static IGasHandler[] getConnectedAcceptors(TileEntity tileEntity)
{
IGasHandler[] acceptors = new IGasHandler[] {null, null, null, null, null, null};
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity acceptor = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
if(acceptor instanceof IGasHandler)
{
acceptors[orientation.ordinal()] = (IGasHandler)acceptor;
}
}
return acceptors;
}
示例5: drain
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
int metaside = this.getBlockMetadata() + 2;
int side = from.ordinal();
if (side == (metaside ^ 1))
{
if (resource != null && resource.isFluidEqual(this.liquidTank2.getFluid()))
return this.liquidTank2.drain(resource.amount, doDrain);
}
//2->5 3->4 4->2 5->3
if (7 - (metaside ^ (metaside > 3 ? 0 : 1)) == (side ^ 1))
{
if (resource != null && resource.isFluidEqual(this.liquidTank.getFluid()))
return this.liquidTank.drain(resource.amount, doDrain);
}
return null;
}
示例6: onBlockPlaced
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) {
ForgeDirection dir = ForgeDirection.getOrientation(side).getOpposite();
if (world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) != this)
dir = dir.getOpposite();
return dir.ordinal();
}
示例7: receiveHydrogen
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public float receiveHydrogen(ForgeDirection from, float receive, boolean doReceive)
{
if (from.ordinal() == this.getBlockMetadata() + 2 && this.shouldPullHydrogen())
{
FluidStack fluidToFill = FluidRegistry.getFluidStack("hydrogen", (int) (receive));
return this.gasTank.fill(fluidToFill, doReceive);
}
return 0;
}
示例8: reloadBlockMasks
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public void reloadBlockMasks() {
this.blockMasks = 0;
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
PipePart.dummyPipes[dir.ordinal()].h = 0.5f - this.baseSize();
if (!this.tile().canAddPart((TMultiPart)PipePart.dummyPipes[dir.ordinal()])) {
this.blockMasks |= this.flagmasks[dir.ordinal()];
}
}
}
示例9: receiveOxygen
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public float receiveOxygen(ForgeDirection from, float receive, boolean doReceive)
{
if (from.ordinal() == this.getBlockMetadata() + 2 && this.shouldPullOxygen())
{
float conversion = 2F * Constants.LOX_GAS_RATIO;
FluidStack fluidToFill = new FluidStack(AsteroidsModule.fluidOxygenGas, (int) (receive * conversion));
int used = MathHelper.ceiling_float_int(this.gasTank.fill(fluidToFill, doReceive) / conversion);
return used;
}
return 0;
}
示例10: canFill
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public boolean canFill(ForgeDirection from, Fluid fluid)
{
if (from.ordinal() == this.getBlockMetadata() + 2)
{
//Can fill with water
return fluid != null && fluid.getName().equals(FluidRegistry.WATER.getName());
}
return false;
}
示例11: getIconIndex
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public int getIconIndex(ForgeDirection direction) {
if (direction == ForgeDirection.UNKNOWN) {
return standardIconIndex;
} else {
int metadata = container.getBlockMetadata();
if (metadata != direction.ordinal()) {
return solidIconIndex;
} else {
return standardIconIndex;
}
}
}
示例12: getAdjacentHydrogenConnections
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public static TileEntity[] getAdjacentHydrogenConnections(TileEntity tile)
{
TileEntity[] adjacentConnections = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];
boolean isMekLoaded = EnergyConfigHandler.isMekanismLoaded();
BlockVec3 thisVec = new BlockVec3(tile);
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = thisVec.getTileEntityOnSide(tile.getWorldObj(), direction);
if (tileEntity instanceof IConnector)
{
if (((IConnector) tileEntity).canConnect(direction.getOpposite(), NetworkType.HYDROGEN))
{
adjacentConnections[direction.ordinal()] = tileEntity;
}
}
else if (isMekLoaded)
{
if (tileEntity instanceof ITubeConnection && (!(tileEntity instanceof IGasTransmitter) || TransmissionType.checkTransmissionType(tileEntity, TransmissionType.GAS, tileEntity)))
{
if (((ITubeConnection) tileEntity).canTubeConnect(direction))
{
adjacentConnections[direction.ordinal()] = tileEntity;
}
}
}
}
return adjacentConnections;
}
示例13: canDrain
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid)
{
int metaside = this.getBlockMetadata() + 2;
int side = from.ordinal();
if (side == (metaside ^ 1))
return this.liquidTank2.getFluid() != null && this.liquidTank2.getFluidAmount() > 0;
//2->5 3->4 4->2 5->3
if (7 - (metaside ^ (metaside > 3 ? 0 : 1)) == (side ^ 1))
return this.liquidTank.getFluid() != null && this.liquidTank.getFluidAmount() > 0;
return false;
}
示例14: updateSources
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
private void updateSources(ForgeDirection source) {
if (sourcesTracker.markTimeIfDelay(receptor.getWorld(), 1)) {
for (int i = 0; i < 6; ++i) {
powerSources[i] -= sourcesTracker.durationOfLastDelay();
if (powerSources[i] < 0) {
powerSources[i] = 0;
}
}
}
if (source != null) {
powerSources[source.ordinal()] = 10;
}
}
示例15: drain
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{
int metaside = this.getBlockMetadata() + 2;
int side = from.ordinal();
if (side == (metaside ^ 1))
{
if (resource != null && resource.isFluidEqual(this.liquidTank.getFluid()))
return this.liquidTank.drain(resource.amount, doDrain);
}
return null;
}