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;
|
package buildcraft.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
@ -23,11 +24,11 @@ import net.minecraft.util.MovingObjectPosition;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
|
import buildcraft.BuildCraftFactory;
|
||||||
import buildcraft.core.CoreConstants;
|
import buildcraft.core.CoreConstants;
|
||||||
import buildcraft.core.IFramePipeConnection;
|
import buildcraft.core.IFramePipeConnection;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
|
@ -39,6 +40,19 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
||||||
setHardness(0.5F);
|
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
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -54,6 +68,11 @@ public class BlockFrame extends Block implements IFramePipeConnection {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
|
return new ArrayList<ItemStack>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return BuildCraftCore.legacyPipeModel;
|
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
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
if (BuildCraftFactory.quarryOneTimeUse) {
|
if (BuildCraftFactory.quarryOneTimeUse) {
|
||||||
|
@ -147,45 +141,14 @@ public class BlockQuarry extends BlockBuildCraft {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (world.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tile = world.getTileEntity(i, j, k);
|
BuildCraftFactory.frameBlock.breakBlock(world, i, j, k, block, metadata);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Z - Axis
|
super.breakBlock(world, i, j, k, block, metadata);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue