add buildcraft quarry frame cleanup, close #2005
This commit is contained in:
parent
46432d2579
commit
fd6a456434
2 changed files with 24 additions and 42 deletions
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
package buildcraft.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -23,11 +24,11 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.BuildCraftFactory;
|
||||
import buildcraft.core.CoreConstants;
|
||||
import buildcraft.core.IFramePipeConnection;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
@ -39,6 +40,19 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
|||
setHardness(0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int meta) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||
Block nBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
if (nBlock == this) {
|
||||
world.setBlockToAir(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
|
@ -54,6 +68,11 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
return new ArrayList<ItemStack>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return BuildCraftCore.legacyPipeModel;
|
||||
|
|
|
@ -132,12 +132,6 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
}
|
||||
}
|
||||
|
||||
private void markFrameForDecay(World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z) == BuildCraftFactory.frameBlock) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
if (BuildCraftFactory.quarryOneTimeUse) {
|
||||
|
@ -147,45 +141,14 @@ public class BlockQuarry extends BlockBuildCraft {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
|
||||
public void breakBlock(World world, int i, int j, int k, Block block, int metadata) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(i, j, k);
|
||||
if (tile instanceof TileQuarry) {
|
||||
TileQuarry quarry = (TileQuarry) tile;
|
||||
Box box = quarry.box;
|
||||
if (box.isInitialized() && Integer.MAX_VALUE != box.xMax) {
|
||||
// X - Axis
|
||||
for (int x = box.xMin; x <= box.xMax; x++) {
|
||||
markFrameForDecay(world, x, box.yMin, box.zMin);
|
||||
markFrameForDecay(world, x, box.yMax, box.zMin);
|
||||
markFrameForDecay(world, x, box.yMin, box.zMax);
|
||||
markFrameForDecay(world, x, box.yMax, box.zMax);
|
||||
}
|
||||
BuildCraftFactory.frameBlock.breakBlock(world, i, j, k, block, metadata);
|
||||
|
||||
// Z - Axis
|
||||
for (int z = box.zMin + 1; z <= box.zMax - 1; z++) {
|
||||
markFrameForDecay(world, box.xMin, box.yMin, z);
|
||||
markFrameForDecay(world, box.xMax, box.yMin, z);
|
||||
markFrameForDecay(world, box.xMin, box.yMax, z);
|
||||
markFrameForDecay(world, box.xMax, box.yMax, z);
|
||||
}
|
||||
|
||||
// Y - Axis
|
||||
for (int y = box.yMin + 1; y <= box.yMax - 1; y++) {
|
||||
|
||||
markFrameForDecay(world, box.xMin, y, box.zMin);
|
||||
markFrameForDecay(world, box.xMax, y, box.zMin);
|
||||
markFrameForDecay(world, box.xMin, y, box.zMax);
|
||||
markFrameForDecay(world, box.xMax, y, box.zMax);
|
||||
}
|
||||
}
|
||||
quarry.destroy();
|
||||
}
|
||||
|
||||
super.breakBlock(world, i, j, k, block, par6);
|
||||
super.breakBlock(world, i, j, k, block, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue