Fixed miner issues

This commit is contained in:
Aidan Brady 2013-12-14 23:45:51 -05:00
parent 0414b0af99
commit f6043b6a62
2 changed files with 14 additions and 3 deletions

View file

@ -3,13 +3,12 @@ package mekanism.common.multipart;
import java.util.Arrays; import java.util.Arrays;
import java.util.Set; import java.util.Set;
import mekanism.api.Object3D;
import mekanism.api.transmitters.ITransmitter; import mekanism.api.transmitters.ITransmitter;
import mekanism.api.transmitters.TransmissionType; import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.PartTransmitterIcons; import mekanism.client.render.PartTransmitterIcons;
import mekanism.client.render.RenderPartTransmitter; import mekanism.client.render.RenderPartTransmitter;
import mekanism.common.FluidNetwork; import mekanism.common.FluidNetwork;
import mekanism.common.PipeUtils; import mekanism.common.util.PipeUtils;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;

View file

@ -32,6 +32,7 @@ import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MinerUtils; import mekanism.common.util.MinerUtils;
import mekanism.common.util.TransporterUtils; import mekanism.common.util.TransporterUtils;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -144,6 +145,11 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
for(Object3D obj : oresToMine) for(Object3D obj : oresToMine)
{ {
if(!obj.exists(worldObj))
{
continue;
}
int id = obj.getBlockId(worldObj); int id = obj.getBlockId(worldObj);
int meta = obj.getMetadata(worldObj); int meta = obj.getMetadata(worldObj);
@ -255,12 +261,18 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
} }
public void setReplace(Object3D obj) public void setReplace(Object3D obj)
{ {
ItemStack stack = getReplace(); ItemStack stack = getReplace();
if(stack != null) if(stack != null)
{ {
worldObj.setBlock(obj.xCoord, obj.yCoord, obj.zCoord, replaceStack.itemID, replaceStack.getItemDamage(), 3); worldObj.setBlock(obj.xCoord, obj.yCoord, obj.zCoord, replaceStack.itemID, replaceStack.getItemDamage(), 3);
if(Block.blocksList[obj.getBlockId(worldObj)] != null && !Block.blocksList[obj.getBlockId(worldObj)].canBlockStay(worldObj, obj.xCoord, obj.yCoord, obj.zCoord))
{
Block.blocksList[obj.getBlockId(worldObj)].dropBlockAsItem(worldObj, obj.xCoord, obj.yCoord, obj.zCoord, obj.getMetadata(worldObj), 1);
worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord);
}
} }
else { else {
worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord); worldObj.setBlockToAir(obj.xCoord, obj.yCoord, obj.zCoord);