本文整理汇总了Java中micdoodle8.mods.galacticraft.api.vector.BlockVec3.getTileEntityOnSide方法的典型用法代码示例。如果您正苦于以下问题:Java BlockVec3.getTileEntityOnSide方法的具体用法?Java BlockVec3.getTileEntityOnSide怎么用?Java BlockVec3.getTileEntityOnSide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类micdoodle8.mods.galacticraft.api.vector.BlockVec3
的用法示例。
在下文中一共展示了BlockVec3.getTileEntityOnSide方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: joinRight
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
private void joinRight()
{
int meta = this.getBlockMetadata();
int side = this.getRight(meta);
BlockVec3 vec = new BlockVec3(this);
for (int z = -this.connectionsUp; z <= this.connectionsDown; z++)
{
TileEntity tile;
BlockVec3 newVec = vec.clone().modifyPositionFromSide(ForgeDirection.DOWN, z);
if (z == 0) tile = this;
else
{
tile = newVec.getTileEntity(this.worldObj);
}
if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta && !tile.isInvalid())
{
TileEntityScreen screenTile = (TileEntityScreen)tile;
screenTile.connectedRight = true;
TileEntity te2 = newVec.getTileEntityOnSide(this.worldObj, side);
if (te2 instanceof TileEntityScreen && te2.getBlockMetadata() == meta && !te2.isInvalid())
{
screenTile.tryConnectRight((TileEntityScreen) te2);
}
}
}
}
示例2: joinLeft
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
private void joinLeft()
{
int meta = this.getBlockMetadata();
int side = this.getLeft(meta);
BlockVec3 vec = new BlockVec3(this);
for (int z = -this.connectionsUp; z <= this.connectionsDown; z++)
{
TileEntity tile;
BlockVec3 newVec = vec.clone().modifyPositionFromSide(ForgeDirection.DOWN, z);
if (z == 0) tile = this;
else
{
tile = newVec.getTileEntity(this.worldObj);
}
if (tile instanceof TileEntityScreen && tile.getBlockMetadata() == meta && !tile.isInvalid())
{
TileEntityScreen screenTile = (TileEntityScreen)tile;
screenTile.connectedLeft = true;
TileEntity te2 = newVec.getTileEntityOnSide(this.worldObj, side);
if (te2 instanceof TileEntityScreen && te2.getBlockMetadata() == meta && !te2.isInvalid())
{
screenTile.tryConnectLeft((TileEntityScreen) te2);
}
}
}
}
示例3: joinUp
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的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);
}
}
}
}
示例4: joinDown
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的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);
}
}
}
}
示例5: getNetworksFromMultipleSides
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
/**
* @param tileEntity - The TileEntity's sides.
* @param approachingDirection - The directions that can be connected.
* @return A list of networks from all specified sides. There will be no
* repeated ElectricityNetworks and it will never return null.
*/
public static Set<IElectricityNetwork> getNetworksFromMultipleSides(TileEntity tileEntity, EnumSet<ForgeDirection> approachingDirection)
{
final Set<IElectricityNetwork> connectedNetworks = new HashSet<IElectricityNetwork>();
BlockVec3 tileVec = new BlockVec3(tileEntity);
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
if (approachingDirection.contains(side))
{
TileEntity outputConductor = tileVec.getTileEntityOnSide(tileEntity.getWorldObj(), side);
IElectricityNetwork electricityNetwork = NetworkHelper.getElectricalNetworkFromTileEntity(outputConductor, side);
if (electricityNetwork != null)
{
connectedNetworks.add(electricityNetwork);
}
}
}
return connectedNetworks;
}
示例6: refresh
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
@Override
public void refresh()
{
if (!this.worldObj.isRemote)
{
this.adjacentConnections = null;
this.getNetwork().refresh();
BlockVec3 thisVec = new BlockVec3(this);
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = thisVec.getTileEntityOnSide(this.worldObj, side);
if (tileEntity != null)
{
if (tileEntity.getClass() == this.getClass() && tileEntity instanceof INetworkProvider && !this.getNetwork().equals(((INetworkProvider) tileEntity).getNetwork()))
{
((INetworkProvider) tileEntity).getNetwork().merge(this.getNetwork());
}
}
}
}
}
示例7: getAdjacentHydrogenConnections
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的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;
}
示例8: getAdjacentConnections
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
@Override
public TileEntity[] getAdjacentConnections()
{
/**
* Cache the adjacentConnections.
*/
if (this.adjacentConnections == null)
{
this.adjacentConnections = new TileEntity[6];
BlockVec3 thisVec = new BlockVec3(this);
for (int i = 0; i < 6; i++)
{
TileEntity tileEntity = thisVec.getTileEntityOnSide(this.worldObj, i);
if (tileEntity instanceof IConnector)
{
if (((IConnector) tileEntity).canConnect(ForgeDirection.getOrientation(i ^ 1), NetworkType.POWER))
{
this.adjacentConnections[i] = tileEntity;
}
}
}
}
return this.adjacentConnections;
}
示例9: getAdjacentOxygenConnections
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
public static TileEntity[] getAdjacentOxygenConnections(TileEntity tile)
{
TileEntity[] adjacentConnections = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];
boolean isMekLoaded = EnergyConfigHandler.isMekanismLoaded();
BlockVec3 thisVec = new BlockVec3(tile);
World world = tile.getWorldObj();
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = thisVec.getTileEntityOnSide(world, direction);
if (tileEntity instanceof IConnector)
{
if (((IConnector) tileEntity).canConnect(direction.getOpposite(), NetworkType.OXYGEN))
{
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;
}
示例10: onBlockActivated
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
final TileEntityOxygenPipe tileEntity = (TileEntityOxygenPipe) par1World.getTileEntity(x, y, z);
if (!par1World.isRemote)
{
final ItemStack stack = par5EntityPlayer.inventory.getCurrentItem();
if (stack != null)
{
if (stack.getItem() instanceof ItemDye)
{
final int dyeColor = par5EntityPlayer.inventory.getCurrentItem().getItemDamageForDisplay();
final byte colorBefore = tileEntity.getColor();
tileEntity.setColor((byte) dyeColor);
if (colorBefore != (byte) dyeColor && !par5EntityPlayer.capabilities.isCreativeMode && --par5EntityPlayer.inventory.getCurrentItem().stackSize == 0)
{
par5EntityPlayer.inventory.mainInventory[par5EntityPlayer.inventory.currentItem] = null;
}
if (colorBefore != (byte) dyeColor && colorBefore != 15)
{
final float f = 0.7F;
final double d0 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5D;
final double d1 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.2D + 0.6D;
final double d2 = par1World.rand.nextFloat() * f + (1.0F - f) * 0.5D;
final EntityItem entityitem = new EntityItem(par1World, x + d0, y + d1, z + d2, new ItemStack(Items.dye, 1, colorBefore));
entityitem.delayBeforeCanPickup = 10;
par1World.spawnEntityInWorld(entityitem);
}
// GCCorePacketManager.sendPacketToClients(GCCorePacketManager.getPacket(GalacticraftCore.CHANNELENTITIES, tileEntity, tileEntity.getColor(), (byte) -1)); TODO Fix pipe color
BlockVec3 tileVec = new BlockVec3(tileEntity);
for (final ForgeDirection dir : ForgeDirection.values())
{
final TileEntity tileAt = tileVec.getTileEntityOnSide(tileEntity.getWorldObj(), dir);
if (tileAt != null && tileAt instanceof IColorable)
{
((IColorable) tileAt).onAdjacentColorChanged(dir);
}
}
return true;
}
}
}
return false;
}
示例11: produce
import micdoodle8.mods.galacticraft.api.vector.BlockVec3; //导入方法依赖的package包/类
public float produce(boolean simulate)
{
float amountProduced = 0;
if (!this.worldObj.isRemote)
{
EnumSet<ForgeDirection> outputDirections = this.getElectricalOutputDirections();
outputDirections.remove(ForgeDirection.UNKNOWN);
BlockVec3 thisVec = new BlockVec3(this);
for (ForgeDirection direction : outputDirections)
{
TileEntity tileAdj = thisVec.getTileEntityOnSide(this.worldObj, direction);
if (tileAdj != null)
{
float toSend = this.extractEnergyGC(null, Math.min(this.getEnergyStoredGC() - amountProduced, this.getEnergyStoredGC() / outputDirections.size()), true);
if (toSend <= 0)
{
continue;
}
if (tileAdj instanceof TileBaseConductor)
{
IElectricityNetwork network = ((IConductor) tileAdj).getNetwork();
if (network != null)
{
amountProduced += (toSend - network.produce(toSend, !simulate, this.tierGC, this));
}
}
else if (tileAdj instanceof TileBaseUniversalElectrical)
{
amountProduced += ((TileBaseUniversalElectrical) tileAdj).receiveElectricity(direction.getOpposite(), toSend, this.tierGC, !simulate);
}
else
{
amountProduced += EnergyUtil.otherModsEnergyTransfer(tileAdj, direction.getOpposite(), toSend, simulate);
}
}
}
}
return amountProduced;
}