Miner fix + silktouch
This commit is contained in:
parent
6f89b72702
commit
16c4c993a1
3 changed files with 48 additions and 6 deletions
src/cr0s/WarpDrive
|
@ -30,6 +30,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import appeng.api.WorldCoord;
|
||||
import appeng.api.IAEItemStack;
|
||||
import appeng.api.Util;
|
||||
|
@ -51,6 +52,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
private int dx, dz, dy;
|
||||
private boolean isMining = false;
|
||||
private boolean isQuarry = false;
|
||||
private boolean useDeiterium = false;
|
||||
|
||||
private String[] methodsArray =
|
||||
{
|
||||
|
@ -121,10 +123,8 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:hilaser", 4F, 1F);
|
||||
int blockID = worldObj.getBlockId(xCoord, currentLayer, zCoord);
|
||||
if (blockID != 0)
|
||||
if (worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) != Material.water && canDig(blockID))
|
||||
if (canDig(blockID))
|
||||
harvestBlock(new Vector3(xCoord, currentLayer, zCoord));
|
||||
else
|
||||
isMining = false;
|
||||
currentMode = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
int blockID = worldObj.getBlockId(valuable.intX(), valuable.intY(), valuable.intZ());
|
||||
|
||||
// Skip if block is too hard or its empty block
|
||||
if (worldObj.getBlockMaterial(xCoord, currentLayer, zCoord) == Material.water || !canDig(blockID))
|
||||
if (!canDig(blockID))
|
||||
return;
|
||||
|
||||
sendLaserPacket(minerVector, new Vector3(valuable.intX(), valuable.intY(), valuable.intZ()).add(0.5), 1, 1, 0, 2 * MINE_DELAY, 0, 50);
|
||||
|
@ -244,6 +244,23 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
Block block = Block.blocksList[blockID];
|
||||
if (block == null)
|
||||
return null;
|
||||
if (useDeiterium)
|
||||
{
|
||||
IMEInventoryHandler cellArray = grid.getCellArray();
|
||||
if (cellArray != null)
|
||||
{
|
||||
int consume = isQuarry?15:1000;
|
||||
IAEItemStack entryToAEIS = Util.createItemStack(new ItemStack(WarpDriveConfig.i.AEExtraFDI, consume, FluidRegistry.getFluidID("deuterium")));
|
||||
long contained = cellArray.countOfItemType(entryToAEIS);
|
||||
if (block.canSilkHarvest(worldObj, null, i, j, k, blockMeta) && contained >= consume)
|
||||
{
|
||||
cellArray.extractItems(entryToAEIS);
|
||||
ArrayList<ItemStack> t = new ArrayList<ItemStack>();
|
||||
t.add(new ItemStack(blockID, 1, blockMeta));
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
return block.getBlockDropped(worldObj, i, j, k, blockMeta, 0);
|
||||
}
|
||||
|
||||
|
@ -508,6 +525,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
isMining = tag.getBoolean("isMining");
|
||||
isQuarry = tag.getBoolean("isQuarry");
|
||||
currentLayer = tag.getInteger("currentLayer");
|
||||
useDeiterium = tag.getBoolean("useDeiterium");
|
||||
minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5);
|
||||
}
|
||||
|
||||
|
@ -518,6 +536,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
tag.setBoolean("isMining", isMining);
|
||||
tag.setBoolean("isQuarry", isQuarry);
|
||||
tag.setInteger("currentLayer", currentLayer);
|
||||
tag.setBoolean("useDeiterium", useDeiterium);
|
||||
}
|
||||
//CC
|
||||
// IPeripheral methods implementation
|
||||
|
@ -547,6 +566,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5);
|
||||
currentLayer = yCoord - layerOffset;
|
||||
isMining = true;
|
||||
useDeiterium = (arguments.length == 1 && FluidRegistry.isFluidRegistered("deuterium"));
|
||||
return new Boolean[] { true };
|
||||
|
||||
case 1: // stop()
|
||||
|
@ -565,6 +585,7 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG
|
|||
minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5);
|
||||
currentLayer = yCoord - layerOffset;
|
||||
isMining = true;
|
||||
useDeiterium = (arguments.length == 1 && FluidRegistry.isFluidRegistered("deuterium"));
|
||||
return new Boolean[] { true };
|
||||
|
||||
case 4: // State is: state, energy, currentLayer, valuablesMined, valuablesInLayer = getMinerState()
|
||||
|
|
|
@ -34,7 +34,7 @@ import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
|||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.1.5_ZLO", dependencies="required-after:IC2; required-after:ComputerCraft; after:CCTurtle; after:gregtech_addon; after:AppliedEnergistics; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite")
|
||||
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.1.5_ZLO", dependencies="required-after:IC2; after:required-AppliedEnergistics; after:extracells; required-after:ComputerCraft; after:CCTurtle; after:gregtech_addon; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite")
|
||||
@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {"WarpDriveBeam", "WarpDriveFreq", "WarpDriveLaserT"}, packetHandler = PacketHandler.class)
|
||||
/**
|
||||
* @author Cr0s
|
||||
|
|
|
@ -21,7 +21,7 @@ public class WarpDriveConfig
|
|||
private Configuration config;
|
||||
public int coreID, controllerID, radarID, isolationID, airID, airgenID, gasID, laserID, miningLaserID, particleBoosterID, liftID, laserCamID, camID, monitorID, iridiumID;
|
||||
//
|
||||
public boolean isGregLoaded = false, isAELoaded = false, isAdvSolPanelLoaded = false, isASLoaded = false, isICBMLoaded = false, isMFFSLoaded = false, isGraviSuiteLoaded = false;
|
||||
public boolean isGregLoaded = false, isAELoaded = false, isAEExtraLoaded = false, isAdvSolPanelLoaded = false, isASLoaded = false, isICBMLoaded = false, isMFFSLoaded = false, isGraviSuiteLoaded = false;
|
||||
//
|
||||
public int[] IC2_Air;
|
||||
public int CC_Computer = 0, CC_peripheral = 0, CCT_Turtle = 0, CCT_Upgraded = 0, CCT_Advanced = 0, GT_Ores = 0, GT_Granite = 0, GT_Machine = 0, ASP = 0, AS_Turbine = 0, ICBM_Machine = 0, ICBM_Missile = 0, MFFS_Field = 0;
|
||||
|
@ -30,6 +30,7 @@ public class WarpDriveConfig
|
|||
private Class<?> AEBlocks;
|
||||
private Class<?> AEMaterials;
|
||||
private Class<?> AEItems;
|
||||
public Item AEExtraFDI;
|
||||
public ArrayList<int[]> CommonWorldGenOres;
|
||||
|
||||
private WarpDriveConfig() {}
|
||||
|
@ -130,6 +131,9 @@ public class WarpDriveConfig
|
|||
isAELoaded = Loader.isModLoaded("AppliedEnergistics");
|
||||
if (isAELoaded)
|
||||
LoadAE();
|
||||
isAEExtraLoaded = Loader.isModLoaded("extracells");
|
||||
if (isAEExtraLoaded)
|
||||
LoadAEExtra();
|
||||
isAdvSolPanelLoaded = Loader.isModLoaded("AdvancedSolarPanel");
|
||||
if (isAdvSolPanelLoaded)
|
||||
LoadASP();
|
||||
|
@ -173,6 +177,7 @@ public class WarpDriveConfig
|
|||
CommonWorldGenOres.add(new int[] {Items.getItem("tinOre").itemID, Items.getItem("uraniumOre").getItemDamage()});
|
||||
MinerOres.add(Items.getItem("rubberWood").itemID);
|
||||
Compot = Items.getItem("advancedAlloy");
|
||||
AEExtraFDI = Items.getItem("FluidCell").getItem();
|
||||
}
|
||||
|
||||
private void LoadCC()
|
||||
|
@ -238,6 +243,22 @@ public class WarpDriveConfig
|
|||
}
|
||||
}
|
||||
|
||||
private void LoadAEExtra()
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<?> z = Class.forName("extracells.ItemEnum");
|
||||
Object z1 = z.getEnumConstants()[6];
|
||||
AEExtraFDI = (Item)z1.getClass().getDeclaredMethod("getItemEntry").invoke(z1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("WarpDriveConfig Error loading AEExtra classes");
|
||||
e.printStackTrace();
|
||||
isAEExtraLoaded = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadASP()
|
||||
{
|
||||
try
|
||||
|
|
Loading…
Add table
Reference in a new issue