Start work on bounding blocks
This commit is contained in:
parent
890de9446b
commit
44ca9d1067
4 changed files with 13 additions and 18 deletions
|
@ -156,9 +156,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
|
|||
@Override
|
||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
|
||||
{
|
||||
boolean place = super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata);
|
||||
boolean place = true;
|
||||
|
||||
if(place)
|
||||
if(stack.getItemDamage() == MachineType.DIGITAL_MINER.meta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(place && super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
|
||||
{
|
||||
TileEntityElectricBlock tileEntity = (TileEntityElectricBlock)world.getBlockTileEntity(x, y, z);
|
||||
|
||||
|
@ -206,9 +211,11 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, IItem
|
|||
((ISustainedInventory)tileEntity).setInventory(getInventory(stack));
|
||||
|
||||
tileEntity.electricityStored = getEnergy(stack);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return place;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,14 +102,14 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
{
|
||||
ChargeUtils.discharge(27, this);
|
||||
|
||||
if(running && getEnergy() >= MekanismUtils.getEnergy(getSpeedMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||
if(running && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE) && searcher.state == State.FINISHED && oresToMine.size() > 0)
|
||||
{
|
||||
if(delay > 0)
|
||||
{
|
||||
delay--;
|
||||
}
|
||||
|
||||
setEnergy(getEnergy()-MekanismUtils.getEnergy(getSpeedMultiplier(), ENERGY_USAGE));
|
||||
setEnergy(getEnergy()-MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_USAGE));
|
||||
|
||||
if(delay == 0)
|
||||
{
|
||||
|
|
|
@ -557,18 +557,6 @@ public final class MekanismUtils
|
|||
return (int)(def * Math.pow(10, (-speedUpgrade/9.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the energy required per tick for a machine via it's upgrades.
|
||||
* @param speedUpgrade - number of speed upgrades
|
||||
* @param energyUpgrade - number of energy upgrades
|
||||
* @param def - the original, default energy required
|
||||
* @return max energy per tick
|
||||
*/
|
||||
public static int getEnergyPerTick(int speedUpgrade, int energyUpgrade, int def)
|
||||
{
|
||||
return (int)(def * Math.pow(10, ((speedUpgrade-energyUpgrade)/9.0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the energy required per tick for a machine via it's upgrades.
|
||||
* @param speedUpgrade - number of speed upgrades
|
||||
|
|
|
@ -112,7 +112,7 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt
|
|||
|
||||
if(stack.getItemDamage() == GeneratorType.ADVANCED_SOLAR_GENERATOR.meta)
|
||||
{
|
||||
if(world.getBlockId(x, y, z) != Block.tallGrass.blockID && world.getBlockId(x, y, z) != 0)
|
||||
if(!Block.blocksList[world.getBlockId(x, y, z)].isBlockReplaceable(world, x, y, z) && world.getBlockId(x, y, z) != 0)
|
||||
place = false;
|
||||
|
||||
if(world.getBlockId(x, y, z) != 0)
|
||||
|
|
Loading…
Reference in a new issue