use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class HarvestAreaManager method getNextBlock.
public BlockPosition getNextBlock() {
checkRecalculate();
BlockPosition next = _harvestedBlocks.get(_currentBlock);
_currentBlock++;
if (_currentBlock >= _harvestedBlocks.size()) {
_currentBlock = 0;
}
return next;
}
use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class MFRUtil method directionsWithoutConveyors.
public static ForgeDirection[] directionsWithoutConveyors(World world, int x, int y, int z) {
ArrayList<ForgeDirection> nonConveyors = new ArrayList<ForgeDirection>();
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
BlockPosition bp = new BlockPosition(x, y, z);
bp.orientation = direction;
bp.moveForwards(1);
TileEntity te = world.getBlockTileEntity(bp.x, bp.y, bp.z);
if (te == null || !(te instanceof TileEntityConveyor)) {
nonConveyors.add(direction);
}
}
return nonConveyors.toArray(new ForgeDirection[nonConveyors.size()]);
}
use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class ItemNeedlegunAmmoBlock method onHitBlock.
@Override
public void onHitBlock(EntityPlayer owner, World world, int x, int y, int z, int side, double distance) {
BlockPosition bp = new BlockPosition(x, y, z, ForgeDirection.getOrientation(side));
bp.moveForwards(1);
placeBlockAt(world, bp.x, bp.y, bp.z);
}
use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class TileEntitySludgeBoiler method activateMachine.
@Override
protected boolean activateMachine() {
if (_tank.getLiquid() != null && _tank.getLiquid().amount > 10) {
_tank.drain(10, true);
setWorkDone(getWorkDone() + 1);
_tick++;
if (getWorkDone() >= getWorkMax()) {
ItemStack s = ((WeightedRandomItemStack) WeightedRandom.getRandomItem(_rand, MFRRegistry.getSludgeDrops())).getStack();
doDrop(s);
setWorkDone(0);
}
if (_tick >= 23) {
Area a = new Area(new BlockPosition(this), 3, 3, 3);
List<?> entities = worldObj.getEntitiesWithinAABB(EntityLiving.class, a.toAxisAlignedBB());
for (Object o : entities) {
if (o instanceof EntityPlayer) {
((EntityPlayer) o).addPotionEffect(new PotionEffect(Potion.hunger.id, 20 * 20, 0));
}
if (o instanceof EntityPlayer) {
((EntityPlayer) o).addPotionEffect(new PotionEffect(Potion.poison.id, 6 * 20, 0));
}
}
_tick = 0;
}
return true;
}
return false;
}
use of powercrystals.core.position.BlockPosition in project MineFactoryReloaded by powercrystals.
the class RedstoneNetwork method notifyNodes.
private void notifyNodes(int subnet) {
if (_ignoreUpdates) {
RedstoneNetwork.log("Network asked to notify nodes while ignoring updates (API misuse?)!");
_mustUpdate = true;
return;
}
_ignoreUpdates = true;
RedstoneNetwork.log("Network with ID %d:%d notifying %d single nodes and %d omni nodes", _id, subnet, _singleNodes.get(subnet).size(), _omniNodes.size());
for (int i = 0; i < _singleNodes.get(subnet).size(); i++) {
BlockPosition bp = _singleNodes.get(subnet).get(i);
RedstoneNetwork.log("Network with ID %d:%d notifying node %s of power state change to %d", _id, subnet, bp.toString(), _powerLevelOutput[subnet]);
notifySingleNode(bp, subnet);
}
for (int i = 0; i < _omniNodes.size(); i++) {
BlockPosition bp = _omniNodes.get(i);
RedstoneNetwork.log("Network with ID %d:%d notifying omni node %s of power state change to %d", _id, subnet, bp.toString(), _powerLevelOutput[subnet]);
notifyOmniNode(bp);
}
_ignoreUpdates = false;
}
Aggregations