本文整理汇总了Java中net.minecraftforge.common.util.ForgeDirection.VALID_DIRECTIONS属性的典型用法代码示例。如果您正苦于以下问题:Java ForgeDirection.VALID_DIRECTIONS属性的具体用法?Java ForgeDirection.VALID_DIRECTIONS怎么用?Java ForgeDirection.VALID_DIRECTIONS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.common.util.ForgeDirection
的用法示例。
在下文中一共展示了ForgeDirection.VALID_DIRECTIONS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canPlantStay
public static boolean canPlantStay(World world, int x, int y, int z) {
Block block = world.getBlock(x, y - 1, z);
if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
if (block.isAir(world, x, y - 1, z)) {
int adjecentCount = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if (adjecentBlock == ModBlocks.chorus_plant)
adjecentCount++;
else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
return false;
}
return adjecentCount == 1;
} else
return false;
} else
return true;
}
示例2: updateTick
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if (world.isRemote)
return;
int surroundingBlockCount = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Block block = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if (block == this || block == Blocks.ice || block == Blocks.packed_ice)
if (++surroundingBlockCount >= 4)
break;
}
if (surroundingBlockCount < 4 || rand.nextInt(100) <= 33) {
int meta = world.getBlockMetadata(x, y, z);
if (meta < 3)
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 2);
else
world.setBlock(x, y, z, Blocks.water);
}
world.scheduleBlockUpdate(x, y, z, this, 40 + rand.nextInt(40));
}
示例3: onBlockPlaced
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;
}
示例4: getConnectedTubes
/**
* Gets all the tubes around a tile entity.
* @param tileEntity - center tile entity
* @return array of TileEntities
*/
public static TileEntity[] getConnectedTubes(TileEntity tileEntity)
{
TileEntity[] tubes = new TileEntity[] {null, null, null, null, null, null};
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tube = Coord4D.get(tileEntity).getFromSide(orientation).getTileEntity(tileEntity.getWorldObj());
if(TransmissionType.checkTransmissionType(tube, TransmissionType.GAS, tileEntity))
{
tubes[orientation.ordinal()] = tube;
}
}
return tubes;
}
示例5: getConnectedAcceptors
/**
* 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;
}
示例6: refresh
@Override
public void refresh()
{
if (!this.worldObj.isRemote)
{
this.adjacentConnections = null;
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = new BlockVec3(this).getTileEntityOnSide(this.worldObj, side);
if (tileEntity != null)
{
if (tileEntity.getClass() == this.getClass() && tileEntity instanceof INetworkProvider && !this.getNetwork().equals(((INetworkProvider) tileEntity).getNetwork()))
{
this.setNetwork((IGridNetwork) this.getNetwork().merge(((INetworkProvider) tileEntity).getNetwork()));
}
}
}
this.getNetwork().refresh();
}
}
示例7: absorb
private boolean absorb(World world, int x, int y, int z) {
LinkedList<Tuple> linkedlist = Lists.newLinkedList();
ArrayList<WorldCoord> arraylist = Lists.newArrayList();
linkedlist.add(new Tuple(new WorldCoord(x, y, z), 0));
int i = 0;
WorldCoord blockpos1;
while (!linkedlist.isEmpty()) {
Tuple tuple = linkedlist.poll();
blockpos1 = (WorldCoord) tuple.getFirst();
int j = (Integer) tuple.getSecond();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
WorldCoord blockpos2 = blockpos1.add(dir);
if (world.getBlock(blockpos2.x, blockpos2.y, blockpos2.z).getMaterial() == Material.water) {
world.setBlockToAir(blockpos2.x, blockpos2.y, blockpos2.z);
arraylist.add(blockpos2);
i++;
if (j < 6)
linkedlist.add(new Tuple(blockpos2, j + 1));
}
}
if (i > 64)
break;
}
Iterator<WorldCoord> iterator = arraylist.iterator();
while (iterator.hasNext()) {
blockpos1 = iterator.next();
world.notifyBlockOfNeighborChange(blockpos1.x, blockpos1.y, blockpos1.z, Blocks.air);
}
return i > 0;
}
示例8: getWorldModel
public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
final BoxModel model = new BoxModel();
model.addBoxI(7, 0, 7, 9, 13, 9).fillIcons(this, 0);
for (final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (world.isSideSolid(x + d.offsetX, y + d.offsetY, z + d.offsetZ, d.getOpposite(), false)) {
model.rotateToSideTex(d);
return model;
}
}
return model;
}
示例9: getWorldModel
public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
final int metadata = world.getBlockMetadata(x, y, z);
final BoxModel model = this.getInventoryModel(metadata);
model.get(0).textureSide[2] = this.iconsFlipped[metadata];
model.get(0).textureSide[3] = null;
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
if (world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) == ExtraUtils.enderQuarry) {
final Box b = new Box(0.125f, 0.0f, 0.125f, 0.875f, 0.0625f, 0.875f);
b.rotateToSide(dir);
b.texture = this.arms;
model.add(b);
}
}
return model;
}
示例10: getWorldModel
public BoxModel getWorldModel(final IBlockAccess world, final int x, final int y, final int z) {
final int metadata = world.getBlockMetadata(x, y, z);
final BoxModel model = this.getInventoryModel(metadata);
if (metadata == 2 || metadata == 3) {
model.fillIcons(this, metadata);
for (final ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
if (world.isSideSolid(x + d.offsetX, y + d.offsetY, z + d.offsetZ, d.getOpposite(), false)) {
model.rotateToSideTex(d);
return model;
}
}
}
return model;
}
示例11: reloadBlockMasks
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()];
}
}
}
示例12: reloadBlockMasks
public void reloadBlockMasks() {
this.blockMasks = 0;
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TransferNodePart.dummyPipes[dir.ordinal()].h = 0.5f + this.baseSize();
if (dir == this.getNodeDir()) {
this.blockMasks |= this.flagmasks[dir.ordinal()];
}
else if (!this.tile().canAddPart((TMultiPart)TransferNodePart.dummyPipes[dir.ordinal()])) {
this.blockMasks |= this.flagmasks[dir.ordinal()];
}
}
}
示例13: getNextPipeType
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;
}
示例14: getInventoryModel
public BoxModel getInventoryModel(final int metadata) {
final BoxModel boxes = new BoxModel();
final IPipe pipe = this.getPipe(metadata);
if (pipe != null) {
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
boxes.add(new Box(0.375f, 0.0f, 0.375f, 0.625f, 0.375f, 0.625f).rotateToSide(dir).setTexture(((IPipeCosmetic)pipe).invPipeTexture(dir)).setLabel("pipe"));
}
if (((IPipeCosmetic)this.getPipe(metadata)).baseSize() > 0.125f) {
boxes.add(new Box(0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f - ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize(), 0.5f + ((IPipeCosmetic)pipe).baseSize()).setTexture(((IPipeCosmetic)this.getPipe(metadata)).baseTexture()).setLabel("base"));
}
}
return boxes;
}
示例15: transmitEnergy
private void transmitEnergy() {
for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
final TileEntity tile = this.worldObj.getTileEntity(this.x() + side.offsetX, this.y() + side.offsetY, this.z() + side.offsetZ);
if (!(tile instanceof TileEntityGenerator)) {
if (tile instanceof IEnergyReceiver) {
this.getStorage().extractEnergy(((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), this.getStorage().extractEnergy(this.transferLimit() * this.getMultiplier(), true), false), false);
}
}
}
}