diff --git a/src/cr0s/WarpDrive/GravityManager.java b/src/cr0s/WarpDrive/GravityManager.java index 840a119d..37545adb 100644 --- a/src/cr0s/WarpDrive/GravityManager.java +++ b/src/cr0s/WarpDrive/GravityManager.java @@ -20,8 +20,6 @@ public class GravityManager if (inSpace) { boolean insideGravField = isEntityInGraviField(entity); - if(entity instanceof EntityPlayer) - ((EntityPlayer)entity).addChatMessage("Grav:" + (insideGravField?"YES":"NO")); if (insideGravField) { diff --git a/src/cr0s/WarpDrive/JumpGatesRegistry.java b/src/cr0s/WarpDrive/JumpGatesRegistry.java index bec8d6ae..02bf37ac 100644 --- a/src/cr0s/WarpDrive/JumpGatesRegistry.java +++ b/src/cr0s/WarpDrive/JumpGatesRegistry.java @@ -137,6 +137,16 @@ public final class JumpGatesRegistry return result; } + + public String commaList() + { + String result = ""; + for (JumpGate jg : gates) + { + result += jg.toNiceString() + ","; + } + return result; + } public JumpGate findNearestGate(int x, int y, int z) { diff --git a/src/cr0s/WarpDrive/JumpgateCommand.java b/src/cr0s/WarpDrive/JumpgateCommand.java new file mode 100644 index 00000000..741769d3 --- /dev/null +++ b/src/cr0s/WarpDrive/JumpgateCommand.java @@ -0,0 +1,33 @@ +package cr0s.WarpDrive; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayerMP; + +public class JumpgateCommand extends CommandBase +{ + @Override + public int getRequiredPermissionLevel() + { + return 4; + } + + @Override + public String getCommandName() + { + return "listjg"; + } + + @Override + public String getCommandUsage(ICommandSender icommandsender) + { + return "Lists jumpgates"; + } + + @Override + public void processCommand(ICommandSender icommandsender, String[] astring) + { + EntityPlayerMP player = (EntityPlayerMP)icommandsender; + player.addChatMessage(WarpDrive.instance.jumpGates.commaList()); + } +} diff --git a/src/cr0s/WarpDrive/TileEntityMiningLaser.java b/src/cr0s/WarpDrive/TileEntityMiningLaser.java index 1d6a7d01..6f7e27f7 100644 --- a/src/cr0s/WarpDrive/TileEntityMiningLaser.java +++ b/src/cr0s/WarpDrive/TileEntityMiningLaser.java @@ -31,6 +31,7 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.oredict.OreDictionary; import appeng.api.WorldCoord; import appeng.api.IAEItemStack; import appeng.api.Util; @@ -49,10 +50,14 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG private final int MAX_BOOSTERS_NUMBER = 1; + private int digX,digZ = 10; + private final int CUBE_SIDE = 8; + private int dx, dz, dy; private boolean isMining = false; private boolean isQuarry = false; - private boolean useDeiterium = false; + + private boolean silkTouch = false; public void setNetworkReady( boolean isReady ) { @@ -154,10 +159,12 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG // Skip if block is too hard or its empty block if (!canDig(blockID)) return; - - sendLaserPacket(minerVector, new Vector3(valuable.intX(), valuable.intY(), valuable.intZ()).add(0.5), 1, 1, 0, 2 * WarpDriveConfig.i.ML_MINE_DELAY, 0, 50); - worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:lowlaser", 4F, 1F); - harvestBlock(valuable); + if(WarpDriveConfig.i.MinerOres.contains(blockID)) + { + sendLaserPacket(minerVector, new Vector3(valuable.intX(), valuable.intY(), valuable.intZ()).add(0.5), 1, 1, 0, 2 * WarpDriveConfig.i.ML_MINE_DELAY, 0, 50); + worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:lowlaser", 4F, 1F); + harvestBlock(valuable); + } } else { @@ -247,17 +254,13 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG Block block = Block.blocksList[blockID]; if (block == null) return null; - if (useDeiterium && grid != null) + if (silkTouch && grid != null) { 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) + if (block.canSilkHarvest(worldObj, null, i, j, k, blockMeta)) { - cellArray.extractItems(entryToAEIS); ArrayList t = new ArrayList(); t.add(new ItemStack(blockID, 1, blockMeta)); return t; @@ -354,9 +357,8 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG valuablesInLayer.clear(); int xmax, zmax, x1, x2, z1, z2; int xmin, zmin; - final int CUBE_SIDE = 8; - x1 = xCoord + CUBE_SIDE / 2; - x2 = xCoord - CUBE_SIDE / 2; + x1 = xCoord + digX / 2; + x2 = xCoord - digX / 2; if (x1 < x2) { @@ -369,8 +371,8 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG xmax = x1; } - z1 = zCoord + CUBE_SIDE / 2; - z2 = zCoord - CUBE_SIDE / 2; + z1 = zCoord + digZ / 2; + z2 = zCoord - digZ / 2; if (z1 < z2) { @@ -386,6 +388,8 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG //System.out.println("Layer: xmax: " + xmax + ", xmin: " + xmin); //System.out.println("Layer: zmax: " + zmax + ", zmin: " + zmin); + + // Search for valuable blocks for (int x = xmin; x <= xmax; x++) for (int z = zmin; z <= zmax; z++) @@ -528,7 +532,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"); + silkTouch = tag.getBoolean("silkTouch"); minerVector = new Vector3(xCoord, yCoord - 1, zCoord).add(0.5); } @@ -539,7 +543,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); + tag.setBoolean("silkTouch", silkTouch); } //CC // IPeripheral methods implementation @@ -569,7 +573,22 @@ 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")); + silkTouch = false; + digX = CUBE_SIDE; + digZ = CUBE_SIDE; + if(arguments.length == 1) + { + if(arguments[0].toString().equals("1")) + silkTouch = true; + + } + else if(arguments.length >= 2) + { + digX = (int) Math.round(Double.parseDouble(arguments[0].toString())); + digZ = (int) Math.round(Double.parseDouble(arguments[1].toString())); + if(arguments.length >= 3) + silkTouch = Double.parseDouble(arguments[2].toString()) == 1; + } return new Boolean[] { true }; case 1: // stop() @@ -588,7 +607,13 @@ 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")); + silkTouch = false; + if(arguments.length == 1) + { + if(Double.parseDouble(arguments[0].toString()) == 1) + silkTouch = true; + + } return new Boolean[] { true }; case 4: // State is: state, energy, currentLayer, valuablesMined, valuablesInLayer = getMinerState() diff --git a/src/cr0s/WarpDrive/WarpDrive.java b/src/cr0s/WarpDrive/WarpDrive.java index 5c2e3335..141907c2 100644 --- a/src/cr0s/WarpDrive/WarpDrive.java +++ b/src/cr0s/WarpDrive/WarpDrive.java @@ -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.2.0", dependencies = "required-after:IC2; required-after:ComputerCraft; after:CCTurtle; after:gregtech_addon; required-after:AppliedEnergistics; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite") +@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.2.1", dependencies = "required-after:IC2; required-after:ComputerCraft; after:CCTurtle; after:gregtech_addon; required-after:AppliedEnergistics; after:AdvancedSolarPanel; after:AtomicScience; after:ICBM|Explosion; after:MFFS; after:GraviSuite") @NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = { "WarpDriveBeam", "WarpDriveFreq", @@ -435,6 +435,7 @@ public class WarpDrive implements LoadingCallback { event.registerServerCommand(new GenerateCommand()); event.registerServerCommand(new SpaceTpCommand()); event.registerServerCommand(new InvisibleCommand()); + event.registerServerCommand(new JumpgateCommand()); } @Override diff --git a/src/cr0s/WarpDrive/WarpDriveConfig.java b/src/cr0s/WarpDrive/WarpDriveConfig.java index efba8838..0b4d096a 100644 --- a/src/cr0s/WarpDrive/WarpDriveConfig.java +++ b/src/cr0s/WarpDrive/WarpDriveConfig.java @@ -10,6 +10,7 @@ import java.lang.reflect.*; import cpw.mods.fml.common.Loader; import net.minecraftforge.common.Configuration; +import net.minecraftforge.oredict.OreDictionary; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -273,14 +274,28 @@ public class WarpDriveConfig MinerOres.add(Block.oreNetherQuartz.blockID); for (int[] t : CommonWorldGenOres) MinerOres.add(t[0]); - MinerOres.add(Block.wood.blockID); - MinerOres.add(Block.planks.blockID); - MinerOres.add(Block.rail.blockID); + //MinerOres.add(Block.wood.blockID); + //MinerOres.add(Block.planks.blockID); + //MinerOres.add(Block.rail.blockID); MinerOres.add(Block.oreDiamond.blockID); MinerOres.add(Block.obsidian.blockID); MinerOres.add(Block.web.blockID); MinerOres.add(Block.fence.blockID); - MinerOres.add(Block.torchWood.blockID); + //MinerOres.add(Block.torchWood.blockID); + + String[] oreNames = OreDictionary.getOreNames(); + for(String oreName: oreNames) + { + if(oreName.substring(0,3).equals("ore")) + { + ArrayList item = OreDictionary.getOres(oreName); + for(ItemStack i: item) + { + MinerOres.add(i.itemID); + WarpDrive.debugPrint("WD: Added ore ID: "+i.itemID); + } + } + } // Ignore WarpDrive blocks (which potentially will be duplicated by cheaters using ship scan/deploy) scannerIgnoreBlocks.add(coreID); @@ -344,7 +359,7 @@ public class WarpDriveConfig GT_Ores = t[2]; // meta 1-15 = ores GT_Granite = t[5]; // 0 - black, 1 - black cobble, 8 - red, 9 - red cobble MinerOres.add(GT_Ores); - MinerOres.add(GT_Granite); + //MinerOres.add(GT_Granite); } catch (Exception e) {