diff --git a/src/cr0s/WarpDrive/SpaceEventHandler.java b/src/cr0s/WarpDrive/SpaceEventHandler.java index 9cae95a8..a9bb8a11 100644 --- a/src/cr0s/WarpDrive/SpaceEventHandler.java +++ b/src/cr0s/WarpDrive/SpaceEventHandler.java @@ -49,18 +49,7 @@ public class SpaceEventHandler { int x = MathHelper.floor_double(entity.posX); int y = MathHelper.floor_double(entity.posY); int z = MathHelper.floor_double(entity.posZ); - - // Instant kill if entity exceeds world's limit - if (x > WarpDrive.WORLD_LIMIT_BLOCKS || z > WarpDrive.WORLD_LIMIT_BLOCKS) { - if (entity instanceof EntityPlayerMP) { - if (((EntityPlayerMP)entity).capabilities.isCreativeMode) { - return; - } - } - entity.attackEntityFrom(DamageSource.outOfWorld, 9000); - return; - } if (entity instanceof EntityPlayerMP) { updatePlayerCloakState(entity); diff --git a/src/cr0s/WarpDrive/WarpDrive.java b/src/cr0s/WarpDrive/WarpDrive.java index 7b5cdaff..a6fc3370 100644 --- a/src/cr0s/WarpDrive/WarpDrive.java +++ b/src/cr0s/WarpDrive/WarpDrive.java @@ -61,8 +61,6 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; * @author Cr0s */ public class WarpDrive implements LoadingCallback { - // World limits - public final static int WORLD_LIMIT_BLOCKS = 100000; public static Block warpCore; public static Block protocolBlock; diff --git a/src/cr0s/WarpDrive/WarpDriveConfig.java b/src/cr0s/WarpDrive/WarpDriveConfig.java index 80dd81cd..806fa3b4 100644 --- a/src/cr0s/WarpDrive/WarpDriveConfig.java +++ b/src/cr0s/WarpDrive/WarpDriveConfig.java @@ -454,6 +454,8 @@ public class WarpDriveConfig loadAdvancedRepulsionSystems(); } // + MinerOres.add(iridiumBlockID); + MinerOres.add(Block.oreCoal.blockID); MinerOres.add(Block.oreNetherQuartz.blockID); MinerOres.add(Block.obsidian.blockID); MinerOres.add(Block.web.blockID); diff --git a/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java b/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java index 80ee8f2a..a0603ac4 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java +++ b/src/cr0s/WarpDrive/machines/TileEntityMiningLaser.java @@ -298,48 +298,13 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral, IG Block block = Block.blocksList[blockID]; if (block == null) return null; - if (useDeiterium && grid != null && AENetworkReady) + if (useDeiterium && grid != null) { IMEInventoryHandler cellArray = grid.getCellArray(); if (cellArray != null && block.canSilkHarvest(worldObj, null, i, j, k, blockMeta)) { - int consume = isQuarry ? 15 : 1000; - - IAEItemStack entryToAEIS1 = null; - long contained1 = 0; - if (WarpDriveConfig.AEExtra_fluidDrive != null) { - entryToAEIS1 = Util.createItemStack(new ItemStack(WarpDriveConfig.AEExtra_fluidDrive, consume, FluidRegistry.getFluidID("deuterium"))); - contained1 = cellArray.countOfItemType(entryToAEIS1); - } - IAEItemStack entryToAEIS2 = null; - long contained2 = 0; - if (WarpDriveConfig.IC2_fluidCell != null) { - entryToAEIS2 = Util.createItemStack(new ItemStack(WarpDriveConfig.IC2_fluidCell, consume, FluidRegistry.getFluidID("deuterium"))); - contained2 = cellArray.countOfItemType(entryToAEIS2); - } - IAEItemStack entryToAEIS3 = null; - long contained3 = 0; - if (WarpDriveConfig.AS_deuteriumCell != 0) { - entryToAEIS3 = Util.createItemStack(new ItemStack(WarpDriveConfig.AS_deuteriumCell, consume, FluidRegistry.getFluidID("deuterium"))); - contained3 = cellArray.countOfItemType(entryToAEIS3); - } - - if (contained1 + contained2 + contained3 >= consume) { - if (contained1 > 0) { - cellArray.extractItems(entryToAEIS1); - } - if (contained2 > 0 && contained1 < consume) { - entryToAEIS2 = Util.createItemStack(new ItemStack(WarpDriveConfig.IC2_fluidCell, (int)(consume - contained2), FluidRegistry.getFluidID("deuterium"))); - cellArray.extractItems(entryToAEIS2); - } - if (contained3 > 0 && contained1 + contained2 < consume) { - entryToAEIS3 = Util.createItemStack(new ItemStack(WarpDriveConfig.AS_deuteriumCell, (int)(consume - contained1 - contained2), FluidRegistry.getFluidID("deuterium"))); - cellArray.extractItems(entryToAEIS3); - } - - ArrayList t = new ArrayList(); - t.add(new ItemStack(blockID, 1, blockMeta)); - return t; - } + ArrayList t = new ArrayList(); + t.add(new ItemStack(blockID, 1, blockMeta)); + return t; } } return block.getBlockDropped(worldObj, i, j, k, blockMeta, 0); diff --git a/src/cr0s/WarpDrive/machines/TileEntityProtocol.java b/src/cr0s/WarpDrive/machines/TileEntityProtocol.java index 9744a4f8..e26d9e82 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityProtocol.java +++ b/src/cr0s/WarpDrive/machines/TileEntityProtocol.java @@ -53,7 +53,7 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral "set_beacon_frequency", "get_dx", "get_dz", // 16, 17, 18 "set_core_frequency", "is_in_space", "is_in_hyperspace", // 19, 20, 21 "set_target_jumpgate", // 22 - "isAttached" // 23 + "isAttached","get_energy_required" // 23, 24 }; private int ticks = 0; @@ -353,7 +353,7 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral @Override public void attach(IComputerAccess computer) { computer.mount("/warpcontroller", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/warpcontroller")); - computer.mount("/startup", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/warpcontroller/startup")); + computer.mount("/mcwarpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/warpcontroller/mcwarpupdater")); } @Override @@ -635,6 +635,19 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral return new Object[] { (boolean)(core.controller != null) }; } break; + case 24: //get_energy_required(distance) + if (arguments.length != 1) { + return new Integer[] { -1 }; + } + try { + argInt0 = ((Double)arguments[0]).intValue(); + } catch(Exception e) { + return new Integer[] { -1 }; + } + if (core != null) { + return new Object[] { (int)(core.calculateRequiredEnergy(core.getMode(), core.shipVolume, argInt0)) }; + } + break; } return new Integer[] { 0 }; diff --git a/src/cr0s/WarpDrive/machines/TileEntityReactor.java b/src/cr0s/WarpDrive/machines/TileEntityReactor.java index fb9b01ef..c804fc2c 100644 --- a/src/cr0s/WarpDrive/machines/TileEntityReactor.java +++ b/src/cr0s/WarpDrive/machines/TileEntityReactor.java @@ -36,7 +36,7 @@ public class TileEntityReactor extends WarpEnergyTE public final int JUMP_DOWN = -2; int dx, dz; int direction; - int distance; + public int distance; public int maxX, maxY, maxZ; public int minX, minY, minZ; @@ -279,6 +279,10 @@ public class TileEntityReactor extends WarpEnergyTE } } + public int getMode() { + return currentMode; + } + public void messageToAllPlayersOnShip(String msg) { AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(this.minX, this.minY, this.minZ, this.maxX + 0.99D, this.maxY + 0.99D, this.maxZ + 0.99D); List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb); @@ -938,7 +942,7 @@ public class TileEntityReactor extends WarpEnergyTE return getBlockType().getLocalizedName() + " '" + coreFrequency + "' energy level is " + getEnergyStored() + " EU." + ((cooldownTime <= 0) ? "" : (" " + (cooldownTime / 20) + " s left of cooldown.")); } - private static int calculateRequiredEnergy(int currentMode, int shipVolume, int jumpDistance) { + public static int calculateRequiredEnergy(int currentMode, int shipVolume, int jumpDistance) { switch (currentMode) { case MODE_TELEPORT: return WarpDriveConfig.WC_ENERGY_PER_ENTITY_TO_SPACE; diff --git a/src/cr0s/WarpDrive/world/HyperSpaceProvider.java b/src/cr0s/WarpDrive/world/HyperSpaceProvider.java index ba4eab48..88f9be9b 100644 --- a/src/cr0s/WarpDrive/world/HyperSpaceProvider.java +++ b/src/cr0s/WarpDrive/world/HyperSpaceProvider.java @@ -86,7 +86,7 @@ public class HyperSpaceProvider extends WorldProvider @Override public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { - super.setAllowedSpawnTypes(false, false); + super.setAllowedSpawnTypes(true, true); } @Override diff --git a/src/cr0s/WarpDrive/world/SpaceProvider.java b/src/cr0s/WarpDrive/world/SpaceProvider.java index f68b1662..475a8909 100644 --- a/src/cr0s/WarpDrive/world/SpaceProvider.java +++ b/src/cr0s/WarpDrive/world/SpaceProvider.java @@ -87,7 +87,7 @@ public class SpaceProvider extends WorldProvider @Override public void setAllowedSpawnTypes(boolean allowHostile, boolean allowPeaceful) { - super.setAllowedSpawnTypes(false, false); + super.setAllowedSpawnTypes(true, true); } @Override diff --git a/src/cr0s/WarpDrive/world/SpaceWorldGenerator.java b/src/cr0s/WarpDrive/world/SpaceWorldGenerator.java index 8d29d418..120ded24 100644 --- a/src/cr0s/WarpDrive/world/SpaceWorldGenerator.java +++ b/src/cr0s/WarpDrive/world/SpaceWorldGenerator.java @@ -45,10 +45,8 @@ public class SpaceWorldGenerator implements IWorldGenerator if (world.provider.dimensionId != WarpDriveConfig.G_SPACE_DIMENSION_ID) return; int x = (chunkX * 16) + (5 - random.nextInt(10)); - int z = (chunkZ * 16) + (5 - random.nextInt(10)); - if (Math.abs(x) > WarpDrive.WORLD_LIMIT_BLOCKS || Math.abs(z) > WarpDrive.WORLD_LIMIT_BLOCKS) - return; int y = Y_LIMIT_DOWN + random.nextInt(Y_LIMIT - Y_LIMIT_DOWN); + int z = (chunkZ * 16) + (5 - random.nextInt(10)); // Moon setup if (random.nextInt(700) == 1) generateMoon(world, x, y, z); @@ -106,7 +104,7 @@ public class SpaceWorldGenerator implements IWorldGenerator } // Place bedrock blocks - world.setBlock(x + coreRadius , y2 , z , Block.bedrock.blockID, 0, 0); + /*world.setBlock(x + coreRadius , y2 , z , Block.bedrock.blockID, 0, 0); world.setBlock(x - coreRadius , y2 , z , Block.bedrock.blockID, 0, 0); world.setBlock(x , y2 , z + coreRadius , Block.bedrock.blockID, 0, 0); world.setBlock(x , y2 , z - coreRadius , Block.bedrock.blockID, 0, 0); @@ -124,6 +122,7 @@ public class SpaceWorldGenerator implements IWorldGenerator world.setBlock(x , y2 , z - moonRadius + 10, Block.bedrock.blockID, 0, 0); world.setBlock(x , y2 + moonRadius - 10, z , Block.bedrock.blockID, 0, 0); world.setBlock(x , y2 - moonRadius + 10, z , Block.bedrock.blockID, 0, 0); + */ // Generate moon's blocks generateSphereEntity(world, x, y2, z, moonRadius, false, block[0], block[1], true); // Generate moon's atmosphere