Update
Made a bunch of config stuff static Changed things to access static config values Removed unused imports Added basic workings of transporter Changed a few more TEs to use WarpDrive.debugPrint Made TileEntityShipScanner an extension of TileEntityAbstractLaser Removed some unused variables Switched from @PostInit and similar to @EventHandler Changed some Vector3.add to Vector3.translate
This commit is contained in:
parent
e1d547202e
commit
67ad736a7e
52 changed files with 979 additions and 857 deletions
BIN
src/assets/warpdrive/textures/blocks/transporterBottom.png
Normal file
BIN
src/assets/warpdrive/textures/blocks/transporterBottom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
BIN
src/assets/warpdrive/textures/blocks/transporterSide.png
Normal file
BIN
src/assets/warpdrive/textures/blocks/transporterSide.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
BIN
src/assets/warpdrive/textures/blocks/transporterTop.png
Normal file
BIN
src/assets/warpdrive/textures/blocks/transporterTop.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -4,9 +4,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockIridium extends Block
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class CamRegistry
|
||||
|
@ -32,7 +29,7 @@ public class CamRegistry
|
|||
{
|
||||
if (i.worldObj != null)
|
||||
{
|
||||
if (i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDriveConfig.i.camID && i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDriveConfig.i.laserCamID)
|
||||
if (i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDriveConfig.camID && i.worldObj.getBlockId(i.camPos.x, i.camPos.y, i.camPos.z) != WarpDriveConfig.laserCamID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.WarpDrive;
|
|||
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cr0s.WarpDrive.CloakManager.CloakedArea;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.network.packet.Packet56MapChunks;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||
|
||||
|
|
|
@ -6,10 +6,7 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLeashKnot;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -45,9 +42,7 @@ import net.minecraft.network.packet.Packet24MobSpawn;
|
|||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.network.packet.Packet25EntityPainting;
|
||||
import net.minecraft.network.packet.Packet26EntityExpOrb;
|
||||
import net.minecraft.network.packet.Packet56MapChunks;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -354,9 +349,6 @@ public class CloakManager {
|
|||
|
||||
extendedblockstorage = storageArrays[y >> 4] = new ExtendedBlockStorage(y >> 4 << 4, !c.worldObj.provider.hasNoSky);
|
||||
}
|
||||
|
||||
int j2 = c.xPosition * 16 + x;
|
||||
int k2 = c.zPosition * 16 + z;
|
||||
extendedblockstorage.setExtBlockID(x, y & 15, z, blockId);
|
||||
|
||||
if (extendedblockstorage.getExtBlockID(x, y & 15, z) != blockId)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
|
||||
|
|
|
@ -6,31 +6,18 @@ import cpw.mods.fml.relauncher.Side;
|
|||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.settings.EnumOptions;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChatMessageComponent;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public final class EntityCamera extends EntityLivingBase
|
||||
{
|
||||
|
@ -38,7 +25,6 @@ public final class EntityCamera extends EntityLivingBase
|
|||
public int yCoord;
|
||||
public int zCoord;
|
||||
|
||||
private int ticks = 0;
|
||||
private EntityPlayer player;
|
||||
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
@ -94,7 +80,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
fireWaitTicks = 2;
|
||||
|
||||
// Make a shoot with camera-laser
|
||||
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDriveConfig.i.laserCamID)
|
||||
if (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDriveConfig.laserCamID)
|
||||
{
|
||||
sendTargetPacket();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ package cr0s.WarpDrive;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cr0s.WarpDrive.machines.TileEntityReactor;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import dan200.turtle.api.ITurtleAccess;
|
||||
import dan200.turtle.api.TurtleSide;
|
||||
import ic2.api.network.NetworkHelper;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -577,7 +575,7 @@ public class EntityJump extends Entity
|
|||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
|
||||
// Skip air blocks
|
||||
if (blockID == 0 || blockID == WarpDriveConfig.i.gasID)
|
||||
if (blockID == 0 || blockID == WarpDriveConfig.gasID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -668,7 +666,7 @@ public class EntityJump extends Entity
|
|||
int blockID = worldObj.getBlockId(x, y, z);
|
||||
|
||||
// Skipping air blocks
|
||||
if (blockID == 0 || blockID == WarpDriveConfig.i.gasID)
|
||||
if (blockID == 0 || blockID == WarpDriveConfig.gasID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -768,7 +766,7 @@ public class EntityJump extends Entity
|
|||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
||||
|
||||
ChunkCoordinates bedLocation = player.getBedLocation();
|
||||
ChunkCoordinates bedLocation = player.getBedLocation(player.worldObj.provider.dimensionId);
|
||||
|
||||
if (bedLocation != null && testBB(axisalignedbb, bedLocation.posX, bedLocation.posY, bedLocation.posZ))
|
||||
{
|
||||
|
@ -881,7 +879,7 @@ public class EntityJump extends Entity
|
|||
return false;
|
||||
}
|
||||
|
||||
if (blockOnShipID != 0 && blockID != 0 && blockID != WarpDriveConfig.i.airID && blockID != WarpDriveConfig.i.gasID && blockID != 18)
|
||||
if (blockOnShipID != 0 && blockID != 0 && blockID != WarpDriveConfig.airID && blockID != WarpDriveConfig.gasID && blockID != 18)
|
||||
{
|
||||
blowX = x;
|
||||
blowY = y;
|
||||
|
@ -971,7 +969,7 @@ public class EntityJump extends Entity
|
|||
mySetBlock(targetWorld, newX, newY, newZ, blockID, blockMeta, 2);
|
||||
|
||||
// Re-schedule air blocks update
|
||||
if (blockID == WarpDriveConfig.i.airID)
|
||||
if (blockID == WarpDriveConfig.airID)
|
||||
{
|
||||
targetWorld.markBlockForUpdate(newX, newY, newZ);
|
||||
targetWorld.scheduleBlockUpdate(newX, newY, newZ, blockID, 40 + targetWorld.rand.nextInt(20));
|
||||
|
@ -986,12 +984,12 @@ public class EntityJump extends Entity
|
|||
oldnbt.setInteger("y", newY);
|
||||
oldnbt.setInteger("z", newZ);
|
||||
TileEntity newTileEntity = null;
|
||||
if (blockID == WarpDriveConfig.i.CC_Computer || blockID == WarpDriveConfig.i.CC_peripheral || blockID == WarpDriveConfig.i.CCT_Turtle || blockID == WarpDriveConfig.i.CCT_Upgraded || blockID == WarpDriveConfig.i.CCT_Advanced)
|
||||
if (blockID == WarpDriveConfig.CC_Computer || blockID == WarpDriveConfig.CC_peripheral || blockID == WarpDriveConfig.CCT_Turtle || blockID == WarpDriveConfig.CCT_Upgraded || blockID == WarpDriveConfig.CCT_Advanced)
|
||||
{
|
||||
newTileEntity = TileEntity.createAndLoadEntity(oldnbt);
|
||||
newTileEntity.invalidate();
|
||||
}
|
||||
else if (blockID == WarpDriveConfig.i.AS_Turbine)
|
||||
else if (blockID == WarpDriveConfig.AS_Turbine)
|
||||
{
|
||||
if (oldnbt.hasKey("zhuYao"))
|
||||
{
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -33,7 +32,7 @@ public class GravityManager
|
|||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (player.getCurrentArmor(2) != null && WarpDriveConfig.i.Jetpacks.contains(player.getCurrentArmor(2).itemID))
|
||||
if (player.getCurrentArmor(2) != null && WarpDriveConfig.Jetpacks.contains(player.getCurrentArmor(2).itemID))
|
||||
{
|
||||
return SPACE_GRAVITY_SNEAK;
|
||||
}
|
||||
|
|
|
@ -190,8 +190,8 @@ public class HyperSpaceProvider extends WorldProvider
|
|||
worldObj.setBlock(var5.posX, var5.posY + 1, var5.posZ - 1, Block.glass.blockID, 0, 2);
|
||||
worldObj.setBlock(var5.posX, var5.posY + 2, var5.posZ - 1, 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, WarpDriveConfig.i.airID, 15, 2);
|
||||
worldObj.setBlock(var5.posX, var5.posY + 1, var5.posZ, WarpDriveConfig.i.airID, 15, 2);
|
||||
worldObj.setBlock(var5.posX, var5.posY, var5.posZ, WarpDriveConfig.airID, 15, 2);
|
||||
worldObj.setBlock(var5.posX, var5.posY + 1, var5.posZ, WarpDriveConfig.airID, 15, 2);
|
||||
}
|
||||
|
||||
return var5;
|
||||
|
|
|
@ -4,8 +4,6 @@ import net.minecraft.command.CommandBase;
|
|||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public class InvisibleCommand extends CommandBase
|
||||
{
|
||||
|
@ -25,8 +23,6 @@ public class InvisibleCommand extends CommandBase
|
|||
public void processCommand(ICommandSender icommandsender, String[] astring)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)icommandsender;
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
int targetDim = WarpDrive.instance.spaceDimID;
|
||||
|
||||
if (astring.length >= 1)
|
||||
{
|
||||
|
|
|
@ -9,9 +9,7 @@ import java.io.PrintWriter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public final class JumpGatesRegistry
|
||||
{
|
||||
|
|
|
@ -6,24 +6,16 @@ import java.io.File;
|
|||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import ic2.api.network.NetworkHelper;
|
||||
|
||||
public class MetaRotations
|
||||
{
|
||||
private File metaRotationsDirectory;
|
||||
public Map<Integer, BlockMetaRotation> metaRotationMap = new HashMap();
|
||||
public Map<Integer, BlockMetaRotation> metaRotationMap = new HashMap<Integer, BlockMetaRotation>();
|
||||
|
||||
public int getRotatedMeta(int block, int meta, int rotate)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.io.DataInputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
|
@ -14,7 +13,6 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import cr0s.WarpDrive.machines.TileEntityCamera;
|
||||
|
@ -63,12 +61,6 @@ public class PacketHandler implements IPacketHandler
|
|||
|
||||
byte tier = inputStream.readByte();
|
||||
|
||||
int w = Math.abs(maxX - minX);
|
||||
int h = Math.abs(maxY - minY);
|
||||
int l = Math.abs(maxZ - minZ);
|
||||
|
||||
int size = w * h * l;
|
||||
|
||||
//WarpDrive.debugPrint("[Cloak Packet] Received " + ((decloak) ? "DEcloaked" : "cloaked") + "area: (" + minX + "; " + minY + "; " + minZ + ") -> (" + maxX + "; " + maxY + "; " + maxZ + ")");
|
||||
|
||||
if (minX <= player.posX && maxX >= player.posY && minY <= player.posZ && maxY >= player.posX && minZ <= player.posY && maxZ >= player.posZ)
|
||||
|
@ -84,7 +76,7 @@ public class PacketHandler implements IPacketHandler
|
|||
for (int x = minX; x <= maxX; x++)
|
||||
for(int z = minZ; z <= maxZ; z++)
|
||||
if (worldObj.getBlockId(x, y, z) != 0)
|
||||
worldObj.setBlock(x, y, z, (tier == 1) ? WarpDriveConfig.i.gasID : 0, 5, 4);
|
||||
worldObj.setBlock(x, y, z, (tier == 1) ? WarpDriveConfig.gasID : 0, 5, 4);
|
||||
|
||||
//WarpDrive.debugPrint("[Cloak Packet] Removing entity...");
|
||||
// Hide any entities inside area
|
||||
|
@ -224,7 +216,6 @@ public class PacketHandler implements IPacketHandler
|
|||
{
|
||||
WarpDrive.debugPrint("Received beam");
|
||||
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
|
||||
int dimID;
|
||||
Vector3 source, target;
|
||||
double sx, sy, sz;
|
||||
double tx, ty, tz;
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SpaceEventHandler
|
|||
if (entity instanceof EntityPlayerMP)
|
||||
{
|
||||
|
||||
if (((EntityPlayerMP)entity).getCurrentArmor(3) != null && WarpDriveConfig.i.SpaceHelmets.contains(((EntityPlayerMP)entity).getCurrentArmor(3).itemID))
|
||||
if (((EntityPlayerMP)entity).getCurrentArmor(3) != null && WarpDriveConfig.SpaceHelmets.contains(((EntityPlayerMP)entity).getCurrentArmor(3).itemID))
|
||||
{
|
||||
Integer airValue = vacuumPlayers.get(((EntityPlayerMP)entity).username);
|
||||
|
||||
|
@ -142,15 +142,15 @@ public class SpaceEventHandler
|
|||
|
||||
List<CloakedArea> cloaks = WarpDrive.instance.cloaks.getCloaksForPoint(p.worldObj.provider.dimensionId, MathHelper.floor_double(p.posX), MathHelper.floor_double(p.posY), MathHelper.floor_double(p.posZ), false);
|
||||
if (cloaks.size() != 0) {
|
||||
//System.out.println("[Cloak] Player inside " + cloaks.size() + " cloaked areas");
|
||||
//WarpDrive.debugPrint("[Cloak] Player inside " + cloaks.size() + " cloaked areas");
|
||||
for (CloakedArea area : cloaks) {
|
||||
//System.out.println("[Cloak] Frequency: " + area.frequency + ". In: " + area.isPlayerInArea(p) + ", W: " + area.isPlayerWithinArea(p));
|
||||
//WarpDrive.debugPrint("[Cloak] Frequency: " + area.frequency + ". In: " + area.isPlayerInArea(p) + ", W: " + area.isPlayerWithinArea(p));
|
||||
if (!area.isPlayerInArea(p) && area.isPlayerWithinArea(p)) {
|
||||
WarpDrive.instance.cloaks.playerEnteringCloakedArea(area, p);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//System.out.println("[Cloak] Player is not inside any cloak fields. Check, which field player may left...");
|
||||
//WarpDrive.debugPrint("[Cloak] Player is not inside any cloak fields. Check, which field player may left...");
|
||||
WarpDrive.instance.cloaks.checkPlayerLeavedArea(p);
|
||||
}
|
||||
} else {
|
||||
|
@ -179,7 +179,7 @@ public class SpaceEventHandler
|
|||
int id1 = e.worldObj.getBlockId(x, y, z);
|
||||
int id2 = e.worldObj.getBlockId(x, y + 1, z);
|
||||
|
||||
if (id1 == WarpDriveConfig.i.airID || id2 == WarpDriveConfig.i.airID)
|
||||
if (id1 == WarpDriveConfig.airID || id2 == WarpDriveConfig.airID)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -187,18 +187,18 @@ public class SpaceEventHandler
|
|||
private boolean consumeO2(ItemStack[] i,EntityPlayerMP ent)
|
||||
{
|
||||
for (int j = 0; j < i.length; ++j)
|
||||
if (i[j] != null && i[j].itemID == WarpDriveConfig.i.IC2_Air[0] && i[j].getItemDamage() == WarpDriveConfig.i.IC2_Air[1])
|
||||
if (i[j] != null && i[j].itemID == WarpDriveConfig.IC2_Air[0] && i[j].getItemDamage() == WarpDriveConfig.IC2_Air[1])
|
||||
{
|
||||
if (--i[j].stackSize <= 0)
|
||||
{
|
||||
i[j] = null;
|
||||
}
|
||||
|
||||
if(WarpDriveConfig.i.IC2_Empty.length != 0)
|
||||
if(WarpDriveConfig.IC2_Empty.length != 0)
|
||||
{
|
||||
WarpDrive.debugPrint("giveEmptyCell");
|
||||
int emptyCell = WarpDriveConfig.i.IC2_Empty[0];
|
||||
int emptyCellM = WarpDriveConfig.i.IC2_Empty[1];
|
||||
int emptyCell = WarpDriveConfig.IC2_Empty[0];
|
||||
int emptyCellM = WarpDriveConfig.IC2_Empty[1];
|
||||
ItemStack emptyCellIS = new ItemStack(emptyCell,1,emptyCellM);
|
||||
if(!ent.inventory.addItemStackToInventory(emptyCellIS))
|
||||
{
|
||||
|
|
|
@ -156,8 +156,7 @@ public class SpaceGenerator extends ChunkProviderGenerate implements IChunkProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3,
|
||||
int var4)
|
||||
public List getPossibleCreatures(EnumCreatureType var1, int var2, int var3, int var4)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.WarpDrive;
|
|||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import java.util.Random;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
|
@ -76,7 +73,7 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
generateGasCloudOfColor(world, x, y, z, 6, 11, random.nextInt(12));
|
||||
}
|
||||
// Quartz asteroid
|
||||
else if (WarpDriveConfig.i.isAELoaded && random.nextInt(20000) == 1)
|
||||
else if (WarpDriveConfig.isAELoaded && random.nextInt(20000) == 1)
|
||||
{
|
||||
generateAsteroidOfBlock(world, x, y, z, 4, 6, WarpDriveConfig.i.getAEBlock("blkQuartzOre").itemID, WarpDriveConfig.i.getAEBlock("blkQuartzOre").getItemDamage());
|
||||
if (random.nextBoolean())
|
||||
|
@ -180,7 +177,7 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
|
||||
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, WarpDriveConfig.i.gasID, color, hollow, true);
|
||||
EntitySphereGen esg = new EntitySphereGen(world, x, y, z, radius, WarpDriveConfig.gasID, color, hollow, true);
|
||||
esg.xCoord = x;
|
||||
esg.yCoord = y;
|
||||
esg.zCoord = z;
|
||||
|
@ -216,13 +213,6 @@ public class SpaceWorldGenerator implements IWorldGenerator
|
|||
generateAsteroid(world, x, y, z, asteroidSizeMax, centerRadiusMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asteroid field generator
|
||||
* @param world мир
|
||||
* @param x координата центра поля
|
||||
* @param y координата центра поля
|
||||
* @param z координата центра поля
|
||||
*/
|
||||
public void generateAsteroidField(World world, int x, int y, int z)
|
||||
{
|
||||
int numOfAsteroids = 15 + world.rand.nextInt(30);
|
||||
|
|
|
@ -145,7 +145,7 @@ public class WarpCoresRegistry
|
|||
double d5 = c.zCoord - core.zCoord;
|
||||
double distance = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
|
||||
if (distance <= (2 * WarpDriveConfig.i.WC_MAX_SHIP_SIDE) - 1)
|
||||
if (distance <= (2 * WarpDriveConfig.WC_MAX_SHIP_SIDE) - 1)
|
||||
{
|
||||
// Check for warpfields intersections
|
||||
core.prepareToJump(); // calculate spatial parameters
|
||||
|
@ -171,7 +171,7 @@ public class WarpCoresRegistry
|
|||
ArrayList<TileEntityReactor> oldRegistry = (ArrayList<TileEntityReactor>) registry.clone();
|
||||
|
||||
for (TileEntityReactor c : registry)
|
||||
if (c == null || c.worldObj == null || c.worldObj.getBlockId(c.xCoord, c.yCoord, c.zCoord) != WarpDriveConfig.i.coreID || c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord) != c || 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) != WarpDriveConfig.coreID || c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord) != c || c.worldObj.getBlockTileEntity(c.xCoord, c.yCoord, c.zCoord).isInvalid())
|
||||
oldRegistry.remove(c);
|
||||
|
||||
// Update old registry to new witout dead cores
|
||||
|
|
|
@ -3,11 +3,7 @@ package cr0s.WarpDrive;
|
|||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
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.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.ServerStarting;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
|
@ -16,50 +12,16 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
|||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cr0s.WarpDrive.machines.BlockAirGenerator;
|
||||
import cr0s.WarpDrive.machines.BlockCamera;
|
||||
import cr0s.WarpDrive.machines.BlockCloakingCoil;
|
||||
import cr0s.WarpDrive.machines.BlockCloakingDeviceCore;
|
||||
import cr0s.WarpDrive.machines.BlockLaser;
|
||||
import cr0s.WarpDrive.machines.BlockLaserCam;
|
||||
import cr0s.WarpDrive.machines.BlockLaserTreeFarm;
|
||||
import cr0s.WarpDrive.machines.BlockLift;
|
||||
import cr0s.WarpDrive.machines.BlockMiningLaser;
|
||||
import cr0s.WarpDrive.machines.BlockMonitor;
|
||||
import cr0s.WarpDrive.machines.BlockParticleBooster;
|
||||
import cr0s.WarpDrive.machines.BlockProtocol;
|
||||
import cr0s.WarpDrive.machines.BlockRadar;
|
||||
import cr0s.WarpDrive.machines.BlockReactor;
|
||||
import cr0s.WarpDrive.machines.BlockShipScanner;
|
||||
import cr0s.WarpDrive.machines.BlockWarpIsolation;
|
||||
import cr0s.WarpDrive.machines.TileEntityAirGenerator;
|
||||
import cr0s.WarpDrive.machines.TileEntityCamera;
|
||||
import cr0s.WarpDrive.machines.TileEntityCloakingDeviceCore;
|
||||
import cr0s.WarpDrive.machines.TileEntityLaser;
|
||||
import cr0s.WarpDrive.machines.TileEntityLaserTreeFarm;
|
||||
import cr0s.WarpDrive.machines.TileEntityLift;
|
||||
import cr0s.WarpDrive.machines.TileEntityMiningLaser;
|
||||
import cr0s.WarpDrive.machines.TileEntityMonitor;
|
||||
import cr0s.WarpDrive.machines.TileEntityParticleBooster;
|
||||
import cr0s.WarpDrive.machines.TileEntityProtocol;
|
||||
import cr0s.WarpDrive.machines.TileEntityRadar;
|
||||
import cr0s.WarpDrive.machines.TileEntityReactor;
|
||||
import cr0s.WarpDrive.machines.TileEntityShipScanner;
|
||||
import cr0s.WarpDrive.machines.WarpChunkTE;
|
||||
import cr0s.WarpDrive.machines.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
@ -100,6 +62,7 @@ public class WarpDrive implements LoadingCallback {
|
|||
public static Block scannerBlock;
|
||||
public static Block cloakBlock;
|
||||
public static Block cloakCoilBlock;
|
||||
public static Block transporterBlock;
|
||||
|
||||
public static Block airBlock;
|
||||
public static Block gasBlock;
|
||||
|
@ -134,7 +97,6 @@ public class WarpDrive implements LoadingCallback {
|
|||
private ArrayList<Ticket> warpTickets = new ArrayList<Ticket>();
|
||||
|
||||
@EventHandler
|
||||
// @PreInit
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
WarpDriveConfig.Init(new Configuration(event
|
||||
.getSuggestedConfigurationFile()));
|
||||
|
@ -151,16 +113,16 @@ public class WarpDrive implements LoadingCallback {
|
|||
System.out.println(out);
|
||||
}
|
||||
|
||||
@Init
|
||||
@EventHandler
|
||||
public void load(FMLInitializationEvent event) {
|
||||
WarpDriveConfig.i.Init2();
|
||||
|
||||
// CORE CONTROLLER
|
||||
this.protocolBlock = new BlockProtocol(WarpDriveConfig.i.controllerID,
|
||||
0, Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Warp Controller");
|
||||
protocolBlock = new BlockProtocol(WarpDriveConfig.controllerID,0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Warp Controller");
|
||||
|
||||
LanguageRegistry.addName(protocolBlock, "Warp Controller");
|
||||
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
|
||||
|
@ -168,173 +130,203 @@ public class WarpDrive implements LoadingCallback {
|
|||
"protocolBlock");
|
||||
|
||||
// WARP CORE
|
||||
this.warpCore = new BlockReactor(WarpDriveConfig.i.coreID, 0, Material.rock).setHardness(0.5F).setStepSound(Block.soundMetalFootstep).setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Warp Core");
|
||||
warpCore = new BlockReactor(WarpDriveConfig.coreID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Warp Core");
|
||||
|
||||
LanguageRegistry.addName(warpCore, "Warp Core");
|
||||
GameRegistry.registerBlock(warpCore, "warpCore");
|
||||
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
|
||||
|
||||
// WARP RADAR
|
||||
this.radarBlock = new BlockRadar(WarpDriveConfig.i.radarID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("W-Radar");
|
||||
radarBlock = new BlockRadar(WarpDriveConfig.radarID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("W-Radar");
|
||||
|
||||
LanguageRegistry.addName(radarBlock, "W-Radar");
|
||||
GameRegistry.registerBlock(radarBlock, "radarBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
|
||||
|
||||
// WARP ISOLATION
|
||||
this.isolationBlock = new BlockWarpIsolation(
|
||||
WarpDriveConfig.i.isolationID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Warp-Field Isolation Block");
|
||||
isolationBlock = new BlockWarpIsolation( WarpDriveConfig.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");
|
||||
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
|
||||
|
||||
// AIR GENERATOR
|
||||
this.airgenBlock = new BlockAirGenerator(WarpDriveConfig.i.airgenID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Air Generator");
|
||||
airgenBlock = new BlockAirGenerator(WarpDriveConfig.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");
|
||||
GameRegistry.registerTileEntity(TileEntityAirGenerator.class,"airgenBlock");
|
||||
|
||||
// AIR BLOCK
|
||||
this.airBlock = (new BlockAir(WarpDriveConfig.i.airID)).setHardness(
|
||||
0.0F).setUnlocalizedName("Air block");
|
||||
airBlock = (new BlockAir(WarpDriveConfig.airID))
|
||||
.setHardness(0.0F)
|
||||
.setUnlocalizedName("Air block");
|
||||
|
||||
LanguageRegistry.addName(airBlock, "Air block");
|
||||
GameRegistry.registerBlock(airBlock, "airBlock");
|
||||
|
||||
// GAS BLOCK
|
||||
this.gasBlock = (new BlockGas(WarpDriveConfig.i.gasID)).setHardness(
|
||||
0.0F).setUnlocalizedName("Gas block");
|
||||
gasBlock = (new BlockGas(WarpDriveConfig.gasID))
|
||||
.setHardness(0.0F)
|
||||
.setUnlocalizedName("Gas block");
|
||||
|
||||
LanguageRegistry.addName(gasBlock, "Gas block");
|
||||
GameRegistry.registerBlock(gasBlock, "gasBlock");
|
||||
|
||||
// LASER EMITTER
|
||||
this.laserBlock = new BlockLaser(WarpDriveConfig.i.laserID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Emitter");
|
||||
laserBlock = new BlockLaser(WarpDriveConfig.laserID, 0,Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Emitter");
|
||||
LanguageRegistry.addName(laserBlock, "Laser Emitter");
|
||||
GameRegistry.registerBlock(laserBlock, "laserBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
|
||||
|
||||
// LASER EMITTER WITH CAMERA
|
||||
this.laserCamBlock = new BlockLaserCam(WarpDriveConfig.i.laserCamID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Emitter + Camera");
|
||||
laserCamBlock = new BlockLaserCam(WarpDriveConfig.laserCamID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Emitter + Camera");
|
||||
LanguageRegistry.addName(laserCamBlock, "Laser Emitter + Camera");
|
||||
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
|
||||
|
||||
// CAMERA
|
||||
this.cameraBlock = new BlockCamera(WarpDriveConfig.i.camID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Camera block");
|
||||
cameraBlock = new BlockCamera(WarpDriveConfig.camID, 0,Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Camera block");
|
||||
|
||||
LanguageRegistry.addName(cameraBlock, "Camera");
|
||||
GameRegistry.registerBlock(cameraBlock, "cameraBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
|
||||
|
||||
// MONITOR
|
||||
this.monitorBlock = new BlockMonitor(WarpDriveConfig.i.monitorID)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Monitor");
|
||||
monitorBlock = new BlockMonitor(WarpDriveConfig.monitorID)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Monitor");
|
||||
|
||||
LanguageRegistry.addName(monitorBlock, "Monitor");
|
||||
GameRegistry.registerBlock(monitorBlock, "monitorBlock");
|
||||
GameRegistry
|
||||
.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
|
||||
|
||||
// MINING LASER
|
||||
this.miningLaserBlock = new BlockMiningLaser(
|
||||
WarpDriveConfig.i.miningLaserID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Mining Laser");
|
||||
miningLaserBlock = new BlockMiningLaser(WarpDriveConfig.miningLaserID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Mining Laser");
|
||||
|
||||
LanguageRegistry.addName(miningLaserBlock, "Mining Laser");
|
||||
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityMiningLaser.class,
|
||||
"miningLaserBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
|
||||
|
||||
// LASER TREE FARM
|
||||
this.laserTreeFarmBlock = new BlockLaserTreeFarm(WarpDriveConfig.i.laserTreeFarmID,0,Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Tree Farm");
|
||||
laserTreeFarmBlock = new BlockLaserTreeFarm(WarpDriveConfig.laserTreeFarmID,0,Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser Tree Farm");
|
||||
|
||||
LanguageRegistry.addName(laserTreeFarmBlock, "Laser Tree Farm");
|
||||
GameRegistry.registerBlock(laserTreeFarmBlock, "laserTreeFarmBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class,"laserTreeFarmBlock");
|
||||
|
||||
// PARTICLE BOOSTER
|
||||
this.boosterBlock = new BlockParticleBooster(
|
||||
WarpDriveConfig.i.particleBoosterID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Particle Booster");
|
||||
boosterBlock = new BlockParticleBooster(WarpDriveConfig.particleBoosterID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Particle Booster");
|
||||
|
||||
LanguageRegistry.addName(boosterBlock, "Particle Booster");
|
||||
GameRegistry.registerBlock(boosterBlock, "boosterBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityParticleBooster.class,
|
||||
"boosterBlock");
|
||||
|
||||
// LASER LIFT
|
||||
this.liftBlock = new BlockLift(WarpDriveConfig.i.liftID, 0,
|
||||
Material.rock).setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser lift");
|
||||
liftBlock = new BlockLift(WarpDriveConfig.liftID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Laser lift");
|
||||
|
||||
LanguageRegistry.addName(liftBlock, "Laser lift");
|
||||
GameRegistry.registerBlock(liftBlock, "liftBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
|
||||
|
||||
// IRIDIUM BLOCK
|
||||
this.iridiumBlock = new BlockIridium(WarpDriveConfig.i.iridiumID)
|
||||
.setHardness(0.8F).setResistance(150 * 4)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Block of Iridium");
|
||||
iridiumBlock = new BlockIridium(WarpDriveConfig.iridiumID)
|
||||
.setHardness(0.8F)
|
||||
.setResistance(150 * 4)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Block of Iridium");
|
||||
|
||||
LanguageRegistry.addName(iridiumBlock, "Block of Iridium");
|
||||
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
|
||||
|
||||
// SHIP SCANNER
|
||||
this.scannerBlock = new BlockShipScanner(WarpDriveConfig.i.shipScannerID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Ship Scanner");
|
||||
scannerBlock = new BlockShipScanner(WarpDriveConfig.shipScannerID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Ship Scanner");
|
||||
|
||||
LanguageRegistry.addName(scannerBlock, "Ship Scanner");
|
||||
GameRegistry.registerBlock(scannerBlock, "scannerBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityShipScanner.class, "scannerBlock");
|
||||
|
||||
// CLOAKING DEVICE CORE
|
||||
this.cloakBlock = new BlockCloakingDeviceCore(WarpDriveConfig.i.cloakCoreID, 0, Material.rock)
|
||||
.setHardness(0.5F).setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone).setUnlocalizedName("Cloaking Device Core");
|
||||
cloakBlock = new BlockCloakingDeviceCore(WarpDriveConfig.cloakCoreID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Cloaking Device Core");
|
||||
|
||||
LanguageRegistry.addName(cloakBlock, "Cloaking Device Core");
|
||||
GameRegistry.registerBlock(cloakBlock, "cloakBlock");
|
||||
GameRegistry.registerTileEntity(TileEntityCloakingDeviceCore.class, "cloakBlock");
|
||||
|
||||
// CLOAKING DEVICE COIL
|
||||
this.cloakCoilBlock = new BlockCloakingCoil(WarpDriveConfig.i.cloakCoilID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Cloaking Device Coil");
|
||||
cloakCoilBlock = new BlockCloakingCoil(WarpDriveConfig.cloakCoilID, 0, Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Cloaking Device Coil");
|
||||
|
||||
LanguageRegistry.addName(cloakCoilBlock, "Cloaking Device Coil");
|
||||
GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock");
|
||||
GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock");
|
||||
|
||||
// TRANSPORTER
|
||||
transporterBlock = new BlockTransporter(WarpDriveConfig.transporterID,Material.rock)
|
||||
.setHardness(0.5F)
|
||||
.setStepSound(Block.soundMetalFootstep)
|
||||
.setCreativeTab(CreativeTabs.tabRedstone)
|
||||
.setUnlocalizedName("Transporter");
|
||||
|
||||
LanguageRegistry.addName(transporterBlock, "Transporter");
|
||||
GameRegistry.registerBlock(transporterBlock, "transporter");
|
||||
GameRegistry.registerTileEntity(TileEntityTransporter.class,"transporter");
|
||||
|
||||
proxy.registerEntities();
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance);
|
||||
|
@ -352,102 +344,102 @@ public class WarpDrive implements LoadingCallback {
|
|||
}
|
||||
}
|
||||
|
||||
@PostInit
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
space = DimensionManager.getWorld(spaceDimID);
|
||||
hyperSpace = DimensionManager.getWorld(hyperSpaceDimID);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'c',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi",
|
||||
"cii", 'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'c',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'f',
|
||||
WarpDriveConfig.i.getIC2Item("frequencyTransmitter"));
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'f', WarpDriveConfig.i.getIC2Item("frequencyTransmitter"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi",
|
||||
"iii", 'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'd',
|
||||
Block.blockDiamond);
|
||||
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'd', Block.blockDiamond);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll",
|
||||
'l', Block.leaves, 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'c',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
'l', Block.leaves,
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa",
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"), 'a',
|
||||
WarpDriveConfig.i.getIC2Item("advancedAlloy"), 's',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"),
|
||||
's', WarpDriveConfig.i.getIC2Item("advancedCircuit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama",
|
||||
"ccc", 'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("miner"));
|
||||
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc",
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("miner"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(boosterBlock), "afc", "ama",
|
||||
"cfa", 'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"), 'f',
|
||||
WarpDriveConfig.i.getIC2Item("glassFiberCableItem"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("mfeUnit"));
|
||||
GameRegistry.addRecipe(new ItemStack(boosterBlock), "afc", "ama", "cfa",
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"),
|
||||
'f', WarpDriveConfig.i.getIC2Item("glassFiberCableItem"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("mfeUnit"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(liftBlock), "aca", "ama", "a#a",
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'a',
|
||||
WarpDriveConfig.i.getIC2Item("advancedAlloy"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("magnetizer"));
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("magnetizer"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii",
|
||||
"iii", 'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"));
|
||||
GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"));
|
||||
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(WarpDriveConfig.i
|
||||
.getIC2Item("iridiumPlate").getItem(), 9), new ItemStack(
|
||||
iridiumBlock));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(WarpDriveConfig.i.getIC2Item("iridiumPlate").getItem(), 9),
|
||||
new ItemStack(iridiumBlock));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(laserCamBlock), "imi", "cec",
|
||||
"#k#", 'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'm',
|
||||
WarpDriveConfig.i.getIC2Item("advancedMachine"), 'c',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'e',
|
||||
laserBlock, 'k', cameraBlock);
|
||||
GameRegistry.addRecipe(new ItemStack(laserCamBlock), "imi", "cec", "#k#",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'e', laserBlock,
|
||||
'k', cameraBlock);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc",
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"), 'c',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'g',
|
||||
Block.glass);
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'g', Block.glass);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg",
|
||||
"ggg", 'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'g',
|
||||
Block.glass);
|
||||
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg",
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'g', Block.glass);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm",
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"), 'a',
|
||||
WarpDriveConfig.i.getIC2Item("advancedAlloy"), 's',
|
||||
WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'g', Block.glass);
|
||||
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"),
|
||||
's', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'g', Block.glass);
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock),false,new Object[] {
|
||||
"cwc", "wmw", "cwc",
|
||||
'c', WarpDriveConfig.i.getIC2Item("electronicCircuit"),
|
||||
'w', "logWood",
|
||||
'm', miningLaserBlock }));
|
||||
"cwc", "wmw", "cwc",
|
||||
'c', WarpDriveConfig.i.getIC2Item("electronicCircuit"),
|
||||
'w', "logWood",
|
||||
'm', miningLaserBlock }));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(cloakBlock),
|
||||
"imi",
|
||||
"mcm",
|
||||
"imi",
|
||||
'i', iridiumBlock, 'c', cloakCoilBlock, 'm', WarpDriveConfig.i.getIC2Item("advancedMachine"));
|
||||
GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi",
|
||||
'i', iridiumBlock,
|
||||
'c', cloakCoilBlock,
|
||||
'm', WarpDriveConfig.i.getIC2Item("advancedMachine"));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(cloakCoilBlock),
|
||||
"iai",
|
||||
"aca",
|
||||
"iai",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"), 'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"), 'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"));
|
||||
GameRegistry.addRecipe(new ItemStack(cloakCoilBlock), "iai", "aca", "iai",
|
||||
'i', WarpDriveConfig.i.getIC2Item("iridiumPlate"),
|
||||
'c', WarpDriveConfig.i.getIC2Item("advancedCircuit"),
|
||||
'a', WarpDriveConfig.i.getIC2Item("advancedAlloy"));
|
||||
|
||||
registry = new WarpCoresRegistry();
|
||||
|
||||
|
@ -457,23 +449,21 @@ public class WarpDrive implements LoadingCallback {
|
|||
}
|
||||
|
||||
private void registerSpaceDimension() {
|
||||
spaceBiome = (new BiomeSpace(23)).setColor(0).setDisableRain()
|
||||
.setBiomeName("Space");
|
||||
spaceBiome = (new BiomeSpace(23))
|
||||
.setColor(0)
|
||||
.setDisableRain()
|
||||
.setBiomeName("Space");
|
||||
this.spaceProviderID = 14;
|
||||
DimensionManager.registerProviderType(this.spaceProviderID,
|
||||
SpaceProvider.class, true);
|
||||
DimensionManager.registerProviderType(this.spaceProviderID, SpaceProvider.class, true);
|
||||
this.spaceDimID = DimensionManager.getNextFreeDimId();
|
||||
DimensionManager.registerDimension(this.spaceDimID,
|
||||
this.spaceProviderID);
|
||||
DimensionManager.registerDimension(this.spaceDimID, this.spaceProviderID);
|
||||
}
|
||||
|
||||
private void registerHyperSpaceDimension() {
|
||||
this.hyperSpaceProviderID = 15;
|
||||
DimensionManager.registerProviderType(this.hyperSpaceProviderID,
|
||||
HyperSpaceProvider.class, true);
|
||||
DimensionManager.registerProviderType(this.hyperSpaceProviderID, HyperSpaceProvider.class, true);
|
||||
this.hyperSpaceDimID = DimensionManager.getNextFreeDimId();
|
||||
DimensionManager.registerDimension(this.hyperSpaceDimID,
|
||||
this.hyperSpaceProviderID);
|
||||
DimensionManager.registerDimension(this.hyperSpaceDimID, this.hyperSpaceProviderID);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -514,14 +504,10 @@ public class WarpDrive implements LoadingCallback {
|
|||
return t;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarpDrive.debugPrint("Ticket not granted");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WarpDrive.debugPrint("No tickets left!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -562,14 +548,6 @@ public class WarpDrive implements LoadingCallback {
|
|||
public void ticketsLoaded(List<Ticket> tickets, World world)
|
||||
{
|
||||
for (Ticket ticket : tickets)
|
||||
{
|
||||
warpTickets.add(ticket);
|
||||
ImmutableSet chunks = ticket.getChunkList();
|
||||
for(Object chunk : chunks)
|
||||
if(chunk instanceof ChunkCoordIntPair)
|
||||
ForgeChunkManager.unforceChunk(ticket,(ChunkCoordIntPair)chunk);
|
||||
ForgeChunkManager.releaseTicket(ticket);
|
||||
//ForgeChunkManager.releaseTicket(ticket);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,9 @@
|
|||
package cr0s.WarpDrive;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Random;
|
||||
import java.lang.reflect.*;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
@ -20,86 +16,91 @@ public class WarpDriveConfig
|
|||
{
|
||||
public static WarpDriveConfig i;
|
||||
private Configuration config;
|
||||
public int coreID, controllerID, radarID, isolationID, airID, airgenID, gasID, laserID, miningLaserID, particleBoosterID, liftID, laserCamID, camID, monitorID, iridiumID, shipScannerID, cloakCoreID, cloakCoilID;
|
||||
public int laserTreeFarmID;
|
||||
public static int coreID, controllerID, radarID, isolationID, airID, airgenID, gasID, laserID, miningLaserID, particleBoosterID, liftID, laserCamID, camID, monitorID, iridiumID, shipScannerID, cloakCoreID, cloakCoilID;
|
||||
public static int laserTreeFarmID, transporterID;
|
||||
//
|
||||
public boolean isGregLoaded = false, isAELoaded = false, isAdvSolPanelLoaded = false, isASLoaded = false, isAEExtraLoaded = false, isICBMLoaded = false, isMFFSLoaded = false, isGraviSuiteLoaded = false;
|
||||
public static boolean isGregLoaded = false, isAELoaded = false, isAdvSolPanelLoaded = false, isASLoaded = false, isAEExtraLoaded = false, isICBMLoaded = false, isMFFSLoaded = false, isGraviSuiteLoaded = false;
|
||||
//
|
||||
public int[] IC2_Air;
|
||||
public int[] IC2_Empty;
|
||||
public int IC2_RubberTree;
|
||||
public ItemStack IC2_Resin;
|
||||
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;
|
||||
public Set<Integer> SpaceHelmets, Jetpacks, MinerOres, MinerLogs, MinerLeaves, scannerIgnoreBlocks;
|
||||
private Class<?> AEBlocks;
|
||||
private Class<?> AEMaterials;
|
||||
private Class<?> AEItems;
|
||||
public ArrayList<int[]> CommonWorldGenOres;
|
||||
public Item AEExtraFDI;
|
||||
public static int[] IC2_Air;
|
||||
public static int[] IC2_Empty;
|
||||
public static int IC2_RubberTree;
|
||||
public static ItemStack IC2_Resin;
|
||||
public static 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;
|
||||
public static Set<Integer> SpaceHelmets, Jetpacks, MinerOres, MinerLogs, MinerLeaves, scannerIgnoreBlocks;
|
||||
private static Class<?> AEBlocks;
|
||||
private static Class<?> AEMaterials;
|
||||
private static Class<?> AEItems;
|
||||
public static ArrayList<int[]> CommonWorldGenOres;
|
||||
public static Item AEExtraFDI;
|
||||
|
||||
public boolean debugMode = false;
|
||||
|
||||
// Mod config
|
||||
// Warp Core
|
||||
public int WC_MAX_ENERGY_VALUE = 100000000;
|
||||
public int WC_ENERGY_PER_BLOCK_MODE1 = 10; // eU
|
||||
public int WC_ENERGY_PER_DISTANCE_MODE1 = 100; // eU
|
||||
public int WC_ENERGY_PER_BLOCK_MODE2 = 1000; // eU
|
||||
public int WC_ENERGY_PER_DISTANCE_MODE2 = 1000; // eU
|
||||
public int WC_ENERGY_PER_ENTITY_TO_SPACE = 1000000; // eU
|
||||
public int WC_MAX_JUMP_DISTANCE = 128; // Maximum jump length value
|
||||
public int WC_MAX_SHIP_VOLUME_ON_SURFACE = 15000; // Maximum ship mass to jump on earth (15k blocks)
|
||||
public int WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE = 500; // Minimum ship volume value for
|
||||
public int WC_MAX_SHIP_SIDE = 100;
|
||||
public int WC_COOLDOWN_INTERVAL_SECONDS = 4;
|
||||
public int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
|
||||
public int WC_ISOLATION_UPDATE_INTARVAL_SECONDS = 10;
|
||||
public static int WC_MAX_ENERGY_VALUE = 100000000;
|
||||
public static int WC_ENERGY_PER_BLOCK_MODE1 = 10; // eU
|
||||
public static int WC_ENERGY_PER_DISTANCE_MODE1 = 100; // eU
|
||||
public static int WC_ENERGY_PER_BLOCK_MODE2 = 1000; // eU
|
||||
public static int WC_ENERGY_PER_DISTANCE_MODE2 = 1000; // eU
|
||||
public static int WC_ENERGY_PER_ENTITY_TO_SPACE = 1000000; // eU
|
||||
public static int WC_MAX_JUMP_DISTANCE = 128; // Maximum jump length value
|
||||
public static int WC_MAX_SHIP_VOLUME_ON_SURFACE = 15000; // Maximum ship mass to jump on earth (15k blocks)
|
||||
public static int WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE = 500; // Minimum ship volume value for
|
||||
public static int WC_MAX_SHIP_SIDE = 100;
|
||||
public static int WC_COOLDOWN_INTERVAL_SECONDS = 4;
|
||||
public static int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
|
||||
public static int WC_ISOLATION_UPDATE_INTARVAL_SECONDS = 10;
|
||||
|
||||
// Warp Radar
|
||||
public int WR_MAX_ENERGY_VALUE = 100000000; // 100kk eU
|
||||
public static int WR_MAX_ENERGY_VALUE = 100000000; // 100kk eU
|
||||
|
||||
// Particle Booster
|
||||
public int PB_MAX_ENERGY_VALUE = 100000;
|
||||
public static int PB_MAX_ENERGY_VALUE = 100000;
|
||||
|
||||
// Mining Laser
|
||||
public int ML_MAX_BOOSTERS_NUMBER = 1;
|
||||
public int ML_SCAN_DELAY = 20 * 5;
|
||||
public int ML_MINE_DELAY = 10;
|
||||
public int ML_EU_PER_LAYER_SPACE = 100;
|
||||
public int ML_EU_PER_LAYER_EARTH = 2500;
|
||||
public int ML_EU_PER_BLOCK_SPACE = 10;
|
||||
public int ML_EU_PER_BLOCK_EARTH = 50;
|
||||
public double ML_EU_MUL_SILKTOUCH = 2.5;
|
||||
public double ML_EU_MUL_FORTUNE = 1.5;
|
||||
public double ML_MAX_SPEED = 10;
|
||||
public double ML_MIN_SPEED = 0.1;
|
||||
public int ML_MAX_SIZE = 128;
|
||||
public static int ML_MAX_BOOSTERS_NUMBER = 1;
|
||||
public static int ML_SCAN_DELAY = 20 * 5;
|
||||
public static int ML_MINE_DELAY = 10;
|
||||
public static int ML_EU_PER_LAYER_SPACE = 100;
|
||||
public static int ML_EU_PER_LAYER_EARTH = 2500;
|
||||
public static int ML_EU_PER_BLOCK_SPACE = 10;
|
||||
public static int ML_EU_PER_BLOCK_EARTH = 50;
|
||||
public static double ML_EU_MUL_SILKTOUCH = 2.5;
|
||||
public static double ML_EU_MUL_FORTUNE = 1.5;
|
||||
public static double ML_MAX_SPEED = 10;
|
||||
public static double ML_MIN_SPEED = 0.1;
|
||||
public static int ML_MAX_SIZE = 128;
|
||||
|
||||
//Tree farm
|
||||
public int TF_MAX_SIZE=32;
|
||||
public static int TF_MAX_SIZE=32;
|
||||
|
||||
//Transporter
|
||||
public static int TR_MAX_ENERGY=1000000;
|
||||
public static boolean TR_RELATIVE_COORDS=false;
|
||||
public static double TR_EU_PER_METRE=100;
|
||||
|
||||
// Laser Emitter
|
||||
public int LE_MAX_BOOSTERS_NUMBER = 10;
|
||||
public int LE_MAX_LASER_ENERGY = 4000000;
|
||||
public int LE_EMIT_DELAY_TICKS = 20 * 3;
|
||||
public int LE_EMIT_SCAN_DELAY_TICKS = 10;
|
||||
public double LE_COLLECT_ENERGY_MULTIPLIER = 0.60D;
|
||||
public int LE_BEAM_LENGTH_PER_ENERGY_DIVIDER = 5000;
|
||||
public int LE_ENTITY_HIT_SET_ON_FIRE_TIME = 100;
|
||||
public int LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER = 10000;
|
||||
public int LE_ENTITY_HIT_EXPLOSION_LASER_ENERGY = 1000000;
|
||||
public int LE_BLOCK_HIT_CONSUME_ENERGY = 70000;
|
||||
public int LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE = 1000;
|
||||
public int LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE = 10;
|
||||
public static int LE_MAX_BOOSTERS_NUMBER = 10;
|
||||
public static int LE_MAX_LASER_ENERGY = 4000000;
|
||||
public static int LE_EMIT_DELAY_TICKS = 20 * 3;
|
||||
public static int LE_EMIT_SCAN_DELAY_TICKS = 10;
|
||||
public static double LE_COLLECT_ENERGY_MULTIPLIER = 0.60D;
|
||||
public static int LE_BEAM_LENGTH_PER_ENERGY_DIVIDER = 5000;
|
||||
public static int LE_ENTITY_HIT_SET_ON_FIRE_TIME = 100;
|
||||
public static int LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER = 10000;
|
||||
public static int LE_ENTITY_HIT_EXPLOSION_LASER_ENERGY = 1000000;
|
||||
public static int LE_BLOCK_HIT_CONSUME_ENERGY = 70000;
|
||||
public static int LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE = 1000;
|
||||
public static int LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE = 10;
|
||||
|
||||
public String schemaLocation = "/home/cros/mc_site/schematics/";
|
||||
public static String schemaLocation = "/home/cros/mc_site/schematics/";
|
||||
|
||||
// Cloaking device core
|
||||
public int CD_MAX_CLOAKING_FIELD_SIDE = 100;
|
||||
public int CD_ENERGY_PER_BLOCK_TIER1 = 1000;
|
||||
public int CD_ENERGY_PER_BLOCK_TIER2 = 5000;
|
||||
public int CD_FIELD_REFRESH_INTERVAL_SECONDS = 10;
|
||||
public int CD_COIL_CAPTURE_BLOCKS = 5;
|
||||
public static int CD_MAX_CLOAKING_FIELD_SIDE = 100;
|
||||
public static int CD_ENERGY_PER_BLOCK_TIER1 = 1000;
|
||||
public static int CD_ENERGY_PER_BLOCK_TIER2 = 5000;
|
||||
public static int CD_FIELD_REFRESH_INTERVAL_SECONDS = 10;
|
||||
public static int CD_COIL_CAPTURE_BLOCKS = 5;
|
||||
|
||||
private WarpDriveConfig() {}
|
||||
|
||||
|
@ -226,6 +227,11 @@ public class WarpDriveConfig
|
|||
|
||||
// Tree Farm
|
||||
TF_MAX_SIZE = config.get("TreeFarm", "max_treefarm_size", 16).getInt();
|
||||
|
||||
// Transporter
|
||||
TR_MAX_ENERGY = config.get("Transporter", "max_energy", 1000000).getInt();
|
||||
TR_RELATIVE_COORDS = config.get("Transporter", "relative_coords", true).getBoolean(true);
|
||||
TR_EU_PER_METRE = config.get("Transporter", "eu_per_ent_per_metre", 100).getDouble(100);
|
||||
}
|
||||
|
||||
public void Init2()
|
||||
|
@ -265,6 +271,7 @@ public class WarpDriveConfig
|
|||
cloakCoreID = config.getBlock("cloakcore", 517).getInt();
|
||||
cloakCoilID = config.getBlock("cloakcoil", 518).getInt();
|
||||
laserTreeFarmID = config.getBlock("lasertreefarm", 519).getInt();
|
||||
transporterID = config.getBlock("transporter", 520).getInt();
|
||||
|
||||
LoadIC2();
|
||||
LoadCC();
|
||||
|
|
|
@ -25,7 +25,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
@Override
|
||||
public boolean generate(World world, Random rand, int i, int j, int k)
|
||||
{
|
||||
if (WarpDriveConfig.i.isAdvSolPanelLoaded)
|
||||
if (WarpDriveConfig.isAdvSolPanelLoaded)
|
||||
solarType = rand.nextInt(2);
|
||||
|
||||
ItemStack cableType = WarpDriveConfig.i.getIC2Item("copperCableBlock").copy();
|
||||
|
@ -218,7 +218,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
world.setBlock(i + 7, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 7, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 7, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||
world.setBlock(i + 7, j + 6, k + 7, WarpDriveConfig.i.ASP, solarType, 0);
|
||||
world.setBlock(i + 7, j + 6, k + 7, WarpDriveConfig.ASP, solarType, 0);
|
||||
world.setBlock(i + 7, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 7, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 7, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
|
@ -251,7 +251,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
world.setBlock(i + 8, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 8, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 8, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||
world.setBlock(i + 8, j + 6, k + 7, WarpDriveConfig.i.ASP, solarType, 0);
|
||||
world.setBlock(i + 8, j + 6, k + 7, WarpDriveConfig.ASP, solarType, 0);
|
||||
world.setBlock(i + 8, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 8, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 8, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
|
@ -286,9 +286,9 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
world.setBlock(i + 9, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 9, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 9, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||
world.setBlock(i + 9, j + 6, k + 7, WarpDriveConfig.i.ASP, solarType, 0);
|
||||
world.setBlock(i + 9, j + 6, k + 7, WarpDriveConfig.ASP, solarType, 0);
|
||||
// Placing air generator
|
||||
world.setBlock(i + 9, j + 5, k + 7, WarpDriveConfig.i.airgenID, 0, 0);
|
||||
world.setBlock(i + 9, j + 5, k + 7, WarpDriveConfig.airgenID, 0, 0);
|
||||
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 + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
|
@ -326,9 +326,9 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
world.setBlock(i + 10, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 10, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 10, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||
world.setBlock(i + 10, j + 6, k + 7, WarpDriveConfig.i.ASP, solarType, 0);
|
||||
world.setBlock(i + 10, j + 6, k + 7, WarpDriveConfig.ASP, solarType, 0);
|
||||
// Placing air generator
|
||||
world.setBlock(i + 10, j + 5, k + 7, WarpDriveConfig.i.airgenID, 0, 0);
|
||||
world.setBlock(i + 10, j + 5, k + 7, WarpDriveConfig.airgenID, 0, 0);
|
||||
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 + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
|
@ -362,7 +362,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
// Place warp-controller
|
||||
if (rand.nextBoolean())
|
||||
{
|
||||
world.setBlock(i + 11, j + 3, k + 7, WarpDriveConfig.i.controllerID);
|
||||
world.setBlock(i + 11, j + 3, k + 7, WarpDriveConfig.controllerID);
|
||||
}
|
||||
|
||||
world.setBlock(i + 11, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
||||
|
@ -384,7 +384,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
world.setBlock(i + 11, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 11, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 11, j + 6, k + 6, cableType.itemID, cableType.getItemDamage(), 0);
|
||||
world.setBlock(i + 11, j + 6, k + 7, WarpDriveConfig.i.ASP, solarType, 0);
|
||||
world.setBlock(i + 11, j + 6, k + 7, WarpDriveConfig.ASP, solarType, 0);
|
||||
world.setBlock(i + 11, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 11, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
world.setBlock(i + 11, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
|
||||
|
@ -418,7 +418,7 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
// Place warp-core
|
||||
if (rand.nextBoolean())
|
||||
{
|
||||
world.setBlock(i + 12, j + 3, k + 7, WarpDriveConfig.i.coreID);
|
||||
world.setBlock(i + 12, j + 3, k + 7, WarpDriveConfig.coreID);
|
||||
}
|
||||
|
||||
world.setBlock(i + 12, j + 3, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
|
||||
|
@ -586,11 +586,12 @@ public class WorldGenSmallShip extends WorldGenerator
|
|||
if (te != null)
|
||||
{
|
||||
TileEntityChest chest = (TileEntityChest)te;
|
||||
int numBonuses = rand.nextInt(28);
|
||||
int size = chest.getSizeInventory();
|
||||
int numBonuses = rand.nextInt(size) / 2;
|
||||
|
||||
for (int i = 0; i < chest.getSizeInventory(); i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (rand.nextInt(15) == 0)
|
||||
if (rand.nextInt(size) <= numBonuses)
|
||||
{
|
||||
numBonuses--;
|
||||
chest.setInventorySlotContents(i, getRandomBonus(rand));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -8,7 +7,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -8,7 +7,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -8,7 +7,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -8,7 +7,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -17,8 +15,6 @@ public class BlockLaserTreeFarm extends BlockContainer
|
|||
{
|
||||
private Icon[] iconBuffer;
|
||||
|
||||
private final int ICON_SIDE = 0;
|
||||
|
||||
public BlockLaserTreeFarm(int id, int texture, Material material)
|
||||
{
|
||||
super(id, material);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -8,7 +7,6 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -17,8 +15,6 @@ public class BlockMiningLaser extends BlockContainer
|
|||
{
|
||||
private Icon[] iconBuffer;
|
||||
|
||||
private final int ICON_SIDE = 0;
|
||||
|
||||
public BlockMiningLaser(int id, int texture, Material material)
|
||||
{
|
||||
super(id, material);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
@ -10,18 +8,13 @@ import cr0s.WarpDrive.ClientCameraUtils;
|
|||
import cr0s.WarpDrive.EntityCamera;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockMonitor extends BlockContainer
|
||||
|
|
|
@ -4,7 +4,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
|
|
70
src/cr0s/WarpDrive/machines/BlockTransporter.java
Normal file
70
src/cr0s/WarpDrive/machines/BlockTransporter.java
Normal file
|
@ -0,0 +1,70 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockTransporter extends BlockContainer
|
||||
{
|
||||
|
||||
private Icon[] iconBuffer;
|
||||
|
||||
public BlockTransporter(int par1, Material par2Material)
|
||||
{
|
||||
super(par1, par2Material);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileEntityTransporter();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IconRegister par1IconRegister)
|
||||
{
|
||||
iconBuffer = new Icon[3];
|
||||
// Solid textures
|
||||
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:transporterBottom");
|
||||
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:transporterTop");
|
||||
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:transporterSide");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(int side, int metadata)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
{
|
||||
return iconBuffer[side];
|
||||
}
|
||||
|
||||
return iconBuffer[2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity of items to drop on block destruction.
|
||||
*/
|
||||
@Override
|
||||
public int quantityDropped(Random par1Random)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public int idDropped(int par1, Random par2Random, int par3)
|
||||
{
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,12 +6,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockWarpIsolation extends Block
|
||||
{
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import appeng.api.IAEItemStack;
|
||||
import appeng.api.Util;
|
||||
import appeng.api.WorldCoord;
|
||||
|
@ -22,14 +17,11 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import cr0s.WarpDrive.WarpDriveConfig;
|
||||
|
||||
public abstract class TileEntityAbstractMiner extends TileEntityAbstractLaser implements IGridMachine, ITileCable
|
||||
|
|
|
@ -67,37 +67,37 @@ public class TileEntityAirGenerator extends TileEntity implements IEnergySink
|
|||
{
|
||||
if (worldObj.isAirBlock(xCoord + 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord + 1, yCoord, zCoord, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord + 1, yCoord, zCoord, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(xCoord - 1, yCoord, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord - 1, yCoord, zCoord, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord - 1, yCoord, zCoord, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord, yCoord + 1, zCoord, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord - 1, zCoord) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord, yCoord - 1, zCoord, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord, yCoord - 1, zCoord, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord, zCoord + 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord + 1, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord + 1, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
|
||||
if (worldObj.isAirBlock(xCoord, yCoord, zCoord - 1) && (currentEnergyValue - EU_PER_AIRBLOCK >= 0))
|
||||
{
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord - 1, WarpDriveConfig.i.airID, START_CONCENTRATION_VALUE, 2);
|
||||
worldObj.setBlock(xCoord, yCoord, zCoord - 1, WarpDriveConfig.airID, START_CONCENTRATION_VALUE, 2);
|
||||
currentEnergyValue -= EU_PER_AIRBLOCK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.WarpDrive.machines;
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.CamRegistryItem;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
|
@ -11,38 +10,16 @@ import dan200.computer.api.IPeripheral;
|
|||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.network.packet.Packet62LevelSound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityCamera extends TileEntity implements IPeripheral
|
||||
{
|
||||
private int dx, dz, dy;
|
||||
private float yaw, pitch; // laser direction
|
||||
|
||||
private int frequency = -1; // beam frequency
|
||||
private float r, g, b; // beam color (corresponds to frequency)
|
||||
|
||||
private boolean isEmitting = false;
|
||||
|
||||
private String[] methodsArray =
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.CloakManager;
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import cr0s.WarpDrive.WarpDriveConfig;
|
||||
|
@ -15,39 +12,12 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implements IEnergySink,
|
||||
IPeripheral {
|
||||
public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implements IEnergySink, IPeripheral
|
||||
{
|
||||
public boolean addedToEnergyNet = false;
|
||||
|
||||
private final int MAX_ENERGY_VALUE = 500000000; // 500kk eU
|
||||
|
@ -58,8 +28,7 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
"getEnergyLevel", // 2
|
||||
"enableCloakingField", // 3 enables field if assembled right
|
||||
"disableCloakingField", // 4 disables cloaking field
|
||||
"fieldFrequency" // 5 fieldFrequency(int)
|
||||
};
|
||||
"fieldFrequency" };
|
||||
|
||||
public boolean isEnabled = false;
|
||||
public byte tier = 1; // cloaking field tier, 1 or 2
|
||||
|
@ -77,61 +46,76 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!addedToEnergyNet && !this.tileEntityInvalid) {
|
||||
if (!addedToEnergyNet && !this.tileEntityInvalid)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||
addedToEnergyNet = true;
|
||||
}
|
||||
|
||||
// Reset sound timer
|
||||
if (soundTicks++ >= 40) {
|
||||
if (soundTicks++ >= 40)
|
||||
{
|
||||
this.soundTicks = 0;
|
||||
this.soundPlayed = false;
|
||||
}
|
||||
|
||||
if (--this.updateTicks <= 0) {
|
||||
//System.out.println("[CloakDev] Updating cloaking state...");
|
||||
this.updateTicks = ((this.tier == 1) ? 20 : (tier == 2) ? 10 : 20) * WarpDriveConfig.i.CD_FIELD_REFRESH_INTERVAL_SECONDS; // resetting timer
|
||||
if (--this.updateTicks <= 0)
|
||||
{
|
||||
//WarpDrive.debugPrint("[CloakDev] Updating cloaking state...");
|
||||
this.updateTicks = ((this.tier == 1) ? 20 : (tier == 2) ? 10 : 20) * WarpDriveConfig.CD_FIELD_REFRESH_INTERVAL_SECONDS; // resetting timer
|
||||
|
||||
if (validateAssembly() && isEnabled) {
|
||||
if (validateAssembly() && isEnabled)
|
||||
{
|
||||
// Consume power for sustaining cloaking field
|
||||
countBlocksAndConsumeEnergy();
|
||||
|
||||
if (currentEnergyValue >= 0) {
|
||||
if (!WarpDrive.instance.cloaks.isAreaExists(this.frequency)) {
|
||||
if (currentEnergyValue >= 0)
|
||||
{
|
||||
if (!WarpDrive.instance.cloaks.isAreaExists(this.frequency))
|
||||
{
|
||||
WarpDrive.instance.cloaks.addCloakedAreaWorld(worldObj, minX, minY, minZ, maxX, maxY, maxZ, frequency, tier);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
|
||||
if (!soundPlayed) {
|
||||
if (!soundPlayed)
|
||||
{
|
||||
soundPlayed = true;
|
||||
worldObj.playSoundEffect(xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, "warpdrive:cl", 4F, 1F);
|
||||
}
|
||||
|
||||
// Enable coils
|
||||
setCoilsState(true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Refresh the field
|
||||
CloakedArea area = WarpDrive.instance.cloaks.getCloakedArea(frequency);
|
||||
if (area != null)
|
||||
area.sendCloakPacketToPlayersEx(false); // recloak field
|
||||
}
|
||||
} else {
|
||||
System.out.println("[CloakDev] Low power, cloak field collapsing...");
|
||||
}
|
||||
else
|
||||
{
|
||||
WarpDrive.debugPrint("[CloakDev] Low power, cloak field collapsing...");
|
||||
currentEnergyValue = 0;
|
||||
setCoilsState(false);
|
||||
disableCloakingField();
|
||||
}
|
||||
} else if (!validateAssembly() && isEnabled) {
|
||||
System.out.println("[CloakDev] Device lost coils, field collapsing");
|
||||
}
|
||||
else if (!validateAssembly() && isEnabled)
|
||||
{
|
||||
WarpDrive.debugPrint("[CloakDev] Device lost coils, field collapsing");
|
||||
currentEnergyValue = 0;
|
||||
setCoilsState(false);
|
||||
disableCloakingField();
|
||||
}
|
||||
}
|
||||
|
||||
if (laserDrawingTicks++ > 100) {
|
||||
if (laserDrawingTicks++ > 100)
|
||||
{
|
||||
laserDrawingTicks = 0;
|
||||
|
||||
if (isEnabled)
|
||||
|
@ -139,8 +123,8 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
}
|
||||
}
|
||||
|
||||
public void setCoilsState(boolean enabled) {
|
||||
final int START_LENGTH = 2; // Step length from core block to main coils
|
||||
public void setCoilsState(boolean enabled)
|
||||
{
|
||||
|
||||
// Directions to check (all six directions: left, right, up, down, front, back)
|
||||
byte[] dx = { 1, -1, 0, 0, 0, 0 };
|
||||
|
@ -151,34 +135,45 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
searchCoilInDirectionAndSetState(dx[i], dy[i], dz[i], enabled);
|
||||
}
|
||||
|
||||
public void searchCoilInDirectionAndSetState(byte dx, byte dy, byte dz, boolean state) {
|
||||
for (int i = 0; i < WarpDriveConfig.i.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.i.cloakCoilID)
|
||||
public void searchCoilInDirectionAndSetState(byte dx, byte dy, byte dz, boolean state)
|
||||
{
|
||||
for (int i = 0; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++)
|
||||
{
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.cloakCoilID)
|
||||
worldObj.setBlockMetadataWithNotify(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz, (state) ? 1 : 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public void searchCoilInDirectionAndDrawLaser(byte dx, byte dy, byte dz) {
|
||||
public void searchCoilInDirectionAndDrawLaser(byte dx, byte dy, byte dz)
|
||||
{
|
||||
final int START_LENGTH = 2;
|
||||
float r = 0.0f, g = 1.0f, b = 0;
|
||||
if (this.tier == 1) {
|
||||
if (this.tier == 1)
|
||||
{
|
||||
r = 0.0f; g = 1.0f;
|
||||
} else if (this.tier == 2) {
|
||||
}
|
||||
else if (this.tier == 2)
|
||||
{
|
||||
r = 1.0f; g = 0.0f;
|
||||
}
|
||||
|
||||
for (int i = START_LENGTH + 1; i < WarpDriveConfig.i.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.i.cloakCoilID)
|
||||
for (int i = START_LENGTH + 1; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++)
|
||||
{
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.cloakCoilID)
|
||||
sendLaserPacket(new Vector3(this).translate(0.5), new Vector3(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz).translate(0.5), r, g, b, 110, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLasers() {
|
||||
public void drawLasers()
|
||||
{
|
||||
final int START_LENGTH = 2;
|
||||
float r = 0.0f, g = 1.0f, b = 0;
|
||||
if (this.tier == 1) {
|
||||
if (this.tier == 1)
|
||||
{
|
||||
r = 0.0f; g = 1.0f;
|
||||
} else if (this.tier == 2) {
|
||||
}
|
||||
else if (this.tier == 2)
|
||||
{
|
||||
r = 1.0f; g = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -190,9 +185,12 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
for (int k = 0; k < 6; k++)
|
||||
searchCoilInDirectionAndDrawLaser(dx[k], dy[k], dz[k]);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int j = 0; j < 6; j++) {
|
||||
switch (worldObj.rand.nextInt(6)) {
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
switch (worldObj.rand.nextInt(6))
|
||||
{
|
||||
case 0:
|
||||
r = 1.0f;
|
||||
g = b = 0;
|
||||
|
@ -224,29 +222,32 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
}
|
||||
}
|
||||
|
||||
public void disableCloakingField() {
|
||||
public void disableCloakingField()
|
||||
{
|
||||
this.isEnabled = false;
|
||||
|
||||
if (WarpDrive.instance.cloaks.isAreaExists(this.frequency))
|
||||
WarpDrive.instance.cloaks.removeCloakedArea(this.frequency);
|
||||
|
||||
if (!soundPlayed) {
|
||||
if (!soundPlayed)
|
||||
{
|
||||
soundPlayed = true;
|
||||
worldObj.playSoundEffect(xCoord + 0.5f, yCoord + 0.5f, zCoord + 0.5f, "warpdrive:dcl", 4F, 1F);
|
||||
}
|
||||
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
|
||||
}
|
||||
public void countBlocksAndConsumeEnergy() {
|
||||
public void countBlocksAndConsumeEnergy()
|
||||
{
|
||||
int blocksCount = 0;
|
||||
for (int y = minY; y <= maxY; y++)
|
||||
for (int x = minX; x <= maxX; x++)
|
||||
for(int z = minZ; z <= maxZ; z++)
|
||||
if (worldObj.getBlockId(x, y, z) != 0)
|
||||
blocksCount++;
|
||||
int energyToConsume = blocksCount * ((this.tier == 1) ? WarpDriveConfig.i.CD_ENERGY_PER_BLOCK_TIER1 : WarpDriveConfig.i.CD_ENERGY_PER_BLOCK_TIER2);
|
||||
int energyToConsume = blocksCount * ((this.tier == 1) ? WarpDriveConfig.CD_ENERGY_PER_BLOCK_TIER1 : WarpDriveConfig.CD_ENERGY_PER_BLOCK_TIER2);
|
||||
|
||||
//System.out.println("[CloakDev] Consuming " + energyToConsume + " eU for " + blocksCount + " blocks");
|
||||
//WarpDrive.debugPrint("[CloakDev] Consuming " + energyToConsume + " eU for " + blocksCount + " blocks");
|
||||
this.currentEnergyValue -= energyToConsume;
|
||||
}
|
||||
|
||||
|
@ -257,7 +258,8 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tag);
|
||||
this.currentEnergyValue = tag.getInteger("energy");
|
||||
this.tier = tag.getByte("tier");
|
||||
|
@ -266,7 +268,8 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
public void writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tag);
|
||||
tag.setInteger("energy", this.getCurrentEnergyValue());
|
||||
tag.setByte("tier", this.tier);
|
||||
|
@ -274,15 +277,18 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
tag.setBoolean("enabled", this.isEnabled);
|
||||
}
|
||||
|
||||
public int searchCoilInDirection(byte dx, byte dy, byte dz) {
|
||||
for (int i = 3; i < WarpDriveConfig.i.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.i.cloakCoilID)
|
||||
public int searchCoilInDirection(byte dx, byte dy, byte dz)
|
||||
{
|
||||
for (int i = 3; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++)
|
||||
{
|
||||
if (worldObj.getBlockId(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz) == WarpDriveConfig.cloakCoilID)
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public boolean validateAssembly() {
|
||||
public boolean validateAssembly()
|
||||
{
|
||||
final int START_LENGTH = 2; // Step length from core block to main coils
|
||||
|
||||
// Directions to check (all six directions: left, right, up, down, front, back)
|
||||
|
@ -291,24 +297,30 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
byte[] dz = { 0, 0, 0, 0, -1, 1 };
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
if (worldObj.getBlockId(xCoord + START_LENGTH * dx[i], yCoord + START_LENGTH * dy[i], zCoord + START_LENGTH * dz[i]) != WarpDriveConfig.i.cloakCoilID)
|
||||
if (worldObj.getBlockId(xCoord + START_LENGTH * dx[i], yCoord + START_LENGTH * dy[i], zCoord + START_LENGTH * dz[i]) != WarpDriveConfig.cloakCoilID)
|
||||
return false;
|
||||
|
||||
// Check cloaking field parameters defining coils
|
||||
this.left = searchCoilInDirection((byte)1, (byte)0, (byte)0) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.left == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.right = searchCoilInDirection((byte)-1, (byte)0, (byte)0) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.right == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.left = searchCoilInDirection((byte)1, (byte)0, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.left == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
this.right = searchCoilInDirection((byte)-1, (byte)0, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.right == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
|
||||
this.up = searchCoilInDirection((byte)0, (byte)1, (byte)0) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.up == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.down = searchCoilInDirection((byte)0, (byte)-1, (byte)0) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.down == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.up = searchCoilInDirection((byte)0, (byte)1, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.up == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
this.down = searchCoilInDirection((byte)0, (byte)-1, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.down == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
|
||||
this.front = searchCoilInDirection((byte)0, (byte)0, (byte)1) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.front == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.back = searchCoilInDirection((byte)0, (byte)0, (byte)-1) + WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.back == WarpDriveConfig.i.CD_COIL_CAPTURE_BLOCKS) return false;
|
||||
this.front = searchCoilInDirection((byte)0, (byte)0, (byte)1) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.front == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
this.back = searchCoilInDirection((byte)0, (byte)0, (byte)-1) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
|
||||
if (this.back == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS)
|
||||
return false;
|
||||
|
||||
int x1 = 0, x2 = 0, z1 = 0, z2 = 0;
|
||||
|
||||
|
@ -318,17 +330,21 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
x1 = xCoord - this.right;
|
||||
x2 = xCoord + this.left;
|
||||
|
||||
if (x1 < x2) {
|
||||
if (x1 < x2)
|
||||
{
|
||||
this.minX = x1;this. maxX = x2;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
this.minX = x2; this.maxX = x1;
|
||||
}
|
||||
|
||||
if (z1 < z2) {
|
||||
if (z1 < z2)
|
||||
{
|
||||
this.minZ = z1; this.maxZ = z2;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
this.minZ = z2; this.maxZ = z1;
|
||||
}
|
||||
|
||||
|
@ -341,97 +357,101 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
// CC
|
||||
// IPeripheral methods implementation
|
||||
@Override
|
||||
public String getType() {
|
||||
public String getType()
|
||||
{
|
||||
return "cloakingdevicecore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames() {
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return methodsArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context,
|
||||
int method, Object[] arguments) throws Exception {
|
||||
switch (method) {
|
||||
case 0: // setFieldTier(1 or 2)
|
||||
try
|
||||
{
|
||||
if (arguments.length >= 1)
|
||||
{
|
||||
tier = (byte) clamp(toInt(arguments[0]),1,2);
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
tier = 1;
|
||||
}
|
||||
return new Object[] { tier };
|
||||
case 1: // isAssemblyValid()
|
||||
return new Object[] { (boolean)validateAssembly() };
|
||||
|
||||
case 2: // getEnergyLevel()
|
||||
return new Object[] { currentEnergyValue };
|
||||
|
||||
case 3: // enableCloakingField()
|
||||
this.isEnabled = true;
|
||||
return new Object[] { true };
|
||||
|
||||
case 4: // disableCloakingField()
|
||||
disableCloakingField();
|
||||
setCoilsState(false);
|
||||
return new Object[] { false };
|
||||
|
||||
case 5: // setFieldFrequency(int)
|
||||
if (arguments.length == 1)
|
||||
{
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
case 0: // setFieldTier(1 or 2)
|
||||
try
|
||||
{
|
||||
if (isEnabled)
|
||||
disableCloakingField();
|
||||
|
||||
if (WarpDrive.instance.cloaks.isAreaExists(toInt(arguments[0])))
|
||||
return new Object[] { this.frequency };
|
||||
|
||||
this.frequency = toInt(arguments[0]);
|
||||
return new Object[] { this.frequency };
|
||||
if (arguments.length >= 1)
|
||||
{
|
||||
tier = (byte) clamp(toInt(arguments[0]),1,2);
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
return new Object[] { false };
|
||||
tier = 1;
|
||||
}
|
||||
}
|
||||
return new Object[] { this.frequency };
|
||||
}
|
||||
|
||||
return new Object[] { tier };
|
||||
case 1: // isAssemblyValid()
|
||||
return new Object[] { (boolean)validateAssembly() };
|
||||
|
||||
case 2: // getEnergyLevel()
|
||||
return new Object[] { currentEnergyValue };
|
||||
|
||||
case 3: // enableCloakingField()
|
||||
this.isEnabled = true;
|
||||
return new Object[] { true };
|
||||
|
||||
case 4: // disableCloakingField()
|
||||
disableCloakingField();
|
||||
setCoilsState(false);
|
||||
return new Object[] { false };
|
||||
|
||||
case 5: // setFieldFrequency(int)
|
||||
if (arguments.length == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isEnabled)
|
||||
disableCloakingField();
|
||||
|
||||
if (WarpDrive.instance.cloaks.isAreaExists(toInt(arguments[0])))
|
||||
return new Object[] { this.frequency };
|
||||
|
||||
this.frequency = toInt(arguments[0]);
|
||||
return new Object[] { this.frequency };
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
return new Object[] { false };
|
||||
}
|
||||
}
|
||||
return new Object[] { this.frequency };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttachToSide(int side) {
|
||||
public boolean canAttachToSide(int side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer) {
|
||||
}
|
||||
public void attach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {
|
||||
}
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
// IEnergySink methods implementation
|
||||
@Override
|
||||
public double demandedEnergyUnits() {
|
||||
public double demandedEnergyUnits()
|
||||
{
|
||||
return (MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount) {
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
{
|
||||
double leftover = 0;
|
||||
currentEnergyValue += Math.round(amount);
|
||||
|
||||
if (getCurrentEnergyValue() > MAX_ENERGY_VALUE) {
|
||||
if (getCurrentEnergyValue() > MAX_ENERGY_VALUE)
|
||||
{
|
||||
leftover = (getCurrentEnergyValue() - MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = MAX_ENERGY_VALUE;
|
||||
}
|
||||
|
@ -440,44 +460,51 @@ public class TileEntityCloakingDeviceCore extends TileEntityAbstractLaser implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput() {
|
||||
public int getMaxSafeInput()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter,
|
||||
ForgeDirection direction) {
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter,ForgeDirection direction)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentEnergyValue
|
||||
*/
|
||||
public int getCurrentEnergyValue() {
|
||||
public int getCurrentEnergyValue()
|
||||
{
|
||||
return currentEnergyValue;
|
||||
}
|
||||
|
||||
public int collectAllEnergy() {
|
||||
public int collectAllEnergy()
|
||||
{
|
||||
int energy = currentEnergyValue;
|
||||
currentEnergyValue = 0;
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
if (addedToEnergyNet) {
|
||||
public void onChunkUnload()
|
||||
{
|
||||
if (addedToEnergyNet)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||
addedToEnergyNet = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
if (addedToEnergyNet) {
|
||||
public void invalidate()
|
||||
{
|
||||
if (addedToEnergyNet)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||
addedToEnergyNet = false;
|
||||
}
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package cr0s.WarpDrive.machines;
|
|||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.CamRegistryItem;
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
|
@ -13,17 +12,14 @@ import dan200.computer.api.IPeripheral;
|
|||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.network.packet.Packet62LevelSound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
@ -32,9 +28,6 @@ import net.minecraft.util.MathHelper;
|
|||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.ChunkPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityLaser extends TileEntityAbstractLaser implements IPeripheral
|
||||
{
|
||||
|
@ -89,11 +82,11 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
}
|
||||
}
|
||||
|
||||
if (isEmitting && (frequency != 1420 && ++delayTicks > WarpDriveConfig.i.LE_EMIT_DELAY_TICKS) || ((frequency == 1420) && ++delayTicks > WarpDriveConfig.i.LE_EMIT_SCAN_DELAY_TICKS))
|
||||
if (isEmitting && (frequency != 1420 && ++delayTicks > WarpDriveConfig.LE_EMIT_DELAY_TICKS) || ((frequency == 1420) && ++delayTicks > WarpDriveConfig.LE_EMIT_SCAN_DELAY_TICKS))
|
||||
{
|
||||
delayTicks = 0;
|
||||
isEmitting = false;
|
||||
emitBeam(Math.min(this.collectEnergyFromBoosters() + MathHelper.floor_double(energyFromOtherBeams * WarpDriveConfig.i.LE_COLLECT_ENERGY_MULTIPLIER), WarpDriveConfig.i.LE_MAX_LASER_ENERGY));
|
||||
emitBeam(Math.min(this.collectEnergyFromBoosters() + MathHelper.floor_double(energyFromOtherBeams * WarpDriveConfig.LE_COLLECT_ENERGY_MULTIPLIER), WarpDriveConfig.LE_MAX_LASER_ENERGY));
|
||||
energyFromOtherBeams = 0;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +110,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
|
||||
if (findFirstBooster() != null)
|
||||
{
|
||||
for (int shift = 1; shift <= WarpDriveConfig.i.LE_MAX_BOOSTERS_NUMBER; shift++)
|
||||
for (int shift = 1; shift <= WarpDriveConfig.LE_MAX_BOOSTERS_NUMBER; shift++)
|
||||
{
|
||||
int newX = xCoord + (dx * shift);
|
||||
int newY = yCoord + (dy * shift);
|
||||
|
@ -142,7 +135,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
private void emitBeam(int energy)
|
||||
{
|
||||
// Beam power calculations
|
||||
int beamLengthBlocks = energy / WarpDriveConfig.i.LE_BEAM_LENGTH_PER_ENERGY_DIVIDER;
|
||||
int beamLengthBlocks = energy / WarpDriveConfig.LE_BEAM_LENGTH_PER_ENERGY_DIVIDER;
|
||||
WarpDrive.debugPrint("Energy: " + energy + " | beamLengthBlocks: " + beamLengthBlocks);
|
||||
|
||||
if (energy == 0 || beamLengthBlocks < 1)
|
||||
|
@ -150,7 +143,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
return;
|
||||
}
|
||||
|
||||
Vector3 beamVector = new Vector3(this).add(0.5);
|
||||
Vector3 beamVector = new Vector3(this).translate(0.5);
|
||||
WarpDrive.debugPrint("beamVector: " + beamVector);
|
||||
float yawz = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float yawx = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
|
||||
|
@ -205,16 +198,16 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
{
|
||||
if (distanceToEntity <= beamLengthBlocks)
|
||||
{
|
||||
((EntityLivingBase)e).setFire(WarpDriveConfig.i.LE_ENTITY_HIT_SET_ON_FIRE_TIME);
|
||||
((EntityLivingBase)e).attackEntityFrom(DamageSource.inFire, energy / WarpDriveConfig.i.LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER);
|
||||
((EntityLivingBase)e).setFire(WarpDriveConfig.LE_ENTITY_HIT_SET_ON_FIRE_TIME);
|
||||
((EntityLivingBase)e).attackEntityFrom(DamageSource.inFire, energy / WarpDriveConfig.LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER);
|
||||
|
||||
if (energy > WarpDriveConfig.i.LE_ENTITY_HIT_EXPLOSION_LASER_ENERGY)
|
||||
if (energy > WarpDriveConfig.LE_ENTITY_HIT_EXPLOSION_LASER_ENERGY)
|
||||
{
|
||||
worldObj.newExplosion(null, e.posX, e.posY, e.posZ, 4F, true, true);
|
||||
}
|
||||
|
||||
// consume energy
|
||||
energy -= WarpDriveConfig.i.LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER + (10 * distanceToEntity);
|
||||
energy -= WarpDriveConfig.LE_ENTITY_HIT_DAMAGE_PER_ENERGY_DIVIDER + (10 * distanceToEntity);
|
||||
endPoint = new Vector3(entityHit.hitVec);
|
||||
break;
|
||||
}
|
||||
|
@ -250,7 +243,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
}
|
||||
|
||||
// Hit is a laser head
|
||||
if (blockID == WarpDriveConfig.i.laserID || blockID == WarpDriveConfig.i.laserCamID)
|
||||
if (blockID == WarpDriveConfig.laserID || blockID == WarpDriveConfig.laserCamID)
|
||||
{
|
||||
// Compare frequencies
|
||||
TileEntityLaser tel = (TileEntityLaser)worldObj.getBlockTileEntity(hit.blockX, hit.blockY, hit.blockZ);
|
||||
|
@ -269,7 +262,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
endPoint = new Vector3(hit.hitVec);
|
||||
}
|
||||
|
||||
energy -= WarpDriveConfig.i.LE_BLOCK_HIT_CONSUME_ENERGY + (resistance * WarpDriveConfig.i.LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE) + (distance * WarpDriveConfig.i.LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE);
|
||||
energy -= WarpDriveConfig.LE_BLOCK_HIT_CONSUME_ENERGY + (resistance * WarpDriveConfig.LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE) + (distance * WarpDriveConfig.LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE);
|
||||
endPoint = new Vector3(hit.hitVec);
|
||||
|
||||
if (energy <= 0)
|
||||
|
@ -352,7 +345,7 @@ public class TileEntityLaser extends TileEntityAbstractLaser implements IPeriphe
|
|||
|
||||
public boolean isWithCamera()
|
||||
{
|
||||
return (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDriveConfig.i.laserCamID);
|
||||
return (worldObj.getBlockId(xCoord, yCoord, zCoord) == WarpDriveConfig.laserCamID);
|
||||
}
|
||||
|
||||
public int getFrequency()
|
||||
|
|
|
@ -119,7 +119,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner implements
|
|||
{
|
||||
if(isRoomForHarvest())
|
||||
{
|
||||
if(blockID == WarpDriveConfig.i.IC2_RubberTree)
|
||||
if(blockID == WarpDriveConfig.IC2_RubberTree)
|
||||
{
|
||||
int metadata = worldObj.getBlockMetadata(pos.intX(), pos.intY(), pos.intZ());
|
||||
if(metadata >= 2 && metadata <= 5)
|
||||
|
@ -127,7 +127,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner implements
|
|||
WarpDrive.debugPrint("wetspot found");
|
||||
if(collectEnergyPacketFromBooster(cost,false))
|
||||
{
|
||||
ItemStack resin = WarpDriveConfig.i.IC2_Resin.copy();
|
||||
ItemStack resin = WarpDriveConfig.IC2_Resin.copy();
|
||||
resin.stackSize = (int) Math.round(Math.random() * 4);
|
||||
dumpToInv(resin);
|
||||
worldObj.setBlockMetadataWithNotify(pos.intX(), pos.intY(), pos.intZ(), metadata+6, 3);
|
||||
|
@ -175,12 +175,12 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner implements
|
|||
|
||||
private boolean isLog(int blockID)
|
||||
{
|
||||
return WarpDriveConfig.i.MinerLogs.contains(blockID);
|
||||
return WarpDriveConfig.MinerLogs.contains(blockID);
|
||||
}
|
||||
|
||||
private boolean isLeaf(int blockID)
|
||||
{
|
||||
return WarpDriveConfig.i.MinerLeaves.contains(blockID);
|
||||
return WarpDriveConfig.MinerLeaves.contains(blockID);
|
||||
}
|
||||
|
||||
private void addTree(ArrayList<Vector3> list,Vector3 newTree)
|
||||
|
@ -316,13 +316,13 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner implements
|
|||
{
|
||||
if(arguments.length == 1)
|
||||
{
|
||||
xSize = clamp(toInt(arguments[0]),3,WarpDriveConfig.i.TF_MAX_SIZE);
|
||||
xSize = clamp(toInt(arguments[0]),3,WarpDriveConfig.TF_MAX_SIZE);
|
||||
zSize = xSize;
|
||||
}
|
||||
else if(arguments.length == 2)
|
||||
{
|
||||
xSize = clamp(toInt(arguments[0]),3,WarpDriveConfig.i.TF_MAX_SIZE);
|
||||
zSize = clamp(toInt(arguments[1]),3,WarpDriveConfig.i.TF_MAX_SIZE);
|
||||
xSize = clamp(toInt(arguments[0]),3,WarpDriveConfig.TF_MAX_SIZE);
|
||||
zSize = clamp(toInt(arguments[1]),3,WarpDriveConfig.TF_MAX_SIZE);
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
|
|
|
@ -1,30 +1,18 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityLift extends TileEntityAbstractLaser implements IEnergySink
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.ArrayList;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IPeripheral
|
||||
{
|
||||
protected final int laserBelow = 0;
|
||||
|
@ -29,16 +28,16 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
@Override
|
||||
protected int calculateLayerCost()
|
||||
{
|
||||
return isOnEarth() ? WarpDriveConfig.i.ML_EU_PER_LAYER_EARTH : WarpDriveConfig.i.ML_EU_PER_LAYER_SPACE;
|
||||
return isOnEarth() ? WarpDriveConfig.ML_EU_PER_LAYER_EARTH : WarpDriveConfig.ML_EU_PER_LAYER_SPACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int calculateBlockCost()
|
||||
{
|
||||
int enPerBlock = isOnEarth() ? WarpDriveConfig.i.ML_EU_PER_BLOCK_EARTH : WarpDriveConfig.i.ML_EU_PER_BLOCK_SPACE;
|
||||
int enPerBlock = isOnEarth() ? WarpDriveConfig.ML_EU_PER_BLOCK_EARTH : WarpDriveConfig.ML_EU_PER_BLOCK_SPACE;
|
||||
if(silkTouch())
|
||||
return (int) Math.round(enPerBlock * WarpDriveConfig.i.ML_EU_MUL_SILKTOUCH * speedMul);
|
||||
return (int) Math.round(enPerBlock * (Math.pow(WarpDriveConfig.i.ML_EU_MUL_FORTUNE, fortune())) * speedMul);
|
||||
return (int) Math.round(enPerBlock * WarpDriveConfig.ML_EU_MUL_SILKTOUCH * speedMul);
|
||||
return (int) Math.round(enPerBlock * (Math.pow(WarpDriveConfig.ML_EU_MUL_FORTUNE, fortune())) * speedMul);
|
||||
}
|
||||
|
||||
private String[] methodsArray =
|
||||
|
@ -79,12 +78,12 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
currentLayer = yCoord - 1;
|
||||
if(speedMul == 0)
|
||||
speedMul = 1;
|
||||
speedMul = Math.max(WarpDriveConfig.i.ML_MIN_SPEED,Math.min(WarpDriveConfig.i.ML_MAX_SPEED,speedMul));
|
||||
speedMul = clamp(speedMul,WarpDriveConfig.ML_MIN_SPEED,WarpDriveConfig.ML_MAX_SPEED);
|
||||
if (isMining)
|
||||
{
|
||||
if (currentMode == 0)
|
||||
{
|
||||
if (++delayTicksScan > (WarpDriveConfig.i.ML_SCAN_DELAY / speedMul))
|
||||
if (++delayTicksScan > (WarpDriveConfig.ML_SCAN_DELAY / speedMul))
|
||||
{
|
||||
delayTicksScan = 0;
|
||||
valuablesInLayer.clear();
|
||||
|
@ -114,13 +113,13 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
}
|
||||
else
|
||||
{
|
||||
if (++delayTicksMine > ((WarpDriveConfig.i.ML_MINE_DELAY / speedMul) + miningDelay))
|
||||
if (++delayTicksMine > ((WarpDriveConfig.ML_MINE_DELAY / speedMul) + miningDelay))
|
||||
{
|
||||
delayTicksMine = 0;
|
||||
int energyReq = calculateBlockCost();
|
||||
if (collectEnergyPacketFromBooster(energyReq,true) && valuableIndex < valuablesInLayer.size())
|
||||
{
|
||||
//System.out.println("[ML] Mining: " + (valuableIndex + 1) + "/" + valuablesInLayer.size());
|
||||
//WarpDrive.debugPrint("[ML] Mining: " + (valuableIndex + 1) + "/" + valuablesInLayer.size());
|
||||
Vector3 valuable = valuablesInLayer.get(valuableIndex);
|
||||
// Mine valuable ore
|
||||
int blockID = worldObj.getBlockId(valuable.intX(), valuable.intY(), valuable.intZ());
|
||||
|
@ -131,7 +130,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
return;
|
||||
}
|
||||
|
||||
if((WarpDriveConfig.i.MinerOres.contains(blockID) || isQuarry) && isRoomForHarvest())
|
||||
if((WarpDriveConfig.MinerOres.contains(blockID) || isQuarry) && isRoomForHarvest())
|
||||
{
|
||||
if(collectEnergyPacketFromBooster(energyReq,false))
|
||||
{
|
||||
|
@ -165,7 +164,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
|
||||
private void scanLayer()
|
||||
{
|
||||
//System.out.println("Scanning layer");
|
||||
//WarpDrive.debugPrint("Scanning layer");
|
||||
valuablesInLayer.clear();
|
||||
int xmax, zmax, x1, x2, z1, z2;
|
||||
int xmin, zmin;
|
||||
|
@ -210,12 +209,12 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
valuablesInLayer.add(new Vector3(x, currentLayer, z));
|
||||
}
|
||||
else // Not-quarry collect only valuables blocks
|
||||
if (WarpDriveConfig.i.MinerOres.contains(worldObj.getBlockId(x, currentLayer, z)))
|
||||
if (WarpDriveConfig.MinerOres.contains(worldObj.getBlockId(x, currentLayer, z)))
|
||||
valuablesInLayer.add(new Vector3(x, currentLayer, z));
|
||||
}
|
||||
|
||||
valuableIndex = 0;
|
||||
//System.out.println("[ML] Found " + valuablesInLayer.size() + " valuables");
|
||||
//WarpDrive.debugPrint("[ML] Found " + valuablesInLayer.size() + " valuables");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -276,8 +275,8 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
{
|
||||
if(arguments.length >= 2)
|
||||
{
|
||||
digX = Math.min(toInt(arguments[0]),WarpDriveConfig.i.ML_MAX_SIZE);
|
||||
digZ = Math.min(toInt(arguments[1]),WarpDriveConfig.i.ML_MAX_SIZE);
|
||||
digX = Math.min(toInt(arguments[0]),WarpDriveConfig.ML_MAX_SIZE);
|
||||
digZ = Math.min(toInt(arguments[1]),WarpDriveConfig.ML_MAX_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -320,8 +319,8 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
{
|
||||
if(arguments.length >= 2)
|
||||
{
|
||||
digX = Math.min(toInt(arguments[0]),WarpDriveConfig.i.ML_MAX_SIZE);
|
||||
digZ = Math.min(toInt(arguments[1]),WarpDriveConfig.i.ML_MAX_SIZE);
|
||||
digX = Math.min(toInt(arguments[0]),WarpDriveConfig.ML_MAX_SIZE);
|
||||
digZ = Math.min(toInt(arguments[1]),WarpDriveConfig.ML_MAX_SIZE);
|
||||
}
|
||||
defineMiningArea(digX,digZ);
|
||||
}
|
||||
|
@ -371,7 +370,7 @@ public class TileEntityMiningLaser extends TileEntityAbstractMiner implements IP
|
|||
try
|
||||
{
|
||||
Double arg = Double.parseDouble(arguments[0].toString());
|
||||
speedMul = Math.min(WarpDriveConfig.i.ML_MAX_SPEED,Math.max(arg,WarpDriveConfig.i.ML_MIN_SPEED));
|
||||
speedMul = Math.min(WarpDriveConfig.ML_MAX_SPEED,Math.max(arg,WarpDriveConfig.ML_MIN_SPEED));
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
|
|
|
@ -1,26 +1,14 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.WarpDriveConfig;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityParticleBooster extends TileEntity implements IEnergySink
|
||||
|
@ -48,7 +36,7 @@ public class TileEntityParticleBooster extends TileEntity implements IEnergySink
|
|||
if (++ticks > 40)
|
||||
{
|
||||
ticks = 0;
|
||||
currentEnergyValue = Math.min(currentEnergyValue, WarpDriveConfig.i.PB_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = Math.min(currentEnergyValue, WarpDriveConfig.PB_MAX_ENERGY_VALUE);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, currentEnergyValue / 10000, 2);
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +59,7 @@ public class TileEntityParticleBooster extends TileEntity implements IEnergySink
|
|||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
{
|
||||
return (WarpDriveConfig.i.PB_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
return (WarpDriveConfig.PB_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,10 +68,10 @@ public class TileEntityParticleBooster extends TileEntity implements IEnergySink
|
|||
double leftover = 0;
|
||||
currentEnergyValue += Math.round(amount);
|
||||
|
||||
if (getCurrentEnergyValue() > WarpDriveConfig.i.PB_MAX_ENERGY_VALUE)
|
||||
if (getCurrentEnergyValue() > WarpDriveConfig.PB_MAX_ENERGY_VALUE)
|
||||
{
|
||||
leftover = (getCurrentEnergyValue() - WarpDriveConfig.i.PB_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.i.PB_MAX_ENERGY_VALUE;
|
||||
leftover = (getCurrentEnergyValue() - WarpDriveConfig.PB_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.PB_MAX_ENERGY_VALUE;
|
||||
}
|
||||
|
||||
return leftover;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class TileEntityProtocol extends TileEntity implements IPeripheral
|
|||
private int back, left, down;
|
||||
|
||||
// Player attaching
|
||||
public ArrayList<String> players = new ArrayList();
|
||||
public ArrayList<String> players = new ArrayList<String>();
|
||||
public String playersString = "";
|
||||
|
||||
private String beaconFrequency = "";
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergySink
|
||||
public class TileEntityRadar extends WarpTE implements IPeripheral, IEnergySink
|
||||
{
|
||||
public boolean addedToEnergyNet = false;
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
|
|||
{
|
||||
if (cooldownTime++ > (20 * ((scanRadius / 1000) + 1)))
|
||||
{
|
||||
//System.out.println("Scanning...");
|
||||
//WarpDrive.debugPrint("Scanning...");
|
||||
WarpDrive.instance.registry.removeDeadCores();
|
||||
results = WarpDrive.instance.registry.searchWarpCoresInRadius(xCoord, yCoord, zCoord, scanRadius);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
|
||||
|
@ -122,7 +122,7 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
|
|||
case 1: // scanRadius (radius)
|
||||
if (arguments.length == 1)
|
||||
{
|
||||
int radius = ((Double)arguments[0]).intValue();
|
||||
int radius = toInt(arguments[0]);
|
||||
if (radius <= 0 || radius > 10000)
|
||||
{
|
||||
scanRadius = 0;
|
||||
|
@ -140,7 +140,7 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
|
|||
else
|
||||
{
|
||||
results = null;
|
||||
System.out.println("Radius: " + radius + " | Enough energy: " + isEnergyEnoughForScanRadiusW(radius));
|
||||
WarpDrive.debugPrint("Radius: " + radius + " | Enough energy: " + isEnergyEnoughForScanRadiusW(radius));
|
||||
return new Boolean[] { false };
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
|
|||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
{
|
||||
return (WarpDriveConfig.i.WR_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
return (WarpDriveConfig.WR_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -207,10 +207,10 @@ public class TileEntityRadar extends TileEntity implements IPeripheral, IEnergyS
|
|||
double leftover = 0;
|
||||
currentEnergyValue += Math.round(amount);
|
||||
|
||||
if (getCurrentEnergyValue() > WarpDriveConfig.i.WR_MAX_ENERGY_VALUE)
|
||||
if (getCurrentEnergyValue() > WarpDriveConfig.WR_MAX_ENERGY_VALUE)
|
||||
{
|
||||
leftover = (getCurrentEnergyValue() - WarpDriveConfig.i.WR_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.i.WR_MAX_ENERGY_VALUE;
|
||||
leftover = (getCurrentEnergyValue() - WarpDriveConfig.WR_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.WR_MAX_ENERGY_VALUE;
|
||||
}
|
||||
|
||||
return leftover;
|
||||
|
|
|
@ -4,10 +4,8 @@ import ic2.api.energy.event.EnergyTileLoadEvent;
|
|||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -86,8 +84,6 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
public boolean shouldTele = false;
|
||||
|
||||
private boolean soundPlayed = false;
|
||||
|
||||
private ArrayList<Entity> teleportedEntities = new ArrayList<Entity>(10);
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
|
@ -99,7 +95,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
}
|
||||
|
||||
// Update warp core in cores registry
|
||||
if (++registryUpdateTicks > WarpDriveConfig.i.WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS * 20)
|
||||
if (++registryUpdateTicks > WarpDriveConfig.WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS * 20)
|
||||
{
|
||||
registryUpdateTicks = 0;
|
||||
WarpDrive.instance.registry.updateInRegistry(this);
|
||||
|
@ -111,7 +107,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
}
|
||||
//WarpDrive.debugPrint("Serverside");
|
||||
|
||||
if (++isolationUpdateTicks > WarpDriveConfig.i.WC_ISOLATION_UPDATE_INTARVAL_SECONDS * 20)
|
||||
if (++isolationUpdateTicks > WarpDriveConfig.WC_ISOLATION_UPDATE_INTARVAL_SECONDS * 20)
|
||||
{
|
||||
isolationUpdateTicks = 0;
|
||||
updateIsolationState();
|
||||
|
@ -202,9 +198,9 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
}
|
||||
|
||||
// Awaiting cooldown time
|
||||
if (/*currentMode != MODE_BASIC_JUMP && */cooldownTime++ < ((WarpDriveConfig.i.WC_COOLDOWN_INTERVAL_SECONDS) * 20) + randomCooldownAddition)
|
||||
if (/*currentMode != MODE_BASIC_JUMP && */cooldownTime++ < ((WarpDriveConfig.WC_COOLDOWN_INTERVAL_SECONDS) * 20) + randomCooldownAddition)
|
||||
{
|
||||
//System.out.println("[WC] Awaiting cooldown: " + cooldownTime + " < " + ( ((WarpDriveConfig.i.WC_COOLDOWN_INTERVAL_SECONDS) * 20) + randomCooldownAddition));
|
||||
//System.out.println("[WC] Awaiting cooldown: " + cooldownTime + " < " + ( ((WarpDriveConfig.WC_COOLDOWN_INTERVAL_SECONDS) * 20) + randomCooldownAddition));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,7 +304,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
{
|
||||
for (int z = zmin; z <= zmax; z++)
|
||||
{
|
||||
if (worldObj.getBlockId(x, y, z) == WarpDriveConfig.i.isolationID)
|
||||
if (worldObj.getBlockId(x, y, z) == WarpDriveConfig.isolationID)
|
||||
{
|
||||
this.isolationBlocksCount++;
|
||||
}
|
||||
|
@ -376,7 +372,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
|
||||
public void summonPlayer(EntityPlayerMP player, int x, int y, int z)
|
||||
{
|
||||
if (this.currentEnergyValue - WarpDriveConfig.i.WC_ENERGY_PER_ENTITY_TO_SPACE >= 0)
|
||||
if (this.currentEnergyValue - WarpDriveConfig.WC_ENERGY_PER_ENTITY_TO_SPACE >= 0)
|
||||
{
|
||||
player.setPositionAndUpdate(x, y, z);
|
||||
|
||||
|
@ -385,7 +381,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
player.mcServer.getConfigurationManager().transferPlayerToDimension(player, this.worldObj.provider.dimensionId, new SpaceTeleporter(DimensionManager.getWorld(this.worldObj.provider.dimensionId), 0, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)));
|
||||
}
|
||||
|
||||
this.currentEnergyValue -= WarpDriveConfig.i.WC_ENERGY_PER_ENTITY_TO_SPACE;
|
||||
this.currentEnergyValue -= WarpDriveConfig.WC_ENERGY_PER_ENTITY_TO_SPACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,7 +397,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
this.shipBack = controller.getBack();
|
||||
this.shipLeft = controller.getLeft();
|
||||
this.shipDown = controller.getDown();
|
||||
this.distance = Math.min(WarpDriveConfig.i.WC_MAX_JUMP_DISTANCE, controller.getDistance());
|
||||
this.distance = Math.min(WarpDriveConfig.WC_MAX_JUMP_DISTANCE, controller.getDistance());
|
||||
return calculateSpatialShipParameters();
|
||||
}
|
||||
|
||||
|
@ -493,7 +489,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
}
|
||||
|
||||
// Ship side is too big
|
||||
if (shipLength > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || shipWidth > WarpDriveConfig.i.WC_MAX_SHIP_SIDE || shipHeight > WarpDriveConfig.i.WC_MAX_SHIP_SIDE)
|
||||
if (shipLength > WarpDriveConfig.WC_MAX_SHIP_SIDE || shipWidth > WarpDriveConfig.WC_MAX_SHIP_SIDE || shipHeight > WarpDriveConfig.WC_MAX_SHIP_SIDE)
|
||||
{
|
||||
this.controller.setJumpFlag(false);
|
||||
return false;
|
||||
|
@ -501,7 +497,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
|
||||
this.shipVolume = getRealShipVolume();
|
||||
|
||||
if (shipVolume > WarpDriveConfig.i.WC_MAX_SHIP_VOLUME_ON_SURFACE && worldObj.provider.dimensionId == 0)
|
||||
if (shipVolume > WarpDriveConfig.WC_MAX_SHIP_VOLUME_ON_SURFACE && worldObj.provider.dimensionId == 0)
|
||||
{
|
||||
this.controller.setJumpFlag(false);
|
||||
return false;
|
||||
|
@ -804,9 +800,9 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
|
||||
if (WarpDrive.instance.jumpGates != null && t != null && !isShipInJumpgate(t))
|
||||
{
|
||||
if (shipVolume < WarpDriveConfig.i.WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE)
|
||||
if (shipVolume < WarpDriveConfig.WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE)
|
||||
{
|
||||
this.messageToAllPlayersOnShip("Ship is too small (" + shipVolume + "/" + WarpDriveConfig.i.WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE + "). Insufficient ship mass to open hyperspace portal.");
|
||||
this.messageToAllPlayersOnShip("Ship is too small (" + shipVolume + "/" + WarpDriveConfig.WC_MIN_SHIP_VOLUME_FOR_HYPERSPACE + "). Insufficient ship mass to open hyperspace portal.");
|
||||
this.controller.setJumpFlag(false);
|
||||
return;
|
||||
}
|
||||
|
@ -902,14 +898,14 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
|
||||
for (Object o : list)
|
||||
{
|
||||
if (currentEnergyValue - WarpDriveConfig.i.WC_ENERGY_PER_ENTITY_TO_SPACE < 0)
|
||||
if (currentEnergyValue - WarpDriveConfig.WC_ENERGY_PER_ENTITY_TO_SPACE < 0)
|
||||
{
|
||||
//if(o instanceof EntityPlayerMP)
|
||||
// ((EntityPlayerMP)o).addChatMessage("Not enough energy to teleport");
|
||||
return;
|
||||
}
|
||||
|
||||
currentEnergyValue -= WarpDriveConfig.i.WC_ENERGY_PER_ENTITY_TO_SPACE;
|
||||
currentEnergyValue -= WarpDriveConfig.WC_ENERGY_PER_ENTITY_TO_SPACE;
|
||||
Entity entity = (Entity) o;
|
||||
int x = MathHelper.floor_double(entity.posX);
|
||||
int z = MathHelper.floor_double(entity.posZ);
|
||||
|
@ -1031,19 +1027,19 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
switch (currentMode)
|
||||
{
|
||||
case MODE_BASIC_JUMP:
|
||||
energyValue = (WarpDriveConfig.i.WC_ENERGY_PER_BLOCK_MODE1 * shipVolume) + (WarpDriveConfig.i.WC_ENERGY_PER_DISTANCE_MODE1 * jumpDistance);
|
||||
energyValue = (WarpDriveConfig.WC_ENERGY_PER_BLOCK_MODE1 * shipVolume) + (WarpDriveConfig.WC_ENERGY_PER_DISTANCE_MODE1 * jumpDistance);
|
||||
break;
|
||||
|
||||
case MODE_LONG_JUMP:
|
||||
energyValue = (WarpDriveConfig.i.WC_ENERGY_PER_BLOCK_MODE2 * shipVolume) + (WarpDriveConfig.i.WC_ENERGY_PER_DISTANCE_MODE2 * jumpDistance);
|
||||
energyValue = (WarpDriveConfig.WC_ENERGY_PER_BLOCK_MODE2 * shipVolume) + (WarpDriveConfig.WC_ENERGY_PER_DISTANCE_MODE2 * jumpDistance);
|
||||
break;
|
||||
|
||||
case MODE_HYPERSPACE:
|
||||
energyValue = WarpDriveConfig.i.WC_MAX_ENERGY_VALUE / 10; // 10% of maximum
|
||||
energyValue = WarpDriveConfig.WC_MAX_ENERGY_VALUE / 10; // 10% of maximum
|
||||
break;
|
||||
|
||||
case MODE_BEACON_JUMP:
|
||||
energyValue = WarpDriveConfig.i.WC_MAX_ENERGY_VALUE / 2; // half of maximum
|
||||
energyValue = WarpDriveConfig.WC_MAX_ENERGY_VALUE / 2; // half of maximum
|
||||
break;
|
||||
|
||||
case MODE_GATE_JUMP:
|
||||
|
@ -1126,7 +1122,7 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
return 0;
|
||||
}
|
||||
|
||||
return (WarpDriveConfig.i.WC_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
return (WarpDriveConfig.WC_MAX_ENERGY_VALUE - currentEnergyValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1135,10 +1131,10 @@ public class TileEntityReactor extends TileEntity implements IEnergySink
|
|||
double leftover = 0;
|
||||
currentEnergyValue += Math.round(amount);
|
||||
|
||||
if (currentEnergyValue > WarpDriveConfig.i.WC_MAX_ENERGY_VALUE)
|
||||
if (currentEnergyValue > WarpDriveConfig.WC_MAX_ENERGY_VALUE)
|
||||
{
|
||||
leftover = (currentEnergyValue - WarpDriveConfig.i.WC_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.i.WC_MAX_ENERGY_VALUE;
|
||||
leftover = (currentEnergyValue - WarpDriveConfig.WC_MAX_ENERGY_VALUE);
|
||||
currentEnergyValue = WarpDriveConfig.WC_MAX_ENERGY_VALUE;
|
||||
}
|
||||
|
||||
return leftover;
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cr0s.WarpDrive.JumpBlock;
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import cr0s.WarpDrive.WarpDriveConfig;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
|
@ -15,34 +14,22 @@ import ic2.api.energy.event.EnergyTileUnloadEvent;
|
|||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergyTile;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
||||
public class TileEntityShipScanner extends TileEntityAbstractLaser implements IEnergySink,
|
||||
IPeripheral {
|
||||
public boolean addedToEnergyNet = false;
|
||||
|
||||
|
@ -50,9 +37,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
private int currentEnergyValue = 0;
|
||||
|
||||
private int state = 0; // 0 - inactive, 1 - active
|
||||
private int firstUncoveredY;
|
||||
|
||||
private boolean isEnabled = false;
|
||||
private TileEntityReactor core = null;
|
||||
|
||||
int laserTicks = 0;
|
||||
|
@ -63,7 +48,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
|
||||
// Config
|
||||
//private final String SCHEMATICS_DIR = "/home/cros/mc_site/schematics/";
|
||||
private final String SCHEMATICS_DIR = WarpDriveConfig.i.schemaLocation;
|
||||
private final String SCHEMATICS_DIR = WarpDriveConfig.schemaLocation;
|
||||
private final int EU_PER_BLOCK_SCAN = 100; // eU per block of ship volume (including air)
|
||||
private final int EU_PER_BLOCK_DEPLOY = 5000;
|
||||
private final int BLOCK_TO_DEPLOY_PER_TICK = 1000;
|
||||
|
@ -109,8 +94,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
|
||||
if (state == 0) { // inactive
|
||||
if (++laserTicks > 20) {
|
||||
sendLaserPacket(new Vector3(this).add(0.5), new Vector3(
|
||||
core.xCoord, core.yCoord, core.zCoord).add(0.5), 0f,
|
||||
sendLaserPacket(new Vector3(this).translate(0.5), new Vector3(core.xCoord, core.yCoord, core.zCoord).translate(0.5), 0f,
|
||||
1f, 0f, 40, 0, 100);
|
||||
laserTicks = 0;
|
||||
}
|
||||
|
@ -157,7 +141,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
g = 0f;
|
||||
}
|
||||
|
||||
sendLaserPacket(new Vector3(this).add(0.5), new Vector3(x, core.maxY, randomZ).add(0.5), r, g, b, 15, 0, 100);
|
||||
sendLaserPacket(new Vector3(this).translate(0.5), new Vector3(x, core.maxY, randomZ).translate(0.5), r, g, b, 15, 0, 100);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,7 +156,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
deployDelayTicks = 0;
|
||||
|
||||
int blocks = Math.min(BLOCK_TO_DEPLOY_PER_TICK, blocksToDeployCount - currentDeployIndex);
|
||||
System.out.println("[ShipScanner] Deploying ship part: " + currentDeployIndex + "/" + blocksToDeployCount + " [remains: " + blocks + "]");
|
||||
WarpDrive.debugPrint("[ShipScanner] Deploying ship part: " + currentDeployIndex + "/" + blocksToDeployCount + " [remains: " + blocks + "]");
|
||||
|
||||
if (blocks == 0) {
|
||||
isDeploying = false;
|
||||
|
@ -199,8 +183,8 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
if (worldObj.rand.nextInt(100) <= 10) {
|
||||
worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:lowlaser", 4F, 1F);
|
||||
|
||||
sendLaserPacket(new Vector3(this).add(0.5), new Vector3(
|
||||
newX + block.x, newY + block.y, newZ + block.z).add(0.5), 0f,
|
||||
sendLaserPacket(new Vector3(this).translate(0.5), new Vector3(
|
||||
newX + block.x, newY + block.y, newZ + block.z).translate(0.5), 0f,
|
||||
1f, 0f, 15, 0, 100);
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +204,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
|
||||
// Search for warp cores above
|
||||
for (int newY = yCoord + 1; newY <= 255; newY++) {
|
||||
if (worldObj.getBlockId(xCoord, newY, zCoord) == WarpDriveConfig.i.coreID) { // found
|
||||
if (worldObj.getBlockId(xCoord, newY, zCoord) == WarpDriveConfig.coreID) { // found
|
||||
// warp
|
||||
// core
|
||||
// above
|
||||
|
@ -241,80 +225,6 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
return result;
|
||||
}
|
||||
|
||||
public void sendLaserPacket(Vector3 source, Vector3 dest, float r, float g,
|
||||
float b, int age, int energy, int radius) {
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if (side == Side.SERVER) {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
|
||||
try {
|
||||
// Write source vector
|
||||
outputStream.writeDouble(source.x);
|
||||
outputStream.writeDouble(source.y);
|
||||
outputStream.writeDouble(source.z);
|
||||
// Write target vector
|
||||
outputStream.writeDouble(dest.x);
|
||||
outputStream.writeDouble(dest.y);
|
||||
outputStream.writeDouble(dest.z);
|
||||
// Write r, g, b of laser
|
||||
outputStream.writeFloat(r);
|
||||
outputStream.writeFloat(g);
|
||||
outputStream.writeFloat(b);
|
||||
// Write age
|
||||
outputStream.writeByte(age);
|
||||
// Write energy value
|
||||
outputStream.writeInt(energy);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
packet.channel = "WarpDriveBeam";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
MinecraftServer
|
||||
.getServer()
|
||||
.getConfigurationManager()
|
||||
.sendToAllNear(source.intX(), source.intY(), source.intZ(),
|
||||
radius, worldObj.provider.dimensionId, packet);
|
||||
ByteArrayOutputStream bos2 = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream2 = new DataOutputStream(bos2);
|
||||
|
||||
try {
|
||||
// Write source vector
|
||||
outputStream2.writeDouble(source.x);
|
||||
outputStream2.writeDouble(source.y);
|
||||
outputStream2.writeDouble(source.z);
|
||||
// Write target vector
|
||||
outputStream2.writeDouble(dest.x);
|
||||
outputStream2.writeDouble(dest.y);
|
||||
outputStream2.writeDouble(dest.z);
|
||||
// Write r, g, b of laser
|
||||
outputStream2.writeFloat(r);
|
||||
outputStream2.writeFloat(g);
|
||||
outputStream2.writeFloat(b);
|
||||
// Write age
|
||||
outputStream2.writeByte(age);
|
||||
// Write energy value
|
||||
outputStream2.writeInt(energy);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
Packet250CustomPayload packet2 = new Packet250CustomPayload();
|
||||
packet.channel = "WarpDriveBeam";
|
||||
packet.data = bos.toByteArray();
|
||||
packet.length = bos.size();
|
||||
MinecraftServer
|
||||
.getServer()
|
||||
.getConfigurationManager()
|
||||
.sendToAllNear(dest.intX(), dest.intY(), dest.intZ(),
|
||||
radius, worldObj.provider.dimensionId, packet);
|
||||
}
|
||||
}
|
||||
|
||||
// Checks energy level
|
||||
private boolean isEnoughEnergyForScan() {
|
||||
if (core != null) {
|
||||
|
@ -339,14 +249,14 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
schematic.setShort("Length", length);
|
||||
schematic.setShort("Height", height);
|
||||
|
||||
System.out.println("[ShipScanner] Ship parameters: w: " + width + ", l: " + length + ", h:" + height);
|
||||
WarpDrive.debugPrint("[ShipScanner] Ship parameters: w: " + width + ", l: " + length + ", h:" + height);
|
||||
|
||||
int size = width * length * height;
|
||||
|
||||
// Consume energy
|
||||
currentEnergyValue = Math.abs(currentEnergyValue - size * EU_PER_BLOCK_SCAN);
|
||||
|
||||
System.out.println("[ShipScanner] Size: " + size);
|
||||
WarpDrive.debugPrint("[ShipScanner] Size: " + size);
|
||||
|
||||
byte localBlocks[] = new byte[size];
|
||||
byte localMetadata[] = new byte[size];
|
||||
|
@ -362,7 +272,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
int blockID = worldObj.getBlockId(core.minX + x, core.minY + y, core.minZ + z);
|
||||
|
||||
// Do not scan air, bedrock and specified forbidden blocks (like ore or Warp-Cores)
|
||||
if (worldObj.isAirBlock(core.minX + x, core.minY + y, core.minZ + z) || blockID == Block.bedrock.blockID || WarpDriveConfig.i.scannerIgnoreBlocks.contains(blockID))
|
||||
if (worldObj.isAirBlock(core.minX + x, core.minY + y, core.minZ + z) || blockID == Block.bedrock.blockID || WarpDriveConfig.scannerIgnoreBlocks.contains(blockID))
|
||||
blockID = 0;
|
||||
|
||||
int blockMetadata = (byte) worldObj.getBlockMetadata(core.minX + x, core.minY + y, core.minZ + z);
|
||||
|
@ -421,7 +331,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
}
|
||||
|
||||
private void writeNBTToFile(String fileName, NBTTagCompound nbttagcompound) {
|
||||
System.out.println("[ShipScanner] Filename: " + fileName);
|
||||
WarpDrive.debugPrint("[ShipScanner] Filename: " + fileName);
|
||||
|
||||
try {
|
||||
File file = new File(fileName);
|
||||
|
@ -488,7 +398,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
NBTTagCompound schematic = readNBTFromFile(SCHEMATICS_DIR + fileName);
|
||||
|
||||
if (schematic == null) {
|
||||
System.out.println("[ShipScanner] Schematic is null!");
|
||||
WarpDrive.debugPrint("[ShipScanner] Schematic is null!");
|
||||
return new Object[] { -1, "Unknow error. Schematic NBT is null" };
|
||||
}
|
||||
|
||||
|
@ -510,11 +420,11 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
|
||||
int size = width* height * length;
|
||||
|
||||
System.out.println("[ShipScanner] Deploying ship: (size: " + size + ", h: " + height + ", w: " + width + ", l: " + length + ")");
|
||||
WarpDrive.debugPrint("[ShipScanner] Deploying ship: (size: " + size + ", h: " + height + ", w: " + width + ", l: " + length + ")");
|
||||
|
||||
// Check energy level
|
||||
if (!isEnoughEnergyForDeploy(size)) {
|
||||
System.out.println("[ShipScanner] Not enough energy! Need at least " + (Math.abs(size * EU_PER_BLOCK_DEPLOY - currentEnergyValue)) + " Eu");
|
||||
WarpDrive.debugPrint("[ShipScanner] Not enough energy! Need at least " + (Math.abs(size * EU_PER_BLOCK_DEPLOY - currentEnergyValue)) + " Eu");
|
||||
return new Object[] { 1, "Not enough energy! Need at least " + (Math.abs(size * EU_PER_BLOCK_DEPLOY - currentEnergyValue)) + " Eu" };
|
||||
}
|
||||
|
||||
|
@ -531,7 +441,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
}
|
||||
|
||||
if (occupiedBlockCount > 0) {
|
||||
System.out.println("[ShipScanner] Deploying area occupied with " + occupiedBlockCount + " blocks. Can't deploy ship.");
|
||||
WarpDrive.debugPrint("[ShipScanner] Deploying area occupied with " + occupiedBlockCount + " blocks. Can't deploy ship.");
|
||||
return new Object[] { 2, "Deploying area occupied with " + occupiedBlockCount + " blocks. Can't deploy ship." };
|
||||
}
|
||||
|
||||
|
@ -548,11 +458,11 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
this.newY = targetY;
|
||||
this.newZ = targetZ;
|
||||
|
||||
System.out.println("[ShipScanner] Target to deploy: (" + targetX + ", " + targetY + ", " + targetZ + ")");
|
||||
WarpDrive.debugPrint("[ShipScanner] Target to deploy: (" + targetX + ", " + targetY + ", " + targetZ + ")");
|
||||
|
||||
// Read blocks and TileEntities from NBT to internal storage array
|
||||
|
||||
System.out.println("[ShipScanner] Loading blocks...");
|
||||
WarpDrive.debugPrint("[ShipScanner] Loading blocks...");
|
||||
byte localBlocks[] = schematic.getByteArray("Blocks");
|
||||
byte localMetadata[] = schematic.getByteArray("Data");
|
||||
|
||||
|
@ -571,7 +481,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
}
|
||||
|
||||
// Load Tile Entities
|
||||
System.out.println("[ShipScanner] Loading TileEntities...");
|
||||
WarpDrive.debugPrint("[ShipScanner] Loading TileEntities...");
|
||||
NBTTagCompound[] tileEntities = new NBTTagCompound[size];
|
||||
NBTTagList tileEntitiesList = schematic.getTagList("TileEntities");
|
||||
|
||||
|
@ -581,7 +491,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
int teY = teTag.getInteger("y");
|
||||
int teZ = teTag.getInteger("z");
|
||||
|
||||
System.out.println("[ShipScanner] Loaded TE: " + teTag.getString("id"));
|
||||
WarpDrive.debugPrint("[ShipScanner] Loaded TE: " + teTag.getString("id"));
|
||||
tileEntities[teX + (teY * length + teZ) * width] = teTag;
|
||||
}
|
||||
|
||||
|
@ -605,9 +515,9 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
if (jb.blockID != 0 && Block.blocksList[jb.blockID] != null) {
|
||||
System.out.print("[ShipScanner] Saving block: " + Block.blocksList[jb.blockID].getUnlocalizedName() + ", TE: ");
|
||||
if (tileEntities[x + (y * length + z) * width] == null) {
|
||||
System.out.println("null!");
|
||||
WarpDrive.debugPrint("null!");
|
||||
} else
|
||||
System.out.println(tileEntities[x + (y * length + z) * width].getString("id"));
|
||||
WarpDrive.debugPrint(tileEntities[x + (y * length + z) * width].getString("id"));
|
||||
}
|
||||
blocksToDeploy[x + (y * length + z) * width] = jb;
|
||||
}
|
||||
|
@ -615,7 +525,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
}
|
||||
|
||||
switchState(1);
|
||||
System.out.println("[ShipScanner] Ship deployed.");
|
||||
WarpDrive.debugPrint("[ShipScanner] Ship deployed.");
|
||||
return new Object[] { 3, "Ship deployed." };
|
||||
}
|
||||
|
||||
|
@ -681,7 +591,7 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
return new Object[] { 0, "Specified .schematic file not found!" };
|
||||
else
|
||||
{
|
||||
System.out.println("[ShipScanner] Trying to deploy ship");
|
||||
WarpDrive.debugPrint("[ShipScanner] Trying to deploy ship");
|
||||
return deployShip(fileName, x, y, z);
|
||||
}
|
||||
} else
|
||||
|
@ -935,4 +845,10 @@ public class TileEntityShipScanner extends TileEntity implements IEnergySink,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldChunkLoad()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
304
src/cr0s/WarpDrive/machines/TileEntityTransporter.java
Normal file
304
src/cr0s/WarpDrive/machines/TileEntityTransporter.java
Normal file
|
@ -0,0 +1,304 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cr0s.WarpDrive.Vector3;
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
import cr0s.WarpDrive.WarpDriveConfig;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
import dan200.computer.api.IPeripheral;
|
||||
import ic2.api.energy.event.EnergyTileLoadEvent;
|
||||
import ic2.api.energy.event.EnergyTileUnloadEvent;
|
||||
import ic2.api.energy.tile.IEnergySink;
|
||||
|
||||
public class TileEntityTransporter extends WarpTE implements IEnergySink, IPeripheral
|
||||
{
|
||||
private final double scanRange=2;
|
||||
|
||||
private final int maxEnergy;
|
||||
private double energyBuffer=0;
|
||||
private boolean addedToEnergyNet = false;
|
||||
|
||||
private double baseLockStrength=-1;
|
||||
private double lockStrengthMul = 1;
|
||||
private boolean isLocked=false;
|
||||
|
||||
private Vector3 centreOnMe = new Vector3(0.5,1,0.5);
|
||||
private Vector3 source = new Vector3();
|
||||
private Vector3 dest = new Vector3();
|
||||
|
||||
private String[] methodArray = {
|
||||
"source",
|
||||
"dest",
|
||||
"lock",
|
||||
"release",
|
||||
"lockStrength",
|
||||
"energize",
|
||||
"energy",
|
||||
"help" };
|
||||
|
||||
public TileEntityTransporter()
|
||||
{
|
||||
super();
|
||||
maxEnergy = WarpDriveConfig.TR_MAX_ENERGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if(isLocked && lockStrengthMul > 0)
|
||||
lockStrengthMul-= 0.01;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType()
|
||||
{
|
||||
return "transporter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMethodNames()
|
||||
{
|
||||
return methodArray;
|
||||
}
|
||||
|
||||
private Object[] setVec3(boolean src,Object... arguments)
|
||||
{
|
||||
Vector3 vec = src ? source : dest;
|
||||
|
||||
try
|
||||
{
|
||||
if(arguments.length >= 3)
|
||||
{
|
||||
vec.x = toDouble(arguments[0]);
|
||||
vec.y = toDouble(arguments[1]);
|
||||
vec.z = toDouble(arguments[2]);
|
||||
}
|
||||
else if(arguments.length == 1)
|
||||
{
|
||||
vec.x = xCoord + centreOnMe.x;
|
||||
vec.y = yCoord + centreOnMe.y;
|
||||
vec.z = zCoord + centreOnMe.z;
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
vec.x = xCoord + centreOnMe.x;
|
||||
vec.y = yCoord + centreOnMe.y;
|
||||
vec.z = zCoord + centreOnMe.z;
|
||||
}
|
||||
return new Object[] { vec.x, vec.y, vec.z };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception
|
||||
{
|
||||
String str = methodArray[method];
|
||||
if(str == "energy")
|
||||
return new Object[] {Math.max(energyBuffer,maxEnergy),maxEnergy};
|
||||
|
||||
if(str == "source")
|
||||
{
|
||||
if(source == null)
|
||||
source = new Vector3(this).translate(centreOnMe);
|
||||
return setVec3(true,arguments);
|
||||
}
|
||||
|
||||
if(str == "dest")
|
||||
{
|
||||
if(dest == null)
|
||||
dest = new Vector3(this).translate(centreOnMe);
|
||||
return setVec3(false,arguments);
|
||||
}
|
||||
|
||||
if(str == "lock")
|
||||
{
|
||||
return new Object[] { lockStrength(source,dest,true) };
|
||||
}
|
||||
|
||||
if(str == "release")
|
||||
{
|
||||
if(isLocked)
|
||||
{
|
||||
isLocked = false;
|
||||
return new Object[] { true };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Object[] { false };
|
||||
}
|
||||
}
|
||||
|
||||
if(str == "lockStrength")
|
||||
{
|
||||
return new Object[] { lockStrength(source,dest,false) };
|
||||
}
|
||||
|
||||
if(str == "energize")
|
||||
{
|
||||
return new Object[] { energize () };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean energize()
|
||||
{
|
||||
double ls = lockStrength(source,dest,false);
|
||||
ArrayList<EntityLivingBase> entitiesToTransport = findEntities(source,ls);
|
||||
double energyReq = WarpDriveConfig.TR_EU_PER_METRE * source.distanceTo(dest);
|
||||
for(EntityLivingBase ent : entitiesToTransport)
|
||||
{
|
||||
if(energyBuffer >= energyReq)
|
||||
{
|
||||
energyBuffer -= energyReq;
|
||||
transportEnt(ent,dest);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void transportEnt(EntityLivingBase ent, Vector3 dest)
|
||||
{
|
||||
if(WarpDriveConfig.TR_RELATIVE_COORDS)
|
||||
ent.setPositionAndUpdate(xCoord+dest.x, yCoord+dest.y, zCoord+dest.z);
|
||||
else
|
||||
ent.setPositionAndUpdate(dest.x, dest.y, dest.z);
|
||||
}
|
||||
|
||||
private double lockStrength(Vector3 source,Vector3 dest,boolean lock)
|
||||
{
|
||||
if(isLocked)
|
||||
{
|
||||
return baseLockStrength * lockStrengthMul;
|
||||
}
|
||||
else if(lock)
|
||||
{
|
||||
baseLockStrength = 1; //REPLACE THIS!!!
|
||||
lockStrengthMul = 1;
|
||||
isLocked = true;
|
||||
return baseLockStrength;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private AxisAlignedBB getAABB()
|
||||
{
|
||||
Vector3 tS = new Vector3(this);
|
||||
Vector3 bS = new Vector3(this);
|
||||
Vector3 scanPos = new Vector3(scanRange/2,1,scanRange/2);
|
||||
Vector3 scanNeg = new Vector3(-scanRange/2,-1,-scanRange/2);
|
||||
if(WarpDriveConfig.TR_RELATIVE_COORDS)
|
||||
{
|
||||
tS.translate(source).translate(scanPos);
|
||||
bS.translate(source).translate(scanNeg);
|
||||
}
|
||||
else
|
||||
{
|
||||
tS = source.clone().translate(scanPos);
|
||||
bS = source.clone().translate(scanNeg);
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox(bS.x,bS.y,bS.z,tS.x,tS.y,tS.z);
|
||||
}
|
||||
|
||||
private ArrayList<EntityLivingBase> findEntities(Vector3 source, double lockStrength)
|
||||
{
|
||||
AxisAlignedBB bb = getAABB();
|
||||
ArrayList<EntityLivingBase> output = new ArrayList<EntityLivingBase>();
|
||||
WarpDrive.debugPrint("Transporter:" +bb.toString());
|
||||
List data = worldObj.getEntitiesWithinAABBExcludingEntity(null, bb);
|
||||
for(Object ent : data)
|
||||
{
|
||||
WarpDrive.debugPrint("Transporter:"+ent.toString() + " found");
|
||||
if(Math.random() < lockStrength) //If weak lock, don't transport
|
||||
if(ent instanceof EntityLivingBase)
|
||||
output.add((EntityLivingBase) ent);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttachToSide(int side) { return true; }
|
||||
|
||||
@Override
|
||||
public void attach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public void detach(IComputerAccess computer) {}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
|
||||
{
|
||||
if(direction.equals(ForgeDirection.UP))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double demandedEnergyUnits()
|
||||
{
|
||||
if(energyBuffer >= maxEnergy)
|
||||
return 0;
|
||||
return maxEnergy-energyBuffer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectEnergyUnits(ForgeDirection directionFrom, double amount)
|
||||
{
|
||||
if(energyBuffer < maxEnergy)
|
||||
{
|
||||
energyBuffer += amount;
|
||||
return 0;
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSafeInput()
|
||||
{
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
if (addedToEnergyNet)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||
addedToEnergyNet = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate()
|
||||
{
|
||||
super.validate();
|
||||
if (!addedToEnergyNet)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
|
||||
addedToEnergyNet = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
if (addedToEnergyNet)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
|
||||
addedToEnergyNet = false;
|
||||
}
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +1,10 @@
|
|||
package cr0s.WarpDrive.machines;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import cr0s.WarpDrive.WarpDrive;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
|
Loading…
Reference in a new issue