Moved missing files back in to proper places

Sorry Lem
This commit is contained in:
Francesco Macagno 2015-07-22 17:31:10 -07:00
parent b64a600a6a
commit f3caf63489
31 changed files with 1796 additions and 5778 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,818 +0,0 @@
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.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
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.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import cr0s.WarpDrive.block.*;
import cr0s.WarpDrive.command.*;
import cr0s.WarpDrive.data.*;
import cr0s.WarpDrive.item.*;
import cr0s.WarpDrive.machines.*;
import cr0s.WarpDrive.render.*;
import cr0s.WarpDrive.world.*;
import dan200.computercraft.api.ComputerCraftAPI;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
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.EnumArmorMaterial;
import net.minecraft.item.Item;
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.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.2.7.0",
dependencies = "required-after:IC2;"
+ " required-after:CoFHCore;"
+ " after:ComputerCraft;"
+ " after:OpenComputer;"
+ " after:CCTurtle;"
+ " after:gregtech_addon;"
+ " required-after:AppliedEnergistics;"
+ " after:AdvancedSolarPanel;"
+ " after:AtomicScience;"
+ " after:ICBM|Explosion;"
+ " after:MFFS;"
+ " after:GraviSuite;"
+ " after:UndergroundBiomes;"
+ " after:NetherOres")
@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {
"WarpDriveBeam",
"WarpDriveFreq",
"WarpDriveLaserT",
"WarpDriveCloaks" }, packetHandler = PacketHandler.class)
/**
* @author Cr0s
*/
public class WarpDrive implements LoadingCallback {
public static Block warpCore;
public static Block protocolBlock;
public static Block radarBlock;
public static Block isolationBlock;
public static Block airgenBlock;
public static Block laserBlock;
public static Block laserCamBlock;
public static Block cameraBlock;
public static Block monitorBlock;
public static Block boosterBlock;
public static Block miningLaserBlock;
public static Block laserTreeFarmBlock;
public static Block liftBlock;
public static Block scannerBlock;
public static Block cloakBlock;
public static Block cloakCoilBlock;
public static Block transporterBlock;
public static Block reactorMonitorBlock;
public static Block powerReactorBlock;
public static Block powerLaserBlock;
public static Block powerStoreBlock;
public static Block airBlock;
public static Block gasBlock;
public static Block iridiumBlock;
public static Block transportBeaconBlock;
public static Block chunkLoaderBlock;
public static BlockDecorative decorativeBlock;
public static Item reactorLaserFocusItem;
public static ItemWarpComponent componentItem;
public static ItemWarpUpgrade upgradeItem;
public static EnumArmorMaterial armorMaterial = EnumHelper.addArmorMaterial("WARP", 5, new int[]{1, 3, 2, 1}, 15);
public static ItemWarpArmor helmetItem;
public static ItemWarpAirCanister airCanisterItem;
public static BiomeGenBase spaceBiome;
public World space;
public SpaceWorldGenerator spaceWorldGenerator;
public HyperSpaceWorldGenerator hyperSpaceWorldGenerator;
public World hyperSpace;
// Client settings
public static float normalFOV = 70.0F;
public static float normalSensitivity = 1.0F;
public static CreativeTabs warpdriveTab = new WarpDriveCreativeTab("Warpdrive", "Warpdrive").setBackgroundImageName("warpdrive:creativeTab");
@Instance("WarpDrive")
public static WarpDrive instance;
@SidedProxy(clientSide = "cr0s.WarpDrive.client.ClientProxy", serverSide = "cr0s.WarpDrive.CommonProxy")
public static CommonProxy proxy;
public static WarpCoresRegistry warpCores;
public static JumpgatesRegistry jumpgates;
public static CloakManager cloaks;
public static CamRegistry cams;
public boolean isOverlayEnabled = false;
public int overlayType = 0;
public String debugMessage = "";
public static WarpDrivePeripheralHandler peripheralHandler = null;
public static String defHelpStr = "help(\"functionName\"): returns help for the function specified";
public static String defEnergyStr = "getEnergyLevel(): returns currently contained energy, max contained energy";
public static String defUpgradeStr = "upgrades(): returns a list of currently installed upgrades";
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
WarpDriveConfig.preInit(new Configuration(event.getSuggestedConfigurationFile()));
if (FMLCommonHandler.instance().getSide().isClient()) {
Minecraft mc = Minecraft.getMinecraft();
// System.out.println("[WarpDrive] Registering sounds event handler...");
MinecraftForge.EVENT_BUS.register(new SoundHandler());
normalFOV = mc.gameSettings.fovSetting;
normalSensitivity = mc.gameSettings.mouseSensitivity;
WarpDrive.print("[WarpDrive] FOV is " + normalFOV + " Sensitivity is " + normalSensitivity);
}
}
@SideOnly(Side.CLIENT)
@EventHandler
public void init(FMLInitializationEvent event) {
// FIXME FMLInterModComms.sendMessage("Waila", "register", "cr0s.WarpDrive.client.WailaHandler.callbackRegister");
}
public static void print(String out) {
System.out.println((FMLCommonHandler.instance().getEffectiveSide().isClient() ? "Client ":"Server ") + out);
}
public static void debugPrint(String out) {
if (WarpDriveConfig.G_DEBUGMODE) {
print(out);
}
}
@EventHandler
public void load(FMLInitializationEvent event) {
WarpDriveConfig.load();
// CORE CONTROLLER
protocolBlock = new BlockProtocol(WarpDriveConfig.controllerID,0, Material.rock);
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
// WARP CORE
warpCore = new BlockReactor(WarpDriveConfig.coreID, 0, Material.rock);
GameRegistry.registerBlock(warpCore, "warpCore");
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
// WARP RADAR
radarBlock = new BlockRadar(WarpDriveConfig.radarID, 0, Material.rock);
GameRegistry.registerBlock(radarBlock, "radarBlock");
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
// WARP ISOLATION
isolationBlock = new BlockWarpIsolation( WarpDriveConfig.isolationID, 0, Material.rock);
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
// AIR GENERATOR
airgenBlock = new BlockAirGenerator(WarpDriveConfig.airgenID, 0,Material.rock);
GameRegistry.registerBlock(airgenBlock, "airgenBlock");
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock");
// AIR BLOCK
airBlock = (new BlockAir(WarpDriveConfig.airID));
GameRegistry.registerBlock(airBlock, "airBlock");
// GAS BLOCK
gasBlock = (new BlockGas(WarpDriveConfig.gasID));
GameRegistry.registerBlock(gasBlock, "gasBlock");
// LASER EMITTER
laserBlock = new BlockLaser(WarpDriveConfig.laserID, 0,Material.rock);
GameRegistry.registerBlock(laserBlock, "laserBlock");
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
// LASER EMITTER WITH CAMERA
laserCamBlock = new BlockLaserCam(WarpDriveConfig.laserCamID, 0, Material.rock);
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
// CAMERA
cameraBlock = new BlockCamera(WarpDriveConfig.camID, 0,Material.rock);
GameRegistry.registerBlock(cameraBlock, "cameraBlock");
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
// MONITOR
monitorBlock = new BlockMonitor(WarpDriveConfig.monitorID);
GameRegistry.registerBlock(monitorBlock, "monitorBlock");
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
// MINING LASER
miningLaserBlock = new BlockMiningLaser(WarpDriveConfig.miningLaserID, 0, Material.rock);
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
// LASER TREE FARM
laserTreeFarmBlock = new BlockLaserTreeFarm(WarpDriveConfig.laserTreeFarmID, 0, Material.rock);
GameRegistry.registerBlock(laserTreeFarmBlock, "laserTreeFarmBlock");
GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class,"laserTreeFarmBlock");
// PARTICLE BOOSTER
boosterBlock = new BlockParticleBooster(WarpDriveConfig.particleBoosterID, 0, Material.rock);
GameRegistry.registerBlock(boosterBlock, "boosterBlock");
GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock");
// LASER LIFT
liftBlock = new BlockLift(WarpDriveConfig.liftID, 0, Material.rock);
GameRegistry.registerBlock(liftBlock, "liftBlock");
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
// IRIDIUM BLOCK
iridiumBlock = new BlockIridium(WarpDriveConfig.iridiumBlockID);
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
// SHIP SCANNER
scannerBlock = new BlockShipScanner(WarpDriveConfig.shipScannerID, 0, Material.rock);
GameRegistry.registerBlock(scannerBlock, "scannerBlock");
GameRegistry.registerTileEntity(TileEntityShipScanner.class, "scannerBlock");
// CLOAKING DEVICE CORE
cloakBlock = new BlockCloakingDeviceCore(WarpDriveConfig.cloakCoreID, 0, Material.rock);
GameRegistry.registerBlock(cloakBlock, "cloakBlock");
GameRegistry.registerTileEntity(TileEntityCloakingDeviceCore.class, "cloakBlock");
// CLOAKING DEVICE COIL
cloakCoilBlock = new BlockCloakingCoil(WarpDriveConfig.cloakCoilID, 0, Material.rock);
GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock");
// TRANSPORTER
transporterBlock = new BlockTransporter(WarpDriveConfig.transporterID,Material.rock);
GameRegistry.registerBlock(transporterBlock, "transporter");
GameRegistry.registerTileEntity(TileEntityTransporter.class,"transporter");
// REACTOR MONITOR
reactorMonitorBlock = new BlockLaserReactorMonitor(WarpDriveConfig.reactorMonitorID, Material.rock);
GameRegistry.registerBlock(reactorMonitorBlock, "reactorMonitor");
GameRegistry.registerTileEntity(TileEntityLaserReactorMonitor.class,"reactorMonitor");
// TRANSPORT BEACON
transportBeaconBlock = new BlockTransportBeacon(WarpDriveConfig.transportBeaconID);
GameRegistry.registerBlock(transportBeaconBlock, "transportBeacon");
// POWER REACTOR, LASER, STORE
powerReactorBlock = new BlockPowerReactor(WarpDriveConfig.powerReactorID);
GameRegistry.registerBlock(powerReactorBlock,"powerReactor");
GameRegistry.registerTileEntity(TileEntityPowerReactor.class, "powerReactor");
powerLaserBlock = new BlockPowerLaser(WarpDriveConfig.powerLaserID);
GameRegistry.registerBlock(powerLaserBlock, "powerLaser");
GameRegistry.registerTileEntity(TileEntityPowerLaser.class, "powerLaser");
powerStoreBlock = new BlockPowerStore(WarpDriveConfig.powerStoreID);
GameRegistry.registerBlock(powerStoreBlock,"powerStore");
GameRegistry.registerTileEntity(TileEntityPowerStore.class, "powerStore");
// CHUNK LOADER
chunkLoaderBlock = new BlockChunkLoader(WarpDriveConfig.chunkLoaderID);
GameRegistry.registerBlock(chunkLoaderBlock, "chunkLoader");
GameRegistry.registerTileEntity(TileEntityChunkLoader.class, "chunkLoader");
// DECORATIVE
decorativeBlock = new BlockDecorative(WarpDriveConfig.decorativeID);
GameRegistry.registerBlock(decorativeBlock, ItemBlockDecorative.class, "decorative");
// REACTOR LASER FOCUS
reactorLaserFocusItem = new ItemReactorLaserFocus(WarpDriveConfig.reactorLaserFocusID);
GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus");
// COMPONENT ITEMS
componentItem = new ItemWarpComponent(WarpDriveConfig.componentID);
GameRegistry.registerItem(componentItem, "component");
helmetItem = new ItemWarpArmor(WarpDriveConfig.helmetID, 0);
GameRegistry.registerItem(helmetItem, "helmet");
airCanisterItem = new ItemWarpAirCanister(WarpDriveConfig.airCanisterID);
GameRegistry.registerItem(airCanisterItem, "airCanisterFull");
upgradeItem = new ItemWarpUpgrade(WarpDriveConfig.upgradeID);
GameRegistry.registerItem(upgradeItem, "upgrade");
proxy.registerEntities();
ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance);
spaceWorldGenerator = new SpaceWorldGenerator();
GameRegistry.registerWorldGenerator(spaceWorldGenerator);
hyperSpaceWorldGenerator = new HyperSpaceWorldGenerator();
GameRegistry.registerWorldGenerator(hyperSpaceWorldGenerator);
registerSpaceDimension();
registerHyperSpaceDimension();
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
warpdriveTab.setBackgroundImageName("items.png");
MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft()));
}
if (WarpDriveConfig.isCCLoaded) {
peripheralHandler = new WarpDrivePeripheralHandler();
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
}
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
space = DimensionManager.getWorld(WarpDriveConfig.G_SPACE_DIMENSION_ID);
hyperSpace = DimensionManager.getWorld(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID);
WarpDriveConfig.postInit();
if (WarpDriveConfig.isICLoaded && WarpDriveConfig.G_ENABLE_IC2_RECIPES) {
initIC2Recipes();
}
if (WarpDriveConfig.isAppliedEnergisticsLoaded && WarpDriveConfig.isThermalExpansionLoaded && WarpDriveConfig.isAtomicScienceLoaded && WarpDriveConfig.G_ENABLE_TDK_RECIPES) {
initAETERecipes();
}
if (WarpDriveConfig.G_ENABLE_VANILLA_RECIPES) {
initVanillaRecipes();
}
warpCores = new WarpCoresRegistry();
jumpgates = new JumpgatesRegistry();
cams = new CamRegistry();
}
private static void initVanillaRecipes() {
componentItem.registerRecipes();
decorativeBlock.initRecipes();
upgradeItem.initRecipes();
//WarpCore
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi",
'i', Item.ingotIron,
'p', componentItem.getIS(6),
'c', componentItem.getIS(2),
'd', Item.diamond));
//Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii",
'i', Item.ingotIron,
'c', componentItem.getIS(5),
'd', Item.diamond));
//Radar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii",
'i', Item.ingotIron,
'c', componentItem.getIS(5),
'p', componentItem.getIS(6),
'g', Block.glass,
'd', Item.diamond));
//Isolation Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi",
'i', Item.ingotIron,
'g', Block.glass,
'e', Item.enderPearl));
//Air generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi",
'i', Item.ingotIron,
'b', Block.fenceIron,
'p', componentItem.getIS(6)));
//Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici",
'i', Item.ingotIron,
'r', Item.redstone,
'c', componentItem.getIS(5),
'l', componentItem.getIS(3),
'p', componentItem.getIS(6)));
//Mining laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili",
'i', Item.ingotIron,
'r', Item.redstone,
't', componentItem.getIS(1),
'c', componentItem.getIS(5),
'l', componentItem.getIS(3)));
//Tree farm laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici",
'i', Item.ingotIron,
's', "treeSapling",
't', componentItem.getIS(1),
'c', componentItem.getIS(5),
'l', componentItem.getIS(3)));
//Laser Lift
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili",
'i', Item.ingotIron,
'r', Item.redstone,
't', componentItem.getIS(1),
'l', componentItem.getIS(3),
'p', componentItem.getIS(6)));
//Transporter
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii",
'i', Item.ingotIron,
't', componentItem.getIS(1),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Particle Booster
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii",
'i', Item.ingotIron,
'r', Item.redstone,
'g', Block.glass,
'p', componentItem.getIS(6)));
//Camera
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici",
'i', Item.ingotIron,
'n', Item.goldNugget,
'g', Block.glass,
'c', componentItem.getIS(5)));
//LaserCamera
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(laserCamBlock), cameraBlock, laserBlock));
//Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici",
'i', Item.ingotIron,
't', Block.torchWood,
'g', Block.glass,
'c', componentItem.getIS(5)));
//Cloaking device
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici",
'i', Item.ingotIron,
'r', Item.redstone,
'l', componentItem.getIS(3),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Cloaking coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini",
'i', Item.ingotIron,
'd', Item.diamond,
'r', Item.redstone,
'n', Item.goldNugget));
//Power Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici",
'i', Item.ingotIron,
'g', Block.glass,
'c', componentItem.getIS(5),
'l', componentItem.getIS(3)));
//Power Reactor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici",
'i', Item.ingotIron,
'g', Block.glass,
'o', componentItem.getIS(4),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Power Store
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici",
'i', Item.ingotIron,
's', componentItem.getIS(7),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Transport Beacon
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ",
'e', Item.enderPearl,
'l', "dyeBlue",
'd', Item.diamond,
's', Item.stick));
//Chunk Loader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi",
'i', Item.ingotIron,
'p', componentItem.getIS(6),
'c', componentItem.getIS(0),
'f', componentItem.getIS(5)));
//Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg",
'i', Item.ingotIron,
'w', Block.cloth,
'g', Block.glass,
'c', componentItem.getIS(8)));
}
private static void initAETERecipes() {
ItemStack redstoneEnergycell = GameRegistry.findItemStack("ThermalExpansion", "cellReinforced", 1);
ItemStack resonantEnergycell = GameRegistry.findItemStack("ThermalExpansion", "cellResonant", 1);
ItemStack bucketEnder = GameRegistry.findItemStack("ThermalExpansion", "bucketEnder", 1);
ItemStack fluixCrystal = WarpDriveConfig.getAEMaterial("matFluxCrystal");
ItemStack quantumEntangledSingularity = WarpDriveConfig.getAEMaterial("matQuantumEntangledSingularity");
ItemStack vibrantQuartzGlass = WarpDriveConfig.getAEBlock("blkQuartzLamp");
vibrantQuartzGlass.setItemDamage(4);
ItemStack antimatter = GameRegistry.findItemStack("ResonantInduction|Atomic", "antimatter", 1);
antimatter.setItemDamage(0);
ItemStack floppy = GameRegistry.findItemStack("ComputerCraft", "disk", 1);
ItemStack ultimateLappack = new ItemStack(WarpDriveConfig.GS_ultimateLappack, 1, 1);
// top = advancedCircuit, redstoneEnergycell, advancedCircuit
// middle = fluix crystal, advancedMachine, fluix crystal
// bottom = advancedCircuit, bucket Resonant ender, advancedCircuit
GameRegistry.addRecipe(new ItemStack(warpCore), "crc", "fmf", "cec",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'r', redstoneEnergycell,
'e', bucketEnder,
'f', fluixCrystal);
// top = advancedCircuit, floppy, advancedCircuit
// middle = advancedCircuit, advancedMachine, advancedCircuit
// bottom = advancedCircuit, fluix crystal, advancedCircuit
GameRegistry.addRecipe(new ItemStack(protocolBlock), "coc", "cmc", "cfc",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'o', floppy,
'f', fluixCrystal);
// top = Iridium plate, Resonant Energycell, Iridium plate
// middle = Singularity, 125 milligram antimatter, Singularity
// bottom = Iridium plate, Ultimate lappack, Iridium plate
GameRegistry.addRecipe(new ItemStack(powerReactorBlock), "iri", "sas", "ili",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
's', quantumEntangledSingularity,
'a', antimatter,
'l', ultimateLappack,
'r', resonantEnergycell);
// top = Advanced circuit, Advanced alloy, Advanced alloy
// middle = Advanced circuit, Warp drive laser, Vibrant quartz glass
// bottom = Advanced circuit, Certus quartz tank, Advanced alloy
ItemStack isMiningLaserBlock = new ItemStack(miningLaserBlock.blockID, 1, 0);
ItemStack isCertusQuartzTank = new ItemStack(WarpDriveConfig.AEExtra_certusQuartzTank.blockID, 1, 0);
GameRegistry.addRecipe(new ItemStack(powerLaserBlock), "caa", "czg", "cta",
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
'z', isMiningLaserBlock,
't', isCertusQuartzTank,
'g', vibrantQuartzGlass);
}
private static void initIC2Recipes() {
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'f', WarpDriveConfig.getIC2Item("frequencyTransmitter"));
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'd', Block.blockDiamond);
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll",
'l', Block.leaves,
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
's', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc",
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
'm', WarpDriveConfig.getIC2Item("miner"));
GameRegistry.addRecipe(new ItemStack(boosterBlock), "afc", "ama", "cfa",
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
'f', WarpDriveConfig.getIC2Item("glassFiberCableItem"),
'm', WarpDriveConfig.getIC2Item("mfeUnit"));
GameRegistry.addRecipe(new ItemStack(liftBlock), "aca", "ama", "a#a",
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
'm', WarpDriveConfig.getIC2Item("magnetizer"));
GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"));
GameRegistry.addShapelessRecipe(
new ItemStack(WarpDriveConfig.getIC2Item("iridiumPlate").getItem(), 9),
new ItemStack(iridiumBlock));
GameRegistry.addRecipe(new ItemStack(laserCamBlock), "imi", "cec", "#k#",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'e', laserBlock,
'k', cameraBlock);
GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm",
'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
's', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Block.glass);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock),false,new Object[] {
"cwc", "wmw", "cwc",
'c', WarpDriveConfig.getIC2Item("electronicCircuit"),
'w', "logWood",
'm', miningLaserBlock }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] {
"ece", "imi", "iei",
'e', Item.enderPearl,
'c', WarpDriveConfig.getIC2Item("electronicCircuit"),
'i', WarpDriveConfig.getIC2Item("plateiron"),
'm', WarpDriveConfig.getIC2Item("machine") }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem),false,new Object[] {
" p ", "pdp", " p ",
'p', WarpDriveConfig.getIC2Item("plateiron"),
'd', "gemDiamond"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorMonitorBlock), false, new Object[] {
"pdp", "dmd", "pdp",
'p', WarpDriveConfig.getIC2Item("plateiron"),
'd', "gemDiamond",
'm', WarpDriveConfig.getIC2Item("mfeUnit")}));
GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi",
'i', iridiumBlock,
'c', cloakCoilBlock,
'm', WarpDriveConfig.getIC2Item("advancedMachine"));
GameRegistry.addRecipe(new ItemStack(cloakCoilBlock), "iai", "aca", "iai",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"));
}
private static void registerSpaceDimension() {
spaceBiome = (new BiomeSpace(24))
.setColor(0)
.setDisableRain()
.setBiomeName("Space");
DimensionManager.registerProviderType(WarpDriveConfig.G_SPACE_PROVIDER_ID, SpaceProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_SPACE_DIMENSION_ID, WarpDriveConfig.G_SPACE_PROVIDER_ID);
}
private static void registerHyperSpaceDimension() {
DimensionManager.registerProviderType(WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID, HyperSpaceProvider.class, true);
DimensionManager.registerDimension(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID, WarpDriveConfig.G_HYPERSPACE_PROVIDER_ID);
}
@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
cloaks = new CloakManager();
MinecraftForge.EVENT_BUS.register(new CloakChunkWatcher());
event.registerServerCommand(new GenerateCommand());
event.registerServerCommand(new SpaceTpCommand());
event.registerServerCommand(new InvisibleCommand());
event.registerServerCommand(new JumpgateCommand());
event.registerServerCommand(new DebugCommand());
}
public Ticket registerChunkLoadTE(WarpChunkTE te, boolean refreshLoading) {
World worldObj = te.worldObj;
if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0)
{
Ticket t = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL);
if (t != null) {
te.giveTicket(t); // FIXME calling the caller is a bad idea
if(refreshLoading)
te.refreshLoading();
return t;
}
else
{
WarpDrive.debugPrint("Ticket not granted");
}
}
else
{
WarpDrive.debugPrint("No tickets left!");
}
return null;
}
public Ticket registerChunkLoadTE(WarpChunkTE te)
{
return registerChunkLoadTE(te, true);
}
public Ticket getTicket(WarpChunkTE te)
{
return registerChunkLoadTE(te, false);
}
@Override
public void ticketsLoaded(List<Ticket> tickets, World world)
{
for (Ticket ticket : tickets)
{
NBTTagCompound data = ticket.getModData();
if(data != null)
{
int w = data.getInteger("ticketWorldObj");
int x = data.getInteger("ticketX");
int y = data.getInteger("ticketY");
int z = data.getInteger("ticketZ");
if(w != 0 || x != 0 || y != 0 || z != 0)
{
WorldServer ws = DimensionManager.getWorld(w);
if(ws != null)
{
TileEntity te = ws.getBlockTileEntity(x, y, z);
if(te != null && te instanceof WarpChunkTE)
{
if(((WarpChunkTE)te).shouldChunkLoad())
{
WarpDrive.debugPrint("[TicketCallback] Regiving Ticket!");
((WarpChunkTE)te).giveTicket(ticket);
((WarpChunkTE)te).refreshLoading(true);
return;
}
}
}
}
}
ForgeChunkManager.releaseTicket(ticket);
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,85 +0,0 @@
package cr0s.WarpDrive.machines;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.WarpDrive.WarpDrive;
import cr0s.WarpDrive.api.IBlockUpdateDetector;
import cr0s.WarpDrive.api.IUpgradable;
import cr0s.WarpDrive.data.EnumUpgradeTypes;
import cr0s.WarpDrive.item.ItemWarpUpgrade;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public abstract class WarpBlockContainer extends BlockContainer {
protected WarpBlockContainer(int par1) {
super(par1, Material.iron);
}
protected WarpBlockContainer(int par1, Material m) {
super(par1, m);
setHardness(0.5F);
setStepSound(Block.soundMetalFootstep);
setCreativeTab(WarpDrive.warpdriveTab);
}
@Override
public void onBlockAdded(World w, int x, int y, int z) {
super.onBlockAdded(w, x, y, z);
TileEntity te = w.getBlockTileEntity(x, y, z);
if (te instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector)te).updatedNeighbours();
}
}
/* FIXME untested
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
boolean hasResponse = false;
TileEntity te = world.getBlockTileEntity(x, y, z);
if(te != null && te instanceof IUpgradable)
{
IUpgradable upgradable = (IUpgradable)te;
ItemStack is = player.inventory.getCurrentItem();
if(is != null)
{
Item i = is.getItem();
if(i instanceof ItemWarpUpgrade)
{
if(upgradable.takeUpgrade(EnumUpgradeTypes.values()[is.getItemDamage()],false))
{
if(!player.capabilities.isCreativeMode)
player.inventory.decrStackSize(player.inventory.currentItem, 1);
player.addChatMessage("Upgrade accepted");
}
else
{
player.addChatMessage("Upgrade declined");
}
hasResponse = true;
}
}
}
return hasResponse;
}
/**/
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, int b) {
super.onNeighborBlockChange(w, x, y, z, b);
TileEntity te = w.getBlockTileEntity(x, y, z);
if (te instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector)te).updatedNeighbours();
}
}
}

View file

@ -1,5 +1,13 @@
package cr0s.warpdrive; package cr0s.WarpDrive;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.WarpDrive.data.JumpBlock;
import cr0s.WarpDrive.data.MovingEntity;
import cr0s.WarpDrive.data.TransitionPlane;
import cr0s.WarpDrive.data.Vector3;
import cr0s.WarpDrive.machines.TileEntityReactor;
import cr0s.WarpDrive.world.SpaceTeleporter;
import dan200.computercraft.api.peripheral.IPeripheral;
import ic2.api.network.NetworkHelper; import ic2.api.network.NetworkHelper;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -14,29 +22,21 @@ import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type; import net.minecraftforge.common.ForgeChunkManager.Type;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.data.JumpBlock;
import cr0s.warpdrive.data.MovingEntity;
import cr0s.warpdrive.data.TransitionPlane;
import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.machines.TileEntityReactor;
import cr0s.warpdrive.world.SpaceTeleporter;
public class EntityJump extends Entity public class EntityJump extends Entity
{ {
@ -143,7 +143,6 @@ public class EntityJump extends Entity
WarpDrive.debugPrint("" + this + " Killing jump entity... (" + reason + ")"); WarpDrive.debugPrint("" + this + " Killing jump entity... (" + reason + ")");
} }
// unlockWorlds();
unforceChunks(); unforceChunks();
worldObj.removeEntity(this); worldObj.removeEntity(this);
} }
@ -302,7 +301,7 @@ public class EntityJump extends Entity
WarpDrive.print("" + this + " messageToAllPlayersOnShip: " + msg); WarpDrive.print("" + this + " messageToAllPlayersOnShip: " + msg);
for (MovingEntity me : entitiesOnShip) { for (MovingEntity me : entitiesOnShip) {
if (me.entity instanceof EntityPlayer) { if (me.entity instanceof EntityPlayer) {
((EntityPlayer)me.entity).addChatMessage(new ChatComponentText("[" + ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg)); ((EntityPlayer)me.entity).addChatMessage("[" + ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg);
} }
} }
} }
@ -362,6 +361,7 @@ public class EntityJump extends Entity
} }
if (!planeValid) { if (!planeValid) {
LocalProfiler.stop(); LocalProfiler.stop();
@SuppressWarnings("null")
String msg = "Ship is outside border, unable to reach space!\nClosest transition plane is ~" + closestPlaneDistance + " m away (" String msg = "Ship is outside border, unable to reach space!\nClosest transition plane is ~" + closestPlaneDistance + " m away ("
+ (closestTransitionPlane.dimensionCenterX - closestTransitionPlane.borderSizeX) + ", 250," + (closestTransitionPlane.dimensionCenterX - closestTransitionPlane.borderSizeX) + ", 250,"
+ (closestTransitionPlane.dimensionCenterZ - closestTransitionPlane.borderSizeZ) + ") to (" + (closestTransitionPlane.dimensionCenterZ - closestTransitionPlane.borderSizeZ) + ") to ("
@ -554,11 +554,11 @@ public class EntityJump extends Entity
if (jb.blockTileEntity != null) { if (jb.blockTileEntity != null) {
// WarpDrive.debugPrint("Removing tile entity at " + jb.x + ", " + jb.y + ", " + jb.z); // WarpDrive.debugPrint("Removing tile entity at " + jb.x + ", " + jb.y + ", " + jb.z);
worldObj.removeTileEntity(jb.x, jb.y, jb.z); worldObj.removeBlockTileEntity(jb.x, jb.y, jb.z);
} }
worldObj.setBlock(jb.x, jb.y, jb.z, Blocks.air, 0, 2); worldObj.setBlock(jb.x, jb.y, jb.z, 0, 0, 2);
te = targetWorld.getTileEntity(jb.x + moveX, jb.y + moveY, jb.z + moveZ); te = targetWorld.getBlockTileEntity(jb.x + moveX, jb.y + moveY, jb.z + moveZ);
if (te != null) { if (te != null) {
teClass = te.getClass(); teClass = te.getClass();
// WarpDrive.debugPrint("Tile at " + jb.x + ", " + jb.y + ", " + jb.z + " is " + teClass + " derived from " + teClass.getSuperclass()); // WarpDrive.debugPrint("Tile at " + jb.x + ", " + jb.y + ", " + jb.z + " is " + teClass + " derived from " + teClass.getSuperclass());
@ -612,7 +612,7 @@ public class EntityJump extends Entity
private void saveShip(int shipSize) { private void saveShip(int shipSize) {
LocalProfiler.start("EntityJump.saveShip"); LocalProfiler.start("EntityJump.saveShip");
try { try {
ItemStack reactorChamber = WarpDriveConfig.isICLoaded ? WarpDriveConfig.getIC2Item("reactorChamber") : null; int reactorChamber = WarpDriveConfig.isICLoaded ? WarpDriveConfig.getIC2Item("reactorChamber").itemID : 0;
ship = new JumpBlock[shipSize]; ship = new JumpBlock[shipSize];
JumpBlock placeAfter[] = new JumpBlock[shipSize]; // blocks and tile entities to be placed at the end, and removed first JumpBlock placeAfter[] = new JumpBlock[shipSize]; // blocks and tile entities to be placed at the end, and removed first
@ -635,18 +635,18 @@ public class EntityJump extends Entity
for (int y = minY; y <= maxY; y++) { for (int y = minY; y <= maxY; y++) {
for (int x = x1; x <= x2; x++) { for (int x = x1; x <= x2; x++) {
for (int z = z1; z <= z2; z++) { for (int z = z1; z <= z2; z++) {
Block block = worldObj.getBlock(x, y, z); int blockID = worldObj.getBlockId(x, y, z);
// Skip air blocks // Skip air blocks
if (worldObj.isAirBlock(x, y, z) && (block.isAssociatedBlock(WarpDrive.airBlock))) { if (worldObj.isAirBlock(x, y, z) && (blockID != WarpDriveConfig.airID)) {
continue; continue;
} }
int blockMeta = worldObj.getBlockMetadata(x, y, z); int blockMeta = worldObj.getBlockMetadata(x, y, z);
TileEntity tileEntity = worldObj.getTileEntity(x, y, z); TileEntity tileEntity = worldObj.getBlockTileEntity(x, y, z);
JumpBlock jumpBlock = new JumpBlock(block, blockMeta, tileEntity, x, y, z); JumpBlock jumpBlock = new JumpBlock(blockID, blockMeta, tileEntity, x, y, z);
if (tileEntity == null || block.isAssociatedBlock(Block.getBlockFromItem(reactorChamber.getItem()))) { if (tileEntity == null || blockID != reactorChamber) {
ship[indexPlaceNormal] = jumpBlock; ship[indexPlaceNormal] = jumpBlock;
indexPlaceNormal++; indexPlaceNormal++;
} else { } else {
@ -690,8 +690,8 @@ public class EntityJump extends Entity
JumpBlock jb = ship[currentIndexInShip]; JumpBlock jb = ship[currentIndexInShip];
if (jb != null) { if (jb != null) {
jb.deploy(targetWorld, moveX, moveY, moveZ); jb.deploy(targetWorld, moveX, moveY, moveZ);
if (jb.block != WarpDriveConfig.CC_peripheral || (jb.blockMeta != 2 && jb.blockMeta != 4)) { if (jb.blockID != WarpDriveConfig.CC_peripheral || (jb.blockMeta != 2 && jb.blockMeta != 4)) {
worldObj.removeTileEntity(jb.x, jb.y, jb.z); worldObj.removeBlockTileEntity(jb.x, jb.y, jb.z);
} }
} }
currentIndexInShip++; currentIndexInShip++;
@ -821,10 +821,10 @@ public class EntityJump extends Entity
for (int x = minX; x <= maxX; x++) { for (int x = minX; x <= maxX; x++) {
for (int z = minZ; z <= maxZ; z++) { for (int z = minZ; z <= maxZ; z++) {
for (int y = minY; y <= maxY; y++) { for (int y = minY; y <= maxY; y++) {
Block block = worldObj.getBlock(x, y, z); int blockID = worldObj.getBlockId(x, y, z);
// Skipping vanilla air & WarpDrive gas blocks, keep WarpDrive air block // Skipping vanilla air & WarpDrive gas blocks, keep WarpDrive air block
if (worldObj.isAirBlock(x, y, z) && (block.isAssociatedBlock(WarpDrive.airBlock))) {// whitelist if (worldObj.isAirBlock(x, y, z) && (blockID != WarpDriveConfig.airID)) {// whitelist
continue; continue;
} }
@ -838,8 +838,7 @@ public class EntityJump extends Entity
WarpDrive.debugPrint("Block(" + x + ", " + y + ", " + z + ") is " + item.getUnlocalizedName() + ":" + worldObj.getBlockMetadata(x, y, z)); WarpDrive.debugPrint("Block(" + x + ", " + y + ", " + z + ") is " + item.getUnlocalizedName() + ":" + worldObj.getBlockMetadata(x, y, z));
/**/ /**/
//TODO: What is block 2702?!? if ((blockID == Block.bedrock.blockID) || (blockID == 2702)) {// Blacklist
if ((block.isAssociatedBlock(Blocks.bedrock)) /*|| (block == 2702)*/) {// Blacklist
reason.append("Bedrock detected onboard at " + x + ", " + y + ", " + z + ". Aborting."); reason.append("Bedrock detected onboard at " + x + ", " + y + ", " + z + ". Aborting.");
LocalProfiler.stop(); LocalProfiler.stop();
return -1; return -1;
@ -860,7 +859,7 @@ public class EntityJump extends Entity
if (!(xBorder || yBorder || zBorder)) if (!(xBorder || yBorder || zBorder))
continue; continue;
Block block = worldObj.getBlock(x, y, z); int blockID = worldObj.getBlockId(x, y, z);
// Skipping air blocks // Skipping air blocks
if (worldObj.isAirBlock(x, y, z)) { if (worldObj.isAirBlock(x, y, z)) {
@ -868,11 +867,11 @@ public class EntityJump extends Entity
} }
// Skipping unmovable blocks // Skipping unmovable blocks
if ((block.isAssociatedBlock(Blocks.bedrock)) /*|| (block == 2702)*/) {// Blacklist if ((blockID == Block.bedrock.blockID) || (blockID == 2702)) {// Blacklist
continue; continue;
} }
TileEntity te = worldObj.getTileEntity(x, y, z); TileEntity te = worldObj.getBlockTileEntity(x, y, z);
if (te == null) { if (te == null) {
continue; continue;
} }
@ -1064,9 +1063,7 @@ public class EntityJump extends Entity
int lmoveY = movementVector[1] * testDistance; int lmoveY = movementVector[1] * testDistance;
int lmoveZ = movementVector[2] * testDistance; int lmoveZ = movementVector[2] * testDistance;
int x, y, z, newX, newY, newZ; int x, y, z, newX, newY, newZ, blockOnShipID, blockID;
Block blockOnShip;
Block block;
for (y = minY; y <= maxY; y++) { for (y = minY; y <= maxY; y++) {
newY = y + lmoveY; newY = y + lmoveY;
for (x = minX; x <= maxX; x++) { for (x = minX; x <= maxX; x++) {
@ -1074,25 +1071,25 @@ public class EntityJump extends Entity
for (z = minZ; z <= maxZ; z++) { for (z = minZ; z <= maxZ; z++) {
newZ = z + lmoveZ; newZ = z + lmoveZ;
block = worldObj.getBlock(newX, newY, newZ); blockID = worldObj.getBlockId(newX, newY, newZ);
if ((block.isAssociatedBlock(Blocks.bedrock))/* || (block == 2702)*/) {// Blacklist if ((blockID == Block.bedrock.blockID) || (blockID == 2702)) {// Blacklist
result.add(x, y, z, result.add(x, y, z,
newX + 0.5D - movementVector[0] * 1.0D, newX + 0.5D - movementVector[0] * 1.0D,
newY + 0.5D - movementVector[1] * 1.0D, newY + 0.5D - movementVector[1] * 1.0D,
newZ + 0.5D - movementVector[2] * 1.0D, newZ + 0.5D - movementVector[2] * 1.0D,
true, "Unpassable block " + block + " detected at destination (" + newX + ";" + newY + ";" + newZ + ")"); true, "Unpassable block " + blockID + " detected at destination (" + newX + ";" + newY + ";" + newZ + ")");
if (!fullCollisionDetails) { if (!fullCollisionDetails) {
return result; return result;
} }
} }
blockOnShip = worldObj.getBlock(x, y, z); blockOnShipID = worldObj.getBlockId(x, y, z);
if (!blockOnShip.isAssociatedBlock(Blocks.air) && !block.isAssociatedBlock(Blocks.air) && !block.isAssociatedBlock(WarpDrive.airBlock) && !block.isAssociatedBlock(WarpDrive.gasBlock)/* && block != 18* TODO: */) { if (blockOnShipID != 0 && blockID != 0 && blockID != WarpDriveConfig.airID && blockID != WarpDriveConfig.gasID && blockID != 18) {
result.add(x, y, z, result.add(x, y, z,
newX + 0.5D + movementVector[0] * 0.1D, newX + 0.5D + movementVector[0] * 0.1D,
newY + 0.5D + movementVector[1] * 0.1D, newY + 0.5D + movementVector[1] * 0.1D,
newZ + 0.5D + movementVector[2] * 0.1D, newZ + 0.5D + movementVector[2] * 0.1D,
true, "Obstacle block #" + block + " detected at (" + newX + ", " + newY + ", " + newZ + ")"); true, "Obstacle block #" + blockID + " detected at (" + newX + ", " + newY + ", " + newZ + ")");
if (!fullCollisionDetails) { if (!fullCollisionDetails) {
return result; return result;
} }
@ -1225,7 +1222,7 @@ public class EntityJump extends Entity
public String toString() { public String toString() {
return String.format("%s/%d \'%s\' @ \'%s\' %.2f, %.2f, %.2f", new Object[] { return String.format("%s/%d \'%s\' @ \'%s\' %.2f, %.2f, %.2f", new Object[] {
getClass().getSimpleName(), getClass().getSimpleName(),
Integer.valueOf(getEntityId()), Integer.valueOf(entityId),
reactor == null ? "~NULL~" : reactor.coreFrequency, reactor == null ? "~NULL~" : reactor.coreFrequency,
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(), worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
Double.valueOf(posX), Double.valueOf(posY), Double.valueOf(posZ)}); Double.valueOf(posX), Double.valueOf(posY), Double.valueOf(posZ)});

View file

@ -1,30 +1,5 @@
package cr0s.warpdrive; package cr0s.WarpDrive;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
@ -34,60 +9,51 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent; 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.GameRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import cr0s.warpdrive.block.BlockAir; import cr0s.WarpDrive.block.*;
import cr0s.warpdrive.block.BlockGas; import cr0s.WarpDrive.command.*;
import cr0s.warpdrive.block.BlockIridium; import cr0s.WarpDrive.data.*;
import cr0s.warpdrive.command.GenerateCommand; import cr0s.WarpDrive.item.*;
import cr0s.warpdrive.command.InvisibleCommand; import cr0s.WarpDrive.machines.*;
import cr0s.warpdrive.command.JumpgateCommand; import cr0s.WarpDrive.render.*;
import cr0s.warpdrive.command.SpaceTpCommand; import cr0s.WarpDrive.world.*;
import cr0s.warpdrive.data.CamRegistry;
import cr0s.warpdrive.data.CloakManager;
import cr0s.warpdrive.data.JumpgatesRegistry;
import cr0s.warpdrive.data.WarpCoresRegistry;
import cr0s.warpdrive.item.ItemWarpAirCanister;
import cr0s.warpdrive.item.ItemWarpArmor;
import cr0s.warpdrive.item.ItemWarpComponent;
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.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.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.render.CameraOverlay;
import cr0s.warpdrive.world.BiomeSpace;
import cr0s.warpdrive.world.HyperSpaceProvider;
import cr0s.warpdrive.world.HyperSpaceWorldGenerator;
import cr0s.warpdrive.world.SpaceProvider;
import cr0s.warpdrive.world.SpaceWorldGenerator;
import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.api.ComputerCraftAPI;
@Mod(modid = "warpdrive", name = "WarpDrive", version = "2.0.0", import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
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.EnumArmorMaterial;
import net.minecraft.item.Item;
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.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.ForgeChunkManager.Type;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@Mod(modid = "WarpDrive", name = "WarpDrive", version = "1.2.7.0",
dependencies = "required-after:IC2;" dependencies = "required-after:IC2;"
+ " required-after:CoFHCore;" + " required-after:CoFHCore;"
+ " after:ComputerCraft;" + " after:ComputerCraft;"
@ -102,6 +68,11 @@ import dan200.computercraft.api.ComputerCraftAPI;
+ " after:GraviSuite;" + " after:GraviSuite;"
+ " after:UndergroundBiomes;" + " after:UndergroundBiomes;"
+ " after:NetherOres") + " after:NetherOres")
@NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = {
"WarpDriveBeam",
"WarpDriveFreq",
"WarpDriveLaserT",
"WarpDriveCloaks" }, packetHandler = PacketHandler.class)
/** /**
* @author Cr0s * @author Cr0s
*/ */
@ -117,19 +88,28 @@ public class WarpDrive implements LoadingCallback {
public static Block monitorBlock; public static Block monitorBlock;
public static Block boosterBlock; public static Block boosterBlock;
public static Block miningLaserBlock; public static Block miningLaserBlock;
public static Block laserTreeFarmBlock;
public static Block liftBlock; public static Block liftBlock;
public static Block scannerBlock; public static Block scannerBlock;
public static Block cloakBlock; public static Block cloakBlock;
public static Block cloakCoilBlock; public static Block cloakCoilBlock;
public static Block transporterBlock;
public static Block reactorMonitorBlock;
public static Block powerReactorBlock;
public static Block powerLaserBlock;
public static Block powerStoreBlock;
public static Block airBlock; public static Block airBlock;
public static Block gasBlock; public static Block gasBlock;
public static Block iridiumBlock; public static Block iridiumBlock;
public static Block transportBeaconBlock;
public static Block chunkLoaderBlock;
public static BlockDecorative decorativeBlock;
public static Item reactorLaserFocusItem;
public static ItemWarpComponent componentItem; public static ItemWarpComponent componentItem;
public static ItemWarpUpgrade upgradeItem;
public static ArmorMaterial armorMaterial = EnumHelper.addArmorMaterial("WARP", 5, new int[]{1, 3, 2, 1}, 15); public static EnumArmorMaterial armorMaterial = EnumHelper.addArmorMaterial("WARP", 5, new int[]{1, 3, 2, 1}, 15);
public static ItemWarpArmor helmetItem; public static ItemWarpArmor helmetItem;
public static ItemWarpAirCanister airCanisterItem; public static ItemWarpAirCanister airCanisterItem;
@ -147,7 +127,7 @@ public class WarpDrive implements LoadingCallback {
@Instance("WarpDrive") @Instance("WarpDrive")
public static WarpDrive instance; public static WarpDrive instance;
@SidedProxy(clientSide = "cr0s.warpdrive.client.ClientProxy", serverSide = "cr0s.warpdrive.CommonProxy") @SidedProxy(clientSide = "cr0s.WarpDrive.client.ClientProxy", serverSide = "cr0s.WarpDrive.CommonProxy")
public static CommonProxy proxy; public static CommonProxy proxy;
public static WarpCoresRegistry warpCores; public static WarpCoresRegistry warpCores;
@ -172,6 +152,9 @@ public class WarpDrive implements LoadingCallback {
if (FMLCommonHandler.instance().getSide().isClient()) { if (FMLCommonHandler.instance().getSide().isClient()) {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
// System.out.println("[WarpDrive] Registering sounds event handler...");
MinecraftForge.EVENT_BUS.register(new SoundHandler());
normalFOV = mc.gameSettings.fovSetting; normalFOV = mc.gameSettings.fovSetting;
normalSensitivity = mc.gameSettings.mouseSensitivity; normalSensitivity = mc.gameSettings.mouseSensitivity;
WarpDrive.print("[WarpDrive] FOV is " + normalFOV + " Sensitivity is " + normalSensitivity); WarpDrive.print("[WarpDrive] FOV is " + normalFOV + " Sensitivity is " + normalSensitivity);
@ -181,10 +164,11 @@ public class WarpDrive implements LoadingCallback {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@EventHandler @EventHandler
public void init(FMLInitializationEvent event) { public void init(FMLInitializationEvent event) {
// FIXME FMLInterModComms.sendMessage("Waila", "register", "cr0s.WarpDrive.client.WailaHandler.callbackRegister");
} }
public static void print(String out) { public static void print(String out) {
System.out.println("WarpDrive " + (FMLCommonHandler.instance().getEffectiveSide().isClient() ? "Client ":"Server ") + ": " + out); System.out.println((FMLCommonHandler.instance().getEffectiveSide().isClient() ? "Client ":"Server ") + out);
} }
public static void debugPrint(String out) { public static void debugPrint(String out) {
@ -198,126 +182,178 @@ public class WarpDrive implements LoadingCallback {
WarpDriveConfig.load(); WarpDriveConfig.load();
// CORE CONTROLLER // CORE CONTROLLER
protocolBlock = new BlockProtocol(0, Material.rock); protocolBlock = new BlockProtocol(WarpDriveConfig.controllerID,0, Material.rock);
GameRegistry.registerBlock(protocolBlock, "protocolBlock"); GameRegistry.registerBlock(protocolBlock, "protocolBlock");
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock"); GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
// WARP CORE // WARP CORE
warpCore = new BlockReactor(0, Material.rock); warpCore = new BlockReactor(WarpDriveConfig.coreID, 0, Material.rock);
GameRegistry.registerBlock(warpCore, "warpCore"); GameRegistry.registerBlock(warpCore, "warpCore");
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore"); GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
// WARP RADAR // WARP RADAR
radarBlock = new BlockRadar(0, Material.rock); radarBlock = new BlockRadar(WarpDriveConfig.radarID, 0, Material.rock);
GameRegistry.registerBlock(radarBlock, "radarBlock"); GameRegistry.registerBlock(radarBlock, "radarBlock");
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock"); GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
// WARP ISOLATION // WARP ISOLATION
isolationBlock = new BlockWarpIsolation(0, Material.rock); isolationBlock = new BlockWarpIsolation( WarpDriveConfig.isolationID, 0, Material.rock);
GameRegistry.registerBlock(isolationBlock, "isolationBlock"); GameRegistry.registerBlock(isolationBlock, "isolationBlock");
// AIR GENERATOR // AIR GENERATOR
airgenBlock = new BlockAirGenerator(0,Material.rock); airgenBlock = new BlockAirGenerator(WarpDriveConfig.airgenID, 0,Material.rock);
GameRegistry.registerBlock(airgenBlock, "airgenBlock"); GameRegistry.registerBlock(airgenBlock, "airgenBlock");
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock"); GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock");
// AIR Block // AIR BLOCK
airBlock = (new BlockAir()); airBlock = (new BlockAir(WarpDriveConfig.airID));
GameRegistry.registerBlock(airBlock, "airBlock"); GameRegistry.registerBlock(airBlock, "airBlock");
// GAS Block // GAS BLOCK
gasBlock = new BlockGas(); gasBlock = (new BlockGas(WarpDriveConfig.gasID));
GameRegistry.registerBlock(gasBlock, "gasBlock"); GameRegistry.registerBlock(gasBlock, "gasBlock");
// LASER EMITTER // LASER EMITTER
laserBlock = new BlockLaser(0, Material.rock); laserBlock = new BlockLaser(WarpDriveConfig.laserID, 0,Material.rock);
GameRegistry.registerBlock(laserBlock, "laserBlock"); GameRegistry.registerBlock(laserBlock, "laserBlock");
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock"); GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
// LASER EMITTER WITH CAMERA // LASER EMITTER WITH CAMERA
laserCamBlock = new BlockLaserCam(0, Material.rock); laserCamBlock = new BlockLaserCam(WarpDriveConfig.laserCamID, 0, Material.rock);
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock"); GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
// CAMERA // CAMERA
cameraBlock = new BlockCamera(0,Material.rock); cameraBlock = new BlockCamera(WarpDriveConfig.camID, 0,Material.rock);
GameRegistry.registerBlock(cameraBlock, "cameraBlock"); GameRegistry.registerBlock(cameraBlock, "cameraBlock");
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock"); GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
// MONITOR // MONITOR
monitorBlock = new BlockMonitor(); monitorBlock = new BlockMonitor(WarpDriveConfig.monitorID);
GameRegistry.registerBlock(monitorBlock, "monitorBlock"); GameRegistry.registerBlock(monitorBlock, "monitorBlock");
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock"); GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
// MINING LASER // MINING LASER
miningLaserBlock = new BlockMiningLaser(0, Material.rock); miningLaserBlock = new BlockMiningLaser(WarpDriveConfig.miningLaserID, 0, Material.rock);
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock"); GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock"); GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
// LASER TREE FARM
laserTreeFarmBlock = new BlockLaserTreeFarm(WarpDriveConfig.laserTreeFarmID, 0, Material.rock);
GameRegistry.registerBlock(laserTreeFarmBlock, "laserTreeFarmBlock");
GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class,"laserTreeFarmBlock");
// PARTICLE BOOSTER // PARTICLE BOOSTER
boosterBlock = new BlockParticleBooster(0, Material.rock); boosterBlock = new BlockParticleBooster(WarpDriveConfig.particleBoosterID, 0, Material.rock);
GameRegistry.registerBlock(boosterBlock, "boosterBlock"); GameRegistry.registerBlock(boosterBlock, "boosterBlock");
GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock"); GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock");
// LASER LIFT // LASER LIFT
liftBlock = new BlockLift(0, Material.rock); liftBlock = new BlockLift(WarpDriveConfig.liftID, 0, Material.rock);
GameRegistry.registerBlock(liftBlock, "liftBlocks"); GameRegistry.registerBlock(liftBlock, "liftBlock");
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock"); GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
// IRIDIUM Blocks // IRIDIUM BLOCK
iridiumBlock = new BlockIridium(); iridiumBlock = new BlockIridium(WarpDriveConfig.iridiumBlockID);
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock"); GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
// SHIP SCANNER // SHIP SCANNER
scannerBlock = new BlockShipScanner(0, Material.rock); scannerBlock = new BlockShipScanner(WarpDriveConfig.shipScannerID, 0, Material.rock);
GameRegistry.registerBlock(scannerBlock, "scannerBlocks"); GameRegistry.registerBlock(scannerBlock, "scannerBlock");
GameRegistry.registerTileEntity(TileEntityShipScanner.class, "scannerBlock"); GameRegistry.registerTileEntity(TileEntityShipScanner.class, "scannerBlock");
// CLOAKING DEVICE CORE // CLOAKING DEVICE CORE
cloakBlock = new BlockCloakingDeviceCore(0, Material.rock); cloakBlock = new BlockCloakingDeviceCore(WarpDriveConfig.cloakCoreID, 0, Material.rock);
GameRegistry.registerBlock(cloakBlock, "cloakBlock"); GameRegistry.registerBlock(cloakBlock, "cloakBlock");
GameRegistry.registerTileEntity(TileEntityCloakingDeviceCore.class, "cloakBlock"); GameRegistry.registerTileEntity(TileEntityCloakingDeviceCore.class, "cloakBlock");
// CLOAKING DEVICE COIL // CLOAKING DEVICE COIL
cloakCoilBlock = new BlockCloakingCoil(0, Material.rock); cloakCoilBlock = new BlockCloakingCoil(WarpDriveConfig.cloakCoilID, 0, Material.rock);
GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock"); GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock");
// COMPONENT ItemsS // TRANSPORTER
componentItem = new ItemWarpComponent(); transporterBlock = new BlockTransporter(WarpDriveConfig.transporterID,Material.rock);
GameRegistry.registerBlock(transporterBlock, "transporter");
GameRegistry.registerTileEntity(TileEntityTransporter.class,"transporter");
// REACTOR MONITOR
reactorMonitorBlock = new BlockLaserReactorMonitor(WarpDriveConfig.reactorMonitorID, Material.rock);
GameRegistry.registerBlock(reactorMonitorBlock, "reactorMonitor");
GameRegistry.registerTileEntity(TileEntityLaserReactorMonitor.class,"reactorMonitor");
// TRANSPORT BEACON
transportBeaconBlock = new BlockTransportBeacon(WarpDriveConfig.transportBeaconID);
GameRegistry.registerBlock(transportBeaconBlock, "transportBeacon");
// POWER REACTOR, LASER, STORE
powerReactorBlock = new BlockPowerReactor(WarpDriveConfig.powerReactorID);
GameRegistry.registerBlock(powerReactorBlock,"powerReactor");
GameRegistry.registerTileEntity(TileEntityPowerReactor.class, "powerReactor");
powerLaserBlock = new BlockPowerLaser(WarpDriveConfig.powerLaserID);
GameRegistry.registerBlock(powerLaserBlock, "powerLaser");
GameRegistry.registerTileEntity(TileEntityPowerLaser.class, "powerLaser");
powerStoreBlock = new BlockPowerStore(WarpDriveConfig.powerStoreID);
GameRegistry.registerBlock(powerStoreBlock,"powerStore");
GameRegistry.registerTileEntity(TileEntityPowerStore.class, "powerStore");
// CHUNK LOADER
chunkLoaderBlock = new BlockChunkLoader(WarpDriveConfig.chunkLoaderID);
GameRegistry.registerBlock(chunkLoaderBlock, "chunkLoader");
GameRegistry.registerTileEntity(TileEntityChunkLoader.class, "chunkLoader");
// DECORATIVE
decorativeBlock = new BlockDecorative(WarpDriveConfig.decorativeID);
GameRegistry.registerBlock(decorativeBlock, ItemBlockDecorative.class, "decorative");
// REACTOR LASER FOCUS
reactorLaserFocusItem = new ItemReactorLaserFocus(WarpDriveConfig.reactorLaserFocusID);
GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus");
// COMPONENT ITEMS
componentItem = new ItemWarpComponent(WarpDriveConfig.componentID);
GameRegistry.registerItem(componentItem, "component"); GameRegistry.registerItem(componentItem, "component");
helmetItem = new ItemWarpArmor(0); helmetItem = new ItemWarpArmor(WarpDriveConfig.helmetID, 0);
GameRegistry.registerItem(helmetItem, "helmet"); GameRegistry.registerItem(helmetItem, "helmet");
airCanisterItem = new ItemWarpAirCanister(); airCanisterItem = new ItemWarpAirCanister(WarpDriveConfig.airCanisterID);
GameRegistry.registerItem(airCanisterItem, "airCanisterFull"); GameRegistry.registerItem(airCanisterItem, "airCanisterFull");
upgradeItem = new ItemWarpUpgrade(WarpDriveConfig.upgradeID);
GameRegistry.registerItem(upgradeItem, "upgrade");
proxy.registerEntities(); proxy.registerEntities();
ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance); ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance);
spaceWorldGenerator = new SpaceWorldGenerator(); spaceWorldGenerator = new SpaceWorldGenerator();
GameRegistry.registerWorldGenerator(spaceWorldGenerator, 0); GameRegistry.registerWorldGenerator(spaceWorldGenerator);
hyperSpaceWorldGenerator = new HyperSpaceWorldGenerator(); hyperSpaceWorldGenerator = new HyperSpaceWorldGenerator();
GameRegistry.registerWorldGenerator(hyperSpaceWorldGenerator, 0); GameRegistry.registerWorldGenerator(hyperSpaceWorldGenerator);
registerSpaceDimension(); registerSpaceDimension();
registerHyperSpaceDimension(); registerHyperSpaceDimension();
@ -325,7 +361,7 @@ public class WarpDrive implements LoadingCallback {
MinecraftForge.EVENT_BUS.register(new SpaceEventHandler()); MinecraftForge.EVENT_BUS.register(new SpaceEventHandler());
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
warpdriveTab.setBackgroundImageName("Items.png"); warpdriveTab.setBackgroundImageName("items.png");
MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft())); MinecraftForge.EVENT_BUS.register(new CameraOverlay(Minecraft.getMinecraft()));
} }
@ -359,76 +395,93 @@ public class WarpDrive implements LoadingCallback {
private static void initVanillaRecipes() { private static void initVanillaRecipes() {
componentItem.registerRecipes(); componentItem.registerRecipes();
decorativeBlock.initRecipes();
upgradeItem.initRecipes();
//WarpCore //WarpCore
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'p', componentItem.getIS(6), 'p', componentItem.getIS(6),
'c', componentItem.getIS(2), 'c', componentItem.getIS(2),
'd', Items.diamond)); 'd', Item.diamond));
//Controller //Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'c', componentItem.getIS(5), 'c', componentItem.getIS(5),
'd', Items.diamond)); 'd', Item.diamond));
//Radar //Radar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'c', componentItem.getIS(5), 'c', componentItem.getIS(5),
'p', componentItem.getIS(6), 'p', componentItem.getIS(6),
'g', Blocks.glass, 'g', Block.glass,
'd', Items.diamond)); 'd', Item.diamond));
//Isolation Blocks //Isolation Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'g', Blocks.glass, 'g', Block.glass,
'e', Items.ender_pearl)); 'e', Item.enderPearl));
//Air generator //Air generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'b', Blocks.iron_bars, 'b', Block.fenceIron,
'p', componentItem.getIS(6))); 'p', componentItem.getIS(6)));
//Laser //Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'r', Items.redstone, 'r', Item.redstone,
'c', componentItem.getIS(5), 'c', componentItem.getIS(5),
'l', componentItem.getIS(3), 'l', componentItem.getIS(3),
'p', componentItem.getIS(6))); 'p', componentItem.getIS(6)));
//Mining laser //Mining laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'r', Items.redstone, 'r', Item.redstone,
't', componentItem.getIS(1),
'c', componentItem.getIS(5),
'l', componentItem.getIS(3)));
//Tree farm laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici",
'i', Item.ingotIron,
's', "treeSapling",
't', componentItem.getIS(1), 't', componentItem.getIS(1),
'c', componentItem.getIS(5), 'c', componentItem.getIS(5),
'l', componentItem.getIS(3))); 'l', componentItem.getIS(3)));
//Laser Lift //Laser Lift
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'r', Items.redstone, 'r', Item.redstone,
't', componentItem.getIS(1), 't', componentItem.getIS(1),
'l', componentItem.getIS(3), 'l', componentItem.getIS(3),
'p', componentItem.getIS(6))); 'p', componentItem.getIS(6)));
//Transporter
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii",
'i', Item.ingotIron,
't', componentItem.getIS(1),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Particle Booster //Particle Booster
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'r', Items.redstone, 'r', Item.redstone,
'g', Blocks.glass, 'g', Block.glass,
'p', componentItem.getIS(6))); 'p', componentItem.getIS(6)));
//Camera //Camera
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'n', Items.gold_nugget, 'n', Item.goldNugget,
'g', Blocks.glass, 'g', Block.glass,
'c', componentItem.getIS(5))); 'c', componentItem.getIS(5)));
//LaserCamera //LaserCamera
@ -436,43 +489,82 @@ public class WarpDrive implements LoadingCallback {
//Monitor //Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici",
'i', Items.iron_ingot, 'i', Item.ingotIron,
't', Blocks.torch, 't', Block.torchWood,
'g', Blocks.glass, 'g', Block.glass,
'c', componentItem.getIS(5))); 'c', componentItem.getIS(5)));
//Cloaking device //Cloaking device
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'r', Items.redstone, 'r', Item.redstone,
'l', componentItem.getIS(3), 'l', componentItem.getIS(3),
'c', componentItem.getIS(5), 'c', componentItem.getIS(5),
'p', componentItem.getIS(6))); 'p', componentItem.getIS(6)));
//Cloaking coil //Cloaking coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'd', Items.diamond, 'd', Item.diamond,
'r', Items.redstone, 'r', Item.redstone,
'n', Items.gold_nugget)); 'n', Item.goldNugget));
//Power Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici",
'i', Item.ingotIron,
'g', Block.glass,
'c', componentItem.getIS(5),
'l', componentItem.getIS(3)));
//Power Reactor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici",
'i', Item.ingotIron,
'g', Block.glass,
'o', componentItem.getIS(4),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Power Store
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici",
'i', Item.ingotIron,
's', componentItem.getIS(7),
'c', componentItem.getIS(5),
'p', componentItem.getIS(6)));
//Transport Beacon
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ",
'e', Item.enderPearl,
'l', "dyeBlue",
'd', Item.diamond,
's', Item.stick));
//Chunk Loader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi",
'i', Item.ingotIron,
'p', componentItem.getIS(6),
'c', componentItem.getIS(0),
'f', componentItem.getIS(5)));
//Helmet //Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg", GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg",
'i', Items.iron_ingot, 'i', Item.ingotIron,
'w', Blocks.wool, 'w', Block.cloth,
'g', Blocks.glass, 'g', Block.glass,
'c', componentItem.getIS(8))); 'c', componentItem.getIS(8)));
} }
private static void initAETERecipes() { private static void initAETERecipes() {
ItemStack redstoneEnergycell = GameRegistry.findItemStack("ThermalExpansion", "cellReinforced", 1); ItemStack redstoneEnergycell = GameRegistry.findItemStack("ThermalExpansion", "cellReinforced", 1);
ItemStack resonantEnergycell = GameRegistry.findItemStack("ThermalExpansion", "cellResonant", 1);
ItemStack bucketEnder = GameRegistry.findItemStack("ThermalExpansion", "bucketEnder", 1); ItemStack bucketEnder = GameRegistry.findItemStack("ThermalExpansion", "bucketEnder", 1);
ItemStack fluixCrystal = WarpDriveConfig.getAEMaterial("matFluxCrystal"); ItemStack fluixCrystal = WarpDriveConfig.getAEMaterial("matFluxCrystal");
ItemStack quantumEntangledSingularity = WarpDriveConfig.getAEMaterial("matQuantumEntangledSingularity");
ItemStack vibrantQuartzGlass = WarpDriveConfig.getAEBlock("blkQuartzLamp"); ItemStack vibrantQuartzGlass = WarpDriveConfig.getAEBlock("blkQuartzLamp");
vibrantQuartzGlass.setItemDamage(4); vibrantQuartzGlass.setItemDamage(4);
ItemStack antimatter = GameRegistry.findItemStack("ResonantInduction|Atomic", "antimatter", 1); ItemStack antimatter = GameRegistry.findItemStack("ResonantInduction|Atomic", "antimatter", 1);
antimatter.setItemDamage(0); antimatter.setItemDamage(0);
ItemStack floppy = GameRegistry.findItemStack("ComputerCraft", "disk", 1); ItemStack floppy = GameRegistry.findItemStack("ComputerCraft", "disk", 1);
ItemStack ultimateLappack = new ItemStack(WarpDriveConfig.GS_ultimateLappack, 1, 1);
// top = advancedCircuit, redstoneEnergycell, advancedCircuit // top = advancedCircuit, redstoneEnergycell, advancedCircuit
// middle = fluix crystal, advancedMachine, fluix crystal // middle = fluix crystal, advancedMachine, fluix crystal
@ -492,14 +584,37 @@ public class WarpDrive implements LoadingCallback {
'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'o', floppy, 'o', floppy,
'f', fluixCrystal); 'f', fluixCrystal);
// top = Iridium plate, Resonant Energycell, Iridium plate
// middle = Singularity, 125 milligram antimatter, Singularity
// bottom = Iridium plate, Ultimate lappack, Iridium plate
GameRegistry.addRecipe(new ItemStack(powerReactorBlock), "iri", "sas", "ili",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
's', quantumEntangledSingularity,
'a', antimatter,
'l', ultimateLappack,
'r', resonantEnergycell);
// top = Advanced circuit, Advanced alloy, Advanced alloy
// middle = Advanced circuit, Warp drive laser, Vibrant quartz glass
// bottom = Advanced circuit, Certus quartz tank, Advanced alloy
ItemStack isMiningLaserBlock = new ItemStack(miningLaserBlock.blockID, 1, 0);
ItemStack isCertusQuartzTank = new ItemStack(WarpDriveConfig.AEExtra_certusQuartzTank.blockID, 1, 0);
GameRegistry.addRecipe(new ItemStack(powerLaserBlock), "caa", "czg", "cta",
'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
'z', isMiningLaserBlock,
't', isCertusQuartzTank,
'g', vibrantQuartzGlass);
} }
private static void initIC2Recipes() { private static void initIC2Recipes() {
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici", GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit")); 'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii", GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
@ -513,10 +628,10 @@ public class WarpDrive implements LoadingCallback {
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii", GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii",
'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'i', WarpDriveConfig.getIC2Item("iridiumPlate"),
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'd', Blocks.diamond_block); 'd', Block.blockDiamond);
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll", GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll",
'l', Blocks.leaves, 'l', Block.leaves,
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit")); 'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
@ -558,18 +673,42 @@ public class WarpDrive implements LoadingCallback {
GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc", GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc",
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Blocks.glass); 'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg", GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg",
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Blocks.glass); 'g', Block.glass);
GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm", GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm",
'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'm', WarpDriveConfig.getIC2Item("advancedMachine"),
'a', WarpDriveConfig.getIC2Item("advancedAlloy"), 'a', WarpDriveConfig.getIC2Item("advancedAlloy"),
's', WarpDriveConfig.getIC2Item("advancedCircuit"), 's', WarpDriveConfig.getIC2Item("advancedCircuit"),
'g', Blocks.glass); 'g', Block.glass);
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock),false,new Object[] {
"cwc", "wmw", "cwc",
'c', WarpDriveConfig.getIC2Item("electronicCircuit"),
'w', "logWood",
'm', miningLaserBlock }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] {
"ece", "imi", "iei",
'e', Item.enderPearl,
'c', WarpDriveConfig.getIC2Item("electronicCircuit"),
'i', WarpDriveConfig.getIC2Item("plateiron"),
'm', WarpDriveConfig.getIC2Item("machine") }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem),false,new Object[] {
" p ", "pdp", " p ",
'p', WarpDriveConfig.getIC2Item("plateiron"),
'd', "gemDiamond"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorMonitorBlock), false, new Object[] {
"pdp", "dmd", "pdp",
'p', WarpDriveConfig.getIC2Item("plateiron"),
'd', "gemDiamond",
'm', WarpDriveConfig.getIC2Item("mfeUnit")}));
GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi", GameRegistry.addRecipe(new ItemStack(cloakBlock), "imi", "mcm", "imi",
'i', iridiumBlock, 'i', iridiumBlock,
@ -605,10 +744,11 @@ public class WarpDrive implements LoadingCallback {
event.registerServerCommand(new SpaceTpCommand()); event.registerServerCommand(new SpaceTpCommand());
event.registerServerCommand(new InvisibleCommand()); event.registerServerCommand(new InvisibleCommand());
event.registerServerCommand(new JumpgateCommand()); event.registerServerCommand(new JumpgateCommand());
event.registerServerCommand(new DebugCommand());
} }
public Ticket registerChunkLoadTE(WarpChunkTE te, boolean refreshLoading) { public Ticket registerChunkLoadTE(WarpChunkTE te, boolean refreshLoading) {
World worldObj = te.getWorldObj(); World worldObj = te.worldObj;
if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0) if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0)
{ {
Ticket t = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL); Ticket t = ForgeChunkManager.requestTicket(this, worldObj, Type.NORMAL);
@ -657,7 +797,7 @@ public class WarpDrive implements LoadingCallback {
WorldServer ws = DimensionManager.getWorld(w); WorldServer ws = DimensionManager.getWorld(w);
if(ws != null) if(ws != null)
{ {
TileEntity te = ws.getTileEntity(x, y, z); TileEntity te = ws.getBlockTileEntity(x, y, z);
if(te != null && te instanceof WarpChunkTE) if(te != null && te instanceof WarpChunkTE)
{ {
if(((WarpChunkTE)te).shouldChunkLoad()) if(((WarpChunkTE)te).shouldChunkLoad())

View file

@ -1,36 +1,29 @@
package cr0s.warpdrive; package cr0s.WarpDrive;
import gravisuite.GraviSuite;
import ic2.api.item.IC2Items;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.Random;
import advsolar.common.AdvancedSolarPanel; import cpw.mods.fml.common.Loader;
import mffs.Content; import cr0s.WarpDrive.data.TransitionPlane;
import mffs.ModularForceFieldSystem; import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.config.Configuration; import ic2.api.item.Items;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Loader;
import cr0s.warpdrive.data.TransitionPlane;
import dan200.computercraft.ComputerCraft;
public class WarpDriveConfig public class WarpDriveConfig
{ {
private static Configuration config; private static Configuration config;
// Blocks (no longer neccessary, TODO: delete once compiling without) // Blocks
/*
public static int coreID; public static int coreID;
public static int controllerID; public static int controllerID;
public static int radarID; public static int radarID;
@ -49,6 +42,16 @@ public class WarpDriveConfig
public static int shipScannerID; public static int shipScannerID;
public static int cloakCoreID; public static int cloakCoreID;
public static int cloakCoilID; public static int cloakCoilID;
public static int laserTreeFarmID;
public static int transporterID;
public static int transportBeaconID;
public static int reactorLaserFocusID;
public static int reactorMonitorID;
public static int powerReactorID;
public static int powerLaserID;
public static int powerStoreID;
public static int chunkLoaderID;
public static int decorativeID;
// Items // Items
public static int componentID; public static int componentID;
@ -58,12 +61,12 @@ public class WarpDriveConfig
public static int bootsID; public static int bootsID;
public static int airCanisterID; public static int airCanisterID;
public static int upgradeID; public static int upgradeID;
*/
/* /*
* The variables which store whether or not individual mods are loaded * The variables which store whether or not individual mods are loaded
*/ */
public static boolean isForgeMultipartLoaded = false; public static boolean isForgeMultipartLoaded = false;
public static boolean isGregLoaded = false;
public static boolean isAppliedEnergisticsLoaded = false; public static boolean isAppliedEnergisticsLoaded = false;
public static boolean isAdvSolPanelLoaded = false; public static boolean isAdvSolPanelLoaded = false;
public static boolean isAtomicScienceLoaded = false; public static boolean isAtomicScienceLoaded = false;
@ -78,37 +81,37 @@ public class WarpDriveConfig
public static boolean isThermalExpansionLoaded = false; public static boolean isThermalExpansionLoaded = false;
public static boolean isMetallurgyLoaded = false; public static boolean isMetallurgyLoaded = false;
public static boolean isAdvancedRepulsionSystemsLoaded = false; public static boolean isAdvancedRepulsionSystemsLoaded = false;
public static boolean isMagicalCropsLoaded = false;
// ForgeMultipart (microblocks) support // ForgeMultipart (microblocks) support
public static Method forgeMultipart_helper_createTileFromNBT = null; public static Method forgeMultipart_helper_createTileFromNBT = null;
public static Method forgeMultipart_helper_sendDescPacket = null; public static Method forgeMultipart_helper_sendDescPacket = null;
public static Method forgeMultipart_tileMultipart_onChunkLoad = null; public static Method forgeMultipart_tileMultipart_onChunkLoad = null;
public static ItemStack IC2_Air; public static int[] IC2_Air;
public static ItemStack IC2_Empty; public static int[] IC2_Empty;
public static Item IC2_RubberWood; public static int IC2_RubberWood;
public static Item IC2_Resin; public static ItemStack IC2_Resin;
public static Item IC2_fluidCell; public static Item IC2_fluidCell;
public static Block CC_Computer, CC_peripheral, CC_Floppy, CCT_Turtle, CCT_Upgraded, CCT_Advanced; public static int CC_Computer = 0, CC_peripheral = 0, CC_Floppy = 0, CCT_Turtle = 0, CCT_Upgraded = 0, CCT_Advanced = 0;
public static Block GT_Ores, GT_Granite, GT_Machine; public static int GT_Ores = 0, GT_Granite = 0, GT_Machine = 0;
public static Item ASP; public static int ASP = 0;
public static int AS_Turbine = 0, AS_deuteriumCell = 0; public static int AS_Turbine = 0, AS_deuteriumCell = 0;
public static int ICBM_Machine = 0, ICBM_Missile = 0, ICBM_Explosive = 0; public static int ICBM_Machine = 0, ICBM_Missile = 0, ICBM_Explosive = 0;
public static Item GS_ultimateLappack; public static int GS_ultimateLappack = 0;
public static Block UB_igneousStone, UB_metamorphicStone, UB_metamorphicCobblestone, UB_sedimentaryStone, UB_igneousCobblestone; public static int UB_igneousStone = 0, UB_igneousCobblestone = 0, UB_metamorphicStone = 0, UB_metamorphicCobblestone = 0, UB_sedimentaryStone = 0;
public static int NetherOres_count; public static int NetherOres_count;
public static int[] NetherOres_block; public static int[] NetherOres_block;
public static int[][] Metallurgy_overworldOresBlock; public static int[][] Metallurgy_overworldOresBlock;
public static int[][] Metallurgy_netherOresBlock; public static int[][] Metallurgy_netherOresBlock;
public static int[][] Metallurgy_endOresBlock; public static int[][] Metallurgy_endOresBlock;
public static ArrayList<Block> forceFieldBlocks; public static ArrayList<Integer> forceFieldBlocks;
public static ArrayList<Item> spaceHelmets, jetpacks, minerLogs, minerLeaves; public static Set<Integer> SpaceHelmets, Jetpacks, MinerOres, MinerLogs, MinerLeaves, scannerIgnoreBlocks;
public static ArrayList<Block> minerOres, scannerIgnoreBlocks;
private static Class<?> AEBlocks; private static Class<?> AEBlocks;
private static Class<?> AEMaterials; private static Class<?> AEMaterials;
private static Class<?> AEItems; private static Class<?> AEItems;
public static ArrayList<Block> commonWorldGenOres; public static ArrayList<int[]> CommonWorldGenOres;
public static Item AEExtra_fluidDrive; public static Item AEExtra_fluidDrive;
public static Block AEExtra_certusQuartzTank; public static Block AEExtra_certusQuartzTank;
@ -152,6 +155,7 @@ public class WarpDriveConfig
public static int WC_WARMUP_RANDOM_TICKS = 60; public static int WC_WARMUP_RANDOM_TICKS = 60;
public static int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10; public static int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
public static int WC_ISOLATION_UPDATE_INTERVAL_SECONDS = 10; public static int WC_ISOLATION_UPDATE_INTERVAL_SECONDS = 10;
public static String[] WC_UNLIMITED_PLAYERNAMES = { "notch", "someone" };
// Warp Radar // Warp Radar
public static int WR_MAX_ENERGY_VALUE = 100000000; // 100kk eU public static int WR_MAX_ENERGY_VALUE = 100000000; // 100kk eU
@ -225,7 +229,26 @@ public class WarpDriveConfig
// Air generator // Air generator
public static int AG_RF_PER_CANISTER = 20; public static int AG_RF_PER_CANISTER = 20;
// Reactor monitor
public static int RM_MAX_ENERGY = 1000000;
public static double RM_EU_PER_HEAT = 2;
// Transporter
public static int TR_MAX_ENERGY = 1000000;
public static boolean TR_RELATIVE_COORDS = true;
public static double TR_EU_PER_METRE = 100;
// public static double TR_MAX_SCAN_RANGE = 4; FIXME: not used ?!?
public static double TR_MAX_BOOST_MUL = 4;
// Power reactor
public static int PR_MAX_ENERGY = 100000000;
public static int PR_TICK_TIME = 5;
public static int PR_MAX_LASERS = 6;
// Power store
public static int PS_MAX_ENERGY = 1000000;
// Laser Lift // Laser Lift
public static int LL_MAX_ENERGY = 2400; public static int LL_MAX_ENERGY = 2400;
public static int LL_LIFT_ENERGY = 800; public static int LL_LIFT_ENERGY = 800;
@ -237,7 +260,7 @@ public class WarpDriveConfig
public static int CL_RF_PER_CHUNKTICK = 320; public static int CL_RF_PER_CHUNKTICK = 320;
public static ItemStack getIC2Item(String id) { public static ItemStack getIC2Item(String id) {
return IC2Items.getItem(id); return Items.getItem(id);
} }
public static ItemStack getAEBlock(String id) { public static ItemStack getAEBlock(String id) {
@ -332,6 +355,7 @@ public class WarpDriveConfig
WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = config.get("WarpCore", "cores_registry_update_interval", WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt(); WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = config.get("WarpCore", "cores_registry_update_interval", WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt();
WC_ISOLATION_UPDATE_INTERVAL_SECONDS = config.get("WarpCore", "isolation_update_interval", WC_ISOLATION_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt(); WC_ISOLATION_UPDATE_INTERVAL_SECONDS = config.get("WarpCore", "isolation_update_interval", WC_ISOLATION_UPDATE_INTERVAL_SECONDS, "(measured in seconds)").getInt();
WC_UNLIMITED_PLAYERNAMES = config.get("WarpCore", "unlimited_playernames", WC_UNLIMITED_PLAYERNAMES, "List of player names which gives unlimited block counts to their ship").getStringList();
// Warp Radar // Warp Radar
WR_MAX_ENERGY_VALUE = config.get("WarpRadar", "max_energy_value", WR_MAX_ENERGY_VALUE).getInt(); WR_MAX_ENERGY_VALUE = config.get("WarpRadar", "max_energy_value", WR_MAX_ENERGY_VALUE).getInt();
@ -405,6 +429,24 @@ public class WarpDriveConfig
// Air generator // Air generator
AG_RF_PER_CANISTER = config.get("Air Generator", "energy_per_canister", AG_RF_PER_CANISTER).getInt(); AG_RF_PER_CANISTER = config.get("Air Generator", "energy_per_canister", AG_RF_PER_CANISTER).getInt();
// Reactor monitor
RM_MAX_ENERGY = config.get("Reactor Monitor", "max_rm_energy", RM_MAX_ENERGY).getInt();
RM_EU_PER_HEAT = config.get("Reactor Monitor", "eu_per_heat", RM_EU_PER_HEAT).getDouble(2);
// Transporter
TR_MAX_ENERGY = config.get("Transporter", "max_energy", TR_MAX_ENERGY).getInt();
TR_RELATIVE_COORDS = config.get("Transporter", "relative_coords", TR_RELATIVE_COORDS).getBoolean(true);
TR_EU_PER_METRE = config.get("Transporter", "eu_per_ent_per_metre", TR_EU_PER_METRE).getDouble(100);
TR_MAX_BOOST_MUL = config.get("Transporter", "max_boost", TR_MAX_BOOST_MUL).getInt();
// Power reactor
PR_MAX_ENERGY = config.get("Reactor", "max_energy", PR_MAX_ENERGY).getInt();
PR_TICK_TIME = config.get("Reactor", "ticks_per_update", PR_TICK_TIME).getInt();
PR_MAX_LASERS = config.get("Reactor", "max_lasers", PR_MAX_LASERS).getInt();
// Power store
PS_MAX_ENERGY = config.get("PowerStore", "max_energy", PS_MAX_ENERGY).getInt();
// Laser lift // Laser lift
LL_MAX_ENERGY = config.get("LaserLift", "max_energy", LL_MAX_ENERGY).getInt(); LL_MAX_ENERGY = config.get("LaserLift", "max_energy", LL_MAX_ENERGY).getInt();
LL_LIFT_ENERGY = config.get("LaserLift", "lift_energy", LL_LIFT_ENERGY, "Energy consummed per entity moved").getInt(); LL_LIFT_ENERGY = config.get("LaserLift", "lift_energy", LL_LIFT_ENERGY, "Energy consummed per entity moved").getInt();
@ -412,24 +454,24 @@ public class WarpDriveConfig
} }
public static void load() { public static void load() {
commonWorldGenOres = new ArrayList<Block>(); CommonWorldGenOres = new ArrayList<int[]>(30);
commonWorldGenOres.add(Blocks.iron_ore); CommonWorldGenOres.add(new int[] {Block.oreIron.blockID, 0});
commonWorldGenOres.add(Blocks.gold_ore); CommonWorldGenOres.add(new int[] {Block.oreGold.blockID, 0});
commonWorldGenOres.add(Blocks.coal_ore); CommonWorldGenOres.add(new int[] {Block.oreCoal.blockID, 0});
commonWorldGenOres.add(Blocks.emerald_ore); CommonWorldGenOres.add(new int[] {Block.oreEmerald.blockID, 0});
commonWorldGenOres.add(Blocks.lapis_ore); CommonWorldGenOres.add(new int[] {Block.oreLapis.blockID, 0});
commonWorldGenOres.add(Blocks.redstone_ore); CommonWorldGenOres.add(new int[] {Block.oreRedstoneGlowing.blockID, 0});
CommonWorldGenOres.add(new int[] {Block.oreRedstone.blockID, 0});
forceFieldBlocks = new ArrayList<Block>(); forceFieldBlocks = new ArrayList<Integer>();
spaceHelmets = new ArrayList<Item>(); SpaceHelmets = new HashSet<Integer>();
jetpacks = new ArrayList<Item>(); Jetpacks = new HashSet<Integer>();
minerOres = new ArrayList<Block>(); MinerOres = new HashSet<Integer>();
minerLogs = new ArrayList<Item>(); MinerLogs = new HashSet<Integer>();
minerLeaves = new ArrayList<Item>(); MinerLeaves = new HashSet<Integer>();
scannerIgnoreBlocks = new ArrayList<Block>(); scannerIgnoreBlocks = new HashSet<Integer>();
config.load(); config.load();
/* Unnneccessary, delete at some point
coreID = config.getBlock("core", 500).getInt(); coreID = config.getBlock("core", 500).getInt();
controllerID = config.getBlock("controller", 501).getInt(); controllerID = config.getBlock("controller", 501).getInt();
radarID = config.getBlock("radar", 502).getInt(); radarID = config.getBlock("radar", 502).getInt();
@ -448,7 +490,17 @@ public class WarpDriveConfig
shipScannerID = config.getBlock("shipscanner", 516).getInt(); shipScannerID = config.getBlock("shipscanner", 516).getInt();
cloakCoreID = config.getBlock("cloakcore", 517).getInt(); cloakCoreID = config.getBlock("cloakcore", 517).getInt();
cloakCoilID = config.getBlock("cloakcoil", 518).getInt(); cloakCoilID = config.getBlock("cloakcoil", 518).getInt();
laserTreeFarmID = config.getBlock("lasertreefarm", 519).getInt();
transporterID = config.getBlock("transporter", 520).getInt();
transportBeaconID = config.getBlock("transportBeacon", 521).getInt();
reactorMonitorID = config.getBlock("reactorMonitor", 522).getInt();
powerLaserID = config.getBlock("powerLaser", 523).getInt();
powerReactorID = config.getBlock("powerReactor", 524).getInt();
powerStoreID = config.getBlock("powerStore", 525).getInt();
chunkLoaderID = config.getBlock("chunkLoader", 526).getInt();
decorativeID = config.getBlock("decorative",527).getInt();
reactorLaserFocusID = config.getItem("reactorLaserFocus", 8700).getInt();
componentID = config.getItem("component", 8701).getInt(); componentID = config.getItem("component", 8701).getInt();
helmetID = config.getItem("helmet", 8702).getInt(); helmetID = config.getItem("helmet", 8702).getInt();
chestID = config.getItem("chest", 8703).getInt(); chestID = config.getItem("chest", 8703).getInt();
@ -456,7 +508,6 @@ public class WarpDriveConfig
bootsID = config.getItem("boots", 8705).getInt(); bootsID = config.getItem("boots", 8705).getInt();
airCanisterID = config.getItem("airCanisterFull", 8706).getInt(); airCanisterID = config.getItem("airCanisterFull", 8706).getInt();
upgradeID = config.getItem("upgrade", 8707).getInt(); upgradeID = config.getItem("upgrade", 8707).getInt();
*/
isForgeMultipartLoaded = Loader.isModLoaded("ForgeMultipart"); isForgeMultipartLoaded = Loader.isModLoaded("ForgeMultipart");
if (isForgeMultipartLoaded) { if (isForgeMultipartLoaded) {
@ -471,6 +522,10 @@ public class WarpDriveConfig
if (isCCLoaded) if (isCCLoaded)
loadCC(); loadCC();
isGregLoaded = Loader.isModLoaded("gregtech_addon");
if (isGregLoaded)
loadGT();
isAppliedEnergisticsLoaded = Loader.isModLoaded("AppliedEnergistics"); isAppliedEnergisticsLoaded = Loader.isModLoaded("AppliedEnergistics");
if (isAppliedEnergisticsLoaded) if (isAppliedEnergisticsLoaded)
loadAppliedEnergistics(); loadAppliedEnergistics();
@ -520,43 +575,42 @@ public class WarpDriveConfig
if (isAdvancedRepulsionSystemsLoaded) { if (isAdvancedRepulsionSystemsLoaded) {
loadAdvancedRepulsionSystems(); loadAdvancedRepulsionSystems();
} }
minerOres.add(WarpDrive.iridiumBlock); isMagicalCropsLoaded = Loader.isModLoaded("MagicalCrops");
minerOres.add(Blocks.coal_ore); //
minerOres.add(Blocks.quartz_ore); MinerOres.add(iridiumBlockID);
minerOres.add(Blocks.obsidian); MinerOres.add(Block.oreCoal.blockID);
minerOres.add(Blocks.web); MinerOres.add(Block.oreNetherQuartz.blockID);
minerOres.add(Blocks.fence); MinerOres.add(Block.obsidian.blockID);
minerOres.add(Blocks.torch); MinerOres.add(Block.web.blockID);
minerOres.add(Blocks.glowstone); MinerOres.add(Block.fence.blockID);
minerOres.add(Blocks.redstone_block); MinerOres.add(Block.torchWood.blockID);
MinerOres.add(Block.glowStone.blockID);
MinerOres.add(Block.blockRedstone.blockID);
// Ignore WarpDrive blocks (which potentially will be duplicated by cheaters using ship scan/deploy) // Ignore WarpDrive blocks (which potentially will be duplicated by cheaters using ship scan/deploy)
scannerIgnoreBlocks.add(WarpDrive.warpCore); scannerIgnoreBlocks.add(coreID);
scannerIgnoreBlocks.add(WarpDrive.protocolBlock); scannerIgnoreBlocks.add(controllerID);
scannerIgnoreBlocks.add(WarpDrive.iridiumBlock); scannerIgnoreBlocks.add(iridiumBlockID);
if (isICLoaded) { if (isICLoaded) {
scannerIgnoreBlocks.add(Block.getBlockFromItem(IC2Items.getItem("mfsUnit").getItem())); scannerIgnoreBlocks.add(Items.getItem("mfsUnit").itemID);
scannerIgnoreBlocks.add(Block.getBlockFromItem(IC2Items.getItem("mfeUnit").getItem())); scannerIgnoreBlocks.add(Items.getItem("mfeUnit").itemID);
scannerIgnoreBlocks.add(Block.getBlockFromItem(IC2Items.getItem("cesuUnit").getItem())); scannerIgnoreBlocks.add(Items.getItem("cesuUnit").itemID);
scannerIgnoreBlocks.add(Block.getBlockFromItem(IC2Items.getItem("batBox").getItem())); scannerIgnoreBlocks.add(Items.getItem("batBox").itemID);
} }
if (isICBMLoaded) { if (isICBMLoaded) {
//TODO: What is this for? scannerIgnoreBlocks.add(ICBM_Explosive);
//scannerIgnoreBlocks.add(ICBM_Explosive);
} }
if (isCCLoaded) { if (isCCLoaded) {
//TODO: Fix scannerIgnoreBlocks.add(CC_Computer);
scannerIgnoreBlocks.add(CCT_Turtle);
//scannerIgnoreBlocks.add(CC_Computer); scannerIgnoreBlocks.add(CCT_Upgraded);
//scannerIgnoreBlocks.add(CCT_Turtle); scannerIgnoreBlocks.add(CCT_Advanced);
//scannerIgnoreBlocks.add(CCT_Upgraded);
//scannerIgnoreBlocks.add(CCT_Advanced);
} }
// Do not deploy ores and valuables // Do not deploy ores and valuables
for (Block t : commonWorldGenOres) {// each element of this set is pair [id, meta] for (int[] t : CommonWorldGenOres) {// each element of this set is pair [id, meta]
scannerIgnoreBlocks.add(t); // we adding ID only scannerIgnoreBlocks.add(t[0]); // we adding ID only
} }
loadWarpDriveConfig(); loadWarpDriveConfig();
@ -564,32 +618,32 @@ public class WarpDriveConfig
} }
public static void postInit() { public static void postInit() {
loadOreDict(); LoadOreDict();
} }
private static void loadOreDict() { private static void LoadOreDict() {
String[] oreNames = OreDictionary.getOreNames(); String[] oreNames = OreDictionary.getOreNames();
for(String oreName: oreNames) { for(String oreName: oreNames) {
String lowerOreName = oreName.toLowerCase(); String lowerOreName = oreName.toLowerCase();
if (oreName.substring(0,3).equals("ore")) { if (oreName.substring(0,3).equals("ore")) {
ArrayList<ItemStack> item = OreDictionary.getOres(oreName); ArrayList<ItemStack> item = OreDictionary.getOres(oreName);
for(ItemStack i: item) { for(ItemStack i: item) {
minerOres.add(Block.getBlockFromItem(i.getItem())); MinerOres.add(i.itemID);
WarpDrive.debugPrint("Added ore: "+ i.getItem().getUnlocalizedName()); WarpDrive.debugPrint("WD: Added ore ID: "+i.itemID);
} }
} }
if (lowerOreName.contains("log")) { if (lowerOreName.contains("log")) {
ArrayList<ItemStack> item = OreDictionary.getOres(oreName); ArrayList<ItemStack> item = OreDictionary.getOres(oreName);
for(ItemStack i: item) { for(ItemStack i: item) {
minerLogs.add(i.getItem()); MinerLogs.add(i.itemID);
WarpDrive.debugPrint("Added log: "+i.getDisplayName()); WarpDrive.debugPrint("WD: Added log ID: "+i.itemID);
} }
} }
if (lowerOreName.contains("leave") || lowerOreName.contains("leaf")) { if (lowerOreName.contains("leave") || lowerOreName.contains("leaf")) {
ArrayList<ItemStack> item = OreDictionary.getOres(oreName); ArrayList<ItemStack> item = OreDictionary.getOres(oreName);
for(ItemStack i: item) { for(ItemStack i: item) {
minerLeaves.add(i.getItem()); MinerLeaves.add(i.itemID);
WarpDrive.debugPrint("Added leaf: "+i.getDisplayName()); WarpDrive.debugPrint("WD: Added leaf ID: "+i.itemID);
} }
} }
} }
@ -611,42 +665,42 @@ public class WarpDriveConfig
private static void loadIC2() private static void loadIC2()
{ {
ASP = IC2Items.getItem("solarPanel").getItem(); ASP = Items.getItem("solarPanel").itemID;
spaceHelmets.add(IC2Items.getItem("hazmatHelmet").getItem()); SpaceHelmets.add(Items.getItem("hazmatHelmet").itemID);
spaceHelmets.add(IC2Items.getItem("quantumHelmet").getItem()); SpaceHelmets.add(Items.getItem("quantumHelmet").itemID);
jetpacks.add(IC2Items.getItem("jetpack").getItem()); Jetpacks.add(Items.getItem("jetpack").itemID);
jetpacks.add(IC2Items.getItem("electricJetpack").getItem()); Jetpacks.add(Items.getItem("electricJetpack").itemID);
IC2_Air = IC2Items.getItem("airCell"); IC2_Air = new int[] {Items.getItem("airCell").itemID, Items.getItem("airCell").getItemDamage()};
IC2_Empty = IC2Items.getItem("cell"); IC2_Empty = new int[] {Items.getItem("cell").itemID, Items.getItem("cell").getItemDamage()};
ItemStack rubberWood = IC2Items.getItem("rubberWood"); ItemStack rubberWood = Items.getItem("rubberWood");
IC2_Resin = IC2Items.getItem("resin").getItem(); IC2_Resin = Items.getItem("resin");
if(rubberWood != null) { if(rubberWood != null) {
IC2_RubberWood = rubberWood.getItem(); IC2_RubberWood = rubberWood.itemID;
} }
ItemStack ore = IC2Items.getItem("uraniumOre"); ItemStack ore = Items.getItem("uraniumOre");
if (ore != null) commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); if (ore != null) CommonWorldGenOres.add(new int[] {ore.itemID, ore.getItemDamage()});
ore = IC2Items.getItem("copperOre"); ore = Items.getItem("copperOre");
if (ore != null) commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); if (ore != null) CommonWorldGenOres.add(new int[] {ore.itemID, ore.getItemDamage()});
ore = IC2Items.getItem("tinOre"); ore = Items.getItem("tinOre");
if (ore != null) commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); if (ore != null) CommonWorldGenOres.add(new int[] {ore.itemID, ore.getItemDamage()});
ore = IC2Items.getItem("leadOre"); ore = Items.getItem("leadOre");
if (ore != null) commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem())); if (ore != null) CommonWorldGenOres.add(new int[] {ore.itemID, ore.getItemDamage()});
minerOres.add(Block.getBlockFromItem(IC2Items.getItem("rubberWood").getItem())); MinerOres.add(Items.getItem("rubberWood").itemID);
IC2_fluidCell = IC2Items.getItem("FluidCell").getItem(); IC2_fluidCell = Items.getItem("FluidCell").getItem();
} }
private static void loadCC() private static void loadCC()
{ {
try try
{ {
Class<?> z = Class.forName("dan200.computercraft.ComputerCraft");
CC_Computer = ComputerCraft.Blocks.computer; CC_Computer = z.getField("computerBlockID").getInt(null);
CC_peripheral = ComputerCraft.Blocks.peripheral; CC_peripheral = z.getField("peripheralBlockID").getInt(null);
//CC_Floppy = ComputerCraft.Blocks.floppy; //TODO: Does not exist anymore. Check if replacement relevant CC_Floppy = z.getField("diskItemID").getInt(null);
CCT_Turtle = ComputerCraft.Blocks.turtle; CCT_Turtle = z.getField("turtleBlockID").getInt(null);
CCT_Upgraded = ComputerCraft.Blocks.turtleExpanded; CCT_Upgraded = z.getField("turtleUpgradedBlockID").getInt(null);
CCT_Advanced = ComputerCraft.Blocks.turtleAdvanced; CCT_Advanced = z.getField("turtleAdvancedBlockID").getInt(null);
} }
catch (Exception e) catch (Exception e)
{ {
@ -654,7 +708,27 @@ public class WarpDriveConfig
e.printStackTrace(); e.printStackTrace();
} }
} }
private static void loadGT()
{
try
{
Class<?> z = Class.forName("gregtechmod.GT_Mod");
int[] t = (int[])z.getField("sBlockIDs").get(null);
GT_Machine = t[1];
GT_Ores = t[2]; // meta 1-15 = ores
GT_Granite = t[5]; // 0 - black, 1 - black cobble, 8 - red, 9 - red cobble
MinerOres.add(GT_Ores);
//MinerOres.add(GT_Granite);
}
catch (Exception e)
{
WarpDrive.debugPrint("WarpDriveConfig Error loading GT classes");
e.printStackTrace();
isGregLoaded = false;
}
}
private static void loadAppliedEnergistics() private static void loadAppliedEnergistics()
{ {
try try
@ -662,7 +736,7 @@ public class WarpDriveConfig
AEBlocks = Class.forName("appeng.api.Blocks"); AEBlocks = Class.forName("appeng.api.Blocks");
AEMaterials = Class.forName("appeng.api.Materials"); AEMaterials = Class.forName("appeng.api.Materials");
AEItems = Class.forName("appeng.api.Items"); AEItems = Class.forName("appeng.api.Items");
minerOres.add(Block.getBlockFromItem(((ItemStack)AEBlocks.getField("blkQuartzOre").get(null)).getItem())); MinerOres.add(((ItemStack)AEBlocks.getField("blkQuartzOre").get(null)).itemID);
} }
catch (Exception e) catch (Exception e)
{ {
@ -695,10 +769,11 @@ public class WarpDriveConfig
{ {
try try
{ {
Class<?> z = Class.forName("advsolar.common.AdvancedSolarPanel");
spaceHelmets.add(AdvancedSolarPanel.advancedSolarHelmet); ASP = z.getField("idAdv").getInt(null);
spaceHelmets.add(AdvancedSolarPanel.hybridSolarHelmet); SpaceHelmets.add(((Item)z.getField("advancedSolarHelmet").get(null)).itemID);
spaceHelmets.add(AdvancedSolarPanel.ultimateSolarHelmet); SpaceHelmets.add(((Item)z.getField("hybridSolarHelmet").get(null)).itemID);
SpaceHelmets.add(((Item)z.getField("ultimateSolarHelmet").get(null)).itemID);
} }
catch (Exception e) catch (Exception e)
{ {
@ -709,25 +784,21 @@ public class WarpDriveConfig
} }
private static void loadAtomicScience() { private static void loadAtomicScience() {
//No 1.7.10 version
/*
try { try {
Class<?> z = Class.forName("resonantinduction.atomic.Atomic"); Class<?> z = Class.forName("resonantinduction.atomic.Atomic");
commonWorldGenOres.add(new int[] {((Block)z.getField("blockUraniumOre").get(null)).blockID, 0}); CommonWorldGenOres.add(new int[] {((Block)z.getField("blockUraniumOre").get(null)).blockID, 0});
AS_Turbine = ((Block)z.getField("blockElectricTurbine").get(null)).blockID; AS_Turbine = ((Block)z.getField("blockElectricTurbine").get(null)).blockID;
AS_deuteriumCell = ((Item)z.getField("itemDeuteriumCell").get(null)).itemID; AS_deuteriumCell = ((Item)z.getField("itemDeuteriumCell").get(null)).itemID;
} catch (Exception e) { } catch (Exception e) {
WarpDrive.debugPrint("WarpDriveConfig Error loading AS classes"); WarpDrive.debugPrint("WarpDriveConfig Error loading AS classes");
isAtomicScienceLoaded = false; isAtomicScienceLoaded = false;
}*/ }
} }
private static void loadICBM() { private static void loadICBM() {
//No 1.7 yet, second project
/*
try { try {
Class<?> z = Class.forName("icbm.core.ICBMCore"); Class<?> z = Class.forName("icbm.core.ICBMCore");
commonWorldGenOres.add(new int[] {((Block)z.getField("blockSulfurOre").get(null)).blockID, 0}); CommonWorldGenOres.add(new int[] {((Block)z.getField("blockSulfurOre").get(null)).blockID, 0});
z = Class.forName("icbm.explosion.ICBMExplosion"); z = Class.forName("icbm.explosion.ICBMExplosion");
ICBM_Machine = ((Block)z.getField("blockMachine").get(null)).blockID; ICBM_Machine = ((Block)z.getField("blockMachine").get(null)).blockID;
ICBM_Missile = ((Item)z.getField("itemMissile").get(null)).itemID; ICBM_Missile = ((Item)z.getField("itemMissile").get(null)).itemID;
@ -736,12 +807,14 @@ public class WarpDriveConfig
WarpDrive.debugPrint("WarpDriveConfig Error loading ICBM classes"); WarpDrive.debugPrint("WarpDriveConfig Error loading ICBM classes");
e.printStackTrace(); e.printStackTrace();
isICBMLoaded = false; isICBMLoaded = false;
}*/ }
} }
private static void loadMFFS() { private static void loadMFFS() {
try { try {
forceFieldBlocks.add(Content.forceField()); Class<?> z = Class.forName("mffs.ModularForceFieldSystem");
int blockId = ((Block)z.getField("blockForceField").get(null)).blockID;
forceFieldBlocks.add(blockId);
} catch (Exception e) { } catch (Exception e) {
WarpDrive.debugPrint("WarpDriveConfig Error loading MFFS classes"); WarpDrive.debugPrint("WarpDriveConfig Error loading MFFS classes");
e.printStackTrace(); e.printStackTrace();
@ -751,10 +824,12 @@ public class WarpDriveConfig
private static void loadGraviSuite() { private static void loadGraviSuite() {
try { try {
spaceHelmets.add(GraviSuite.ultimateSolarHelmet); Class<?> z = Class.forName("gravisuite.GraviSuite");
jetpacks.add(GraviSuite.advJetpack); if (z.getField("ultimateSolarHelmet").get(null) != null)
jetpacks.add(GraviSuite.graviChestPlate); SpaceHelmets.add(((Item)z.getField("ultimateSolarHelmet").get(null)).itemID);
GS_ultimateLappack = GraviSuite.ultimateLappack; Jetpacks.add(z.getField("advJetpackID").getInt(null) + 256);
Jetpacks.add(z.getField("graviChestPlateID").getInt(null) + 256);
GS_ultimateLappack = z.getField("ultimateLappackID").getInt(null) + 256;
} catch (Exception e) { } catch (Exception e) {
WarpDrive.debugPrint("WarpDriveConfig Error loading GS classes"); WarpDrive.debugPrint("WarpDriveConfig Error loading GS classes");
e.printStackTrace(); e.printStackTrace();
@ -763,8 +838,6 @@ public class WarpDriveConfig
} }
private static void loadUndergroundBiomes() { private static void loadUndergroundBiomes() {
//TODO: Re-add if desired. My patience has run out for mod compatibility.
/*
try { try {
Class<?> z = Class.forName("exterminatorJeff.undergroundBiomes.common.UndergroundBiomes"); Class<?> z = Class.forName("exterminatorJeff.undergroundBiomes.common.UndergroundBiomes");
UB_igneousStone = ((Block)z.getField("igneousStone").get(null)).blockID; UB_igneousStone = ((Block)z.getField("igneousStone").get(null)).blockID;
@ -778,7 +851,6 @@ public class WarpDriveConfig
e.printStackTrace(); e.printStackTrace();
isUndergroundBiomesLoaded = false; isUndergroundBiomesLoaded = false;
} }
*/
} }
private static void loadNetherOres() { private static void loadNetherOres() {
@ -831,10 +903,10 @@ public class WarpDriveConfig
} }
private static void loadAdvancedRepulsionSystems() { private static void loadAdvancedRepulsionSystems() {
//TODO: Cant find block object
try { try {
//forceFieldBlocks.add(BlockForceField); Class<?> z = Class.forName("mods.immibis.ars.ARSMod");
int fieldBlockId = ((Block)z.getField("MFFSFieldblock").get(null)).blockID;
forceFieldBlocks.add(fieldBlockId);
} catch (Exception e) { } catch (Exception e) {
WarpDrive.print("WarpDriveConfig Error loading AdvancedRepulsionSystems classes"); WarpDrive.print("WarpDriveConfig Error loading AdvancedRepulsionSystems classes");
e.printStackTrace(); e.printStackTrace();
@ -842,86 +914,173 @@ public class WarpDriveConfig
} }
} }
public static Block getDefaultSurfaceBlock(Random random, boolean corrupted, boolean isMoon) { public static int[] getDefaultSurfaceBlock(Random random, boolean corrupted, boolean isMoon) {
if (isMoon) { if (isMoon) {
if (random.nextInt(5) == 1) { if (isGregLoaded && (random.nextInt(100) == 1)) {
return Blocks.netherrack; if (random.nextBoolean()) {
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?1:0};
} else {
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?9:8};
}
} else if (random.nextInt(5) == 1) {
return new int[] {Block.netherrack.blockID, 0};
} else if (random.nextInt(15) == 1) { } else if (random.nextInt(15) == 1) {
return Blocks.end_stone; return new int[] {Block.whiteStone.blockID, 0};
} }
} else { } else {
if (random.nextInt(6) == 1) { if (isGregLoaded && (random.nextInt(25) == 1)) {
return Blocks.netherrack; if (random.nextBoolean()) {
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?1:0};
} else {
return new int[] {GT_Granite, (corrupted && random.nextBoolean())?9:8};
}
} else if (random.nextInt(6) == 1) {
return new int[] {Block.netherrack.blockID, 0};
} else if (random.nextInt(50) == 1) { } else if (random.nextInt(50) == 1) {
return Blocks.end_stone; return new int[] {Block.whiteStone.blockID, 0};
} }
} }
if (corrupted && random.nextBoolean()) { if (corrupted && random.nextBoolean()) {
if (isUndergroundBiomesLoaded) { if (isUndergroundBiomesLoaded) {
int rnd = random.nextInt(8 + 8 + 2); int rnd = random.nextInt(8 + 8 + 2);
if (rnd < 8) { if (rnd < 8) {
return UB_igneousCobblestone; return new int[] {UB_igneousCobblestone, rnd};
} else if (rnd < (8 + 8)) { } else if (rnd < (8 + 8)) {
return UB_metamorphicCobblestone; return new int[] {UB_metamorphicCobblestone, rnd - 8};
} }
} }
return Blocks.cobblestone; return new int[] {Block.cobblestone.blockID, 0};
} }
if (isUndergroundBiomesLoaded) { if (isUndergroundBiomesLoaded) {
int rnd = random.nextInt(8 + 8 + 8 + 3); int rnd = random.nextInt(8 + 8 + 8 + 3);
if (rnd < 8) { if (rnd < 8) {
return UB_igneousCobblestone; return new int[] {UB_igneousStone, rnd};
} else if (rnd < (8 + 8)) { } else if (rnd < (8 + 8)) {
return UB_metamorphicStone; return new int[] {UB_metamorphicStone, rnd - 8};
} }
else if (rnd < (8 + 8 + 8)) { else if (rnd < (8 + 8 + 8)) {
return UB_sedimentaryStone; if (rnd == 8 + 8 + 8) {
return new int[] {205, 0}; // emasher Limestone
} else {
return new int[] {UB_sedimentaryStone, rnd - 8 - 8};
}
} }
} }
return Blocks.stone; return new int[] {Block.stone.blockID, 0};
} }
public static Block getRandomSurfaceBlock(Random random, Block block, int blockMeta, boolean bedrock) { public static int[] getRandomSurfaceBlock(Random random, int blockID, int blockMeta, boolean bedrock) {
if (bedrock && (random.nextInt(1000) == 1)) { if (bedrock && (random.nextInt(1000) == 1)) {
return Blocks.bedrock; return new int[] {Block.bedrock.blockID, 0};
} else if (Blocks.end_stone.isAssociatedBlock(block)) { } else if (blockID == GT_Granite) {
return getRandomEndBlock(random, block, blockMeta); if ((blockMeta == 0) || (blockMeta == 1)) {
} else if (Blocks.netherrack.isAssociatedBlock(block)) { int[] t;
return getRandomNetherBlock(random, block, blockMeta); t = getRandomOverworldBlock(random, blockID, blockMeta);
if (t[0] == blockID)
t = getRandomOverworldBlock(random, blockID, blockMeta);
if (t[0] == blockID)
t = getRandomEndBlock(random, blockID, blockMeta);
return t;
} else if ((blockMeta == 8) || (blockMeta == 9)) {
int[] t;
t = getRandomOverworldBlock(random, blockID, blockMeta);
if (t[0] == blockID)
t = getRandomEndBlock(random, blockID, blockMeta);
if (t[0] == blockID)
t = getRandomOverworldBlock(random, blockID, blockMeta);
return t;
}
} else if (blockID == Block.whiteStone.blockID) {
return getRandomEndBlock(random, blockID, blockMeta);
} else if (blockID == Block.netherrack.blockID) {
return getRandomNetherBlock(random, blockID, blockMeta);
} }
return getRandomOverworldBlock(random, block, blockMeta); return getRandomOverworldBlock(random, blockID, blockMeta);
} }
public static Block getRandomOverworldBlock(Random random, Block block, int blockMeta) public static int[] getRandomOverworldBlock(Random random, int blockID, int blockMeta)
{ {
if (random.nextInt(25) == 5) { if (random.nextInt(25) == 5) {
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size())); return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
} else if (isMetallurgyLoaded && (random.nextInt(25) == 1)) {
return Metallurgy_overworldOresBlock[random.nextInt(Metallurgy_overworldOresBlock.length)];
} else if (isAppliedEnergisticsLoaded && random.nextInt(750) == 1) { } else if (isAppliedEnergisticsLoaded && random.nextInt(750) == 1) {
return Block.getBlockFromItem(getAEBlock("blkQuartzOre").getItem()); return new int[] {getAEBlock("blkQuartzOre").itemID, getAEBlock("blkQuartzOre").getItemDamage()};
} else if (random.nextInt(250) == 1) { } else if (random.nextInt(250) == 1) {
return Blocks.diamond_ore; return new int[] {Block.oreDiamond.blockID, 0};
} else if (!isNetherOresLoaded && (random.nextInt(10000) == 42)) {
return new int[] {iridiumBlockID, 0};
} else if (!isMagicalCropsLoaded && (random.nextInt(100) == 56)) {
return new int[] {3108, 0}; // Essence ore
} else if (isGregLoaded) {
if (random.nextInt(50) == 1)
return new int[] {GT_Ores, 5}; //Bauxite S /* Stone/Iron/Diamod pick | +S = Silktouch recommended */
else if (random.nextInt(50) == 1)
return new int[] {GT_Ores, 1}; //Galena S
else if (random.nextInt(100) == 1)
return new int[] {GT_Ores, 8}; //Sphalerite S+S
else if (random.nextInt(250) == 1)
return new int[] {GT_Ores, 13}; //Tetrahedrite I
else if (random.nextInt(250) == 1)
return new int[] {GT_Ores, 14}; //Cassiterite I
else if (random.nextInt(250) == 1)
return new int[] {GT_Ores, 15}; //Nickel I
else if (random.nextInt(500) == 1)
return new int[] {GT_Ores, 3}; //Ruby I+S
else if (random.nextInt(500) == 1)
return new int[] {GT_Ores, 4}; //Sapphire I+S
else if (random.nextInt(2000) == 1)
return new int[] {GT_Ores, 2}; //Iridium D+S
} }
return block; return new int[] {blockID, blockMeta};
} }
public static Block getRandomNetherBlock(Random random, Block block, int blockMeta) { public static int[] getRandomNetherBlock(Random random, int blockID, int blockMeta) {
if (isICLoaded && (!isNetherOresLoaded) && (random.nextInt(10000) == 42)) { if (isICLoaded && (!isNetherOresLoaded) && (random.nextInt(10000) == 42)) {
return WarpDrive.iridiumBlock; return new int[] {iridiumBlockID, 0};
} else if (isNetherOresLoaded && (random.nextInt(25) == 1)) {
int rnd = random.nextInt(NetherOres_count);
return new int[] {NetherOres_block[rnd / 16], rnd % 16};
} else if (isMetallurgyLoaded && (random.nextInt(25) == 1)) {
return Metallurgy_netherOresBlock[random.nextInt(Metallurgy_netherOresBlock.length)];
} else if (random.nextInt(25) == 1) { } else if (random.nextInt(25) == 1) {
return Blocks.quartz_ore; return new int[] {Block.oreNetherQuartz.blockID, 0};
} else if (!isMagicalCropsLoaded && (random.nextInt(100) == 56)) {
return new int[] {3109, 0}; // Nether essence ore
} else if (isGregLoaded) {
if (random.nextInt(100) == 1)
return new int[] {GT_Ores, 6}; //Pyrite S+S
else if (random.nextInt(100) == 1)
return new int[] {GT_Ores, 8}; //Sphalerite S+S
else if (random.nextInt(500) == 1)
return new int[] {GT_Ores, 7}; //Cinnabar I+S
} else if ((!isNetherOresLoaded) && (random.nextInt(100) == 13)) } else if ((!isNetherOresLoaded) && (random.nextInt(100) == 13))
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size())); return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
return block; return new int[] {blockID, blockMeta};
} }
public static Block getRandomEndBlock(Random random, Block block, int blockMeta) public static int[] getRandomEndBlock(Random random, int blockID, int blockMeta)
{ {
if (isICLoaded && random.nextInt(10000) == 42) { if (isICLoaded && random.nextInt(10000) == 42) {
return WarpDrive.iridiumBlock; return new int[] { iridiumBlockID, 0 };
} else if (isGregLoaded) {
if (random.nextInt(250) == 1)
return new int[] {GT_Ores, 9}; //Tungstate I
else if (random.nextInt(500) == 1)
return new int[] {GT_Ores, 12}; //Sodalite I+S
else if (random.nextInt(500) == 1)
return new int[] {GT_Ores, 10}; //Cooperite=Sheldonite D
else if (random.nextInt(1000) == 1)
return new int[] {GT_Ores, 11}; //Olivine D+S
} else if (isMetallurgyLoaded && (random.nextInt(25) == 1)) {
return Metallurgy_endOresBlock[random.nextInt(Metallurgy_endOresBlock.length)];
} else if (random.nextInt(200) == 13) { } else if (random.nextInt(200) == 13) {
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size())); return CommonWorldGenOres.get(random.nextInt(CommonWorldGenOres.size()));
} }
return block; return new int[] {blockID, blockMeta};
} }
public static boolean isAirBlock(World worldObj, int id, int x, int y, int z) {
return id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(worldObj, x, y, z);
}
} }

File diff suppressed because it is too large Load diff

View file

@ -1,38 +1,83 @@
package cr0s.warpdrive.machines; package cr0s.WarpDrive.machines;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.WarpDrive.WarpDrive;
import cr0s.WarpDrive.api.IBlockUpdateDetector;
import cr0s.WarpDrive.api.IUpgradable;
import cr0s.WarpDrive.data.EnumUpgradeTypes;
import cr0s.WarpDrive.item.ItemWarpUpgrade;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IBlockUpdateDetector;
public abstract class WarpBlockContainer extends BlockContainer { public abstract class WarpBlockContainer extends BlockContainer {
protected WarpBlockContainer() { protected WarpBlockContainer(int par1) {
super(Material.iron); super(par1, Material.iron);
} }
protected WarpBlockContainer(Material m) { protected WarpBlockContainer(int par1, Material m) {
super(m); super(par1, m);
setHardness(0.5F); setHardness(0.5F);
setStepSound(Block.soundTypeMetal); setStepSound(Block.soundMetalFootstep);
setCreativeTab(WarpDrive.warpdriveTab); setCreativeTab(WarpDrive.warpdriveTab);
} }
@Override @Override
public void onBlockAdded(World w, int x, int y, int z) { public void onBlockAdded(World w, int x, int y, int z) {
super.onBlockAdded(w, x, y, z); super.onBlockAdded(w, x, y, z);
TileEntity te = w.getTileEntity(x, y, z); TileEntity te = w.getBlockTileEntity(x, y, z);
if (te instanceof IBlockUpdateDetector) { if (te instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector)te).updatedNeighbours(); ((IBlockUpdateDetector)te).updatedNeighbours();
} }
} }
/* FIXME untested
@Override @Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block b) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
{
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
boolean hasResponse = false;
TileEntity te = world.getBlockTileEntity(x, y, z);
if(te != null && te instanceof IUpgradable)
{
IUpgradable upgradable = (IUpgradable)te;
ItemStack is = player.inventory.getCurrentItem();
if(is != null)
{
Item i = is.getItem();
if(i instanceof ItemWarpUpgrade)
{
if(upgradable.takeUpgrade(EnumUpgradeTypes.values()[is.getItemDamage()],false))
{
if(!player.capabilities.isCreativeMode)
player.inventory.decrStackSize(player.inventory.currentItem, 1);
player.addChatMessage("Upgrade accepted");
}
else
{
player.addChatMessage("Upgrade declined");
}
hasResponse = true;
}
}
}
return hasResponse;
}
/**/
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, int b) {
super.onNeighborBlockChange(w, x, y, z, b); super.onNeighborBlockChange(w, x, y, z, b);
TileEntity te = w.getTileEntity(x, y, z); TileEntity te = w.getBlockTileEntity(x, y, z);
if (te instanceof IBlockUpdateDetector) { if (te instanceof IBlockUpdateDetector) {
((IBlockUpdateDetector)te).updatedNeighbours(); ((IBlockUpdateDetector)te).updatedNeighbours();
} }