Bugfixes + config
Fixed: * TE duplication and overclocking after jump Added: * Configuration file
This commit is contained in:
parent
3f8f99394b
commit
f0e6d400cb
15 changed files with 251 additions and 121 deletions
|
@ -25,7 +25,7 @@ public class CamRegistry {
|
||||||
|
|
||||||
public boolean isCamAlive(CamRegistryItem i) {
|
public boolean isCamAlive(CamRegistryItem i) {
|
||||||
if (i.worldObj != null) {
|
if (i.worldObj != null) {
|
||||||
if (i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDrive.instance.CAMERA_BLOCKID && i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDrive.instance.LASER_BLOCKCAM_BLOCKID) {
|
if (i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDrive.instance.config.camID && i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDrive.instance.config.laserCamID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public final class EntityCamera extends EntityLivingBase {
|
||||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_SPACE) && fireWaitTicks-- == 0) {
|
} else if (Keyboard.isKeyDown(Keyboard.KEY_SPACE) && fireWaitTicks-- == 0) {
|
||||||
fireWaitTicks = 2;
|
fireWaitTicks = 2;
|
||||||
// Make a shoot with camera-laser
|
// Make a shoot with camera-laser
|
||||||
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDrive.LASER_BLOCKCAM_BLOCKID) {
|
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDrive.instance.config.laserCamID) {
|
||||||
sendTargetPacket();
|
sendTargetPacket();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,10 +7,15 @@ import dan200.computer.api.IPeripheral;
|
||||||
import dan200.turtle.api.ITurtleAccess;
|
import dan200.turtle.api.ITurtleAccess;
|
||||||
import dan200.turtle.api.TurtleSide;
|
import dan200.turtle.api.TurtleSide;
|
||||||
import ic2.api.energy.tile.IEnergyTile;
|
import ic2.api.energy.tile.IEnergyTile;
|
||||||
|
import ic2.api.network.NetworkHelper;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -397,7 +402,20 @@ public class EntityJump extends Entity {
|
||||||
public void finishJump() {
|
public void finishJump() {
|
||||||
System.out.println("[JE] Finished. Jump took " + ((System.currentTimeMillis() - msCounter) / 1000F) + " seconds");
|
System.out.println("[JE] Finished. Jump took " + ((System.currentTimeMillis() - msCounter) / 1000F) + " seconds");
|
||||||
|
|
||||||
// Прыжок окончен
|
//FIXME TileEntity duplication workaround
|
||||||
|
System.out.println("Removing TE duplicates. Size before: " + targetWorld.loadedTileEntityList.size());
|
||||||
|
LocalProfiler.start("EntityJump.removeDuplicates()");
|
||||||
|
|
||||||
|
try {
|
||||||
|
targetWorld.loadedTileEntityList = this.removeDuplicates(targetWorld.loadedTileEntityList);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("TE Duplicates removing exception: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalProfiler.stop();
|
||||||
|
|
||||||
|
System.out.println("Removing TE duplicates. Size after: " + targetWorld.loadedTileEntityList.size());
|
||||||
|
|
||||||
killEntity("");
|
killEntity("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,9 +470,9 @@ public class EntityJump extends Entity {
|
||||||
method = c.getDeclaredMethod ("onLoaded", new Class[0]);
|
method = c.getDeclaredMethod ("onLoaded", new Class[0]);
|
||||||
method.invoke (te, new Object[0]);
|
method.invoke (te, new Object[0]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else // Machine
|
} else // Machine/Generator
|
||||||
if (c.getName().equals("ic2.core.block.TileEntityBlock") || c.getName().contains("ic2.core.block.generator")) {
|
if (c.getName().equals("ic2.core.block.TileEntityBlock") || c.getName().contains("ic2.core.block.generator")) {
|
||||||
try {
|
try {
|
||||||
Method method;
|
Method method;
|
||||||
|
@ -465,9 +483,17 @@ public class EntityJump extends Entity {
|
||||||
method = c.getDeclaredMethod ("onLoaded", new Class[0]);
|
method = c.getDeclaredMethod ("onLoaded", new Class[0]);
|
||||||
method.invoke (te, new Object[0]);
|
method.invoke (te, new Object[0]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
te.updateContainingBlockInfo();
|
||||||
|
|
||||||
|
try {
|
||||||
|
NetworkHelper.updateTileEntityField(te, "facing");
|
||||||
|
} catch (Exception e) {
|
||||||
|
//e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,7 +528,7 @@ public class EntityJump extends Entity {
|
||||||
for(int z = z1; z <= z2; z++) {
|
for(int z = z1; z <= z2; z++) {
|
||||||
int blockID = worldObj.getBlockId(x, y, z);
|
int blockID = worldObj.getBlockId(x, y, z);
|
||||||
// Skip air blocks
|
// Skip air blocks
|
||||||
if (blockID == 0 || blockID == WarpDrive.GAS_BLOCKID) {
|
if (blockID == 0 || blockID == WarpDrive.instance.config.gasID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +609,7 @@ public class EntityJump extends Entity {
|
||||||
int blockID = worldObj.getBlockId(x, y, z);
|
int blockID = worldObj.getBlockId(x, y, z);
|
||||||
|
|
||||||
// Skipping air blocks
|
// Skipping air blocks
|
||||||
if (blockID == 0 || blockID == WarpDrive.GAS_BLOCKID) {
|
if (blockID == 0 || blockID == WarpDrive.instance.config.gasID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -786,7 +812,7 @@ public class EntityJump extends Entity {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockOnShipID != 0 && blockID != 0 && blockID != WarpDrive.AIR_BLOCKID && blockID != WarpDrive.GAS_BLOCKID && blockID != 18) {
|
if (blockOnShipID != 0 && blockID != 0 && blockID != WarpDrive.instance.config.airID && blockID != WarpDrive.instance.config.gasID && blockID != 18) {
|
||||||
blowX = x;
|
blowX = x;
|
||||||
blowY = y;
|
blowY = y;
|
||||||
blowZ = z;
|
blowZ = z;
|
||||||
|
@ -843,7 +869,7 @@ public class EntityJump extends Entity {
|
||||||
for (int z = minZ; z <= maxZ; z++) {
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
for (int y = minY; y <= maxY; y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
int blockID = worldObj.getBlockId(x, y, z);
|
int blockID = worldObj.getBlockId(x, y, z);
|
||||||
if (blockID == 0 || blockID == WarpDrive.AIR_BLOCKID || blockID == WarpDrive.GAS_BLOCKID) {
|
if (blockID == 0 || blockID == WarpDrive.instance.config.airID || blockID == WarpDrive.instance.config.gasID) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,12 +893,6 @@ public class EntityJump extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Перемещение одиночного блока на новое место
|
|
||||||
*
|
|
||||||
* @param indexInShip индекс блока в сохранённом в памяти корабле
|
|
||||||
* @return состояние перемещения
|
|
||||||
*/
|
|
||||||
public boolean moveBlockSimple(int indexInShip) {
|
public boolean moveBlockSimple(int indexInShip) {
|
||||||
try {
|
try {
|
||||||
JumpBlock shipBlock = ship[indexInShip];
|
JumpBlock shipBlock = ship[indexInShip];
|
||||||
|
@ -894,7 +914,7 @@ public class EntityJump extends Entity {
|
||||||
|
|
||||||
mySetBlock(targetWorld, newX, newY, newZ, blockID, blockMeta, 2);
|
mySetBlock(targetWorld, newX, newY, newZ, blockID, blockMeta, 2);
|
||||||
// Re-schedule air blocks update
|
// Re-schedule air blocks update
|
||||||
if (blockID == WarpDrive.AIR_BLOCKID) {
|
if (blockID == WarpDrive.instance.config.airID) {
|
||||||
targetWorld.markBlockForUpdate(newX, newY, newZ);
|
targetWorld.markBlockForUpdate(newX, newY, newZ);
|
||||||
targetWorld.scheduleBlockUpdate(newX, newY, newZ, blockID, 40 + targetWorld.rand.nextInt(20));
|
targetWorld.scheduleBlockUpdate(newX, newY, newZ, blockID, 40 + targetWorld.rand.nextInt(20));
|
||||||
}
|
}
|
||||||
|
@ -930,6 +950,7 @@ public class EntityJump extends Entity {
|
||||||
newTileEntity.validate();
|
newTileEntity.validate();
|
||||||
|
|
||||||
worldObj.removeBlockTileEntity(oldX, oldY, oldZ);
|
worldObj.removeBlockTileEntity(oldX, oldY, oldZ);
|
||||||
|
|
||||||
targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity);
|
targetWorld.setBlockTileEntity(newX, newY, newZ, newTileEntity);
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
|
@ -940,6 +961,24 @@ public class EntityJump extends Entity {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Object> removeDuplicates(List<TileEntity> l) {
|
||||||
|
Set<TileEntity> s = new TreeSet<TileEntity>(new Comparator<TileEntity>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(TileEntity o1, TileEntity o2) {
|
||||||
|
if (o1.xCoord == o2.xCoord && o1.yCoord == o2.yCoord && o1.zCoord == o2.zCoord) {
|
||||||
|
System.out.println("Removed duplicated TE: " + o1 + ", " + o2);
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
s.addAll(l);
|
||||||
|
return new ArrayList<Object>(Arrays.asList(s.toArray()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
//System.out.println("[JE@"+this+"] readEntityFromNBT()");
|
//System.out.println("[JE@"+this+"] readEntityFromNBT()");
|
||||||
|
|
|
@ -6,9 +6,11 @@ import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import cr0s.WarpDrive.JumpBlock;
|
import cr0s.WarpDrive.JumpBlock;
|
||||||
import cr0s.WarpDrive.LocalProfiler;
|
import cr0s.WarpDrive.LocalProfiler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -239,7 +241,7 @@ public final class EntitySphereGen extends Entity {
|
||||||
} else if (random.nextInt(1000) == 1) {
|
} else if (random.nextInt(1000) == 1) {
|
||||||
_blockID = Block.bedrock.blockID;
|
_blockID = Block.bedrock.blockID;
|
||||||
} else if (random.nextInt(10000) == 42) {
|
} else if (random.nextInt(10000) == 42) {
|
||||||
_blockID = WarpDrive.IRIDIUM_BLOCKID;
|
_blockID = WarpDrive.instance.config.iridiumID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _blockID;
|
return _blockID;
|
||||||
|
|
|
@ -187,8 +187,8 @@ public class HyperSpaceProvider extends WorldProvider {
|
||||||
|
|
||||||
worldObj.setBlock(var5.posX, var5.posY + 3, var5.posZ, Block.glass.blockID, 0, 2);
|
worldObj.setBlock(var5.posX, var5.posY + 3, var5.posZ, Block.glass.blockID, 0, 2);
|
||||||
|
|
||||||
worldObj.setBlock(var5.posX, var5.posY, var5.posZ, WarpDrive.AIR_BLOCKID, 15, 2);
|
worldObj.setBlock(var5.posX, var5.posY, var5.posZ, WarpDrive.instance.config.airID, 15, 2);
|
||||||
worldObj.setBlock(var5.posX, var5.posY + 1, var5.posZ, WarpDrive.AIR_BLOCKID, 15, 2);
|
worldObj.setBlock(var5.posX, var5.posY + 1, var5.posZ, WarpDrive.instance.config.airID, 15, 2);
|
||||||
}
|
}
|
||||||
return var5;
|
return var5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cr0s.WarpDrive;
|
package cr0s.WarpDrive;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
@ -101,7 +102,7 @@ public class SpaceEventHandler {
|
||||||
int id1 = e.worldObj.getBlockId(x, y, z);
|
int id1 = e.worldObj.getBlockId(x, y, z);
|
||||||
int id2 = e.worldObj.getBlockId(x, y + 1, z);
|
int id2 = e.worldObj.getBlockId(x, y + 1, z);
|
||||||
|
|
||||||
if (id1 == WarpDrive.AIR_BLOCKID || id2 == WarpDrive.AIR_BLOCKID) {
|
if (id1 == WarpDrive.instance.config.airID || id2 == WarpDrive.instance.config.airID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateGasSphereEntity(World world, int x, int y, int z, int radius, boolean hollow, int color) {
|
private void generateGasSphereEntity(World world, int x, int y, int z, int radius, boolean hollow, int color) {
|
||||||
EntitySphereGen esg = new EntitySphereGen(world, x, y, z, radius, WarpDrive.GAS_BLOCKID, color, hollow, true, false);
|
EntitySphereGen esg = new EntitySphereGen(world, x, y, z, radius, WarpDrive.instance.config.gasID, color, hollow, true, false);
|
||||||
esg.xCoord = x;
|
esg.xCoord = x;
|
||||||
esg.yCoord = y;
|
esg.yCoord = y;
|
||||||
esg.zCoord = z;
|
esg.zCoord = z;
|
||||||
|
@ -514,7 +514,7 @@ public class SpaceWorldGenerator implements IWorldGenerator {
|
||||||
else if (random.nextInt(500) == 1) {
|
else if (random.nextInt(500) == 1) {
|
||||||
blockID = Block.oreDiamond.blockID;
|
blockID = Block.oreDiamond.blockID;
|
||||||
} else if (random.nextInt(10000) == 42) {
|
} else if (random.nextInt(10000) == 42) {
|
||||||
blockID = WarpDrive.IRIDIUM_BLOCKID;
|
blockID = WarpDrive.instance.config.iridiumID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return blockID;
|
return blockID;
|
||||||
|
|
|
@ -57,32 +57,32 @@ public class TileEntityAirGenerator extends TileEntity implements IEnergySink {
|
||||||
|
|
||||||
private void releaseAir() {
|
private void releaseAir() {
|
||||||
if (worldObj.isAirBlock(xCoord + 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord + 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord + 1, yCoord, zCoord, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord + 1, yCoord, zCoord, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.isAirBlock(xCoord - 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord - 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord - 1, yCoord, zCoord, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord - 1, yCoord, zCoord, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord, yCoord + 1, zCoord, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.isAirBlock(xCoord, yCoord - 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord, yCoord - 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord, yCoord - 1, zCoord, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord, yCoord - 1, zCoord, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.isAirBlock(xCoord, yCoord, zCoord + 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord, yCoord, zCoord + 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord, yCoord, zCoord + 1, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord, yCoord, zCoord + 1, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldObj.isAirBlock(xCoord, yCoord, zCoord - 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
if (worldObj.isAirBlock(xCoord, yCoord, zCoord - 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0)) {
|
||||||
worldObj.setBlock(xCoord, yCoord, zCoord - 1, WarpDrive.AIR_BLOCKID, START_CONCENTRATION_VALUE, 2);
|
worldObj.setBlock(xCoord, yCoord, zCoord - 1, WarpDrive.instance.config.airID, START_CONCENTRATION_VALUE, 2);
|
||||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -226,7 +226,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hit is a laser head
|
// Hit is a laser head
|
||||||
if (blockID == WarpDrive.instance.LASER_BLOCK_BLOCKID || blockID == WarpDrive.instance.LASER_BLOCKCAM_BLOCKID) {
|
if (blockID == WarpDrive.instance.config.laserID || blockID == WarpDrive.instance.config.laserCamID) {
|
||||||
// Compare frequencies
|
// Compare frequencies
|
||||||
TileEntityLaser tel = (TileEntityLaser)worldObj.getBlockTileEntity(hit.blockX, hit.blockY, hit.blockZ);
|
TileEntityLaser tel = (TileEntityLaser)worldObj.getBlockTileEntity(hit.blockX, hit.blockY, hit.blockZ);
|
||||||
if (tel != null && tel.getFrequency() == frequency) {
|
if (tel != null && tel.getFrequency() == frequency) {
|
||||||
|
@ -310,7 +310,7 @@ public class TileEntityLaser extends TileEntity implements IPeripheral{
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWithCamera() {
|
public boolean isWithCamera() {
|
||||||
return (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDrive.LASER_BLOCKCAM_BLOCKID);
|
return (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDrive.instance.config.laserCamID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFrequency() {
|
public int getFrequency() {
|
||||||
|
|
|
@ -61,9 +61,9 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
||||||
Block.oreRedstoneGlowing.blockID,
|
Block.oreRedstoneGlowing.blockID,
|
||||||
Block.oreRedstone.blockID,
|
Block.oreRedstone.blockID,
|
||||||
Block.oreNetherQuartz.blockID,
|
Block.oreNetherQuartz.blockID,
|
||||||
247, // IC
|
Items.getItem("uraniumOre").itemID, // IC
|
||||||
248, // IC
|
Items.getItem("copperOre").itemID, // IC
|
||||||
249, // IC
|
Items.getItem("tinOre").itemID, // IC
|
||||||
4095 // AS uranus
|
4095 // AS uranus
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -99,16 +99,25 @@ public class TileEntityMiningLaser extends TileEntity implements IPeripheral{
|
||||||
private int layerOffset = 1;
|
private int layerOffset = 1;
|
||||||
|
|
||||||
private Vector3 minerVector;
|
private Vector3 minerVector;
|
||||||
private long uid = 0;
|
//private long uid = 0;
|
||||||
|
|
||||||
TileEntityParticleBooster booster = null;
|
TileEntityParticleBooster booster = null;
|
||||||
|
|
||||||
private final int MFFS_FIELD_BLOCKID = 1681;
|
private final int MFFS_FIELD_BLOCKID = 1681;
|
||||||
|
|
||||||
private boolean isOnEarth = false;
|
private boolean isOnEarth = false;
|
||||||
|
//int t = 20;
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
/*if (uid == 0) {
|
||||||
|
uid = worldObj.rand.nextInt(99999);
|
||||||
|
}
|
||||||
|
if (--t == 0) {
|
||||||
|
t = 20;
|
||||||
|
System.out.println("[MINER] Ticked: " + uid + " | " + xCoord + "; " + yCoord + "; " + zCoord);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
isOnEarth = (worldObj.provider.dimensionId == 0);
|
isOnEarth = (worldObj.provider.dimensionId == 0);
|
||||||
|
|
||||||
if (isMining) {
|
if (isMining) {
|
||||||
|
|
|
@ -263,7 +263,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink {
|
||||||
for (int y = ymin; y <= ymax; y++) {
|
for (int y = ymin; y <= ymax; y++) {
|
||||||
for (int x = xmin; x <= xmax; x++) {
|
for (int x = xmin; x <= xmax; x++) {
|
||||||
for (int z = zmin; z <= zmax; z++) {
|
for (int z = zmin; z <= zmax; z++) {
|
||||||
if (worldObj.getBlockId(x, y, z) == WarpDrive.ISOLATION_BLOCKID) {
|
if (worldObj.getBlockId(x, y, z) == WarpDrive.instance.config.isolationID) {
|
||||||
this.isolationBlocksCount++;
|
this.isolationBlocksCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,8 @@ public class WarpCoresRegistry {
|
||||||
public boolean isWarpCoreIntersectsWithOthers(TileEntityReactor core) {
|
public boolean isWarpCoreIntersectsWithOthers(TileEntityReactor core) {
|
||||||
AxisAlignedBB aabb1, aabb2;
|
AxisAlignedBB aabb1, aabb2;
|
||||||
|
|
||||||
|
removeDeadCores();
|
||||||
|
|
||||||
for (TileEntityReactor c : registry) {
|
for (TileEntityReactor c : registry) {
|
||||||
// Skip cores in other worlds
|
// Skip cores in other worlds
|
||||||
if (c.worldObj != core.worldObj) {
|
if (c.worldObj != core.worldObj) {
|
||||||
|
@ -143,10 +145,11 @@ public class WarpCoresRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDeadCores() {
|
public void removeDeadCores() {
|
||||||
|
LocalProfiler.start("WCR.removeDeadCores()");
|
||||||
ArrayList<TileEntityReactor> oldRegistry = (ArrayList<TileEntityReactor>) registry.clone();
|
ArrayList<TileEntityReactor> oldRegistry = (ArrayList<TileEntityReactor>) registry.clone();
|
||||||
|
|
||||||
for (TileEntityReactor c : registry) {
|
for (TileEntityReactor c : registry) {
|
||||||
if (c != null && c.worldObj != null && (c.worldObj.getBlockId(c.xCoord, c.yCoord, c.zCoord) != WarpDrive.WARP_CORE_BLOCKID || (c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord) != null && c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord).isInvalid()))) {
|
if (c != null && c.worldObj != null && (c.worldObj.getBlockId(c.xCoord, c.yCoord, c.zCoord) != WarpDrive.instance.config.coreID|| (c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord) != null && c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord).isInvalid()))) {
|
||||||
oldRegistry.remove(c);
|
oldRegistry.remove(c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +157,7 @@ public class WarpCoresRegistry {
|
||||||
|
|
||||||
// Update old registry to new witout dead cores
|
// Update old registry to new witout dead cores
|
||||||
this.registry = (ArrayList<TileEntityReactor>) oldRegistry.clone();
|
this.registry = (ArrayList<TileEntityReactor>) oldRegistry.clone();
|
||||||
|
LocalProfiler.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fix it to normal work in client
|
// TODO: fix it to normal work in client
|
||||||
|
|
|
@ -2,6 +2,7 @@ package cr0s.WarpDrive;
|
||||||
|
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.Mod.EventHandler;
|
||||||
import cpw.mods.fml.common.Mod.Init;
|
import cpw.mods.fml.common.Mod.Init;
|
||||||
import cpw.mods.fml.common.Mod.Instance;
|
import cpw.mods.fml.common.Mod.Instance;
|
||||||
import cpw.mods.fml.common.Mod.PostInit;
|
import cpw.mods.fml.common.Mod.PostInit;
|
||||||
|
@ -19,6 +20,7 @@ import ic2.api.item.Items;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import shipmod.ShipModConfig;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -27,6 +29,7 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager;
|
import net.minecraftforge.common.ForgeChunkManager;
|
||||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||||
|
@ -39,83 +42,26 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
* @author Cr0s
|
* @author Cr0s
|
||||||
*/
|
*/
|
||||||
public class WarpDrive implements LoadingCallback {
|
public class WarpDrive implements LoadingCallback {
|
||||||
|
|
||||||
public final static int WARP_CORE_BLOCKID = 500;
|
|
||||||
public final static int PROTOCOL_BLOCK_BLOCKID = 501;
|
|
||||||
public final static int RADAR_BLOCK_BLOCKID = 502;
|
|
||||||
public final static int ISOLATION_BLOCKID = 503;
|
|
||||||
public final static int AIR_BLOCKID = 504;
|
|
||||||
public final static int AIRGEN_BLOCKID = 505;
|
|
||||||
public final static int GAS_BLOCKID = 506;
|
|
||||||
|
|
||||||
public final static int LASER_BLOCK_BLOCKID = 507;
|
|
||||||
public final static int MINING_LASER_BLOCK_BLOCKID = 508;
|
|
||||||
public final static int PARTICLE_BOOSTER_BLOCKID = 509;
|
|
||||||
public final static int LIFT_BLOCKID = 510;
|
|
||||||
|
|
||||||
public final static int LASER_BLOCKCAM_BLOCKID = 512;
|
|
||||||
public final static int CAMERA_BLOCKID = 513;
|
|
||||||
public final static int MONITOR_BLOCKID = 514;
|
|
||||||
|
|
||||||
public final static int IRIDIUM_BLOCKID = 515;
|
|
||||||
|
|
||||||
// World limits
|
// World limits
|
||||||
public final static int WORLD_LIMIT_BLOCKS = 100000;
|
public final static int WORLD_LIMIT_BLOCKS = 100000;
|
||||||
|
|
||||||
public final static Block warpCore = new BlockReactor(WARP_CORE_BLOCKID, 0, Material.rock)
|
public static Block warpCore;
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
public static Block protocolBlock;
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Core");
|
public static Block radarBlock;
|
||||||
|
public static Block isolationBlock;
|
||||||
|
public static Block airgenBlock;
|
||||||
|
public static Block laserBlock;
|
||||||
|
public static Block laserCamBlock;
|
||||||
|
public static Block cameraBlock;
|
||||||
|
public static Block monitorBlock;
|
||||||
|
public static Block boosterBlock;
|
||||||
|
public static Block miningLaserBlock;
|
||||||
|
public static Block liftBlock;
|
||||||
|
|
||||||
public final static Block protocolBlock = new BlockProtocol(PROTOCOL_BLOCK_BLOCKID, 0, Material.rock)
|
public static Block airBlock;
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
public static Block gasBlock;
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Controller");
|
|
||||||
|
|
||||||
public final static Block radarBlock = new BlockRadar(RADAR_BLOCK_BLOCKID, 0, Material.rock)
|
public static Block iridiumBlock;
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("W-Radar");
|
|
||||||
|
|
||||||
public final static Block isolationBlock = new BlockWarpIsolation(ISOLATION_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp-Field Isolation Block");
|
|
||||||
|
|
||||||
public final static Block airgenBlock = new BlockAirGenerator(AIRGEN_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Air Generator");
|
|
||||||
|
|
||||||
public final static Block laserBlock = new BlockLaser(LASER_BLOCK_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser Emitter");
|
|
||||||
|
|
||||||
public final static Block laserCamBlock = new BlockLaserCam(LASER_BLOCKCAM_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser Emitter + Camera");
|
|
||||||
|
|
||||||
public final static Block cameraBlock = new BlockCamera(CAMERA_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Camera block");
|
|
||||||
|
|
||||||
public final static Block monitorBlock = new BlockMonitor(MONITOR_BLOCKID)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Monitor");
|
|
||||||
|
|
||||||
public final static Block boosterBlock = new BlockParticleBooster(PARTICLE_BOOSTER_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Particle Booster");
|
|
||||||
|
|
||||||
public final static Block miningLaserBlock = new BlockMiningLaser(MINING_LASER_BLOCK_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Mining Laser");
|
|
||||||
|
|
||||||
public final static Block liftBlock = new BlockLift(LIFT_BLOCKID, 0, Material.rock)
|
|
||||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser lift");
|
|
||||||
|
|
||||||
public final static Block airBlock = (new BlockAir(AIR_BLOCKID)).setHardness(0.0F).setUnlocalizedName("Air block");
|
|
||||||
public final static Block gasBlock = (new BlockGas(GAS_BLOCKID)).setHardness(0.0F).setUnlocalizedName("Gas block");
|
|
||||||
|
|
||||||
public final static Block iridiumBlock = new BlockIridium(IRIDIUM_BLOCKID)
|
|
||||||
.setHardness(0.8F).setResistance(150 * 4).setStepSound(Block.soundMetalFootstep)
|
|
||||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Block of Iridium");
|
|
||||||
|
|
||||||
public static BiomeGenBase spaceBiome;
|
public static BiomeGenBase spaceBiome;
|
||||||
public World space;
|
public World space;
|
||||||
|
@ -140,8 +86,14 @@ public class WarpDrive implements LoadingCallback {
|
||||||
public boolean isOverlayEnabled = false;
|
public boolean isOverlayEnabled = false;
|
||||||
public int overlayType = 0;
|
public int overlayType = 0;
|
||||||
|
|
||||||
@PreInit
|
public WarpDriveConfig config;
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
//@PreInit
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
this.config = new WarpDriveConfig(new Configuration(event.getSuggestedConfigurationFile()));
|
||||||
|
this.config.loadAndSave();
|
||||||
|
|
||||||
if(FMLCommonHandler.instance().getSide().isClient())
|
if(FMLCommonHandler.instance().getSide().isClient())
|
||||||
{
|
{
|
||||||
System.out.println("[WarpDrive] Registering sounds event handler...");
|
System.out.println("[WarpDrive] Registering sounds event handler...");
|
||||||
|
@ -151,59 +103,114 @@ public class WarpDrive implements LoadingCallback {
|
||||||
|
|
||||||
@Init
|
@Init
|
||||||
public void load(FMLInitializationEvent event) {
|
public void load(FMLInitializationEvent event) {
|
||||||
|
// WARP CORE
|
||||||
|
this.warpCore = new BlockReactor(this.config.coreID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Core");
|
||||||
LanguageRegistry.addName(warpCore, "Warp Core");
|
LanguageRegistry.addName(warpCore, "Warp Core");
|
||||||
GameRegistry.registerBlock(warpCore, "warpCore");
|
GameRegistry.registerBlock(warpCore, "warpCore");
|
||||||
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
|
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
|
||||||
|
|
||||||
|
// CORE CONTROLLER
|
||||||
|
this.protocolBlock = new BlockProtocol(config.controllerID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Controller");
|
||||||
LanguageRegistry.addName(protocolBlock, "Warp Controller");
|
LanguageRegistry.addName(protocolBlock, "Warp Controller");
|
||||||
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
|
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
|
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
|
||||||
|
|
||||||
|
// WARP RADAR
|
||||||
|
this.radarBlock = new BlockRadar(config.radarID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("W-Radar");
|
||||||
LanguageRegistry.addName(radarBlock, "W-Radar");
|
LanguageRegistry.addName(radarBlock, "W-Radar");
|
||||||
GameRegistry.registerBlock(radarBlock, "radarBlock");
|
GameRegistry.registerBlock(radarBlock, "radarBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
|
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
|
||||||
|
|
||||||
|
// WARP ISOLATION
|
||||||
|
this.isolationBlock = new BlockWarpIsolation(config.isolationID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp-Field Isolation Block");
|
||||||
LanguageRegistry.addName(isolationBlock, "Warp-Field Isolation Block");
|
LanguageRegistry.addName(isolationBlock, "Warp-Field Isolation Block");
|
||||||
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
|
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
|
||||||
|
|
||||||
|
// AIR GENERATOR
|
||||||
|
this.airgenBlock = new BlockAirGenerator(config.airgenID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Air Generator");
|
||||||
|
LanguageRegistry.addName(airgenBlock, "Air Generator");
|
||||||
|
GameRegistry.registerBlock(airgenBlock, "airgenBlock");
|
||||||
|
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock");
|
||||||
|
|
||||||
|
// AIR BLOCK
|
||||||
|
this.airBlock = (new BlockAir(config.airID)).setHardness(0.0F).setUnlocalizedName("Air block");
|
||||||
LanguageRegistry.addName(airBlock, "Air block");
|
LanguageRegistry.addName(airBlock, "Air block");
|
||||||
GameRegistry.registerBlock(airBlock, "airBlock");
|
GameRegistry.registerBlock(airBlock, "airBlock");
|
||||||
|
|
||||||
|
// GAS BLOCK
|
||||||
|
this.gasBlock = (new BlockGas(config.gasID)).setHardness(0.0F).setUnlocalizedName("Gas block");
|
||||||
LanguageRegistry.addName(gasBlock, "Gas block");
|
LanguageRegistry.addName(gasBlock, "Gas block");
|
||||||
GameRegistry.registerBlock(gasBlock, "gasBlock");
|
GameRegistry.registerBlock(gasBlock, "gasBlock");
|
||||||
|
|
||||||
LanguageRegistry.addName(airgenBlock, "Air Generator");
|
|
||||||
GameRegistry.registerBlock(airgenBlock, "airgenBlock");
|
|
||||||
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock");
|
|
||||||
|
|
||||||
|
// LASER EMITTER
|
||||||
|
this.laserBlock = new BlockLaser(config.laserID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser Emitter");
|
||||||
LanguageRegistry.addName(laserBlock, "Laser Emitter");
|
LanguageRegistry.addName(laserBlock, "Laser Emitter");
|
||||||
GameRegistry.registerBlock(laserBlock, "laserBlock");
|
GameRegistry.registerBlock(laserBlock, "laserBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
|
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
|
||||||
|
|
||||||
|
// LASER EMITTER WITH CAMERA
|
||||||
|
this.laserCamBlock = new BlockLaserCam(config.laserCamID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser Emitter + Camera");
|
||||||
LanguageRegistry.addName(laserCamBlock, "Laser Emitter + Camera");
|
LanguageRegistry.addName(laserCamBlock, "Laser Emitter + Camera");
|
||||||
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
|
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
|
||||||
|
|
||||||
|
// CAMERA
|
||||||
|
this.cameraBlock = new BlockCamera(config.camID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Camera block");
|
||||||
LanguageRegistry.addName(cameraBlock, "Camera");
|
LanguageRegistry.addName(cameraBlock, "Camera");
|
||||||
GameRegistry.registerBlock(cameraBlock, "cameraBlock");
|
GameRegistry.registerBlock(cameraBlock, "cameraBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
|
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
|
||||||
|
|
||||||
|
// MONITOR
|
||||||
|
this.monitorBlock = new BlockMonitor(config.monitorID)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Monitor");
|
||||||
LanguageRegistry.addName(monitorBlock, "Monitor");
|
LanguageRegistry.addName(monitorBlock, "Monitor");
|
||||||
GameRegistry.registerBlock(monitorBlock, "monitorBlock");
|
GameRegistry.registerBlock(monitorBlock, "monitorBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
|
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
|
||||||
|
|
||||||
|
// MINING LASER
|
||||||
|
this.miningLaserBlock = new BlockMiningLaser(config.miningLaserID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Mining Laser");
|
||||||
LanguageRegistry.addName(miningLaserBlock, "Mining Laser");
|
LanguageRegistry.addName(miningLaserBlock, "Mining Laser");
|
||||||
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
|
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
|
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
|
||||||
|
|
||||||
|
// PARTICLE BOOSTER
|
||||||
|
this.boosterBlock = new BlockParticleBooster(config.particleBoosterID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Particle Booster");
|
||||||
LanguageRegistry.addName(boosterBlock, "Particle Booster");
|
LanguageRegistry.addName(boosterBlock, "Particle Booster");
|
||||||
GameRegistry.registerBlock(boosterBlock, "boosterBlock");
|
GameRegistry.registerBlock(boosterBlock, "boosterBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock");
|
GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock");
|
||||||
|
|
||||||
|
// RAY LIFT
|
||||||
|
this.liftBlock = new BlockLift(config.liftID, 0, Material.rock)
|
||||||
|
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Laser lift");
|
||||||
LanguageRegistry.addName(liftBlock, "Laser lift");
|
LanguageRegistry.addName(liftBlock, "Laser lift");
|
||||||
GameRegistry.registerBlock(liftBlock, "liftBlock");
|
GameRegistry.registerBlock(liftBlock, "liftBlock");
|
||||||
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
|
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
|
||||||
|
|
||||||
|
// IRIDIUM BLOCK
|
||||||
|
this.iridiumBlock = new BlockIridium(config.iridiumID)
|
||||||
|
.setHardness(0.8F).setResistance(150 * 4).setStepSound(Block.soundMetalFootstep)
|
||||||
|
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Block of Iridium");
|
||||||
LanguageRegistry.addName(iridiumBlock, "Block of Iridium");
|
LanguageRegistry.addName(iridiumBlock, "Block of Iridium");
|
||||||
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
|
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
|
||||||
|
|
||||||
|
|
68
src/cr0s/WarpDrive/WarpDriveConfig.java
Normal file
68
src/cr0s/WarpDrive/WarpDriveConfig.java
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
package cr0s.WarpDrive;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.Configuration;
|
||||||
|
|
||||||
|
public class WarpDriveConfig {
|
||||||
|
private Configuration config;
|
||||||
|
|
||||||
|
public Set<Integer> valuableOres;
|
||||||
|
public Set<Integer> minerValuables;
|
||||||
|
|
||||||
|
public int coreID, controllerID, radarID, isolationID, airID, airgenID, gasID, laserID, miningLaserID, particleBoosterID, liftID, laserCamID, camID, monitorID, iridiumID;
|
||||||
|
/*
|
||||||
|
* public final static int WARP_CORE_BLOCKID = 500;
|
||||||
|
public final static int PROTOCOL_BLOCK_BLOCKID = 501;
|
||||||
|
public final static int RADAR_BLOCK_BLOCKID = 502;
|
||||||
|
public final static int ISOLATION_BLOCKID = 503;
|
||||||
|
public final static int AIR_BLOCKID = 504;
|
||||||
|
public final static int AIRGEN_BLOCKID = 505;
|
||||||
|
public final static int GAS_BLOCKID = 506;
|
||||||
|
|
||||||
|
public final static int LASER_BLOCK_BLOCKID = 507;
|
||||||
|
public final static int MINING_LASER_BLOCK_BLOCKID = 508;
|
||||||
|
public final static int PARTICLE_BOOSTER_BLOCKID = 509;
|
||||||
|
public final static int LIFT_BLOCKID = 510;
|
||||||
|
|
||||||
|
public final static int LASER_BLOCKCAM_BLOCKID = 512;
|
||||||
|
public final static int CAMERA_BLOCKID = 513;
|
||||||
|
public final static int MONITOR_BLOCKID = 514;
|
||||||
|
|
||||||
|
public final static int IRIDIUM_BLOCKID = 515;
|
||||||
|
*/
|
||||||
|
public WarpDriveConfig(Configuration config) {
|
||||||
|
this.config = config;
|
||||||
|
|
||||||
|
this.valuableOres = new HashSet<Integer>();
|
||||||
|
this.minerValuables = new HashSet<Integer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadAndSave() {
|
||||||
|
this.config.load();
|
||||||
|
|
||||||
|
this.coreID = this.config.getBlock("core", 500).getInt();
|
||||||
|
this.controllerID = this.config.getBlock("controller", 501).getInt();
|
||||||
|
|
||||||
|
this.radarID = this.config.getBlock("radar", 502).getInt();
|
||||||
|
this.isolationID = this.config.getBlock("isolation", 503).getInt();
|
||||||
|
|
||||||
|
this.airID = this.config.getBlock("air", 504).getInt();
|
||||||
|
this.airgenID = this.config.getBlock("airgen", 505).getInt();
|
||||||
|
this.gasID = this.config.getBlock("gas", 506).getInt();
|
||||||
|
|
||||||
|
this.laserID = this.config.getBlock("laser", 507).getInt();
|
||||||
|
this.miningLaserID = this.config.getBlock("mininglaser", 508).getInt();
|
||||||
|
this.particleBoosterID = this.config.getBlock("particlebooster", 509).getInt();
|
||||||
|
this.liftID = this.config.getBlock("lift", 510).getInt();
|
||||||
|
|
||||||
|
this.laserCamID = this.config.getBlock("lasercam", 512).getInt();
|
||||||
|
this.camID = this.config.getBlock("camera", 513).getInt();
|
||||||
|
this.monitorID = this.config.getBlock("monitor", 514).getInt();
|
||||||
|
|
||||||
|
this.iridiumID = this.config.getBlock("iridium", 515).getInt();
|
||||||
|
|
||||||
|
this.config.save();
|
||||||
|
}
|
||||||
|
}
|
|
@ -296,7 +296,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
||||||
world.setBlock(i + 9, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
world.setBlock(i + 9, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||||
world.setBlock(i + 9, j + 6, k + 7, ADV_SOLAR_BLOCKID, solarType, 0);
|
world.setBlock(i + 9, j + 6, k + 7, ADV_SOLAR_BLOCKID, solarType, 0);
|
||||||
// Placing air generator
|
// Placing air generator
|
||||||
world.setBlock(i + 9, j + 5, k + 7, WarpDrive.AIRGEN_BLOCKID, 0, 0);
|
world.setBlock(i + 9, j + 5, k + 7, WarpDrive.instance.config.airgenID, 0, 0);
|
||||||
|
|
||||||
world.setBlock(i + 9, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
world.setBlock(i + 9, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||||
world.setBlock(i + 9, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
world.setBlock(i + 9, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||||
|
@ -338,7 +338,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
||||||
world.setBlock(i + 10, j + 6, k + 7, ADV_SOLAR_BLOCKID, solarType, 0);
|
world.setBlock(i + 10, j + 6, k + 7, ADV_SOLAR_BLOCKID, solarType, 0);
|
||||||
|
|
||||||
// Placing air generator
|
// Placing air generator
|
||||||
world.setBlock(i + 10, j + 5, k + 7, WarpDrive.AIRGEN_BLOCKID, 0, 0);
|
world.setBlock(i + 10, j + 5, k + 7, WarpDrive.instance.config.airgenID, 0, 0);
|
||||||
|
|
||||||
world.setBlock(i + 10, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
world.setBlock(i + 10, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||||
world.setBlock(i + 10, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
world.setBlock(i + 10, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||||
|
@ -372,7 +372,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
||||||
|
|
||||||
// Place warp-controller
|
// Place warp-controller
|
||||||
if (rand.nextBoolean()) {
|
if (rand.nextBoolean()) {
|
||||||
world.setBlock(i + 11, j + 3, k + 7, WarpDrive.PROTOCOL_BLOCK_BLOCKID);
|
world.setBlock(i + 11, j + 3, k + 7, WarpDrive.instance.config.controllerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlock(i + 11, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
world.setBlock(i + 11, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
||||||
|
@ -427,7 +427,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
||||||
|
|
||||||
// Place warp-core
|
// Place warp-core
|
||||||
if (rand.nextBoolean()) {
|
if (rand.nextBoolean()) {
|
||||||
world.setBlock(i + 12, j + 3, k + 7, WarpDrive.WARP_CORE_BLOCKID);
|
world.setBlock(i + 12, j + 3, k + 7, WarpDrive.instance.config.coreID);
|
||||||
}
|
}
|
||||||
|
|
||||||
world.setBlock(i + 12, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
world.setBlock(i + 12, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
||||||
|
|
Loading…
Reference in a new issue