本文整理汇总了Java中net.minecraftforge.common.util.ForgeDirection.getOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeDirection.getOrientation方法的具体用法?Java ForgeDirection.getOrientation怎么用?Java ForgeDirection.getOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.util.ForgeDirection
的用法示例。
在下文中一共展示了ForgeDirection.getOrientation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidTileEntity
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public static boolean isValidTileEntity(final TileEntity inv, final int side) {
if (inv == null) {
return false;
}
final ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
final String classname = inv.getClass().toString();
if (classname.contains("thermalexpansion") && classname.contains("conduit")) {
return false;
}
if (inv instanceof IFluidHandler) {
final FluidTankInfo[] t = ((IFluidHandler)inv).getTankInfo(forgeSide);
if (t != null && t.length != 0) {
return true;
}
}
if (inv instanceof IInventory && ((IInventory)inv).getSizeInventory() > 0) {
if (!(inv instanceof ISidedInventory)) {
return true;
}
final int[] t2 = ((ISidedInventory)inv).getAccessibleSlotsFromSide(side);
if (t2 != null && t2.length != 0) {
return true;
}
}
return isRFEnergy(inv, forgeSide);
}
示例2: joinDown
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
private void joinDown()
{
int meta = this.getBlockMetadata();
ForgeDirection side = ForgeDirection.getOrientation(this.getRight(meta));
BlockVec3 vec = new BlockVec3(this);
for (int x = -this.connectionsLeft; x <= this.connectionsRight; x++)
{
TileEntity tile;
BlockVec3 newVec = vec.clone().modifyPositionFromSide(side, x);
if (x == 0) tile = this;
else
{
tile = newVec.getTileEntity(this.worldObj);
}
if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta && !tile.isInvalid())
{
TileEntityScreen screenTile = (TileEntityScreen)tile;
screenTile.connectedDown = true;
TileEntity te2 = newVec.getTileEntityOnSide(this.worldObj, 0);
if (te2 instanceof TileEntityScreen && te2.getBlockMetadata() == meta && !te2.isInvalid())
{
screenTile.tryConnectDown((TileEntityScreen) te2);
}
}
}
}
示例3: getTankInfo
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
FluidTankInfo[] tankInfo = new FluidTankInfo[] {};
if (from == ForgeDirection.getOrientation(this.getBlockMetadata() + 2))
{
tankInfo = new FluidTankInfo[] { new FluidTankInfo(this.gasTank) };
}
else if (from == ForgeDirection.getOrientation(this.getBlockMetadata() + 2).getOpposite())
{
tankInfo = new FluidTankInfo[] { new FluidTankInfo(this.liquidTank) };
}
return tankInfo;
}
示例4: joinUp
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
private void joinUp()
{
int meta = this.getBlockMetadata();
ForgeDirection side = ForgeDirection.getOrientation(this.getRight(meta));
BlockVec3 vec = new BlockVec3(this);
for (int x = -this.connectionsLeft; x <= this.connectionsRight; x++)
{
TileEntity tile;
BlockVec3 newVec = vec.clone().modifyPositionFromSide(side, x);
if (x == 0) tile = this;
else
{
tile = newVec.getTileEntity(this.worldObj);
}
if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta && !tile.isInvalid())
{
TileEntityScreen screenTile = (TileEntityScreen)tile;
screenTile.connectedUp = true;
TileEntity te2 = newVec.getTileEntityOnSide(this.worldObj, 1);
if (te2 instanceof TileEntityScreen && te2.getBlockMetadata() == meta && !te2.isInvalid())
{
screenTile.tryConnectUp((TileEntityScreen) te2);
}
}
}
}
示例5: getDirections
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public static EnumSet<ForgeDirection> getDirections(TileEntity tileEntity, NetworkType type)
{
EnumSet<ForgeDirection> possibleSides = EnumSet.noneOf(ForgeDirection.class);
if (tileEntity instanceof IConnector)
{
for (int i = 0; i < 6; i++)
{
ForgeDirection direction = ForgeDirection.getOrientation(i);
if (((IConnector) tileEntity).canConnect(direction, type))
{
possibleSides.add(direction);
}
}
}
return possibleSides;
}
示例6: getTankInfo
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
FluidTankInfo[] tankInfo = new FluidTankInfo[] { };
if (from == ForgeDirection.getOrientation(this.getBlockMetadata() + 2))
{
tankInfo = new FluidTankInfo[] { new FluidTankInfo(this.oilTank) };
}
else if (from == ForgeDirection.getOrientation((this.getBlockMetadata() + 2) ^ 1))
{
tankInfo = new FluidTankInfo[] { new FluidTankInfo(this.fuelTank) };
}
return tankInfo;
}
示例7: setBlockBoundsBasedOnState
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@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);
}
示例8: renderTileEntityAt
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
OpenGLHelper.pushMatrix();
OpenGLHelper.translate(x, y, z);
OpenGLHelper.colour(0xFFFFFF);
bindTexture(TextureMap.locationBlocksTexture);
ForgeDirection dir = ForgeDirection.getOrientation(tile.getBlockMetadata());
switch (dir) {
case DOWN:
OpenGLHelper.rotate(180, 1, 0, 0);
OpenGLHelper.translate(0, -1, -1);
break;
case EAST:
OpenGLHelper.rotate(270, 0, 0, 1);
OpenGLHelper.translate(-1, 0, 0);
break;
case NORTH:
OpenGLHelper.rotate(270, 1, 0, 0);
OpenGLHelper.translate(0, -1, 0);
break;
case SOUTH:
OpenGLHelper.rotate(90, 1, 0, 0);
OpenGLHelper.translate(0, 0, -1);
break;
case WEST:
OpenGLHelper.rotate(90, 0, 0, 1);
OpenGLHelper.translate(0, -1, 0);
break;
default:
break;
}
renderRod(renderer, tile.getBlockType(), tile.getBlockMetadata());
OpenGLHelper.popMatrix();
}
示例9: executeAction
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public boolean executeAction(World world, ItemStack wand, EntityPlayer player, int x, int y, int z, int side,
int event) {
int md = world.getBlockMetadata(x, y, z);
BlockInfusedBlockOre block = (BlockInfusedBlockOre) world.getBlock(x, y, z);
if (world.isRemote) {
for (int i = 0; i < 10; i++)
if (md < 6)
UtilsFX.infusedStoneSparkle(world, x, y, z, md + 1);
return false;
} else {
ForgeDirection dir = ForgeDirection.getOrientation(side);
int iX = dir.equals(ForgeDirection.EAST) ? x + 1 : dir.equals(ForgeDirection.WEST) ? x - 1 : x;
int iY = dir.equals(ForgeDirection.UP) ? y + 1 : dir.equals(ForgeDirection.DOWN) ? y - 1 : y;
int iZ = dir.equals(ForgeDirection.SOUTH) ? z + 1 : dir.equals(ForgeDirection.NORTH) ? z - 1 : z;
for (ItemStack item : block.getDropsWand(world, x, y, z, md, player.isSneaking())) {
float f = 0.7F;
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem = new EntityItem(world, (double) iX + d0, (double) iY + d1, (double) iZ + d2,
item);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
world.setBlock(x, y, z, block.getBaseBlock(), block.getBaseMeta(), 2);
return true;
}
}
示例10: canPlaceBlockOnSide
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5){
ForgeDirection dir = ForgeDirection.getOrientation(par5);
return (dir == NORTH && par1World.isSideSolid(par2, par3, par4 + 1, NORTH)) ||
(dir == SOUTH && par1World.isSideSolid(par2, par3, par4 - 1, SOUTH)) ||
(dir == WEST && par1World.isSideSolid(par2 + 1, par3, par4, WEST )) ||
(dir == EAST && par1World.isSideSolid(par2 - 1, par3, par4, EAST ));
}
示例11: getNextPipeType
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public static int getNextPipeType(final IBlockAccess world, final int x, final int y, final int z, int metadata) {
if ((metadata >= 8 && metadata < 15) || metadata > 15) {
return metadata;
}
if (metadata == 7) {
return 0;
}
if (metadata == 15) {
return 7;
}
if (metadata == 6) {
return 15;
}
metadata = (metadata + 1) % 8;
final IPipe pipe = TNHelper.getPipe(world, x, y, z);
if (pipe == null) {
return metadata;
}
int numNeighbors = 0;
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (TNHelper.canInput(world, x, y, z, dir) && TNHelper.canInput(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite())) {
++numNeighbors;
}
}
if (numNeighbors <= 1) {
if (metadata >= 1 && metadata <= 6) {
return 15;
}
}
else {
for (ForgeDirection dir2 = ForgeDirection.getOrientation(metadata - 1); metadata >= 1 && metadata <= 6 && (!TNHelper.canInput(world, x, y, z, dir2) || !TNHelper.canInput(world, x + dir2.offsetX, y + dir2.offsetY, z + dir2.offsetZ, dir2.getOpposite())); dir2 = ForgeDirection.getOrientation(++metadata - 1)) {}
if (metadata == 7) {
return 15;
}
}
return metadata;
}
示例12: getModel
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
public BoxModel getModel(final int metadata) {
final ForgeDirection dir = ForgeDirection.getOrientation(metadata);
final BoxModel boxes = new BoxModel();
final float w = 0.125f;
boxes.add(new Box(0.0625f, 0.0f, 0.0625f, 0.9375f, 0.0625f, 0.9375f).rotateToSide(dir).setTextureSides(dir.ordinal(), BlockTransferNode.nodeBase));
boxes.add(new Box(0.1875f, 0.0625f, 0.1875f, 0.8125f, 0.25f, 0.8125f).rotateToSide(dir));
boxes.add(new Box(0.3125f, 0.25f, 0.3125f, 0.6875f, 0.375f, 0.6875f).rotateToSide(dir));
boxes.add(new Box(0.375f, 0.25f, 0.375f, 0.625f, 0.375f, 0.625f).rotateToSide(dir).setTexture(BlockTransferNode.nodeBase).setAllSideInvisible().setSideInvisible(dir.getOpposite().ordinal(), false));
return boxes;
}
示例13: getInputPoint
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public Vector3 getInputPoint()
{
Vector3 headVec = new Vector3(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord + 0.5);
ForgeDirection facingDir = ForgeDirection.getOrientation(this.facing);
headVec.x += facingDir.offsetX * 0.1F;
headVec.y += facingDir.offsetY * 0.1F;
headVec.z += facingDir.offsetZ * 0.1F;
return headVec;
}
示例14: getElectricInputDirection
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public ForgeDirection getElectricInputDirection()
{
if (this.isMaster)
{
return ForgeDirection.getOrientation(this.facing + 2);
}
TileEntityMinerBase master = this.getMaster();
if (master != null)
{
return ForgeDirection.getOrientation(master.facing + 2);
}
return ForgeDirection.UNKNOWN;
}
示例15: setBlockBoundsBasedOnState
import net.minecraftforge.common.util.ForgeDirection; //导入方法依赖的package包/类
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta != -1)
{
ForgeDirection dir = ForgeDirection.getOrientation(meta);
switch (dir)
{
case UP:
this.setBlockBounds(0.3F, 0.3F, 0.3F, 0.7F, 1.0F, 0.7F);
break;
case DOWN:
this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 0.42F, 0.8F);
break;
case EAST:
this.setBlockBounds(0.58F, 0.2F, 0.2F, 1.0F, 0.8F, 0.8F);
break;
case WEST:
this.setBlockBounds(0.0F, 0.2F, 0.2F, 0.42F, 0.8F, 0.8F);
break;
case NORTH:
this.setBlockBounds(0.2F, 0.2F, 0.0F, 0.8F, 0.8F, 0.42F);
break;
case SOUTH:
this.setBlockBounds(0.2F, 0.2F, 0.58F, 0.8F, 0.8F, 1.0F);
break;
default:
break;
}
}
}