Merge branch 'MC1.7' into ConfImprovements

This commit is contained in:
Francesco Macagno 2015-08-10 23:13:34 -07:00
commit 7bf5d55d04
72 changed files with 1422 additions and 1263 deletions

3
.gitignore vendored
View file

@ -14,4 +14,5 @@ eclipse/*
*.iws
*.ipr
*.idea/
src/main/resources/Thumbs.db
dependencies

21
.travis.yml Normal file
View file

@ -0,0 +1,21 @@
language: java
jdk:
- oraclejdk7
- openjdk7
- oraclejdk8
before_install:
- chmod +x gradlew
before_deploy:
- export RELEASE_FILE=$(ls build/libs/*.jar)
- echo "deploying ${RELEASE_PKG_FILE} to GitHub releases"
deploy:
provider: releases
api_key:
secure: IzGBMb7m6y5DgoeNtlcRU4vnfnpULwrLEqbYnrK65mXh8LFR5QXRPcS5qhMctwbl4ZCXxe8BMSUegFo3grRPDQ8m1CJDt6Jh6+GydhQbuf5NtUOFMTrH5s2Ob5q23xXhxJGrQEFCm+a0L9YPDAV234UTOdUZZ6KAow5+E8hVx3PZGFWgFMUmSa/uX0Aqh++FfRMDcWtRtp9r6sth23JCgcO4Ryxohd67OYvFbvhoHBLDG5SpD0iRweY/uLVA/DIZuazdb+grqGocjCpzrh8a/bbUxUF4CbJOiInY2/9EuSgIIC267K5P76UKEAutMtC2/vx/EdHNapTRGjgXCU8FOBkepFZ6Rc97mPxFDvCK0xBIRcftO4f1fs27SS/MkQBaEVqd8wZxuDDcHcX3H2+84VM+9isGBmNdxgz+r5RDnDKcfATg3c2saN4X6Lz/CP4kVjiGb02rwZlS2e8BZIFWi/ahdEJY/IdzfnbfS5S+7hxddbtIOWnNsZ2JLTN0MzJYCCD6IXTloUBmljokQgB1vRY4Xzm7iDeF/yew2Jiuo1JoQI9RVlbBOXY+XobCz93yjeFvhOHIm/1y5wZff5bFO9LAshEwCriD1wjcnpac4qvy/RpRzUKnvUZyGoWdNBq8egrY3EZT7rV0DRFeiXLG6j1BB65LjvlK0wWhadn6Kps=
file_glob: true
file: "${RELEASE_FILE}"
on:
repo: LemADEC/WarpDrive
branch: MC1.7
tags: true
jdk: oraclejdk7

View file

@ -1,6 +1,6 @@
WarpDrive for 1.7
=========
[![Build Status](https://travis-ci.org/LemADEC/WarpDrive.svg?branch=MC1.7)](https://travis-ci.org/LemADEC/WarpDrive)
An update to the warp drive mod. Currently in progress.
Will work almost exactly like the original, but with improvements!

View file

@ -17,13 +17,17 @@ buildscript {
apply plugin: 'forge'
version = "1.3.0"
group= "cr0s.warpdrive" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
version = "1.3.2"
group = "cr0s.warpdrive" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "warpdrive"
minecraft {
version = "1.7.10-10.13.4.1492-1.7.10"
runDir = "eclipse"
// replacing
replace "@version@", project.version
replaceIn "WarpDrive.java"
}
dependencies {

View file

@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.world.ChunkCoordIntPair;
@ -293,8 +292,8 @@ public class EntityJump extends Entity {
WarpDrive.logger.info("" + this + " messageToAllPlayersOnShip: " + msg);
for (MovingEntity me : entitiesOnShip) {
if (me.entity instanceof EntityPlayer) {
((EntityPlayer) me.entity).addChatMessage(new ChatComponentText("["
+ ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg));
WarpDrive.addChatMessage((EntityPlayer) me.entity, "["
+ ((reactor != null && reactor.coreFrequency.length() > 0) ? reactor.coreFrequency : "WarpCore") + "] " + msg);
}
}
}

View file

@ -205,15 +205,15 @@ public class SpaceEventHandler {
private static boolean consumeO2(ItemStack[] inventory, EntityPlayerMP entityPlayer) {
for (int j = 0; j < inventory.length; ++j) {
if (inventory[j] != null && inventory[j] == WarpDriveConfig.IC2_Air) {
if (inventory[j] != null && inventory[j] == WarpDriveConfig.IC2_air) {
inventory[j].stackSize--;
if (inventory[j].stackSize <= 0) {
inventory[j] = null;
}
if (WarpDriveConfig.IC2_Empty != null) {
if (WarpDriveConfig.IC2_empty != null) {
// WarpDrive.debugPrint("giveEmptyCell");
ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_Empty.getItem(), 1, 0);
ItemStack emptyCell = new ItemStack(WarpDriveConfig.IC2_empty.getItem(), 1, 0);
if (!entityPlayer.inventory.addItemStackToInventory(emptyCell)) {
World world = entityPlayer.worldObj;
EntityItem itemEnt = new EntityItem(world, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, emptyCell);
@ -236,7 +236,7 @@ public class SpaceEventHandler {
int check = MathHelper.ceiling_float_int(distance - 3.0F);
if (check > 0) {
if ( (player.getCurrentArmor(0) != null && player.getCurrentArmor(0) == WarpDriveConfig.getIC2Item("quantumBoots")) // FIXME cache the value
if ( (player.getCurrentArmor(0) != null && player.getCurrentArmor(0) == WarpDriveConfig.getIC2Item("itemArmorQuantumBoots")) // FIXME cache the value
|| (player.getCurrentArmor(2) != null && WarpDriveConfig.jetpacks.contains(player.getCurrentArmor(2)))) {
event.setCanceled(true); // Don't damage player
}

View file

@ -6,6 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -13,6 +14,7 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
@ -109,9 +111,8 @@ 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;
@Mod(modid = WarpDrive.MODID, name = "WarpDrive", version = WarpDrive.VERSION, dependencies = "required-after:IC2API;" + " required-after:CoFHCore;" + " after:ComputerCraft;"
@Mod(modid = WarpDrive.MODID, name = "WarpDrive", version = WarpDrive.VERSION, dependencies = "after:IC2API;" + " after:CoFHCore;" + " after:ComputerCraft;"
+ " after:OpenComputer;" + " after:CCTurtle;" + " after:gregtech_addon;" + " after:AppliedEnergistics;" + " after:AdvancedSolarPanel;"
+ " after:AtomicScience;" + " after:ICBM|Explosion;" + " after:MFFS;" + " after:GraviSuite;" + " after:UndergroundBiomes;" + " after:NetherOres")
/**
@ -119,8 +120,7 @@ import dan200.computercraft.api.ComputerCraftAPI;
*/
public class WarpDrive implements LoadingCallback {
public static final String MODID = "WarpDrive";
public static final String VERSION = "1.3.0.0";
public static final String VERSION = "@version@";
public static Block warpCore;
public static Block protocolBlock;
public static Block radarBlock;
@ -148,471 +148,595 @@ public class WarpDrive implements LoadingCallback {
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 ArmorMaterial 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 space;
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.MODID)
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";
public static Logger logger;
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
WarpDriveConfig.preInit(new Configuration(event.getSuggestedConfigurationFile()));
logger = event.getModLog();
if (FMLCommonHandler.instance().getSide().isClient()) {
Minecraft mc = Minecraft.getMinecraft();
normalFOV = mc.gameSettings.fovSetting;
normalSensitivity = mc.gameSettings.mouseSensitivity;
logger.info("FOV is " + normalFOV + " Sensitivity is " + normalSensitivity);
}
}
@EventHandler
public void init(FMLInitializationEvent event) {
// FIXME FMLInterModComms.sendMessage("Waila", "register", "cr0s.warpdrive.client.WailaHandler.callbackRegister");
PacketHandler.init();
}
public static void debugPrint(String out) {
if (WarpDriveConfig.G_DEBUGMODE) {
logger.debug(out);
logger.info(out);
}
}
@EventHandler
public void load(FMLInitializationEvent event) {
WarpDriveConfig.load();
// CORE CONTROLLER
protocolBlock = new BlockProtocol(0, Material.rock);
GameRegistry.registerBlock(protocolBlock, "protocolBlock");
GameRegistry.registerTileEntity(TileEntityProtocol.class, "protocolBlock");
// WARP CORE
warpCore = new BlockReactor(0, Material.rock);
GameRegistry.registerBlock(warpCore, "warpCore");
GameRegistry.registerTileEntity(TileEntityReactor.class, "warpCore");
// WARP RADAR
radarBlock = new BlockRadar(0, Material.rock);
GameRegistry.registerBlock(radarBlock, "radarBlock");
GameRegistry.registerTileEntity(TileEntityRadar.class, "radarBlock");
// WARP ISOLATION
isolationBlock = new BlockWarpIsolation(0, Material.rock);
GameRegistry.registerBlock(isolationBlock, "isolationBlock");
// AIR GENERATOR
airgenBlock = new BlockAirGenerator(0, Material.rock);
GameRegistry.registerBlock(airgenBlock, "airgenBlock");
GameRegistry.registerTileEntity(TileEntityAirGenerator.class, "airgenBlock");
// AIR BLOCK
airBlock = new BlockAir();
GameRegistry.registerBlock(airBlock, "airBlock");
// GAS BLOCK
gasBlock = new BlockGas();
GameRegistry.registerBlock(gasBlock, "gasBlock");
// LASER EMITTER
laserBlock = new BlockLaser(0, Material.rock);
GameRegistry.registerBlock(laserBlock, "laserBlock");
GameRegistry.registerTileEntity(TileEntityLaser.class, "laserBlock");
// LASER EMITTER WITH CAMERA
laserCamBlock = new BlockLaserCam(0, Material.rock);
GameRegistry.registerBlock(laserCamBlock, "laserCamBlock");
// CAMERA
cameraBlock = new BlockCamera(0, Material.rock);
GameRegistry.registerBlock(cameraBlock, "cameraBlock");
GameRegistry.registerTileEntity(TileEntityCamera.class, "cameraBlock");
// MONITOR
monitorBlock = new BlockMonitor();
GameRegistry.registerBlock(monitorBlock, "monitorBlock");
GameRegistry.registerTileEntity(TileEntityMonitor.class, "monitorBlock");
// MINING LASER
miningLaserBlock = new BlockMiningLaser(0, Material.rock);
GameRegistry.registerBlock(miningLaserBlock, "miningLaserBlock");
GameRegistry.registerTileEntity(TileEntityMiningLaser.class, "miningLaserBlock");
// LASER TREE FARM
laserTreeFarmBlock = new BlockLaserTreeFarm(0, Material.rock);
GameRegistry.registerBlock(laserTreeFarmBlock, "laserTreeFarmBlock");
GameRegistry.registerTileEntity(TileEntityLaserTreeFarm.class, "laserTreeFarmBlock");
// PARTICLE BOOSTER
boosterBlock = new BlockParticleBooster(0, Material.rock);
GameRegistry.registerBlock(boosterBlock, "boosterBlock");
GameRegistry.registerTileEntity(TileEntityParticleBooster.class, "boosterBlock");
// LASER LIFT
liftBlock = new BlockLift(0, Material.rock);
GameRegistry.registerBlock(liftBlock, "liftBlock");
GameRegistry.registerTileEntity(TileEntityLift.class, "liftBlock");
// IRIDIUM BLOCK
iridiumBlock = new BlockIridium();
GameRegistry.registerBlock(iridiumBlock, "iridiumBlock");
// SHIP SCANNER
scannerBlock = new BlockShipScanner(0, Material.rock);
GameRegistry.registerBlock(scannerBlock, "scannerBlock");
GameRegistry.registerTileEntity(TileEntityShipScanner.class, "scannerBlock");
// CLOAKING DEVICE CORE
cloakBlock = new BlockCloakingDeviceCore(0, Material.rock);
GameRegistry.registerBlock(cloakBlock, "cloakBlock");
GameRegistry.registerTileEntity(TileEntityCloakingDeviceCore.class, "cloakBlock");
// CLOAKING DEVICE COIL
cloakCoilBlock = new BlockCloakingCoil(0, Material.rock);
GameRegistry.registerBlock(cloakCoilBlock, "cloakCoilBlock");
// TRANSPORTER
transporterBlock = new BlockTransporter(Material.rock);
GameRegistry.registerBlock(transporterBlock, "transporter");
GameRegistry.registerTileEntity(TileEntityTransporter.class, "transporter");
// REACTOR MONITOR
reactorMonitorBlock = new BlockLaserReactorMonitor(Material.rock);
GameRegistry.registerBlock(reactorMonitorBlock, "reactorMonitor");
GameRegistry.registerTileEntity(TileEntityLaserReactorMonitor.class, "reactorMonitor");
if (WarpDriveConfig.isIndustrialCraft2loaded) {
reactorMonitorBlock = new BlockLaserReactorMonitor(Material.rock);
GameRegistry.registerBlock(reactorMonitorBlock, "reactorMonitor");
GameRegistry.registerTileEntity(TileEntityLaserReactorMonitor.class, "reactorMonitor");
}
// TRANSPORT BEACON
transportBeaconBlock = new BlockTransportBeacon();
GameRegistry.registerBlock(transportBeaconBlock, "transportBeacon");
// POWER REACTOR, LASER, STORE
powerReactorBlock = new BlockPowerReactor();
GameRegistry.registerBlock(powerReactorBlock, "powerReactor");
GameRegistry.registerTileEntity(TileEntityPowerReactor.class, "powerReactor");
powerLaserBlock = new BlockPowerLaser();
GameRegistry.registerBlock(powerLaserBlock, "powerLaser");
GameRegistry.registerTileEntity(TileEntityPowerLaser.class, "powerLaser");
powerStoreBlock = new BlockPowerStore();
GameRegistry.registerBlock(powerStoreBlock, "powerStore");
GameRegistry.registerTileEntity(TileEntityPowerStore.class, "powerStore");
// CHUNK LOADER
chunkLoaderBlock = new BlockChunkLoader();
GameRegistry.registerBlock(chunkLoaderBlock, "chunkLoader");
GameRegistry.registerTileEntity(TileEntityChunkLoader.class, "chunkLoader");
// DECORATIVE
decorativeBlock = new BlockDecorative();
GameRegistry.registerBlock(decorativeBlock, ItemBlockDecorative.class, "decorative");
// REACTOR LASER FOCUS
reactorLaserFocusItem = new ItemReactorLaserFocus();
GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus");
if (WarpDriveConfig.isIndustrialCraft2loaded) {
reactorLaserFocusItem = new ItemReactorLaserFocus();
GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus");
}
// COMPONENT ITEMS
componentItem = new ItemWarpComponent();
GameRegistry.registerItem(componentItem, "component");
helmetItem = new ItemWarpArmor(armorMaterial, 0);
GameRegistry.registerItem(helmetItem, "helmet");
airCanisterItem = new ItemWarpAirCanister();
GameRegistry.registerItem(airCanisterItem, "airCanisterFull");
upgradeItem = new ItemWarpUpgrade();
GameRegistry.registerItem(upgradeItem, "upgrade");
proxy.registerEntities();
ForgeChunkManager.setForcedChunkLoadingCallback(instance, instance);
spaceWorldGenerator = new SpaceWorldGenerator();
GameRegistry.registerWorldGenerator(spaceWorldGenerator, 0);
hyperSpaceWorldGenerator = new HyperSpaceWorldGenerator();
GameRegistry.registerWorldGenerator(hyperSpaceWorldGenerator, 0);
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) {
if (WarpDriveConfig.isComputerCraftLoaded) {
peripheralHandler = new WarpDrivePeripheralHandler();
ComputerCraftAPI.registerPeripheralProvider(peripheralHandler);
peripheralHandler.register();
}
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
space = DimensionManager.getWorld(WarpDriveConfig.G_SPACE_DIMENSION_ID);
hyperSpace = DimensionManager.getWorld(WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID);
WarpDriveConfig.postInit();
WarpDriveConfig.postInit();
WarpDriveConfig.loadWorldGen();
if (WarpDriveConfig.isICLoaded && WarpDriveConfig.G_ENABLE_IC2_RECIPES) {
if (WarpDriveConfig.isIndustrialCraft2loaded && WarpDriveConfig.G_ENABLE_IC2_RECIPES) {
initIC2Recipes();
}
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', Items.iron_ingot, 'p', componentItem.getIS(6),
'c', componentItem.getIS(2), 'd', Items.diamond));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(warpCore), false, "ipi", "ici", "idi",
'i', Items.iron_ingot,
'p', componentItem.getItemStack(6),
'c', componentItem.getItemStack(2),
'd', Items.diamond));
// Controller
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii", 'i', Items.iron_ingot, 'c',
componentItem.getIS(5), 'd', Items.diamond));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(protocolBlock), false, "ici", "idi", "iii",
'i', Items.iron_ingot,
'c', componentItem.getItemStack(5),
'd', Items.diamond));
// Radar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii", 'i', Items.iron_ingot, 'c', componentItem.getIS(5),
'p', componentItem.getIS(6), 'g', Blocks.glass, 'd', Items.diamond));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(radarBlock), false, "ggg", "pdc", "iii",
'i', Items.iron_ingot,
'c', componentItem.getItemStack(5),
'p', componentItem.getItemStack(6),
'g', Blocks.glass,
'd', Items.diamond));
// Isolation Block
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi", 'i', Items.iron_ingot, 'g', Blocks.glass, 'e',
Items.ender_pearl));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(isolationBlock), false, "igi", "geg", "igi",
'i', Items.iron_ingot,
'g', Blocks.glass,
'e', Items.ender_pearl));
// Air generator
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi", 'i', Items.iron_ingot, 'b', Blocks.iron_bars, 'p',
componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(airgenBlock), false, "ibi", "i i", "ipi",
'i', Items.iron_ingot,
'b', Blocks.iron_bars,
'p', componentItem.getItemStack(6)));
// Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici", 'i', Items.iron_ingot, 'r', Items.redstone, 'c',
componentItem.getIS(5), 'l', componentItem.getIS(3), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserBlock), false, "ili", "iri", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'c', componentItem.getItemStack(5),
'l', componentItem.getItemStack(3),
'p', componentItem.getItemStack(6)));
// Mining laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili", 'i', Items.iron_ingot, 'r', Items.redstone,
't', componentItem.getIS(1), 'c', componentItem.getIS(5), 'l', componentItem.getIS(3)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(miningLaserBlock), false, "ici", "iti", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', componentItem.getItemStack(1),
'c', componentItem.getItemStack(5),
'l', componentItem.getItemStack(3)));
// Tree farm laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici", 'i', Items.iron_ingot, 's', "treeSapling",
't', componentItem.getIS(1), 'c', componentItem.getIS(5), 'l', componentItem.getIS(3)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(laserTreeFarmBlock), false, "ili", "sts", "ici",
'i', Items.iron_ingot,
's', "treeSapling",
't', componentItem.getItemStack(1),
'c', componentItem.getItemStack(5),
'l', componentItem.getItemStack(3)));
// Laser Lift
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili", 'i', Items.iron_ingot, 'r', Items.redstone, 't',
componentItem.getIS(1), 'l', componentItem.getIS(3), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(liftBlock), false, "ipi", "rtr", "ili",
'i', Items.iron_ingot,
'r', Items.redstone,
't', componentItem.getItemStack(1),
'l', componentItem.getItemStack(3),
'p', componentItem.getItemStack(6)));
// Transporter
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii", 'i', Items.iron_ingot, 't', componentItem
.getIS(1), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, "iii", "ptc", "iii",
'i', Items.iron_ingot,
't', componentItem.getItemStack(1),
'c', componentItem.getItemStack(5),
'p', componentItem.getItemStack(6)));
// Particle Booster
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii", 'i', Items.iron_ingot, 'r', Items.redstone, 'g',
Blocks.glass, 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(boosterBlock), false, "ipi", "rgr", "iii",
'i', Items.iron_ingot,
'r', Items.redstone,
'g', Blocks.glass,
'p', componentItem.getItemStack(6)));
// Camera
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici", 'i', Items.iron_ingot, 'n', Items.gold_nugget, 'g',
Blocks.glass, 'c', componentItem.getIS(5)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cameraBlock), false, "ngn", "i i", "ici",
'i', Items.iron_ingot,
'n', Items.gold_nugget,
'g', Blocks.glass,
'c', componentItem.getItemStack(5)));
// LaserCamera
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(laserCamBlock), cameraBlock, laserBlock));
// Monitor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici", 'i', Items.iron_ingot, 't', Blocks.torch, 'g',
Blocks.glass, 'c', componentItem.getIS(5)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(monitorBlock), false, "ggg", "iti", "ici",
'i', Items.iron_ingot,
't', Blocks.torch,
'g', Blocks.glass,
'c', componentItem.getItemStack(5)));
// Cloaking device
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici", 'i', Items.iron_ingot, 'r', Items.redstone, 'l',
componentItem.getIS(3), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakBlock), false, "ipi", "lrl", "ici",
'i', Items.iron_ingot,
'r', Items.redstone,
'l', componentItem.getItemStack(3),
'c', componentItem.getItemStack(5),
'p', componentItem.getItemStack(6)));
// Cloaking coil
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini", 'i', Items.iron_ingot, 'd', Items.diamond, 'r',
Items.redstone, 'n', Items.gold_nugget));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cloakCoilBlock), false, "ini", "rdr", "ini",
'i', Items.iron_ingot,
'd', Items.diamond,
'r', Items.redstone,
'n', Items.gold_nugget));
// Power Laser
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici", 'i', Items.iron_ingot, 'g', Blocks.glass, 'c',
componentItem.getIS(5), 'l', componentItem.getIS(3)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerLaserBlock), false, "iii", "ilg", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'c', componentItem.getItemStack(5),
'l', componentItem.getItemStack(3)));
// Power Reactor
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici", 'i', Items.iron_ingot, 'g', Blocks.glass, 'o',
componentItem.getIS(4), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerReactorBlock), false, "ipi", "gog", "ici",
'i', Items.iron_ingot,
'g', Blocks.glass,
'o', componentItem.getItemStack(4),
'c', componentItem.getItemStack(5),
'p', componentItem.getItemStack(6)));
// Power Store
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici", 'i', Items.iron_ingot, 's', componentItem
.getIS(7), 'c', componentItem.getIS(5), 'p', componentItem.getIS(6)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(powerStoreBlock), false, "ipi", "isi", "ici",
'i', Items.iron_ingot,
's', componentItem.getItemStack(7),
'c', componentItem.getItemStack(5),
'p', componentItem.getItemStack(6)));
// Transport Beacon
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ", 'e', Items.ender_pearl, 'l', "dyeBlue",
'd', Items.diamond, 's', Items.stick));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transportBeaconBlock), false, " e ", "ldl", " s ",
'e', Items.ender_pearl,
'l', "dyeBlue",
'd', Items.diamond,
's', Items.stick));
// Chunk Loader
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi", 'i', Items.iron_ingot, 'p', componentItem
.getIS(6), 'c', componentItem.getIS(0), 'f', componentItem.getIS(5)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(chunkLoaderBlock), false, "ipi", "ici", "ifi",
'i', Items.iron_ingot,
'p', componentItem .getItemStack(6),
'c', componentItem.getItemStack(0),
'f', componentItem.getItemStack(5)));
// Helmet
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg", 'i', Items.iron_ingot, 'w', Blocks.wool, 'g',
Blocks.glass, 'c', componentItem.getIS(8)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(helmetItem), false, "iii", "iwi", "gcg",
'i', Items.iron_ingot,
'w', Blocks.wool,
'g', Blocks.glass,
'c', componentItem.getItemStack(8)));
}
private static void initIC2Recipes() {
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm',
WarpDriveConfig.getIC2Item("advancedMachine"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
ItemStack advancedMachine = WarpDriveConfig.getIC2Item("blockMachine").copy();
advancedMachine.setItemDamage(12);
ItemStack miner = WarpDriveConfig.getIC2Item("blockMachine").copy();
miner.setItemDamage(7);
ItemStack magnetizer = WarpDriveConfig.getIC2Item("blockMachine").copy();
magnetizer.setItemDamage(9);
ItemStack fiberGlassCable = WarpDriveConfig.getIC2Item("itemCable").copy();
fiberGlassCable.setItemDamage(9);
ItemStack circuit = WarpDriveConfig.getIC2Item("itemPartCircuit").copy();
ItemStack ironPlate = WarpDriveConfig.getIC2Item("itemPlates").copy();
ironPlate.setItemDamage(4);
ItemStack mfe = WarpDriveConfig.getIC2Item("blockElectric").copy();
mfe.setItemDamage(1);
GameRegistry.addRecipe(new ItemStack(warpCore), "ici", "cmc", "ici",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"));
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm',
WarpDriveConfig.getIC2Item("advancedMachine"), 'c', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(protocolBlock), "iic", "imi", "cii",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"));
GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm',
WarpDriveConfig.getIC2Item("advancedMachine"), 'f', WarpDriveConfig.getIC2Item("frequencyTransmitter"));
GameRegistry.addRecipe(new ItemStack(radarBlock), "ifi", "imi", "imi",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'm', advancedMachine,
'f', WarpDriveConfig.getIC2Item("itemFreq"));
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"), 'm',
WarpDriveConfig.getIC2Item("advancedMachine"), 'd', Blocks.diamond_block);
GameRegistry.addRecipe(new ItemStack(isolationBlock), "iii", "idi", "iii",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'm', advancedMachine,
'd', Blocks.diamond_block);
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll", 'l', Blocks.leaves, 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c',
WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(airgenBlock), "lcl", "lml", "lll",
'l', Blocks.leaves,
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"));
GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'a',
WarpDriveConfig.getIC2Item("advancedAlloy"), 's', WarpDriveConfig.getIC2Item("advancedCircuit"));
GameRegistry.addRecipe(new ItemStack(laserBlock), "sss", "ama", "aaa",
'm', advancedMachine,
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"),
's', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"));
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc", 'c', WarpDriveConfig.getIC2Item("advancedCircuit"), 'a',
WarpDriveConfig.getIC2Item("advancedAlloy"), 'm', WarpDriveConfig.getIC2Item("miner"));
GameRegistry.addRecipe(new ItemStack(miningLaserBlock), "aaa", "ama", "ccc",
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"),
'm', 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(boosterBlock), "afc", "ama", "cfa",
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"),
'f', fiberGlassCable,
'm', mfe);
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(liftBlock), "aca", "ama", "a#a",
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"),
'm', magnetizer);
GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii", 'i', WarpDriveConfig.getIC2Item("iridiumPlate"));
GameRegistry.addRecipe(new ItemStack(iridiumBlock), "iii", "iii", "iii",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"));
GameRegistry.addShapelessRecipe(new ItemStack(WarpDriveConfig.getIC2Item("iridiumPlate").getItem(), 9), new ItemStack(iridiumBlock));
GameRegistry.addShapelessRecipe(new ItemStack(WarpDriveConfig.getIC2Item("itemPartIridium").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(laserCamBlock), "imi", "cec", "#k#",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'e', laserBlock,
'k', cameraBlock);
GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c',
WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(cameraBlock), "cgc", "gmg", "cgc",
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'c',
WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(monitorBlock), "gcg", "gmg", "ggg",
'm', advancedMachine,
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm", 'm', WarpDriveConfig.getIC2Item("advancedMachine"), 'a',
WarpDriveConfig.getIC2Item("advancedAlloy"), 's', WarpDriveConfig.getIC2Item("advancedCircuit"), 'g', Blocks.glass);
GameRegistry.addRecipe(new ItemStack(scannerBlock), "sgs", "mma", "amm",
'm', advancedMachine,
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"),
's', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'g', Blocks.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(laserTreeFarmBlock), false, new Object[] { "cwc", "wmw", "cwc",
'c', circuit,
'w', "logWood",
'm', miningLaserBlock }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] { "ece", "imi", "iei", 'e', Items.ender_pearl, 'c',
WarpDriveConfig.getIC2Item("electronicCircuit"), 'i', WarpDriveConfig.getIC2Item("plateiron"), 'm', WarpDriveConfig.getIC2Item("machine") }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(transporterBlock), false, new Object[] { "ece", "imi", "iei",
'e', Items.ender_pearl,
'c', circuit,
'i', ironPlate,
'm', advancedMachine }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem), false, new Object[] { " p ", "pdp", " p ", 'p',
WarpDriveConfig.getIC2Item("plateiron"), 'd', "gemDiamond" }));
if (WarpDriveConfig.isIndustrialCraft2loaded) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorLaserFocusItem), false, new Object[] { " p ", "pdp", " p ",
'p', ironPlate,
'd', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(reactorMonitorBlock), false, new Object[] { "pdp", "dmd", "pdp",
'p', ironPlate,
'd', "gemDiamond",
'm', mfe }));
}
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', advancedMachine);
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"));
GameRegistry.addRecipe(new ItemStack(cloakCoilBlock), "iai", "aca", "iai",
'i', WarpDriveConfig.getIC2Item("itemPartIridium"),
'c', WarpDriveConfig.getIC2Item("itemPartCircuitAdv"),
'a', WarpDriveConfig.getIC2Item("itemPartAlloy"));
}
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.getWorldObj();
if (ForgeChunkManager.ticketCountAvailableFor(this, worldObj) > 0) {
@ -630,15 +754,15 @@ public class WarpDrive implements LoadingCallback {
}
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) {
@ -663,8 +787,15 @@ public class WarpDrive implements LoadingCallback {
}
}
}
ForgeChunkManager.releaseTicket(ticket);
}
}
public static void addChatMessage(final EntityPlayer player, final String message) {
String[] lines = message.split("\n");
for (String line : lines) {
player.addChatMessage(new ChatComponentText(line));
}
}
}

View file

@ -1,12 +1,22 @@
package cr0s.warpdrive;
import cpw.mods.fml.common.Optional;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.peripheral.IPeripheral;
import dan200.computercraft.api.peripheral.IPeripheralProvider;
@Optional.InterfaceList({
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheralProvider", modid = "ComputerCraft")
})
public class WarpDrivePeripheralHandler implements IPeripheralProvider {
public void register() {
ComputerCraftAPI.registerPeripheralProvider(this);
}
@Override
@Optional.Method(modid = "ComputerCraft")
public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
// WarpDrive.debugPrint("Checking Peripheral at " + x + ", " + y + ", " + z);
TileEntity te = world.getTileEntity(x, y, z);

View file

@ -22,7 +22,7 @@ public class BlockAir extends Block
private IIcon[] iconBuffer;
public BlockAir() {
super(Material.air);
super(Material.fire);
setHardness(0.0F);
setBlockName("warpdrive.blocks.Air");
}
@ -162,7 +162,7 @@ public class BlockAir extends Block
// Count air in adjacent blocks
Block xp_block = world.getBlock(x + 1, y, z);
boolean xp_isAir = world.isAirBlock(x + 1, y, z);;
int xp_concentration = (xp_block.isAssociatedBlock(this)) ? 0 : world.getBlockMetadata(x + 1, y, z);
int xp_concentration = (xp_block != this) ? 0 : world.getBlockMetadata(x + 1, y, z);
if (xp_isAir) {
air_count++;
if (xp_concentration > 0) {
@ -244,9 +244,9 @@ public class BlockAir extends Block
}
if (concentration != new_concentration) {
if (concentration == 15) {
if (!xp_block.isAssociatedBlock(WarpDrive.airgenBlock) && !xn_block.isAssociatedBlock(WarpDrive.airgenBlock)
&& !yp_block.isAssociatedBlock(WarpDrive.airgenBlock) && !yn_block.isAssociatedBlock(WarpDrive.airgenBlock)
&& !zp_block.isAssociatedBlock(WarpDrive.airgenBlock) && !zn_block.isAssociatedBlock(WarpDrive.airgenBlock)) {
if ( xp_block != WarpDrive.airgenBlock && xn_block != WarpDrive.airgenBlock
&& yp_block != WarpDrive.airgenBlock && yn_block != WarpDrive.airgenBlock
&& zp_block != WarpDrive.airgenBlock && zn_block != WarpDrive.airgenBlock) {
// WarpDrive.debugPrint("AirGenerator not found, removing air block at " + x + ", " + y + ", " + z);
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
} else {

View file

@ -79,9 +79,9 @@ public class BlockDecorative extends Block {
}
public void initRecipes() {
GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(0, 8), false, "sss", "scs", "sss", 's', Blocks.stone, 'c', WarpDrive.componentItem.getIS(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(0, 8), false, "sss", "scs", "sss", 's', Blocks.stone, 'c', WarpDrive.componentItem.getItemStack(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(2, 8), false, "sss", "scs", "sss", 's', getIS(0), 'c', WarpDrive.componentItem.getIS(5)));
GameRegistry.addRecipe(new ShapedOreRecipe(getISNoCache(2, 8), false, "sss", "scs", "sss", 's', getIS(0), 'c', WarpDrive.componentItem.getItemStack(5)));
}
}

View file

@ -10,14 +10,16 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.conf.WarpDriveConfig;
public class BlockGas extends Block {
private IIcon[] gasIcons;
private IIcon[] iconBuffer;
public BlockGas() {
super(Material.air);
super(Material.fire);
setHardness(0.0F);
setCreativeTab(WarpDrive.warpdriveTab);
setBlockName("warpdrive.blocks.Gas");
}
@ -58,24 +60,24 @@ public class BlockGas extends Block {
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
gasIcons = new IIcon[12];
gasIcons[0] = par1IconRegister.registerIcon("warpdrive:gasBlockBlue");
gasIcons[1] = par1IconRegister.registerIcon("warpdrive:gasBlockRed");
gasIcons[2] = par1IconRegister.registerIcon("warpdrive:gasBlockGreen");
gasIcons[3] = par1IconRegister.registerIcon("warpdrive:gasBlockYellow");
gasIcons[4] = par1IconRegister.registerIcon("warpdrive:gasBlockDark");
gasIcons[5] = par1IconRegister.registerIcon("warpdrive:gasBlockDarkness");
gasIcons[6] = par1IconRegister.registerIcon("warpdrive:gasBlockWhite");
gasIcons[7] = par1IconRegister.registerIcon("warpdrive:gasBlockMilk");
gasIcons[8] = par1IconRegister.registerIcon("warpdrive:gasBlockOrange");
gasIcons[9] = par1IconRegister.registerIcon("warpdrive:gasBlockSyren");
gasIcons[10] = par1IconRegister.registerIcon("warpdrive:gasBlockGray");
gasIcons[11] = par1IconRegister.registerIcon("warpdrive:gasBlockViolet");
iconBuffer = new IIcon[12];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:gasBlockBlue");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:gasBlockRed");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:gasBlockGreen");
iconBuffer[3] = par1IconRegister.registerIcon("warpdrive:gasBlockYellow");
iconBuffer[4] = par1IconRegister.registerIcon("warpdrive:gasBlockDark");
iconBuffer[5] = par1IconRegister.registerIcon("warpdrive:gasBlockDarkness");
iconBuffer[6] = par1IconRegister.registerIcon("warpdrive:gasBlockWhite");
iconBuffer[7] = par1IconRegister.registerIcon("warpdrive:gasBlockMilk");
iconBuffer[8] = par1IconRegister.registerIcon("warpdrive:gasBlockOrange");
iconBuffer[9] = par1IconRegister.registerIcon("warpdrive:gasBlockSyren");
iconBuffer[10] = par1IconRegister.registerIcon("warpdrive:gasBlockGray");
iconBuffer[11] = par1IconRegister.registerIcon("warpdrive:gasBlockViolet");
}
@Override
public IIcon getIcon(int side, int metadata) {
return gasIcons[metadata % gasIcons.length]; // Lem
return iconBuffer[metadata % iconBuffer.length];
}
@Override

View file

@ -5,7 +5,6 @@ import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.FMLCommonHandler;
@ -82,7 +81,7 @@ public class DebugCommand extends CommandBase
catch (Exception e)
{
e.printStackTrace();
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender)));
WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
return;
}
@ -150,7 +149,7 @@ public class DebugCommand extends CommandBase
}
else
{
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender)));
WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
}
}

View file

@ -3,7 +3,6 @@ package cr0s.warpdrive.command;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
@ -42,7 +41,7 @@ public class GenerateCommand extends CommandBase {
// Reject command, if player is not in space
if (player.dimension != WarpDriveConfig.G_SPACE_DIMENSION_ID && (!"ship".equals(struct))) {
player.addChatMessage(new ChatComponentText("* generate: this structure is only allowed in space!"));
WarpDrive.addChatMessage(player, "* generate: this structure is only allowed in space!");
return;
}
@ -84,11 +83,11 @@ public class GenerateCommand extends CommandBase {
}
}
} else {
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender)));
WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
}
}
} else {
player.addChatMessage(new ChatComponentText(getCommandUsage(icommandsender)));
WarpDrive.addChatMessage(player, getCommandUsage(icommandsender));
}
}
}

View file

@ -3,7 +3,6 @@ package cr0s.warpdrive.command;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import cr0s.warpdrive.WarpDrive;
public class JumpgateCommand extends CommandBase {
@ -25,6 +24,6 @@ public class JumpgateCommand extends CommandBase {
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
EntityPlayerMP player = (EntityPlayerMP) icommandsender;
player.addChatMessage(new ChatComponentText(WarpDrive.jumpgates.commaList()));
WarpDrive.addChatMessage(player, WarpDrive.jumpgates.commaList());
}
}

View file

@ -20,35 +20,35 @@ import cr0s.warpdrive.data.TransitionPlane;
public class WarpDriveConfig {
private static Configuration config;
/*
* The variables which store whether or not individual mods are loaded
*/
public static boolean isForgeMultipartLoaded = false;
public static boolean isAdvSolPanelLoaded = false;
public static boolean isAdvancedSolarPanelLoaded = false;
public static boolean isAtomicScienceLoaded = false;
public static boolean isICBMLoaded = false;
public static boolean isMFFSLoaded = false;
public static boolean isGraviSuiteLoaded = false;
public static boolean isICLoaded = false;
public static boolean isCCLoaded = false;
public static boolean isIndustrialCraft2loaded = false;
public static boolean isComputerCraftLoaded = false;
public static boolean isNetherOresLoaded = false;
public static boolean isThermalExpansionLoaded = false;
public static boolean isAdvancedRepulsionSystemsLoaded = false;
public static boolean isMagicalCropsLoaded = false;
// ForgeMultipart (microblocks) support
public static Method forgeMultipart_helper_createTileFromNBT = null;
public static Method forgeMultipart_helper_sendDescPacket = null;
public static Method forgeMultipart_tileMultipart_onChunkLoad = null;
public static ItemStack IC2_Air;
public static ItemStack IC2_Empty;
public static ItemStack IC2_RubberWood;
public static ItemStack IC2_air;
public static ItemStack IC2_empty;
public static ItemStack IC2_rubberWood;
public static ItemStack IC2_Resin;
public static Item IC2_fluidCell;
public static Block CC_Computer, CC_peripheral, CCT_Turtle, CCT_Upgraded, CCT_Advanced;
public static Item CC_Floppy;
public static ItemStack GT_Ores, GT_Granite, GT_Machine;
public static ItemStack IC2_solarPanel;
@ -56,11 +56,11 @@ public class WarpDriveConfig {
public static int ICBM_Machine, ICBM_Missile, ICBM_Explosive;
public static Item GS_ultimateLappack;
public static ArrayList<Block> forceFieldBlocks;
public static ArrayList<Block> minerOres, minerLogs, minerLeaves, scannerIgnoreBlocks;
public static ArrayList<Item> spaceHelmets, jetpacks;
public static ArrayList<Block> commonWorldGenOres;
// Mod configuration (see loadWarpDriveConfig() for comments/definitions)
// General
public static int G_SPACE_PROVIDER_ID = 14;
@ -75,14 +75,14 @@ public class WarpDriveConfig {
public static boolean G_DEBUGMODE = false;
public static String G_SCHEMALOCATION = "warpDrive_schematics";
public static int G_BLOCKS_PER_TICK = 3500;
public static boolean G_ENABLE_IC2_RECIPES = true;
public static boolean G_ENABLE_VANILLA_RECIPES = false;
public static boolean G_ENABLE_TDK_RECIPES = false;
// Transition planes
public static TransitionPlane[] G_TRANSITIONPLANES = null;
// Warp Drive Core
public static int WC_MAX_ENERGY_VALUE = 100000000;
public static int WC_ENERGY_PER_BLOCK_MODE1 = 10;
@ -102,7 +102,7 @@ public class WarpDriveConfig {
public static int WC_CORES_REGISTRY_UPDATE_INTERVAL_SECONDS = 10;
public static int WC_ISOLATION_UPDATE_INTERVAL_SECONDS = 10;
public static String[] WC_UNLIMITED_PLAYERNAMES = { "notch", "someone" };
// Warp Radar
public static int WR_MAX_ENERGY_VALUE = 100000000; // 100kk eU
public static int WR_MAX_ISOLATION_RANGE = 2;
@ -110,23 +110,23 @@ public class WarpDriveConfig {
public static int WR_MAX_ISOLATION_BLOCKS = 132;
public static double WR_MIN_ISOLATION_EFFECT = 0.12;
public static double WR_MAX_ISOLATION_EFFECT = 1.00;
// Ship Scanner
public static int SS_MAX_ENERGY_VALUE = 500000000;
public static int SS_EU_PER_BLOCK_SCAN = 100; // eU per block of ship volume
// (including air)
public static int SS_EU_PER_BLOCK_DEPLOY = 5000;
public static int SS_MAX_DEPLOY_RADIUS_BLOCKS = 50;
// Particle Booster
public static int PB_MAX_ENERGY_VALUE = 100000;
// Laser Emitter
public static int LE_MAX_BOOSTERS_NUMBER = 10;
public static int LE_MAX_LASER_ENERGY = 4000000;
public static int LE_EMIT_DELAY_TICKS = 20 * 3;
public static int LE_EMIT_SCAN_DELAY_TICKS = 10;
public static double LE_COLLECT_ENERGY_MULTIPLIER = 0.60D;
public static int LE_BEAM_LENGTH_PER_ENERGY_DIVIDER = 5000;
public static int LE_ENTITY_HIT_SET_ON_FIRE_TIME = 100;
@ -135,7 +135,7 @@ public class WarpDriveConfig {
public static int LE_BLOCK_HIT_CONSUME_ENERGY = 70000;
public static int LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE = 1000;
public static int LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE = 10;
// Mining Laser
// BuildCraft quarry values for reference
// - harvesting one block is 60 MJ/block = 600 RF/block = ~145 EU/block
@ -172,57 +172,57 @@ public class WarpDriveConfig {
public static double ML_DEUTERIUM_MUL_SILKTOUCH = 1.0;
public static double ML_EU_MUL_FORTUNE = 2.5;
public static int ML_MAX_RADIUS = 5;
// Tree farm
public static int TF_MAX_SIZE = 16;
// Cloaking device core
public static int CD_MAX_CLOAKING_FIELD_SIDE = 100;
public static int CD_ENERGY_PER_BLOCK_TIER1 = 125;
public static int CD_ENERGY_PER_BLOCK_TIER2 = 500;
public static int CD_FIELD_REFRESH_INTERVAL_SECONDS = 3;
public static int CD_COIL_CAPTURE_BLOCKS = 5;
// Air generator
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.0;
// public static double TR_MAX_SCAN_RANGE = 4; FIXME: not used ?!?
public static double TR_MAX_BOOST_MUL = 4.0;
// 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
public static int LL_MAX_ENERGY = 2400;
public static int LL_LIFT_ENERGY = 800;
public static int LL_TICK_RATE = 10;
// Chunk Loader
public static int CL_MAX_ENERGY = 1000000;
public static int CL_MAX_DISTANCE = 2;
public static int CL_RF_PER_CHUNKTICK = 320;
public static ItemStack getIC2Item(String id) {
return new ItemStack((Item) Item.itemRegistry.getObject("IC2:" + id));
}
public static void preInit(Configuration configIn) {
config = configIn;
}
public static void loadWarpDriveConfig() {
// General
G_SPACE_PROVIDER_ID = config.get("General", "space_provider_id", G_SPACE_PROVIDER_ID, "Space dimension provider ID").getInt();
@ -240,7 +240,7 @@ public class WarpDriveConfig {
G_BLOCKS_PER_TICK = config.get("General", "blocks_per_tick", G_BLOCKS_PER_TICK,
"Number of blocks to move per ticks, too high will cause lag spikes on ship jumping or deployment, too low may break the ship wirings")
.getInt();
G_ENABLE_IC2_RECIPES = config.get("General", "enable_ic2_recipes", G_ENABLE_IC2_RECIPES, "Original recipes based on IndustrialCrat2 by Cr0s")
.getBoolean(true);
G_ENABLE_VANILLA_RECIPES = config.get("General", "enable_vanilla_recipes", G_ENABLE_VANILLA_RECIPES, "Vanilla recipes by DarkholmeTenk").getBoolean(
@ -251,7 +251,7 @@ public class WarpDriveConfig {
G_ENABLE_TDK_RECIPES,
"Mixed recipes for TDK packs by Lem'ADEC (currently requires at least AppliedEnergistics, Extracells, AtomicScience, IndustrialCraft2, GraviSuite and ThermalExpansion")
.getBoolean(false);
// TransitionPlane
config.addCustomCategoryComment("TransitionPlane",
"Transition planes defines which region in space allows to go to other dimensions, default is overworld with 100k radius.\n"
@ -278,7 +278,7 @@ public class WarpDriveConfig {
}
// FIXME: check transition planes aren't overlapping
// FIXME: check transition planes have valid dimension id
// Warp Core
WC_MAX_ENERGY_VALUE = config.get("WarpCore", "max_energy_value", WC_MAX_ENERGY_VALUE, "Maximum energy storage").getInt();
WC_ENERGY_PER_BLOCK_MODE1 = config.get("WarpCore", "energy_per_block_mode1", WC_ENERGY_PER_BLOCK_MODE1).getInt();
@ -300,14 +300,14 @@ public class WarpDriveConfig {
.getInt();
WC_WARMUP_LONGJUMP_SECONDS = config.get("WarpCore", "warmup_longjump_seconds", WC_WARMUP_LONGJUMP_SECONDS, "Long jump means more than 50 blocks")
.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_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
WR_MAX_ENERGY_VALUE = config.get("WarpRadar", "max_energy_value", WR_MAX_ENERGY_VALUE).getInt();
WR_MAX_ISOLATION_RANGE = config.get("WarpRadar", "max_isolation_range", WR_MAX_ISOLATION_RANGE,
@ -325,7 +325,7 @@ public class WarpDriveConfig {
WR_MAX_ISOLATION_EFFECT = config.get("WarpRadar", "max_isolation_effect", WR_MAX_ISOLATION_EFFECT,
"isolation effect achieved with max number of isolation blocks (0.01 to 1.00)").getDouble(1.00D);
WR_MAX_ISOLATION_EFFECT = Math.min(1.0D, Math.max(WR_MAX_ISOLATION_EFFECT, 0.01D));
// Ship Scanner
SS_MAX_ENERGY_VALUE = config.get("WarpCore", "max_energy_value", SS_MAX_ENERGY_VALUE, "Maximum energy storage").getInt();
SS_EU_PER_BLOCK_SCAN = config.get("ShipScanner", "energy_per_block_when_scanning", SS_EU_PER_BLOCK_SCAN,
@ -340,16 +340,16 @@ public class WarpDriveConfig {
}
SS_MAX_DEPLOY_RADIUS_BLOCKS = config.get("ShipScanner", "max_deploy_radius_blocks", SS_MAX_DEPLOY_RADIUS_BLOCKS,
"Max distance from ship scanner to ship core, measured in blocks").getInt();
// Particle Booster
PB_MAX_ENERGY_VALUE = config.get("ParticleBooster", "max_energy_value", PB_MAX_ENERGY_VALUE).getInt();
// Laser Emitter
LE_MAX_BOOSTERS_NUMBER = config.get("LaserEmitter", "max_boosters_number", LE_MAX_BOOSTERS_NUMBER).getInt();
LE_MAX_LASER_ENERGY = config.get("LaserEmitter", "max_laser_energy", LE_MAX_LASER_ENERGY).getInt();
LE_EMIT_DELAY_TICKS = config.get("LaserEmitter", "emit_delay_ticks", LE_EMIT_DELAY_TICKS).getInt();
LE_EMIT_SCAN_DELAY_TICKS = config.get("LaserEmitter", "emit_scan_delay_ticks", LE_EMIT_SCAN_DELAY_TICKS).getInt();
// Laser Emitter tweaks
LE_COLLECT_ENERGY_MULTIPLIER = config.get("LaserEmitterTweaks", "collect_energy_multiplier", LE_COLLECT_ENERGY_MULTIPLIER).getDouble(0.6D);
LE_BEAM_LENGTH_PER_ENERGY_DIVIDER = config.get("LaserEmitterTweaks", "beam_length_per_energy_divider", LE_BEAM_LENGTH_PER_ENERGY_DIVIDER).getInt();
@ -363,7 +363,7 @@ public class WarpDriveConfig {
LE_BLOCK_HIT_CONSUME_ENERGY_PER_BLOCK_RESISTANCE).getInt();
LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE = config.get("LaserEmitterTweaks", "block_hit_consume_energy_per_distance",
LE_BLOCK_HIT_CONSUME_ENERGY_PER_DISTANCE).getInt();
// Mining Laser
ML_MAX_BOOSTERS_NUMBER = config.get("MiningLaser", "max_boosters_number", ML_MAX_BOOSTERS_NUMBER).getInt();
ML_WARMUP_DELAY_TICKS = config.get("MiningLaser", "warmup_delay_ticks", ML_WARMUP_DELAY_TICKS).getInt();
@ -378,10 +378,10 @@ public class WarpDriveConfig {
ML_DEUTERIUM_MUL_SILKTOUCH = config.get("MiningLaser", "silktouch_deuterium_mul", ML_DEUTERIUM_MUL_SILKTOUCH).getDouble(1.0);
ML_EU_MUL_FORTUNE = config.get("MiningLaser", "fortune_power_base", ML_EU_MUL_FORTUNE).getDouble(2.5);
ML_MAX_RADIUS = config.get("MiningLaser", "max_radius", ML_MAX_RADIUS).getInt();
// Tree Farm
TF_MAX_SIZE = config.get("TreeFarm", "max_treefarm_size", TF_MAX_SIZE).getInt();
// Cloaking device core
CD_MAX_CLOAKING_FIELD_SIDE = config.get("CloakingDevice", "max_cloaking_field_side", CD_MAX_CLOAKING_FIELD_SIDE).getInt();
CD_ENERGY_PER_BLOCK_TIER1 = config.get("CloakingDevice", "energy_per_block_tier1", CD_ENERGY_PER_BLOCK_TIER1).getInt();
@ -389,34 +389,34 @@ public class WarpDriveConfig {
CD_FIELD_REFRESH_INTERVAL_SECONDS = config.get("CloakingDevice", "field_refresh_interval_seconds", CD_FIELD_REFRESH_INTERVAL_SECONDS).getInt();
CD_COIL_CAPTURE_BLOCKS = config.get("CloakingDevice", "coil_capture_blocks", CD_COIL_CAPTURE_BLOCKS, "Extra blocks covered after the outer coils")
.getInt();
// Air generator
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.0);
TR_MAX_BOOST_MUL = config.get("Transporter", "max_boost", TR_MAX_BOOST_MUL).getDouble(4.0);
// 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
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_TICK_RATE = config.get("LaserLift", "tick_rate", LL_TICK_RATE).getInt();
}
public static void load() {
commonWorldGenOres = new ArrayList<Block>();
commonWorldGenOres.add(Blocks.iron_ore);
@ -425,9 +425,9 @@ public class WarpDriveConfig {
commonWorldGenOres.add(Blocks.emerald_ore);
commonWorldGenOres.add(Blocks.lapis_ore);
commonWorldGenOres.add(Blocks.redstone_ore);
forceFieldBlocks = new ArrayList<Block>();
spaceHelmets = new ArrayList<Item>();
jetpacks = new ArrayList<Item>();
minerOres = new ArrayList<Block>();
@ -435,51 +435,54 @@ public class WarpDriveConfig {
minerLeaves = new ArrayList<Block>();
scannerIgnoreBlocks = new ArrayList<Block>();
config.load();
isForgeMultipartLoaded = Loader.isModLoaded("ForgeMultipart");
if (isForgeMultipartLoaded) {
loadForgeMultipart();
}
isICLoaded = Loader.isModLoaded("IC2");
if (isICLoaded)
isIndustrialCraft2loaded = Loader.isModLoaded("IC2");
if (isIndustrialCraft2loaded) {
loadIC2();
}
isCCLoaded = Loader.isModLoaded("ComputerCraft");
if (isCCLoaded)
isComputerCraftLoaded = Loader.isModLoaded("ComputerCraft");
if (isComputerCraftLoaded) {
loadCC();
}
isAdvSolPanelLoaded = Loader.isModLoaded("AdvancedSolarPanel");
if (isAdvSolPanelLoaded)
isAdvancedSolarPanelLoaded = Loader.isModLoaded("AdvancedSolarPanel");
if (isAdvancedSolarPanelLoaded) {
loadASP();
}
isAtomicScienceLoaded = Loader.isModLoaded("ResonantInduction|Atomic");
if (isAtomicScienceLoaded)
if (isAtomicScienceLoaded) {
loadAtomicScience();
isICBMLoaded = Loader.isModLoaded("ICBM|Explosion");
if (isICBMLoaded)
loadICBM();
}
isMFFSLoaded = Loader.isModLoaded("MFFS");
if (isMFFSLoaded)
if (isMFFSLoaded) {
loadMFFS();
}
isGraviSuiteLoaded = Loader.isModLoaded("GraviSuite");
if (isGraviSuiteLoaded)
if (isGraviSuiteLoaded) {
loadGraviSuite();
}
isNetherOresLoaded = Loader.isModLoaded("NetherOres");
isThermalExpansionLoaded = Loader.isModLoaded("ThermalExpansion");
if (isThermalExpansionLoaded)
if (isThermalExpansionLoaded) {
loadThermalExpansion();
}
isAdvancedRepulsionSystemsLoaded = Loader.isModLoaded("AdvancedRepulsionSystems");
if (isAdvancedRepulsionSystemsLoaded) {
loadAdvancedRepulsionSystems();
}
isMagicalCropsLoaded = Loader.isModLoaded("MagicalCrops");
//
minerOres.add(WarpDrive.iridiumBlock);
@ -491,23 +494,24 @@ public class WarpDriveConfig {
minerOres.add(Blocks.torch);
minerOres.add(Blocks.glowstone);
minerOres.add(Blocks.redstone_block);
// Ignore WarpDrive blocks (which potentially will be duplicated by
// cheaters using ship scan/deploy)
scannerIgnoreBlocks.add(WarpDrive.warpCore);
scannerIgnoreBlocks.add(WarpDrive.protocolBlock);
scannerIgnoreBlocks.add(WarpDrive.iridiumBlock);
if (isICLoaded) {
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:mfsUnit"));
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:mfeUnit"));
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:cesuUnit"));
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:batBox"));
if (isIndustrialCraft2loaded) {
// Metadata: 0 Batbox, 1 MFE, 2 MFSU, 3 LV transformer, 4 MV transformer, 5 HV transformer, 6 EV transformer, 7 CESU
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:blockElectric"));
// Metadata: 0 Batbox, 1 CESU, 2 MFE, 3 MFSU
scannerIgnoreBlocks.add(Block.getBlockFromName("IC2:blockChargepad"));
}
if (isICBMLoaded) {
scannerIgnoreBlocks.add(Block.getBlockFromName("ICBM:explosive"));
}
if (isCCLoaded) {
if (isComputerCraftLoaded) {
scannerIgnoreBlocks.add(CC_Computer);
scannerIgnoreBlocks.add(CCT_Turtle);
scannerIgnoreBlocks.add(CCT_Upgraded);
@ -517,15 +521,15 @@ public class WarpDriveConfig {
for (Block t : commonWorldGenOres) {
scannerIgnoreBlocks.add(t);
}
loadWarpDriveConfig();
config.save();
}
public static void postInit() {
LoadOreDict();
}
private static void LoadOreDict() {
String[] oreNames = OreDictionary.getOreNames();
for (String oreName : oreNames) {
@ -553,7 +557,7 @@ public class WarpDriveConfig {
}
}
}
private static void loadForgeMultipart() {
try {//TODO: Update to 1.7
Class forgeMultipart_helper = Class.forName("codechicken.multipart.MultipartHelper");
@ -567,37 +571,50 @@ public class WarpDriveConfig {
e.printStackTrace();
}
}
private static void loadIC2() {
IC2_solarPanel = getIC2Item("solarPanel");
spaceHelmets.add(getIC2Item("hazmatHelmet").getItem());
spaceHelmets.add(getIC2Item("quantumHelmet").getItem());
jetpacks.add(getIC2Item("jetpack").getItem());
jetpacks.add(getIC2Item("electricJetpack").getItem());
IC2_Air = getIC2Item("airCell");
IC2_Empty = getIC2Item("cell");
ItemStack rubberWood = getIC2Item("rubberWood");
IC2_Resin = getIC2Item("resin");
if (rubberWood != null) {
IC2_RubberWood = rubberWood;
try {
IC2_solarPanel = getIC2Item("blockGenerator");
IC2_solarPanel.setItemDamage(3);
spaceHelmets.add(getIC2Item("itemArmorHazmatHelmet").getItem());
spaceHelmets.add(getIC2Item("itemSolarHelmet").getItem());
spaceHelmets.add(getIC2Item("itemArmorNanoHelmet").getItem());
spaceHelmets.add(getIC2Item("itemArmorQuantumHelmet").getItem());
jetpacks.add(getIC2Item("itemArmorJetpack").getItem());
jetpacks.add(getIC2Item("itemArmorJetpackElectric").getItem());
IC2_empty = getIC2Item("itemCellEmpty");
IC2_air = getIC2Item("itemCellEmpty");
IC2_air.setItemDamage(5);
ItemStack rubberWood = getIC2Item("blockRubWood");
IC2_Resin = getIC2Item("itemHarz");
if (rubberWood != null) {
IC2_rubberWood = rubberWood;
minerOres.add(Block.getBlockFromItem(getIC2Item("rubberWood").getItem()));
}
ItemStack ore = getIC2Item("blockOreUran");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("blockOreCopper");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("blockOreTin");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("blockOreLead");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
IC2_fluidCell = getIC2Item("itemFluidCell").getItem();
} catch (Exception exception) {
WarpDrive.logger.error("WarpDriveConfig Error loading IndustrialCraft2 classes");
exception.printStackTrace();
}
ItemStack ore = getIC2Item("uraniumOre");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("copperOre");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("tinOre");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
ore = getIC2Item("leadOre");
if (ore != null)
commonWorldGenOres.add(Block.getBlockFromItem(ore.getItem()));
minerOres.add(Block.getBlockFromItem(getIC2Item("rubberWood").getItem()));
IC2_fluidCell = getIC2Item("FluidCell").getItem();
}
private static void loadCC() {
try {
/*
@ -613,7 +630,7 @@ public class WarpDriveConfig {
e.printStackTrace();
}
}
private static void loadASP() {
try {
spaceHelmets.add((Item) Item.itemRegistry.getObject("AdvancedSolarPanel:advanced_solar_helmet"));
@ -622,10 +639,10 @@ public class WarpDriveConfig {
} catch (Exception e) {
WarpDrive.logger.error("WarpDriveConfig Error loading ASP classes");
e.printStackTrace();
isAdvSolPanelLoaded = false;
isAdvancedSolarPanelLoaded = false;
}
}
private static void loadAtomicScience() {
try {
/* TODO: Does not exist for 1.7
@ -640,7 +657,7 @@ public class WarpDriveConfig {
isAtomicScienceLoaded = false;
}
}
private static void loadICBM() {
try {
/* TODO: Does not exist yet for 1.7
@ -658,7 +675,7 @@ public class WarpDriveConfig {
isICBMLoaded = false;
}
}
private static void loadMFFS() {
try {
forceFieldBlocks.add(Block.getBlockFromName("MFFS:FIXME_field")); // FIXME
@ -669,10 +686,10 @@ public class WarpDriveConfig {
isMFFSLoaded = false;
}
}
private static void loadGraviSuite() {
try {
spaceHelmets.add((Item) Item.itemRegistry.getObject("GraviSuite.ultimateSolarHelmet")); // FIXME
jetpacks.add((Item) Item.itemRegistry.getObject("GraviSuite.advJetpack")); // FIXME
jetpacks.add((Item) Item.itemRegistry.getObject("GraviSuite.graviChestPlate")); // FIXME
@ -683,7 +700,7 @@ public class WarpDriveConfig {
isGraviSuiteLoaded = false;
}
}
private static void loadThermalExpansion() {
try {
// TEEnergyCell =
@ -695,10 +712,10 @@ public class WarpDriveConfig {
isThermalExpansionLoaded = false;
}
}
private static void loadAdvancedRepulsionSystems() {
try {
forceFieldBlocks.add(Block.getBlockFromName("AdvancedRepulsionSystems:field"));
} catch (Exception e) {
WarpDrive.logger.error("WarpDriveConfig Error loading AdvancedRepulsionSystems classes");
@ -706,7 +723,7 @@ public class WarpDriveConfig {
isAdvancedRepulsionSystemsLoaded = false;
}
}
public static Block getDefaultSurfaceBlock(Random random, boolean corrupted, boolean isMoon) {
if (isMoon) {
if (random.nextInt(5) == 1) {
@ -726,7 +743,7 @@ public class WarpDriveConfig {
}
return Blocks.stone;
}
public static Block getRandomSurfaceBlock(Random random, Block def, boolean bedrock) {
if (bedrock && (random.nextInt(1000) == 1)) {
return Blocks.bedrock;
@ -737,7 +754,7 @@ public class WarpDriveConfig {
}
return getRandomOverworldBlock(random, def);
}
public static Block getRandomOverworldBlock(Random random, Block def) {
if (random.nextInt(25) == 5) {
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size()));
@ -748,9 +765,9 @@ public class WarpDriveConfig {
}
return def;
}
public static Block getRandomNetherBlock(Random random, Block def) {
if (isICLoaded && (random.nextInt(10000) == 42)) {
if (isIndustrialCraft2loaded && (random.nextInt(10000) == 42)) {
return WarpDrive.iridiumBlock;
} else if (random.nextInt(25) == 1) {
return Blocks.quartz_ore;
@ -758,17 +775,17 @@ public class WarpDriveConfig {
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size()));
return def;
}
public static Block getRandomEndBlock(Random random, Block def) {
if (isICLoaded && random.nextInt(10000) == 42) {
if (isIndustrialCraft2loaded && random.nextInt(10000) == 42) {
return WarpDrive.iridiumBlock;
} else if (random.nextInt(200) == 13) {
return commonWorldGenOres.get(random.nextInt(commonWorldGenOres.size()));
}
return def;
}
public static void loadWorldGen() {
public static void loadWorldGen() {
}
}

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive.item;
import cpw.mods.fml.common.Optional;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorComponent;
import net.minecraft.client.renderer.texture.IIconRegister;
@ -7,6 +8,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cr0s.warpdrive.WarpDrive;
@Optional.InterfaceList({
@Optional.Interface(iface = "ic2.api.reactor.IReactorComponent", modid = "IC2API")
})
public class ItemReactorLaserFocus extends Item implements IReactorComponent
{
private final static int maxHeat = 3000;
@ -44,6 +48,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
other.setItemDamage(newOne);
}
@Optional.Method(modid = "IC2")
private static void coolComponent(ItemStack self, IReactorComponent comp, IReactor reactor, ItemStack stack, int x, int y)
{
int maxTransfer = maxHeat - self.getItemDamage();
@ -53,7 +58,8 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
damageComponent(self,retained - transferHeat);
}
private static void coolReactor(IReactor reactor,ItemStack stack)
@Optional.Method(modid = "IC2")
private static void coolReactor(IReactor reactor, ItemStack stack)
{
int reactorHeat = reactor.getHeat();
int myHeat = stack.getItemDamage();
@ -63,6 +69,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
}
@Override
@Optional.Method(modid = "IC2")
public void processChamber(IReactor reactor, ItemStack yourStack, int x, int y, boolean heatrun)
{
if(heatrun)
@ -89,6 +96,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
}
@Override
@Optional.Method(modid = "IC2")
public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack,ItemStack pulsingStack,
int youX, int youY, int pulseX, int pulseY, boolean heatrun)
{
@ -96,24 +104,28 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
}
@Override
@Optional.Method(modid = "IC2")
public boolean canStoreHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{
return true;
}
@Override
@Optional.Method(modid = "IC2")
public int getMaxHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{
return maxHeat;
}
@Override
@Optional.Method(modid = "IC2")
public int getCurrentHeat(IReactor reactor, ItemStack yourStack, int x, int y)
{
return yourStack.getItemDamage();
}
@Override
@Optional.Method(modid = "IC2")
public int alterHeat(IReactor reactor, ItemStack yourStack, int x, int y, int heat)
{
//WarpDrive.debugPrint("ReactorLaserAlter:" + heat);
@ -123,6 +135,7 @@ public class ItemReactorLaserFocus extends Item implements IReactorComponent
}
@Override
@Optional.Method(modid = "IC2")
public float influenceExplosion(IReactor reactor, ItemStack yourStack)
{
return 0;

View file

@ -39,7 +39,7 @@ public class ItemWarpComponent extends Item implements IAirCanister {
cachedIS = new ItemStack[potentialUnlocalized.length];
}
public ItemStack getIS(int damage) {
public ItemStack getItemStack(int damage) {
if (damage >=0 && damage < potentialUnlocalized.length) {
if (cachedIS[damage] == null) {
cachedIS[damage] = new ItemStack(WarpDrive.componentItem,1,damage);
@ -55,50 +55,50 @@ public class ItemWarpComponent extends Item implements IAirCanister {
public void registerRecipes() {
WarpDrive.debugPrint("Registering empty recipe");
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(0),false,"nrn","r r","nrn",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(0),false,"nrn","r r","nrn",
'r', Items.redstone,
'n', Items.gold_nugget));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(1),false,"g","e","c",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(1),false,"g","e","c",
'g', Blocks.glass,
'e', Items.ender_pearl,
'c', getIS(0)));
'c', getItemStack(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(2),false," g ","ede"," c ",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(2),false," g ","ede"," c ",
'g', Blocks.glass,
'e', Items.ender_pearl,
'd', Items.diamond,
'c', getIS(0)));
'c', getItemStack(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(3),false," g ","rtr"," c ",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(3),false," g ","rtr"," c ",
'g', Blocks.glass,
'r', "dyeBlue",
't', Blocks.torch,
'c', getIS(0)));
'c', getItemStack(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(4),false," l ","rcr"," l ",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(4),false," l ","rcr"," l ",
'l', "dyeWhite",
'r', Items.coal,
'c', getIS(0)));
'c', getItemStack(0)));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(5),false,"g ","gwr","rwr",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(5),false,"g ","gwr","rwr",
'g', Items.gold_nugget,
'r', Items.redstone,
'w', "plankWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(6),false,"gig","iri","gig",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(6),false,"gig","iri","gig",
'g', Items.gold_nugget,
'r', Items.redstone,
'i', Items.iron_ingot));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(7),false,"glg","ldl","glg",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(7),false,"glg","ldl","glg",
'g', Items.gold_nugget,
'l', "dyeBlue",
'd', Items.diamond));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(8),false,"gcg","g g","gcg",
GameRegistry.addRecipe(new ShapedOreRecipe(getItemStack(8),false,"gcg","g g","gcg",
'g', Blocks.glass,
'c', getIS(0)));
'c', getItemStack(0)));
}
public boolean doesMatch(ItemStack is, String unlocalised) {

View file

@ -79,16 +79,16 @@ public class ItemWarpUpgrade extends Item {
}
public void initRecipes() {
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Energy.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e',
WarpDrive.componentItem.getIS(7), 'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Energy.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e',
WarpDrive.componentItem.getItemStack(7), 'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Power.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e',
WarpDrive.componentItem.getIS(6), 'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Power.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e',
WarpDrive.componentItem.getItemStack(6), 'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Speed.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e',
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Speed.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e',
Items.sugar, 'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Range.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getIS(0), 'e',
GameRegistry.addRecipe(new ShapedOreRecipe(getIS(EnumUpgradeTypes.Range.ordinal()), false, "c", "e", "r", 'c', WarpDrive.componentItem.getItemStack(0), 'e',
WarpDrive.transportBeaconBlock, 'r', Items.redstone));
}

View file

@ -11,7 +11,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -95,7 +94,7 @@ public class BlockAirGenerator extends BlockContainer
if (te != null) {
ItemStack heldItemStack = player.getHeldItem();
if (heldItemStack == null) {
player.addChatMessage(new ChatComponentText(te.getStatus()));
WarpDrive.addChatMessage(player, te.getStatus());
return true;
} else {
Item heldItem = heldItemStack.getItem();

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -80,9 +79,9 @@ public class BlockCamera extends BlockContainer {
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
WarpDrive.instance.cams.printRegistry(par1World);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid!"));
WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is invalid!");
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is valid for camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ);
}
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -71,11 +70,11 @@ public class BlockCloakingDeviceCore extends BlockContainer {
TileEntityCloakingDeviceCore te = (TileEntityCloakingDeviceCore)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus() + "\n"
// + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled + "\n"
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus()
// + " isInvalid? " + te.isInvalid() + " Valid? " + te.isValid + " Cloaking? " + te.isCloaking + " Enabled? " + te.isEnabled
+ ((!te.isValid) ? "Invalid assembly!" :
((!te.isEnabled) ? "Cloak is disabled" :
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!")))));
((te.isCloaking) ? "A tier " + te.tier + " cloak is currently covering " + te.volume + " blocks!" : "Cloak needs more power!"))));
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -79,9 +78,9 @@ public class BlockLaserCam extends BlockContainer {
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, cameraFrequency);
WarpDrive.debugPrint("cam detected as " + cam);
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName()
WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName()
+ ": Beam frequency '" + beamFrequency + "' is " + ((beamFrequency < 0) ? "invalid!" : "valid.")
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ)));
+ " Camera frequency '" + cameraFrequency + "' is " + ((cam == null) ? "invalid!" : "valid for laser-camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -88,7 +87,7 @@ public class BlockLift extends BlockContainer
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -89,7 +88,7 @@ public class BlockMiningLaser extends BlockContainer {
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(miningLaser.getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, miningLaser.getStatus());
return true;
}

View file

@ -8,7 +8,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -75,10 +74,10 @@ public class BlockMonitor extends BlockContainer {
int frequency = ((TileEntityMonitor)te).getFrequency();
CamRegistryItem cam = WarpDrive.instance.cams.getCamByFrequency(par1World, frequency);
if (cam == null) {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!"));
WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is invalid or camera is too far!");
return false;
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText(getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ));
WarpDrive.addChatMessage(par5EntityPlayer, getLocalizedName() + " Frequency '" + frequency + "' is valid. Viewing camera at " + cam.position.chunkPosX + ", " + cam.position.chunkPosY + ", " + cam.position.chunkPosZ);
// Spawn camera entity
EntityCamera e = new EntityCamera(par1World, cam.position, par5EntityPlayer);
par1World.spawnEntityInWorld(e);

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -85,7 +84,7 @@ public class BlockParticleBooster extends BlockContainer {
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof WarpEnergyTE) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((WarpEnergyTE) te).getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, ((WarpEnergyTE) te).getStatus());
return true;
}
}

View file

@ -3,10 +3,10 @@ package cr0s.warpdrive.machines;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
public class BlockPowerStore extends WarpBlockContainer {
private IIcon iconBuffer;
@ -41,7 +41,7 @@ public class BlockPowerStore extends WarpBlockContainer {
WarpEnergyTE te = (WarpEnergyTE) par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -102,7 +101,7 @@ public class BlockProtocol extends BlockContainer {
TileEntityProtocol controller = (TileEntityProtocol)par1World.getTileEntity(par2, par3, par4);
if (controller != null) {
controller.attachPlayer(par5EntityPlayer);
par5EntityPlayer.addChatMessage(new ChatComponentText(controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList()));
WarpDrive.addChatMessage(par5EntityPlayer, controller.getBlockType().getLocalizedName() + " Attached players: " + controller.getAttachedPlayersList());
return true;
}
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -91,7 +90,7 @@ public class BlockRadar extends BlockContainer
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true;
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -90,7 +89,7 @@ public class BlockReactor extends BlockContainer {
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityReactor) {
par5EntityPlayer.addChatMessage(new ChatComponentText(((TileEntityReactor)te).getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, ((TileEntityReactor)te).getStatus());
return true;
}
}

View file

@ -9,7 +9,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
@ -77,7 +76,7 @@ public class BlockShipScanner extends BlockContainer {
WarpEnergyTE te = (WarpEnergyTE)par1World.getTileEntity(par2, par3, par4);
if (te != null && (par5EntityPlayer.getHeldItem() == null)) {
par5EntityPlayer.addChatMessage(new ChatComponentText(te.getStatus()));
WarpDrive.addChatMessage(par5EntityPlayer, te.getStatus());
return true;
}

View file

@ -16,12 +16,19 @@ public class TileEntityAirGenerator extends WarpEnergyTE {
private final int AIR_GENERATION_TICKS = 40;
private final int START_CONCENTRATION_VALUE = 15;
public TileEntityAirGenerator() {
super();
peripheralName = "warpdriveAirGenerator";
// methodsArray = Arrays.asList("", "");;
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
if (this.isInvalid()) {
return;
@ -116,16 +123,4 @@ public class TileEntityAirGenerator extends WarpEnergyTE {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -23,7 +23,7 @@ public class TileEntityCamera extends WarpInterfacedTE {
public TileEntityCamera() {
super();
peripheralName = "camera";
peripheralName = "warpdriveCamera";
methodsArray = new String[] {
"freq"
};
@ -31,6 +31,8 @@ public class TileEntityCamera extends WarpInterfacedTE {
@Override
public void updateEntity() {
super.updateEntity();
// Update frequency on clients (recovery mechanism, no need to go too fast)
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
packetSendTicks--;
@ -93,7 +95,7 @@ public class TileEntityCamera extends WarpInterfacedTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] freq(Context context, Arguments arguments) {
public Object[] freq(Context context, Arguments arguments) {
if (arguments.count() == 1) {
setFrequency(arguments.checkInteger(0));
}

View file

@ -25,6 +25,8 @@ public class TileEntityChunkLoader extends WarpChunkTE implements IUpgradable
public TileEntityChunkLoader() {
super();
IC2_sinkTier = 2;
IC2_sourceTier = 2;
negDX = 0;
negDZ = 0;
posDX = 0;
@ -227,17 +229,4 @@ public class TileEntityChunkLoader extends WarpChunkTE implements IUpgradable
{
return upgrades;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 2;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 2;
}
}

View file

@ -1,5 +1,7 @@
package cr0s.warpdrive.machines;
import java.util.Arrays;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
@ -14,19 +16,33 @@ import cr0s.warpdrive.conf.WarpDriveConfig;
import cr0s.warpdrive.data.CloakedArea;
import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.network.PacketHandler;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
private final int MAX_ENERGY_VALUE = 500000000; // 500kk EU
public boolean isEnabled = false;
public byte tier = 1; // cloaking field tier, 1 or 2
// inner coils color map
final float[] innerCoilColor_r = { 1.00f, 1.00f, 1.00f, 1.00f, 0.75f, 0.25f, 0.00f, 0.00f, 0.00f, 0.00f, 0.50f, 1.00f };
final float[] innerCoilColor_g = { 0.00f, 0.25f, 0.75f, 1.00f, 1.00f, 1.00f, 1.00f, 1.00f, 0.50f, 0.25f, 0.00f, 0.00f };
final float[] innerCoilColor_b = { 0.25f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.50f, 1.00f, 1.00f, 1.00f, 1.00f, 0.75f };
// Spatial cloaking field parameters
public int front, back, up, down, left, right;
public int minX = 0, minY = 0, minZ = 0, maxX = 0, maxY = 0, maxZ = 0;
private final int innerCoilsDistance = 2; // Step length from core block to main coils
private final byte[] dx = { -1, 1, 0, 0, 0, 0 }; // validateAssembly() is coded ordering, do not change!
private final byte[] dy = { 0, 0, -1, 1, 0, 0 }; // validateAssembly() is coded ordering, do not change!
private final byte[] dz = { 0, 0, 0, 0, -1, 1 }; // validateAssembly() is coded ordering, do not change!
private int[] outerCoilsDistance = {0, 0, 0, 0, 0, 0};
public int minX = 0;
public int minY = 0;
public int minZ = 0;
public int maxX = 0;
public int maxY = 0;
public int maxZ = 0;
public boolean isValid = false;
public boolean isCloaking = false;
@ -39,22 +55,24 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
public TileEntityCloakingDeviceCore() {
super();
peripheralName = "cloakingdevicecore";
peripheralName = "warpdriveCloakingCore";
methodsArray = new String[] {
"tier", // set field tier to 1 or 2, return field tier
"isAssemblyValid", // returns true or false
"getEnergyLevel",
"enable" // set field enable state (true or false), return true if enabled
"tier", // set field tier to 1 or 2, return field tier
"isAssemblyValid", // returns true or false
"getEnergyLevel",
"enable" // set field enable state (true or false), return true if enabled
};
CC_scripts = Arrays.asList("cloak1", "cloak2", "uncloak");
}
@Override
public void updateEntity() {
super.updateEntity();
if (!FMLCommonHandler.instance().getEffectiveSide().isServer()) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
// Reset sound timer
soundTicks++;
if (soundTicks >= 40) {
@ -64,7 +82,7 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
updateTicks--;
if (updateTicks <= 0) {
//System.out.println("" + this + " Updating cloaking state...");
WarpDrive.logger.info("" + this + " Updating cloaking state...");
updateTicks = ((tier == 1) ? 20 : (tier == 2) ? 10 : 20) * WarpDriveConfig.CD_FIELD_REFRESH_INTERVAL_SECONDS; // resetting timer
isValid = validateAssembly();
@ -93,6 +111,8 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
CloakedArea area = WarpDrive.cloaks.getCloakedArea(worldObj, xCoord, yCoord, zCoord);
if (area != null) {
area.sendCloakPacketToPlayersEx(false); // recloak field
} else {
WarpDrive.debugPrint("getCloakedArea1 returned null for " + worldObj + " " + xCoord + "," + yCoord + "," + zCoord);
}
} else {// enabled, not cloaking but not able to
// IDLE
@ -109,6 +129,8 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
CloakedArea area = WarpDrive.cloaks.getCloakedArea(worldObj, xCoord, yCoord, zCoord);
if (area != null) {
area.sendCloakPacketToPlayersEx(false); // recloak field
} else {
WarpDrive.debugPrint("getCloakedArea2 returned null for " + worldObj + " " + xCoord + "," + yCoord + "," + zCoord);
}
setCoilsState(true);
} else {// loosing power
@ -129,104 +151,74 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
}
}
public void setCoilsState(boolean enabled) {
private void setCoilsState(final boolean enabled) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (enabled) ? 1 : 0, 2);
// Directions to check (all six directions: left, right, up, down, front, back)
byte[] dx = { 1, -1, 0, 0, 0, 0 };
byte[] dy = { 0, 0, -1, 1, 0, 0 };
byte[] dz = { 0, 0, 0, 0, -1, 1 };
for (int i = 0; i < 6; i++) {
searchCoilInDirectionAndSetState(dx[i], dy[i], dz[i], enabled);
for (int direction = 0; direction < 6; direction++) {
setCoilState(innerCoilsDistance, direction, enabled);
setCoilState(outerCoilsDistance[direction], direction, enabled);
}
}
public void searchCoilInDirectionAndSetState(byte dx, byte dy, byte dz, boolean enabled) {
int coilCount = 0;
for (int i = 0; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
if (worldObj.getBlock(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
coilCount++;
if (coilCount > 2) {
return;
}
worldObj.setBlockMetadataWithNotify(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz, (enabled) ? 1 : 0, 2);
}
private void setCoilState(final int distance, final int direction, final boolean enabled) {
int x = xCoord + distance * dx[direction];
int y = yCoord + distance * dy[direction];
int z = zCoord + distance * dz[direction];
if (worldObj.getBlock(x, y, z).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
worldObj.setBlockMetadataWithNotify(x, y, z, (enabled) ? 1 : 0, 2);
}
}
public void searchCoilInDirectionAndDrawLaser(byte dx, byte dy, byte dz) {
final int START_LENGTH = 2;
float r = 0.0f, g = 1.0f, b = 0;
if (tier == 1) {
r = 0.0f;
g = 1.0f;
}
private void drawLasers() {
float r = 0.0f;
float g = 1.0f;
float b = 0.0f;
if (!isCloaking) {// out of energy
r = 0.75f;
g = 0.50f;
b = 0.50f;
} else if (tier == 1) {
r = 0.25f;
g = 1.00f;
b = 0.00f;
} else if (tier == 2) {
r = 1.0f;
g = 0.0f;
}
for (int i = START_LENGTH + 1; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
if (worldObj.getBlock(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
PacketHandler.sendBeamPacketToPlayersInArea(worldObj,
new Vector3(this).translate(0.5),
new Vector3(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz).translate(0.5),
r, g, b, 110, 0,
AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ));
}
}
}
public void drawLasers() {
final int START_LENGTH = 2;
float r = 0.0f, g = 1.0f, b = 0;
if (this.tier == 1) {
r = 0.0f; g = 1.0f;
} else if (this.tier == 2) {
r = 1.0f; g = 0.0f;
r = 0.00f;
g = 0.25f;
b = 1.00f;
}
// Directions to check (all six directions: left, right, up, down, front, back)
byte[] dx = { 1, -1, 0, 0, 0, 0 };
byte[] dy = { 0, 0, -1, 1, 0, 0 };
byte[] dz = { 0, 0, 0, 0, -1, 1 };
for (int k = 0; k < 6; k++) {
searchCoilInDirectionAndDrawLaser(dx[k], dy[k], dz[k]);
for (int direction = 0; direction < 6; direction++) {
PacketHandler.sendBeamPacketToPlayersInArea(worldObj,
new Vector3(
xCoord + innerCoilsDistance * dx[direction],
yCoord + innerCoilsDistance * dy[direction],
zCoord + innerCoilsDistance * dz[direction]).translate(0.5),
new Vector3(
xCoord + outerCoilsDistance[direction] * dx[direction],
yCoord + outerCoilsDistance[direction] * dy[direction],
zCoord + outerCoilsDistance[direction] * dz[direction]).translate(0.5),
r, g, b, 110, 0,
AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ));
}
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
switch (worldObj.rand.nextInt(6)) {
case 0:
r = 1.0f;
g = b = 0;
break;
case 1:
r = b = 0;
g = 1.0f;
break;
case 2:
r = g = 0;
b = 1.0f;
break;
case 3:
r = b = 0.5f;
g = 0;
break;
case 4:
r = g = 1.0f;
b = 0;
break;
case 5:
r = 1.0f;
b = 0.5f;
g = 0f;
// draw connecting coils
for (int i = 0; i < 5; i++) {
for (int j = i + 1; j < 6; j++) {
// skip mirrored coils (removing the inner lines)
if (dx[i] == -dx[j] && dy[i] == -dy[j] && dz[i] == -dz[j]) {
continue;
}
// draw a random colored beam
int mapIndex = worldObj.rand.nextInt(innerCoilColor_b.length);
r = innerCoilColor_r[mapIndex];
g = innerCoilColor_g[mapIndex];
b = innerCoilColor_b[mapIndex];
PacketHandler.sendBeamPacketToPlayersInArea(worldObj,
new Vector3(xCoord + START_LENGTH * dx[i], yCoord + START_LENGTH * dy[i], zCoord + START_LENGTH * dz[i]).translate(0.5),
new Vector3(xCoord + START_LENGTH * dx[j], yCoord + START_LENGTH * dy[j], zCoord + START_LENGTH * dz[j]).translate(0.5),
new Vector3(xCoord + innerCoilsDistance * dx[i], yCoord + innerCoilsDistance * dy[i], zCoord + innerCoilsDistance * dz[i]).translate(0.5),
new Vector3(xCoord + innerCoilsDistance * dx[j], yCoord + innerCoilsDistance * dy[j], zCoord + innerCoilsDistance * dz[j]).translate(0.5),
r, g, b, 110, 0,
AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ));
}
@ -282,84 +274,74 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
this.tier = tag.getByte("tier");
this.isEnabled = tag.getBoolean("enabled");
}
@Override
public void writeToNBT(NBTTagCompound tag) {
super.writeToNBT(tag);
tag.setByte("tier", tier);
tag.setBoolean("enabled", isEnabled);
}
public int searchCoilInDirection(byte dx, byte dy, byte dz) {
for (int i = 3; i < WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE; i++) {
if (worldObj.getBlock(xCoord + i * dx, yCoord + i * dy, zCoord + i * dz).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
return i;
}
}
return 0;
}
public boolean validateAssembly() {
final int START_LENGTH = 2; // Step length from core block to main coils
final int maxOuterCoilDistance = WarpDriveConfig.CD_MAX_CLOAKING_FIELD_SIDE - WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
// Directions to check (all six directions: left, right, up, down, front, back)
byte[] dx = { 1, -1, 0, 0, 0, 0 };
byte[] dy = { 0, 0, -1, 1, 0, 0 };
byte[] dz = { 0, 0, 0, 0, -1, 1 };
for (int i = 0; i < 6; i++) {
if (worldObj.getBlock(xCoord + START_LENGTH * dx[i], yCoord + START_LENGTH * dy[i], zCoord + START_LENGTH * dz[i]).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
for (int direction = 0; direction < 6; direction++) {
// check validity of inner coil
int x = xCoord + innerCoilsDistance * dx[direction];
int y = yCoord + innerCoilsDistance * dy[direction];
int z = zCoord + innerCoilsDistance * dz[direction];
if (!worldObj.getBlock(x, y, z).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
return false;
}
// find closest outer coil
int newCoilDistance = 0;
for (int distance = 3; distance < maxOuterCoilDistance; distance++) {
x += dx[direction];
y += dy[direction];
z += dz[direction];
if (worldObj.getBlock(x, y, z).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
newCoilDistance = distance;
break;
}
}
// disable previous outer coil, in case a different one was found
if ( newCoilDistance != outerCoilsDistance[direction]
&& outerCoilsDistance[direction] > 0) {
int oldX = xCoord + outerCoilsDistance[direction] * dx[direction];
int oldY = yCoord + outerCoilsDistance[direction] * dy[direction];
int oldZ = zCoord + outerCoilsDistance[direction] * dz[direction];
if (worldObj.getBlock(oldX, oldY, oldZ).isAssociatedBlock(WarpDrive.cloakCoilBlock)) {
worldObj.setBlockMetadataWithNotify(oldX, oldY, oldZ, 0, 2);
}
}
// check validity and save new coil position
if (newCoilDistance <= 0) {
outerCoilsDistance[direction] = 0;
WarpDrive.debugPrint("Invalid outercoil assembly at " + direction);
return false;
}
outerCoilsDistance[direction] = newCoilDistance;
}
// Check cloaking field parameters defining coils
this.left = searchCoilInDirection((byte)1, (byte)0, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.left == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
this.right = searchCoilInDirection((byte)-1, (byte)0, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.right == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
this.up = searchCoilInDirection((byte)0, (byte)1, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.up == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
this.down = searchCoilInDirection((byte)0, (byte)-1, (byte)0) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.down == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
this.front = searchCoilInDirection((byte)0, (byte)0, (byte)1) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.front == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
this.back = searchCoilInDirection((byte)0, (byte)0, (byte)-1) + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
if (this.back == WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS) return false;
int x1 = 0, x2 = 0, z1 = 0, z2 = 0;
z1 = zCoord - this.back;
z2 = zCoord + this.front;
x1 = xCoord - this.right;
x2 = xCoord + this.left;
if (x1 < x2) {
this.minX = x1; this.maxX = x2;
} else {
this.minX = x2; this.maxX = x1;
}
if (z1 < z2) {
this.minZ = z1; this.maxZ = z2;
} else {
this.minZ = z2; this.maxZ = z1;
}
this.minY = yCoord - this.down;
this.maxY = yCoord + this.up;
minX = xCoord - outerCoilsDistance[0] - WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
maxX = xCoord + outerCoilsDistance[1] + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
minY = Math.max( 0, yCoord - outerCoilsDistance[2] - WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS);
maxY = Math.min(255, yCoord + outerCoilsDistance[3] + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS);
minZ = zCoord - outerCoilsDistance[4] - WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
maxZ = zCoord + outerCoilsDistance[5] + WarpDriveConfig.CD_COIL_CAPTURE_BLOCKS;
return true;
}
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] tier(Context context, Arguments arguments) {
public Object[] tier(Context context, Arguments arguments) {
if (arguments.count() == 1) {
if (arguments.checkInteger(0) == 2) {
tier = 2;
@ -372,13 +354,13 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] isAssemblyValid(Context context, Arguments arguments) {
public Object[] isAssemblyValid(Context context, Arguments arguments) {
return new Object[] { (boolean)validateAssembly() };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] enable(Context context, Arguments arguments) {
public Object[] enable(Context context, Arguments arguments) {
if (arguments.count() == 1) {
isEnabled = arguments.checkBoolean(0);
}
@ -386,21 +368,6 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
}
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/cloakingdevicecore", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/cloakingdevicecore"));
computer.mount("/warpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/common/updater"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
computer.mount("/uncloak", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/cloakingdevicecore/uncloak"));
computer.mount("/cloak1", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/cloakingdevicecore/cloak1"));
computer.mount("/cloak2", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/cloakingdevicecore/cloak2"));
}
}
}
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
@ -440,16 +407,4 @@ public class TileEntityCloakingDeviceCore extends WarpEnergyTE {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -56,18 +56,21 @@ public class TileEntityLaser extends WarpInterfacedTE {
public TileEntityLaser() {
super();
peripheralName = "laser";
methodsArray = new String[] { "emitBeam", // 0
"pos", // 1
"freq", // 2
"getFirstHit", // 3
"getBoosterDXDZ", // 4
"camFreq" // 5
peripheralName = "warpdriveLaser";
methodsArray = new String[] {
"emitBeam", // 0
"pos", // 1
"freq", // 2
"getFirstHit", // 3
"getBoosterDXDZ", // 4
"camFreq" // 5
};
}
@Override
public void updateEntity() {
super.updateEntity();
if (isWithCamera()) {
// Update frequency on clients (recovery mechanism, no need to go
// too fast)
@ -495,19 +498,19 @@ public class TileEntityLaser extends WarpInterfacedTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] emitBeam(Context context, Arguments arguments) {
public Object[] emitBeam(Context context, Arguments arguments) {
return emitBeam(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] pos(Context context, Arguments arguments) {
public Object[] pos(Context context, Arguments arguments) {
return new Integer[] { xCoord, yCoord, zCoord };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] freq(Context context, Arguments arguments) {
public Object[] freq(Context context, Arguments arguments) {
if (arguments.count() == 1) {
setBeamFrequency(arguments.checkInteger(0));
}
@ -516,20 +519,20 @@ public class TileEntityLaser extends WarpInterfacedTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getFirstHit(Context context, Arguments arguments) {
public Object[] getFirstHit(Context context, Arguments arguments) {
return getFirstHit();
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getBoosterDXDZ(Context context, Arguments arguments) {
public Object[] getBoosterDXDZ(Context context, Arguments arguments) {
findFirstBooster();
return new Integer[] { dx, dz };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] CamFreq(Context context, Arguments arguments) {
public Object[] CamFreq(Context context, Arguments arguments) {
if (isWithCamera()) {
if (arguments.count() == 1) {
setCameraFrequency(arguments.checkInteger(0));

View file

@ -21,6 +21,12 @@ public class TileEntityLaserReactorMonitor extends TileEntityAbstractLaser {
private final int workRate = 10;
private int ticks = 0;
public TileEntityLaserReactorMonitor() {
super();
IC2_sinkTier = 2;
IC2_sourceTier = 2;
}
private Set<Object> findReactors() {//returns either IReactor or IReactorChamber tile entity
int[] xD = {-2, 2, 0, 0, 0, 0};
int[] yD = { 0, 0,-2, 2, 0, 0};
@ -79,10 +85,11 @@ public class TileEntityLaserReactorMonitor extends TileEntityAbstractLaser {
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
ticks++;
if (ticks > workRate) {
@ -133,16 +140,4 @@ public class TileEntityLaserReactorMonitor extends TileEntityAbstractLaser {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 2;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 2;
}
}

View file

@ -35,7 +35,9 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
public TileEntityLaserTreeFarm() {
super();
peripheralName = "treefarmLaser";
IC2_sinkTier = 2;
IC2_sourceTier = 2;
peripheralName = "warpdriveLaserTreefarm";
methodsArray = new String[] {
"start",
"stop",
@ -98,7 +100,7 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
int cost = calculateBlockCost(block);
if (consumeEnergyFromBooster(cost, true)) {
if (isRoomForHarvest()) {
if (block.isAssociatedBlock(Block.getBlockFromItem(WarpDriveConfig.IC2_RubberWood.getItem()))) {
if (block.isAssociatedBlock(Block.getBlockFromItem(WarpDriveConfig.IC2_rubberWood.getItem()))) {
int metadata = worldObj.getBlockMetadata(pos.intX(), pos.intY(), pos.intZ());
if (metadata >= 2 && metadata <= 5) {
WarpDrive.debugPrint("wetspot found");
@ -341,16 +343,4 @@ public class TileEntityLaserTreeFarm extends TileEntityAbstractMiner {
protected float getColorB() {
return 0.4f;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 2;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 2;
}
}

View file

@ -36,17 +36,23 @@ public class TileEntityLift extends WarpEnergyTE {
public TileEntityLift() {
super();
peripheralName = "warpdriveLaserLift";
methodsArray = new String[] { "getEnergyLevel", "mode", "active",
IC2_sinkTier = 2;
IC2_sourceTier = 2;
peripheralName = "warpdriveLift";
methodsArray = new String[] {
"getEnergyLevel",
"mode",
"active",
"help" };
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
tickCount++;
if (tickCount >= WarpDriveConfig.LL_TICK_RATE) {
@ -201,13 +207,13 @@ public class TileEntityLift extends WarpEnergyTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] mode(Context context, Arguments arguments) {
public Object[] mode(Context context, Arguments arguments) {
return mode(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] active(Context context, Arguments arguments) {
public Object[] active(Context context, Arguments arguments) {
if (arguments.count() == 1) {
computerEnabled = arguments.checkBoolean(0);
}
@ -272,16 +278,4 @@ public class TileEntityLift extends WarpEnergyTE {
}
return null;
}
@Override
public int getSinkTier() {
// TODO Arbitrarily chosen value
return 2;
}
@Override
public int getSourceTier() {
// TODO Arbitrarily chosen value
return 2;
}
}

View file

@ -1,6 +1,7 @@
package cr0s.warpdrive.machines;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import li.cil.oc.api.machine.Arguments;
@ -21,7 +22,6 @@ import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.conf.WarpDriveConfig;
import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.network.PacketHandler;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
@ -54,15 +54,19 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
public TileEntityMiningLaser() {
super();
peripheralName = "mininglaser";
peripheralName = "warpdriveMiningLaser";
methodsArray = new String[] { "mine", "stop", "isMining", "quarry", "state", "offset" };
CC_scripts = Arrays.asList("mine", "stop");
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
if (currentState == STATE_IDLE) {
delayTicksWarmup = 0;
delayTicksScan = 0;
@ -128,14 +132,14 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
int offset = (yCoord - currentLayer) % (2 * r);
int age = Math.max(20, Math.round(2.5F * WarpDriveConfig.ML_SCAN_DELAY_TICKS));
double y = currentLayer + 1.0D;
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord - r + offset, y, zCoord + r).translate(0.3D), 0.0F, 0.0F, 1.0F, age,
0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord + r, y, zCoord + r - offset).translate(0.3D), 0.0F, 0.0F, 1.0F, age,
0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord + r - offset, y, zCoord - r).translate(0.3D), 0.0F, 0.0F, 1.0F, age,
0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord - r, y, zCoord - r + offset).translate(0.3D), 0.0F, 0.0F, 1.0F, age,
0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord - r + offset, y, zCoord + r).translate(0.3D),
0.0F, 0.0F, 1.0F, age, 0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord + r, y, zCoord + r - offset).translate(0.3D),
0.0F, 0.0F, 1.0F, age, 0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord + r - offset, y, zCoord - r).translate(0.3D),
0.0F, 0.0F, 1.0F, age, 0, 50);
PacketHandler.sendBeamPacket(worldObj, minerVector, new Vector3(xCoord - r, y, zCoord - r + offset).translate(0.3D),
0.0F, 0.0F, 1.0F, age, 0, 50);
worldObj.playSoundEffect(xCoord + 0.5f, yCoord, zCoord + 0.5f, "warpdrive:hilaser", 4F, 1F);
delayTicksMine = 0;
currentState = STATE_MINING;
@ -242,12 +246,8 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
if (stacks != null) {
boolean overflow = false;
int qtyLeft = 0;
ItemStack stackLeft = null;
for (ItemStack stack : stacks) {
if (qtyLeft > 0) {
stackLeft = copyWithSize(stack, qtyLeft);
qtyLeft = putInChest(findChest(), stackLeft);
}
qtyLeft = putInChest(findChest(), stack);
if (qtyLeft > 0) {
WarpDrive.debugPrint("" + this + " Overflow detected");
overflow = true;
@ -563,38 +563,38 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] mine(Context context, Arguments arguments) {
public Object[] mine(Context context, Arguments arguments) {
return mine(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] stop(Context context, Arguments arguments) {
public Object[] stop(Context context, Arguments arguments) {
stop();
return null;
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] isMining(Context context, Arguments arguments) {
public Object[] isMining(Context context, Arguments arguments) {
return new Boolean[] { isMining() };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] quarry(Context context, Arguments arguments) {
public Object[] quarry(Context context, Arguments arguments) {
return quarry(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] state(Context context, Arguments arguments) {
public Object[] state(Context context, Arguments arguments) {
return state(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] offset(Context context, Arguments arguments) {
public Object[] offset(Context context, Arguments arguments) {
return offset(argumentsOCtoCC(arguments));
}
@ -649,19 +649,6 @@ public class TileEntityMiningLaser extends WarpInterfacedTE {
}
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/mininglaser", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/mininglaser"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
computer.mount("/mine", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/mininglaser/mine"));
computer.mount("/stop", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/mininglaser/stop"));
}
}
}
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {

View file

@ -19,7 +19,7 @@ public class TileEntityMonitor extends WarpInterfacedTE {
public TileEntityMonitor() {
super();
peripheralName = "monitor";
peripheralName = "warpdriveMonitor";
methodsArray = new String[] {
"freq"
};
@ -27,6 +27,8 @@ public class TileEntityMonitor extends WarpInterfacedTE {
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
packetSendTicks--;
if (packetSendTicks <= 0) {
@ -65,7 +67,7 @@ public class TileEntityMonitor extends WarpInterfacedTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] freq(Context context, Arguments arguments) {
public Object[] freq(Context context, Arguments arguments) {
if (arguments.count() == 1) {
setFrequency(arguments.checkInteger(0));
}

View file

@ -8,12 +8,20 @@ import cr0s.warpdrive.conf.WarpDriveConfig;
public class TileEntityParticleBooster extends WarpEnergyTE {
private int ticks = 0;
public TileEntityParticleBooster() {
peripheralName = "warpdriveParticleBooster";
methodsArray = new String[] {
"getEnergyLevel"
};
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
ticks++;
if (ticks > 20) {
@ -46,16 +54,4 @@ public class TileEntityParticleBooster extends WarpEnergyTE {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -1,5 +1,6 @@
package cr0s.warpdrive.machines;
import cpw.mods.fml.common.Optional;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@ -9,9 +10,8 @@ import cr0s.warpdrive.data.Vector3;
import cr0s.warpdrive.network.PacketHandler;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPeripheral, IBlockUpdateDetector {
public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IBlockUpdateDetector {
Vector3 myVec;
Vector3 reactorVec;
ForgeDirection side = ForgeDirection.UNKNOWN;
@ -21,7 +21,10 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
boolean useLaser = false;
boolean doOnce = false;
String[] methodArray = { "energy", "hasReactor", "side", "sendLaser", "help" };
public TileEntityPowerLaser() {
methodsArray = new String[] { "energy", "hasReactor", "side", "sendLaser", "help" };
peripheralName = "warpdrivePowerLaser";
}
public TileEntityPowerReactor scanForReactor() {
reactor = null;
@ -91,6 +94,8 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
@Override
public void updateEntity() {
super.updateEntity();
if (doOnce == false) {
scanForReactor();
scanForBooster();
@ -144,16 +149,6 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
super.readFromNBT(nbt);
}
@Override
public String getType() {
return "warpdriveReactorLaser";
}
@Override
public String[] getMethodNames() {
return methodArray;
}
private static String helpStr(Object[] args) {
if (args.length > 0) {
String arg = args[0].toString().toLowerCase();
@ -170,9 +165,11 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
return WarpDrive.defHelpStr;
}
// ComputerCraft methods
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
String methodName = methodArray[method];
String methodName = methodsArray[method];
if (methodName.equals("energy")) {
scanForBooster();
if (booster == null) {
@ -193,29 +190,4 @@ public class TileEntityPowerLaser extends TileEntityAbstractLaser implements IPe
}
return null;
}
@Override
public void attach(IComputerAccess computer) {
}
@Override
public void detach(IComputerAccess computer) {
}
@Override
public boolean equals(IPeripheral other) {
return other == this;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -1,5 +1,7 @@
package cr0s.warpdrive.machines;
import java.util.Arrays;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -8,7 +10,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.api.IBlockUpdateDetector;
import cr0s.warpdrive.conf.WarpDriveConfig;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
@ -56,14 +57,17 @@ public class TileEntityPowerReactor extends WarpEnergyTE implements IBlockUpdate
public TileEntityPowerReactor() {
super();
peripheralName = "warpdriveReactor";
methodsArray = new String[] { "active", "energy", // returns energy, max energy, energy rate
"instability", // returns ins0,1,2,3
"release", // releases all energy
"releaseRate", // releases energy when more than arg0 is produced
"releaseAbove", // releases any energy above arg0 amount
"help" // returns help on arg0 function
peripheralName = "warpdrivePowerReactor";
methodsArray = new String[] {
"active",
"energy", // returns energy, max energy, energy rate
"instability", // returns ins0,1,2,3
"release", // releases all energy
"releaseRate", // releases energy when more than arg0 is produced
"releaseAbove", // releases any energy above arg0 amount
"help" // returns help on arg0 function
};
CC_scripts = Arrays.asList("startup");
}
private void increaseInstability(ForgeDirection from, boolean isNatural) {
@ -160,10 +164,11 @@ public class TileEntityPowerReactor extends WarpEnergyTE implements IBlockUpdate
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
if (WarpDriveConfig.G_DEBUGMODE) {
WarpDrive.debugPrint("tickCount " + tickCount + " releasedThisTick " + releasedThisTick + " lasersReceived " + lasersReceived
@ -384,20 +389,6 @@ public class TileEntityPowerReactor extends WarpEnergyTE implements IBlockUpdate
}
// ComputerCraft IPeripheral methods implementation
@Override
public void attach(IComputerAccess computer) {
super.attach(computer);
int id = computer.getID();
connectedComputers.put(id, computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/power", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/power"));
computer.mount("/warpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/common/updater"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
computer.mount("/startup", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/power/startup"));
}
}
}
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {
// computer is alive => start updating reactor
@ -535,16 +526,4 @@ public class TileEntityPowerReactor extends WarpEnergyTE implements IBlockUpdate
worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
Double.valueOf(xCoord), Double.valueOf(yCoord), Double.valueOf(zCoord) });
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -9,6 +9,8 @@ public class TileEntityPowerStore extends WarpEnergyTE {
public TileEntityPowerStore() {
super();
IC2_sinkTier = 0;
IC2_sourceTier = 0;
peripheralName = "warpdrivePowerStore";
methodsArray = new String[] {
"getEnergyLevel"
@ -49,26 +51,4 @@ public class TileEntityPowerStore extends WarpEnergyTE {
}
return null;
}
@Override
public void attach(IComputerAccess computer) {
// nothing to see here
}
@Override
public void detach(IComputerAccess computer) {
// nothing to see here
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 0;
}
}

View file

@ -1,6 +1,7 @@
package cr0s.warpdrive.machines;
import java.util.ArrayList;
import java.util.Arrays;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
@ -8,14 +9,12 @@ import li.cil.oc.api.machine.Context;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.conf.WarpDriveConfig;
import cr0s.warpdrive.machines.TileEntityReactor.ReactorMode;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
@ -54,7 +53,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
public TileEntityProtocol() {
super();
peripheralName = "warpcore";
peripheralName = "warpdriveShipController";
methodsArray = new String[] {
"dim_positive",
"dim_negative",
@ -77,10 +76,13 @@ public class TileEntityProtocol extends WarpInterfacedTE {
"isAttached",
"getEnergyRequired"
};
CC_scripts = Arrays.asList("startup");
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
@ -171,7 +173,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
String name = players.get(i);
if (entityPlayer.getDisplayName().equals(name)) {
entityPlayer.addChatMessage(new ChatComponentText(getBlockType().getLocalizedName() + " Detached."));
WarpDrive.addChatMessage(entityPlayer, getBlockType().getLocalizedName() + " Detached.");
players.remove(i);
return;
}
@ -180,7 +182,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
entityPlayer.attackEntityFrom(DamageSource.generic, 1);
players.add(entityPlayer.getDisplayName());
updatePlayersString();
entityPlayer.addChatMessage(new ChatComponentText(getBlockType().getLocalizedName() + " Successfully attached."));
WarpDrive.addChatMessage(entityPlayer, getBlockType().getLocalizedName() + " Successfully attached.");
}
public void updatePlayersString() {
@ -420,56 +422,56 @@ public class TileEntityProtocol extends WarpInterfacedTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] dim_positive(Context context, Arguments arguments) {
public Object[] dim_positive(Context context, Arguments arguments) {
return dim_positive(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] dim_negative(Context context, Arguments arguments) {
public Object[] dim_negative(Context context, Arguments arguments) {
return dim_negative(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] mode(Context context, Arguments arguments) {
public Object[] mode(Context context, Arguments arguments) {
return mode(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] distance(Context context, Arguments arguments) {
public Object[] distance(Context context, Arguments arguments) {
return distance(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] direction(Context context, Arguments arguments) {
public Object[] direction(Context context, Arguments arguments) {
return direction(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getAttachedPlayers(Context context, Arguments arguments) {
public Object[] getAttachedPlayers(Context context, Arguments arguments) {
return getAttachedPlayers(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] summon(Context context, Arguments arguments) {
public Object[] summon(Context context, Arguments arguments) {
return summon(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] summon_all(Context context, Arguments arguments) {
public Object[] summon_all(Context context, Arguments arguments) {
setSummonAllFlag(true);
return null;
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] pos(Context context, Arguments arguments) {
public Object[] pos(Context context, Arguments arguments) {
if (core == null) {
return null;
}
@ -479,7 +481,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getEnergyLevel(Context context, Arguments arguments) {
public Object[] getEnergyLevel(Context context, Arguments arguments) {
if (core == null) {
return null;
}
@ -489,7 +491,7 @@ public class TileEntityProtocol extends WarpInterfacedTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getEnergyRequired(Context context, Arguments arguments) {
public Object[] getEnergyRequired(Context context, Arguments arguments) {
if (core == null) {
return null;
}
@ -499,26 +501,26 @@ public class TileEntityProtocol extends WarpInterfacedTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] jump(Context context, Arguments arguments) {
public Object[] jump(Context context, Arguments arguments) {
doJump();
return null;
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getShipSize(Context context, Arguments arguments) {
public Object[] getShipSize(Context context, Arguments arguments) {
return getShipSize(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] beaconFrequency(Context context, Arguments arguments) {
public Object[] beaconFrequency(Context context, Arguments arguments) {
return beaconFrequency(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getOrientation(Context context, Arguments arguments) {
public Object[] getOrientation(Context context, Arguments arguments) {
if (core != null) {
return new Object[] { core.dx, 0, core.dz };
}
@ -527,31 +529,31 @@ public class TileEntityProtocol extends WarpInterfacedTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] coreFrequency(Context context, Arguments arguments) {
public Object[] coreFrequency(Context context, Arguments arguments) {
return coreFrequency(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] isInSpace(Context context, Arguments arguments) {
public Object[] isInSpace(Context context, Arguments arguments) {
return new Boolean[] { worldObj.provider.dimensionId == WarpDriveConfig.G_SPACE_DIMENSION_ID };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] isInHyperspace(Context context, Arguments arguments) {
public Object[] isInHyperspace(Context context, Arguments arguments) {
return new Boolean[] { worldObj.provider.dimensionId == WarpDriveConfig.G_HYPERSPACE_DIMENSION_ID };
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] targetJumpgate(Context context, Arguments arguments) {
public Object[] targetJumpgate(Context context, Arguments arguments) {
return targetJumpgate(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] isAttached(Context context, Arguments arguments) {
public Object[] isAttached(Context context, Arguments arguments) {
if (core != null) {
return new Object[] { (boolean) (core.controller != null) };
}
@ -726,19 +728,6 @@ public class TileEntityProtocol extends WarpInterfacedTE {
}
// ComputerCraft IPeripheral methods implementation
@Override
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/warpcontroller", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/warpcontroller"));
computer.mount("/warpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/common/updater"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
computer.mount("/startup", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/warpcontroller/startup"));
}
}
}
@Override
@Optional.Method(modid = "ComputerCraft")
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) {

View file

@ -1,6 +1,7 @@
package cr0s.warpdrive.machines;
import java.util.ArrayList;
import java.util.Arrays;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
@ -11,7 +12,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.conf.WarpDriveConfig;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
@ -23,7 +23,7 @@ public class TileEntityRadar extends WarpEnergyTE {
public TileEntityRadar() {
super();
peripheralName = "radar";
peripheralName = "warpdriveRadar";
methodsArray = new String[] {
"scanRadius",
"getResultsCount",
@ -31,15 +31,17 @@ public class TileEntityRadar extends WarpEnergyTE {
"getEnergyLevel",
"pos"
};
CC_scripts = Arrays.asList("scan", "ping");
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
try {
if (getBlockMetadata() == 2) {
cooldownTime++;
@ -68,13 +70,13 @@ public class TileEntityRadar extends WarpEnergyTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] scanRadius(Context context, Arguments arguments) {
public Object[] scanRadius(Context context, Arguments arguments) {
return scanRadius(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getResultsCount(Context context, Arguments arguments) {
public Object[] getResultsCount(Context context, Arguments arguments) {
if (results != null) {
return new Integer[] { results.size() };
}
@ -83,13 +85,13 @@ public class TileEntityRadar extends WarpEnergyTE {
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getResult(Context context, Arguments arguments) {
public Object[] getResult(Context context, Arguments arguments) {
return getResult(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] pos(Context context, Arguments arguments) {
public Object[] pos(Context context, Arguments arguments) {
return new Integer[] { xCoord, yCoord, zCoord };
}
@ -148,14 +150,6 @@ public class TileEntityRadar extends WarpEnergyTE {
@Optional.Method(modid = "ComputerCraft")
public void attach(IComputerAccess computer) {
super.attach(computer);
if (WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/radar", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/radar"));
computer.mount("/warpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/common/updater"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
computer.mount("/scan", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/radar/scan"));
computer.mount("/ping", ComputerCraftAPI.createResourceMount(WarpDrive.class, "warpdrive", "lua/radar/ping"));
}
}
if (getBlockMetadata() == 0) {
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 + 2);
}
@ -203,16 +197,4 @@ public class TileEntityRadar extends WarpEnergyTE {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
// TODO Arbitrarily chosen value
return 3;
}
@Override
public int getSourceTier() {
// TODO Arbitrarily chosen value
return 3;
}
}

View file

@ -15,7 +15,6 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldServer;
@ -87,12 +86,19 @@ public class TileEntityReactor extends WarpEnergyTE {
private boolean soundPlayed = false;
public TileEntityReactor() {
super();
peripheralName = "warpdriveShipCore";
// methodsArray = Arrays.asList("", "");;
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
super.updateEntity();
// Always cooldown
if (cooldownTime > 0) {
@ -312,12 +318,12 @@ public class TileEntityReactor extends WarpEnergyTE {
List list = worldObj.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb);
WarpDrive.logger.info(this + " messageToAllPlayersOnShip: " + msg);
for (Object o : list) {
if (o == null || !(o instanceof EntityPlayer)) {
for (Object object : list) {
if (object == null || !(object instanceof EntityPlayer)) {
continue;
}
((EntityPlayer) o).addChatMessage(new ChatComponentText("[" + (coreFrequency.length() > 0 ? coreFrequency : "WarpCore") + "] " + msg));
WarpDrive.addChatMessage((EntityPlayer) object, "[" + (coreFrequency.length() > 0 ? coreFrequency : "WarpCore") + "] " + msg);
}
}
@ -1090,16 +1096,4 @@ public class TileEntityReactor extends WarpEnergyTE {
new Object[] { getClass().getSimpleName(), coreFrequency, worldObj == null ? "~NULL~" : worldObj.getWorldInfo().getWorldName(),
Integer.valueOf(xCoord), Integer.valueOf(yCoord), Integer.valueOf(zCoord) });
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 3;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 3;
}
}

View file

@ -1,7 +1,5 @@
package cr0s.warpdrive.machines;
import ic2.api.energy.tile.IEnergyTile;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@ -52,17 +50,17 @@ public class TileEntityShipScanner extends WarpEnergyTE {
public TileEntityShipScanner() {
super();
peripheralName = "shipscanner";
peripheralName = "warpdriveShipScanner";
methodsArray = new String[] { "scan", "fileName", "getEnergyLevel", "deploy", "state" };
}
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient())
return;
super.updateEntity();
if (++warpCoreSearchTicks > 20) {
core = searchWarpCore();
warpCoreSearchTicks = 0;
@ -246,7 +244,6 @@ public class TileEntityShipScanner extends WarpEnergyTE {
NBTTagList localBlocks = new NBTTagList();
byte localMetadata[] = new byte[size];
boolean extra = false;
NBTTagList tileEntitiesList = new NBTTagList();
@ -285,15 +282,13 @@ public class TileEntityShipScanner extends WarpEnergyTE {
}
// Remove energy from energy storages
if (te instanceof IEnergyTile) {
// IC2
if (tileTag.hasKey("energy")) {
tileTag.setInteger("energy", 0);
}
// Gregtech
if (tileTag.hasKey("mStoredEnergy")) {
tileTag.setInteger("mStoredEnergy", 0);
}
// IC2
if (tileTag.hasKey("energy")) {
tileTag.setInteger("energy", 0);
}
// Gregtech
if (tileTag.hasKey("mStoredEnergy")) {
tileTag.setInteger("mStoredEnergy", 0);
}
// Transform TE's coordinates from local axis to
@ -450,7 +445,7 @@ public class TileEntityShipScanner extends WarpEnergyTE {
// Load Tile Entities
NBTTagCompound[] tileEntities = new NBTTagCompound[blocksToDeployCount];
NBTTagList tileEntitiesList = schematic.getTagList("TileEntities", new NBTTagByteArray(new byte[0]).getId()); //TODO: 0 is not corect
NBTTagList tileEntitiesList = schematic.getTagList("TileEntities", new NBTTagByteArray(new byte[0]).getId()); //TODO: 0 is not correct
for (int i = 0; i < tileEntitiesList.tagCount(); i++) {
NBTTagCompound teTag = tileEntitiesList.getCompoundTagAt(i);
@ -510,19 +505,19 @@ public class TileEntityShipScanner extends WarpEnergyTE {
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] scan(Context context, Arguments arguments) {
public Object[] scan(Context context, Arguments arguments) {
return scan(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] filename(Context context, Arguments arguments) {
public Object[] filename(Context context, Arguments arguments) {
return filename(argumentsOCtoCC(arguments));
}
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] deploy(Context context, Arguments arguments) {
public Object[] deploy(Context context, Arguments arguments) {
return deploy(argumentsOCtoCC(arguments));
}
@ -620,14 +615,4 @@ public class TileEntityShipScanner extends WarpEnergyTE {
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public int getSinkTier() {
return 3;
}
@Override
public int getSourceTier() {
return 3;
}
}

View file

@ -40,7 +40,9 @@ public class TileEntityTransporter extends WarpEnergyTE implements IUpgradable {
public TileEntityTransporter() {
super();
peripheralName = "transporter";
IC2_sinkTier = 2;
IC2_sourceTier = 2;
peripheralName = "warpdriveTransporter";
methodsArray = new String[] { "source", "dest", "lock", "release", "lockStrength", "energize", "getEnergyLevel", "powerBoost", "energyCost",
"upgrades", "help" };
}
@ -454,16 +456,4 @@ public class TileEntityTransporter extends WarpEnergyTE implements IUpgradable {
public Map<EnumUpgradeTypes, Integer> getInstalledUpgrades() {
return upgrades;
}
@Override
public int getSinkTier() {
// TODO Auto-generated method stub
return 2;
}
@Override
public int getSourceTier() {
// TODO Auto-generated method stub
return 2;
}
}

View file

@ -24,6 +24,8 @@ public abstract class WarpChunkTE extends WarpEnergyTE
// OVERRIDES
@Override
public void updateEntity() {
super.updateEntity();
if (shouldChunkLoad() != areChunksLoaded) {
refreshLoading();
}

View file

@ -1,12 +1,12 @@
package cr0s.warpdrive.machines;
import java.util.HashMap;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergySource;
import java.util.HashMap;
import cofh.api.energy.IEnergyHandler;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
@ -14,9 +14,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.energy.IEnergyHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cr0s.warpdrive.conf.WarpDriveConfig;
import cr0s.warpdrive.api.IBlockUpdateDetector;
import cr0s.warpdrive.data.EnumUpgradeTypes;
@ -30,11 +30,22 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
protected int energyStored_internal = 0;
private static final double EU_PER_INTERNAL = 1.0D;
private static final double RF_PER_INTERNAL = 1800.0D / 437.5D;
protected int IC2_sinkTier = 3;
protected int IC2_sourceTier = 3;
private int scanTickCount = -1;
private IEnergyHandler[] TE_energyHandlers = new IEnergyHandler[ForgeDirection.VALID_DIRECTIONS.length];
private Object[] cofhEnergyHandlers;
protected HashMap<EnumUpgradeTypes,Integer> upgrades = new HashMap<EnumUpgradeTypes,Integer>();
public WarpEnergyTE() {
super();
if (WarpDriveConfig.isThermalExpansionLoaded) {
this.RF_initialiseAPI();
}
}
public Object[] getUpgrades()
{
Object[] retVal = new Object[EnumUpgradeTypes.values().length];
@ -163,37 +174,39 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
// OpenComputer callback methods
@Callback
@Optional.Method(modid = "OpenComputers")
private Object[] getEnergyLevel(Context context, Arguments arguments) {
public Object[] getEnergyLevel(Context context, Arguments arguments) {
return getEnergyLevel();
}
// Minecraft overrides
@Override
public void updateEntity() {
super.updateEntity();
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return;
}
// IndustrialCraft2
if (!addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnergyNet = true;
if (WarpDriveConfig.isIndustrialCraft2loaded) {
IC2_addToEnergyNet();
}
// Thermal Expansion
scanTickCount++;
if(scanTickCount >= 20) {
scanTickCount = 0;
scanForEnergyHandlers();
}
outputEnergy();
if (WarpDriveConfig.isThermalExpansionLoaded) {
scanTickCount++;
if(scanTickCount >= 20) {
scanTickCount = 0;
scanForEnergyHandlers();
}
outputEnergy();
}
}
@Override
public void onChunkUnload() {
if (addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnergyNet = false;
if (WarpDriveConfig.isIndustrialCraft2loaded) {
IC2_removeFromEnergyNet();
}
super.onChunkUnload();
@ -201,9 +214,8 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
@Override
public void invalidate() {
if (addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnergyNet = false;
if (WarpDriveConfig.isIndustrialCraft2loaded) {
IC2_removeFromEnergyNet();
}
super.invalidate();
@ -256,6 +268,35 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
return canOutputEnergy(to);
}
@Optional.Method(modid = "IC2")
private void IC2_addToEnergyNet() {
if (!addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnergyNet = true;
}
}
@Optional.Method(modid = "IC2")
private void IC2_removeFromEnergyNet() {
if (addedToEnergyNet) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnergyNet = false;
}
}
@Override
@Optional.Method(modid = "IC2")
public int getSinkTier() {
return IC2_sinkTier;
}
@Override
@Optional.Method(modid = "IC2")
public int getSourceTier() {
return IC2_sourceTier;
}
// ThermalExpansion IEnergyHandler interface
@Override
@ -337,12 +378,17 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
@Optional.Method(modid = "CoFHCore")
private void outputEnergy() {
for(ForgeDirection from: ForgeDirection.VALID_DIRECTIONS) {
if (TE_energyHandlers[from.ordinal()] != null) {
outputEnergy(from, TE_energyHandlers[from.ordinal()]);
if (cofhEnergyHandlers[from.ordinal()] != null) {
outputEnergy(from, (IEnergyHandler) cofhEnergyHandlers[from.ordinal()]);
}
}
}
@Optional.Method(modid = "CoFHCore")
private void RF_initialiseAPI() {
cofhEnergyHandlers = new IEnergyHandler[ForgeDirection.VALID_DIRECTIONS.length];
}
// Forge overrides
@Override
@ -383,11 +429,13 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
// WarpDrive overrides
@Override
public void updatedNeighbours() {
scanForEnergyHandlers();
if (WarpDriveConfig.isThermalExpansionLoaded) {
scanForEnergyHandlers();
}
}
@Optional.Method(modid = "CoFHCore")
public void scanForEnergyHandlers() {
private void scanForEnergyHandlers() {
for(ForgeDirection from : ForgeDirection.VALID_DIRECTIONS) {
boolean iehFound = false;
if (canConnectEnergy(from)) {
@ -396,12 +444,12 @@ public abstract class WarpEnergyTE extends WarpInterfacedTE implements IEnergyHa
IEnergyHandler ieh = (IEnergyHandler)te;
if (ieh.canConnectEnergy(from.getOpposite())) {
iehFound = true;
TE_energyHandlers[from.ordinal()] = ieh;
cofhEnergyHandlers[from.ordinal()] = ieh;
}
}
}
if (!iehFound) {
TE_energyHandlers[from.ordinal()] = null;
cofhEnergyHandlers[from.ordinal()] = null;
}
}
}

View file

@ -1,38 +1,48 @@
package cr0s.warpdrive.machines;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import li.cil.oc.api.FileSystem;
import li.cil.oc.api.Network;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.Environment;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.Visibility;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.conf.WarpDriveConfig;
import dan200.computercraft.api.ComputerCraftAPI;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
// OpenComputer API: https://github.com/MightyPirates/OpenComputers/tree/master-MC1.7.10/src/main/java/li/cil/oc/api
@Optional.InterfaceList({
@Optional.Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputers"),
@Optional.Interface(iface = "dan200.computercraft.api.peripheral.IPeripheral", modid = "ComputerCraft")
})
public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, Environment {
WarpInterfacedTE() {
super();
if (Loader.isModLoaded("OpenComputers")) {
OC_constructor();
}
}
// Common computer properties
private boolean interfacedFirstTick = true;
protected String peripheralName = null;
protected String[] methodsArray = {};
// pre-loaded scripts support
private volatile ManagedEnvironment OC_fileSystem = null;
private volatile boolean CC_hasResource = false;
private volatile boolean OC_hasResource = false;
protected volatile List<String> CC_scripts = null;
// OpenComputer specific properties
protected Node OC_node = null;
protected boolean OC_addedToNetwork = false;
@ -40,10 +50,34 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
// ComputerCraft specific properties
protected HashMap<Integer, IComputerAccess> connectedComputers = new HashMap<Integer, IComputerAccess>();
private boolean assetExist(final String resourcePath) {
URL url = getClass().getResource(resourcePath);
return (url != null);
}
// TileEntity overrides, notably for OpenComputer
@Override
public void updateEntity() {
super.updateEntity();
if (interfacedFirstTick) {
if (WarpDriveConfig.isComputerCraftLoaded) {
String CC_path = "/assets/" + WarpDrive.MODID.toLowerCase() + "/lua.ComputerCraft/" + peripheralName;
CC_hasResource = assetExist(CC_path);
}
if (Loader.isModLoaded("OpenComputers")) {
String OC_path = "/assets/" + WarpDrive.MODID.toLowerCase() + "/lua.OpenComputers/" + peripheralName;
OC_hasResource = assetExist(OC_path);
}
// deferred constructor so the derived class can finish it's initialization first
if (Loader.isModLoaded("OpenComputers")) {
OC_constructor();
}
interfacedFirstTick = false;
return;
}
if (Loader.isModLoaded("OpenComputers")) {
if (!OC_addedToNetwork) {
OC_addedToNetwork = true;
@ -51,7 +85,7 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
}
}
}
@Override
public void invalidate() {
if (Loader.isModLoaded("OpenComputers")) {
@ -138,6 +172,15 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
public void attach(IComputerAccess computer) {
int id = computer.getID();
connectedComputers.put(id, computer);
if (CC_hasResource && WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
computer.mount("/" + peripheralName, ComputerCraftAPI.createResourceMount(WarpDrive.class, WarpDrive.MODID.toLowerCase(), "lua.ComputerCraft/" + peripheralName));
computer.mount("/warpupdater", ComputerCraftAPI.createResourceMount(WarpDrive.class, WarpDrive.MODID.toLowerCase(), "lua.ComputerCraft/common/updater"));
if (WarpDriveConfig.G_LUA_SCRIPTS == WarpDriveConfig.LUA_SCRIPTS_ALL) {
for(String script : CC_scripts) {
computer.mount("/" + script, ComputerCraftAPI.createResourceMount(WarpDrive.class, WarpDrive.MODID.toLowerCase(), "lua.ComputerCraft/" + peripheralName + "/" + script));
}
}
}
}
@Override
@ -159,7 +202,7 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
// Computer abstraction methods
protected void sendEvent(String eventName, Object[] arguments) {
// WarpDrive.debugPrint("" + this + " Sending event '" + eventName + "'");
if (WarpDriveConfig.isCCLoaded) {
if (WarpDriveConfig.isComputerCraftLoaded) {
Set<Integer> keys = connectedComputers.keySet();
for(Integer key:keys) {
IComputerAccess comp = connectedComputers.get(key);
@ -169,9 +212,18 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
}
// OpenComputers methods
@Callback
@Optional.Method(modid = "OpenComputers")
public void OC_constructor() {
public Object[] interfaced(Context context, Arguments arguments) {
return new String[] { "This is a WarpDrive computer interfaced tile entity." };
}
@Optional.Method(modid = "OpenComputers")
private void OC_constructor() {
OC_node = Network.newNode(this, Visibility.Network).withComponent(peripheralName).create();
if (OC_hasResource && WarpDriveConfig.G_LUA_SCRIPTS != WarpDriveConfig.LUA_SCRIPTS_NONE) {
OC_fileSystem = FileSystem.asManagedEnvironment(FileSystem.fromClass(getClass(), WarpDrive.MODID.toLowerCase(), "lua.OpenComputers/" + peripheralName), peripheralName);
}
}
@Override
@ -183,13 +235,29 @@ public abstract class WarpInterfacedTE extends WarpTE implements IPeripheral, En
@Override
@Optional.Method(modid = "OpenComputers")
public void onConnect(Node node) {
// nothing special
if (node.host() instanceof Context) {
// Attach our file system to new computers we get connected to.
// Note that this is also called for all already present computers
// when we're added to an already existing network, so we don't
// have to loop through the existing nodes manually.
if (OC_fileSystem != null) {
node.connect(OC_fileSystem.node());
}
}
}
@Override
@Optional.Method(modid = "OpenComputers")
public void onDisconnect(Node node) {
// nothing special
if (OC_fileSystem != null) {
if (node.host() instanceof Context) {
// Disconnecting from a single computer
node.disconnect(OC_fileSystem.node());
} else if (node == OC_node) {
// Disconnecting from the network
OC_fileSystem.node().remove();
}
}
}
@Override

View file

@ -1,6 +1,8 @@
package cr0s.warpdrive.machines;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import cr0s.warpdrive.data.Vector3;
public abstract class WarpTE extends TileEntity

View file

@ -81,20 +81,20 @@ public class PacketHandler {
public static void sendFreqPacket(int dimensionId, int xCoord, int yCoord, int zCoord, int frequency) {
FrequencyMessage frequencyMessage = new FrequencyMessage(xCoord, yCoord, zCoord, frequency);
simpleNetworkManager.sendToAllAround(frequencyMessage, new TargetPoint(dimensionId, xCoord, yCoord, zCoord, 100));
WarpDrive.debugPrint("Packet 'frequency' sent (" + xCoord + ", " + yCoord + ", " + zCoord + ") frequency " + frequency);
WarpDrive.debugPrint("Sent frequency packet (" + xCoord + ", " + yCoord + ", " + zCoord + ") frequency " + frequency);
}
// LaserCamera shooting at target (client -> server)
public static void sendLaserTargetingPacket(int x, int y, int z, float yaw, float pitch) {
TargetingMessage targetingMessage = new TargetingMessage(x, y, z, yaw, pitch);
simpleNetworkManager.sendToServer(targetingMessage);
WarpDrive.debugPrint("Packet 'targeting' sent (" + x + ", " + y + ", " + z + ") yaw " + yaw + " pitch " + pitch);
WarpDrive.debugPrint("Sent targeting packet (" + x + ", " + y + ", " + z + ") yaw " + yaw + " pitch " + pitch);
}
// Sending cloaking area definition (server -> client)
public static void sendCloakPacket(EntityPlayer player, AxisAlignedBB aabb, int tier, boolean decloak) {
CloakMessage cloakMessage = new CloakMessage(aabb, tier, decloak);
simpleNetworkManager.sendTo(cloakMessage, (EntityPlayerMP) player);
WarpDrive.debugPrint("Packet 'cloak' sent (aabb " + aabb + ") tier " + tier + " decloak " + decloak);
WarpDrive.debugPrint("Sent cloak packet (aabb " + aabb + ") tier " + tier + " decloak " + decloak);
}
}

View file

@ -4,7 +4,6 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -18,211 +17,205 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.network.PacketHandler;
public final class EntityCamera extends EntityLivingBase
{
public int xCoord;
public int yCoord;
public int zCoord;
private EntityPlayer player;
private Minecraft mc = Minecraft.getMinecraft();
private int dx = 0, dy = 0, dz = 0;
private int zoomNumber = 0;
private int closeWaitTicks = 0;
private int zoomWaitTicks = 0;
private int fireWaitTicks = 0;
private boolean isActive = true;
private int bootUpTicks = 20;
public EntityCamera(World world) {
super(world);
// TODO Auto-generated constructor stub
}
public final class EntityCamera extends EntityLivingBase {
// entity coordinates (x, y, z) are dynamically changed by player
// camera block coordinates are fixed
public int xCoord;
public int yCoord;
public int zCoord;
private EntityPlayer player;
private Minecraft mc = Minecraft.getMinecraft();
private int dx = 0, dy = 0, dz = 0;
private int zoomNumber = 0;
private int closeWaitTicks = 0;
private int zoomWaitTicks = 0;
private int fireWaitTicks = 0;
private boolean isActive = true;
private int bootUpTicks = 20;
private boolean isCentered = true;
public EntityCamera(World world, ChunkPosition pos, EntityPlayer player) {
super(world);
this.setInvisible(true);
int x = pos.chunkPosX;
int y = pos.chunkPosY;
int z = pos.chunkPosZ;
this.xCoord = x;
this.posX = x;
this.yCoord = y;
this.posY = y;
this.zCoord = z;
this.posZ = z;
this.player = player;
}
private void closeCamera() {
if (!isActive) {
return;
}
public EntityCamera(World world) {
super(world);
}
public EntityCamera(World world, ChunkPosition pos, EntityPlayer player) {
super(world);
setInvisible(true);
int x = pos.chunkPosX;
int y = pos.chunkPosY;
int z = pos.chunkPosZ;
xCoord = x;
posX = x;
yCoord = y;
posY = y;
zCoord = z;
posZ = z;
this.player = player;
}
private void closeCamera() {
if (!isActive) {
return;
}
ClientCameraUtils.resetViewpoint();
worldObj.removeEntity(this);
isActive = false;
}
@Override
public void onEntityUpdate() {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
if (player == null || player.isDead) {
WarpDrive.debugPrint("" + this + " Player is null or dead, closing camera...");
closeCamera();
return;
}
if (!ClientCameraUtils.isValidContext(worldObj)) {
WarpDrive.debugPrint("" + this + " Invalid context, closing camera...");
closeCamera();
return;
}
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
mc.renderViewEntity.rotationYaw = player.rotationYaw;
//mc.renderViewEntity.rotationYawHead = player.rotationYawHead;
mc.renderViewEntity.rotationPitch = player.rotationPitch;
WarpDrive.instance.debugMessage = "Mouse " + Mouse.isButtonDown(0) + " " + Mouse.isButtonDown(1) + " " + Mouse.isButtonDown(2) + " " + Mouse.isButtonDown(3)
+ "\nBackspace " + Keyboard.isKeyDown(Keyboard.KEY_BACKSLASH) + " Space " + Keyboard.isKeyDown(Keyboard.KEY_SPACE) + " Shift " + "";
// Perform zoom
if (Mouse.isButtonDown(0)) {// FIXME merge: main is using right click with Mouse.isButtonDown(1), branch is using left click
zoomWaitTicks++;
if (zoomWaitTicks >= 2) {
zoomWaitTicks = 0;
zoom();
}
} else {
zoomWaitTicks = 0;
}
if (bootUpTicks > 0) {
bootUpTicks--;
} else {
if (Mouse.isButtonDown(1)) {
closeWaitTicks++;
if (closeWaitTicks >= 2) {
closeWaitTicks = 0;
closeCamera();
}
} else {
closeWaitTicks = 0;
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {// FIXME merge: main is using left click with Mouse.isButtonDown(0), branch is using space bar
fireWaitTicks++;
if (fireWaitTicks >= 2) {
fireWaitTicks = 0;
// Make a shoot with camera-laser
if (block.isAssociatedBlock(WarpDrive.laserCamBlock)) {
PacketHandler.sendLaserTargetingPacket(xCoord, yCoord, zCoord, mc.renderViewEntity.rotationYaw, mc.renderViewEntity.rotationPitch);
}
}
} else {
fireWaitTicks = 0;
}
GameSettings gamesettings = mc.gameSettings;
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
dy = -1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
dy = 2;
} else if (Keyboard.isKeyDown(gamesettings.keyBindLeft.getKeyCode())) {
dz = -1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindRight.getKeyCode())) {
dz = 1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindForward.getKeyCode())) {
dx = 1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindBack.getKeyCode())) {
dx = -1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) { // centering view
dx = 0;
dy = 0;
dz = 0;
isCentered = !isCentered;
worldObj.removeEntity(this);
isActive = false;
}
@Override
public void onEntityUpdate() {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
if (player == null || player.isDead) {
WarpDrive.debugPrint("" + this + " Player is null or dead, closing camera...");
closeCamera();
return;
}
}
if (!ClientCameraUtils.isValidContext(worldObj)) {
WarpDrive.debugPrint("" + this + " Invalid context, closing camera...");
closeCamera();
return;
}
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
mc.renderViewEntity.rotationYaw = player.rotationYaw;
//mc.renderViewEntity.rotationYawHead = player.rotationYawHead;
mc.renderViewEntity.rotationPitch = player.rotationPitch;
WarpDrive.instance.debugMessage = "Mouse " + Mouse.isButtonDown(0) + " " + Mouse.isButtonDown(1) + " " + Mouse.isButtonDown(2) + " " + Mouse.isButtonDown(3) + "\nBackspace "
+ Keyboard.isKeyDown(Keyboard.KEY_BACKSLASH) + " Space " + Keyboard.isKeyDown(Keyboard.KEY_SPACE) + " Shift " + "";
// Perform zoom
if (Mouse.isButtonDown(0)) {// FIXME merge: main is using right click with Mouse.isButtonDown(1), branch is using left click
zoomWaitTicks++;
if (zoomWaitTicks >= 2) {
zoomWaitTicks = 0;
zoom();
}
} else {
zoomWaitTicks = 0;
}
if (bootUpTicks > 0) {
bootUpTicks--;
} else {
if (Mouse.isButtonDown(1)) {
closeWaitTicks++;
if (closeWaitTicks >= 2) {
closeWaitTicks = 0;
closeCamera();
}
} else {
closeWaitTicks = 0;
}
}
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {// FIXME merge: main is using left click with Mouse.isButtonDown(0), branch is using space bar
fireWaitTicks++;
if (fireWaitTicks >= 2) {
fireWaitTicks = 0;
// Make a shoot with camera-laser
if (block.isAssociatedBlock(WarpDrive.laserCamBlock)) {
PacketHandler.sendLaserTargetingPacket(xCoord, yCoord, zCoord, mc.renderViewEntity.rotationYaw, mc.renderViewEntity.rotationPitch);
}
}
} else {
fireWaitTicks = 0;
}
GameSettings gamesettings = mc.gameSettings;
if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
dy = -1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
dy = 2;
} else if (Keyboard.isKeyDown(gamesettings.keyBindLeft.getKeyCode())) {
dz = -1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindRight.getKeyCode())) {
dz = 1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindForward.getKeyCode())) {
dx = 1;
} else if (Keyboard.isKeyDown(gamesettings.keyBindBack.getKeyCode())) {
dx = -1;
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) { // centering view
dx = 0;
dy = 0;
dz = 0;
isCentered = !isCentered;
return;
}
if (isCentered) {
setPosition(xCoord + 0.5D, yCoord + 0.75D, zCoord + 0.5D);
setPosition(xCoord + 0.5D, yCoord + 0.75D, zCoord + 0.5D);
} else {
setPosition(xCoord + dx, yCoord + dy, zCoord + dz);
}
}
}
@Override
public void onUpdate() {
super.onUpdate();
this.motionX = this.motionY = this.motionZ = 0.0D;
}
public void zoom() {
if (zoomNumber == 0) {
mc.gameSettings.fovSetting = -0.75F;
mc.gameSettings.mouseSensitivity = 0.4F;
} else if (zoomNumber == 1) {
mc.gameSettings.fovSetting = -1.25F;
mc.gameSettings.mouseSensitivity = 0.3F;
} else if (zoomNumber == 2) {
mc.gameSettings.fovSetting = -1.6F;
mc.gameSettings.mouseSensitivity = 0.15F;
} else if (zoomNumber == 3) {
mc.gameSettings.fovSetting = WarpDrive.normalFOV;
mc.gameSettings.mouseSensitivity = WarpDrive.normalSensitivity;
}
zoomNumber = (zoomNumber + 1) % 4;
}
@Override
public boolean shouldRenderInPass(int pass) {
return false;
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
}
@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound)
{
xCoord = nbttagcompound.getInteger("x");
yCoord = nbttagcompound.getInteger("y");
zCoord = nbttagcompound.getInteger("z");
}
@Override
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
{
nbttagcompound.setInteger("x", xCoord);
nbttagcompound.setInteger("y", yCoord);
nbttagcompound.setInteger("z", zCoord);
}
@Override
public ItemStack getHeldItem() {
return null;
}
@Override
public void setCurrentItemOrArmor(int i, ItemStack itemstack) {
}
@Override
public ItemStack[] getLastActiveItems() {
return null;
}
}
}
}
@Override
public void onUpdate() {
super.onUpdate();
this.motionX = this.motionY = this.motionZ = 0.0D;
}
public void zoom() {
if (zoomNumber == 0) {
mc.gameSettings.fovSetting = -0.75F;
mc.gameSettings.mouseSensitivity = 0.4F;
} else if (zoomNumber == 1) {
mc.gameSettings.fovSetting = -1.25F;
mc.gameSettings.mouseSensitivity = 0.3F;
} else if (zoomNumber == 2) {
mc.gameSettings.fovSetting = -1.6F;
mc.gameSettings.mouseSensitivity = 0.15F;
} else if (zoomNumber == 3) {
mc.gameSettings.fovSetting = WarpDrive.normalFOV;
mc.gameSettings.mouseSensitivity = WarpDrive.normalSensitivity;
}
zoomNumber = (zoomNumber + 1) % 4;
}
@Override
public boolean shouldRenderInPass(int pass) {
return false;
}
@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
// nothing to save, skip ancestor call
xCoord = nbttagcompound.getInteger("x");
yCoord = nbttagcompound.getInteger("y");
zCoord = nbttagcompound.getInteger("z");
}
@Override
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
// nothing to save, skip ancestor call
nbttagcompound.setInteger("x", xCoord);
nbttagcompound.setInteger("y", yCoord);
nbttagcompound.setInteger("z", zCoord);
}
@Override
public ItemStack getHeldItem() {
return null;
}
@Override
public void setCurrentItemOrArmor(int i, ItemStack itemstack) {
}
@Override
public ItemStack[] getLastActiveItems() {
return null;
}
@Override
public ItemStack getEquipmentInSlot(int i) {
return null;

View file

@ -21,7 +21,7 @@ public class WorldGenSmallShip extends WorldGenerator {
public WorldGenSmallShip(boolean corrupted) {
this.corrupted = corrupted;
if (WarpDriveConfig.isICLoaded) {
if (WarpDriveConfig.isIndustrialCraft2loaded) {
IC2_solarType = WarpDriveConfig.IC2_solarPanel.getItemDamage();
} else {
WarpDriveConfig.IC2_solarPanel = new ItemStack(Blocks.air); // FIXME: have proper generation for non-IC2
@ -32,28 +32,28 @@ public class WorldGenSmallShip extends WorldGenerator {
@Override
public boolean generate(World world, Random rand, int centerX, int centerY, int centerZ) {
ItemStack cableType = new ItemStack(Blocks.air);
if (WarpDriveConfig.isICLoaded) {
if (WarpDriveConfig.isAdvSolPanelLoaded) {
if (WarpDriveConfig.isIndustrialCraft2loaded) {
if (WarpDriveConfig.isAdvancedSolarPanelLoaded) {
IC2_solarType = rand.nextInt(2);
}
cableType = WarpDriveConfig.getIC2Item("copperCableBlock").copy();
cableType = WarpDriveConfig.getIC2Item("blockCable").copy();
switch (rand.nextInt(4)) {
case 0:
cableType = WarpDriveConfig.getIC2Item("glassFiberCableBlock").copy();
cableType.setItemDamage(0);
break;
case 1:
cableType = WarpDriveConfig.getIC2Item("glassFiberCableBlock").copy();
cableType.setItemDamage(3);
break;
case 2:
cableType = WarpDriveConfig.getIC2Item("insulatedGoldCableBlock").copy();
cableType.setItemDamage(6);
break;
case 3:
cableType = WarpDriveConfig.getIC2Item("doubleInsulatedIronCableBlock").copy();
cableType.setItemDamage(9);
break;
}
}
@ -227,8 +227,10 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 7, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 7, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 7, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 7, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
}
world.setBlock(i + 7, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 7, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -260,8 +262,10 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 8, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 8, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 8, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 8, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
}
world.setBlock(i + 8, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 8, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -295,8 +299,10 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 9, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 9, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 9, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 9, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 9, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 9, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 9, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
}
// Placing air generator
world.setBlock(i + 9, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0);
world.setBlock(i + 9, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -335,8 +341,10 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 10, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 10, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 10, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 10, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 10, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 10, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 10, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
}
// Placing air generator
world.setBlock(i + 10, j + 5, k + 7, WarpDrive.airgenBlock, 0, 0);
world.setBlock(i + 10, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -380,7 +388,7 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 11, j + 4, k + 6, WorldGenStructure.getGlassBlock(corrupted, rand));
// Place computer
if (rand.nextBoolean()) {
if (rand.nextBoolean() && WarpDriveConfig.isComputerCraftLoaded) {
world.setBlock(i + 11, j + 4, k + 7, WarpDriveConfig.CC_Computer, 12, 3);
}
@ -391,8 +399,10 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 11, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 11, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 11, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 11, j + 6, k + 7, Block.getBlockFromItem(WarpDriveConfig.IC2_solarPanel.getItem()), IC2_solarType, 0);
}
world.setBlock(i + 11, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 11, j + 7, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -432,16 +442,22 @@ public class WorldGenSmallShip extends WorldGenerator {
world.setBlock(i + 12, j + 3, k + 12, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 12, j + 4, k + 2, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 4, k + 6, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 4, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 12, j + 4, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
}
world.setBlock(i + 12, j + 4, k + 8, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 4, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 5, k + 2, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 5, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 12, j + 5, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
}
world.setBlock(i + 12, j + 5, k + 12, WorldGenStructure.getGlassBlock(corrupted, rand));
world.setBlock(i + 12, j + 6, k + 3, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 12, j + 6, k + 4, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 12, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 12, j + 6, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
if (WarpDriveConfig.isIndustrialCraft2loaded) {
world.setBlock(i + 12, j + 6, k + 6, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
world.setBlock(i + 12, j + 6, k + 7, Block.getBlockFromItem(cableType.getItem()), cableType.getItemDamage(), 0);
}
world.setBlock(i + 12, j + 6, k + 10, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 12, j + 6, k + 11, WorldGenStructure.getStoneBlock(corrupted, rand));
world.setBlock(i + 12, j + 7, k + 5, WorldGenStructure.getStoneBlock(corrupted, rand));
@ -605,14 +621,15 @@ public class WorldGenSmallShip extends WorldGenerator {
while (!isDone) {
switch (rand.nextInt(14)) {
case 0:
res = WarpDriveConfig.getIC2Item("massFabricator").copy();
case 0:// Mass fabricator
res = WarpDriveConfig.getIC2Item("blockMachine").copy();
res.setItemDamage(14);
res.stackSize = 1; // + rand.nextInt(2);
isDone = true;
break;
case 1:
res = WarpDriveConfig.getIC2Item("nuke").copy();
res = WarpDriveConfig.getIC2Item("blockNuke").copy();
res.stackSize = 1 + rand.nextInt(2);
isDone = true;
break;
@ -624,14 +641,16 @@ public class WorldGenSmallShip extends WorldGenerator {
isDone = true;
break;// skipped
case 6:
res = WarpDriveConfig.getIC2Item("glassFiberCableItem").copy();
case 6:// Glass fiber cable item
res = WarpDriveConfig.getIC2Item("itemCable").copy();
res.setItemDamage(9);
res.stackSize = 2 + rand.nextInt(12);
isDone = true;
break;
case 7:
res = WarpDriveConfig.getIC2Item("matter").copy();
case 7:// UU matter cell
res = WarpDriveConfig.getIC2Item("itemCellEmpty").copy();
res.setItemDamage(3);
res.stackSize = 2 + rand.nextInt(14);
isDone = true;
break;
@ -664,7 +683,7 @@ public class WorldGenSmallShip extends WorldGenerator {
// Advanced solar panels
case 13:
if (WarpDriveConfig.isAdvSolPanelLoaded) {
if (WarpDriveConfig.isAdvancedSolarPanelLoaded) {
res = new ItemStack(WarpDriveConfig.IC2_solarPanel.getItem(), rand.nextInt(3), IC2_solarType).copy();
isDone = true;
}

View file

@ -11,8 +11,8 @@ public class WorldGenStructure {
if (corrupted && (rand.nextInt(15) == 1))
return Blocks.air;
if (WarpDriveConfig.isICLoaded) {
return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("reinforcedStone").getItem());
if (WarpDriveConfig.isIndustrialCraft2loaded) {
return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("blockAlloy").getItem());
} else {
return Blocks.stone;
}
@ -22,8 +22,8 @@ public class WorldGenStructure {
if (corrupted && (rand.nextInt(30) == 1))
return Blocks.air;
if (WarpDriveConfig.isICLoaded) {
return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("reinforcedGlass").getItem());
if (WarpDriveConfig.isIndustrialCraft2loaded) {
return Block.getBlockFromItem(WarpDriveConfig.getIC2Item("blockAlloyGlass").getItem());
} else {
return Blocks.glass;
}

View file

@ -5,7 +5,7 @@ end
Side = { "bottom", "top", "back", "left", "right" }
for i = 1,5 do
if peripheral.getType(Side[i]) == "cloakingdevicecore" then
if peripheral.getType(Side[i]) == "warpdriveCloakingCore" then
warp = peripheral.wrap(Side[i])
break
else
@ -16,22 +16,22 @@ end
if warp == nil then
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.write("No cloak core detected")
term.write("No cloaking core detected")
else
warp.tier(1)
warp.enable(true)
if warp.isAssemblyValid() then
term.setBackgroundColor(colors.lime)
term.setTextColor(colors.blue)
term.write("Tier 1 cloak enabled")
term.write("Tier 1 cloaking is enabled")
else
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.write("Invalid assembly!")
term.write("Invalid cloaking assembly!")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
print()
print("In each of the 6 directions, you need to place exactly 2 Cloaking device coils, for a total of 12 coils.")
print("In each of the 6 directions, you need to place exactly 2 Cloaking coils, for a total of 12 coils.")
print("The 6 inner coils shall be exactly one block away from the core.")
print("The cloaking field will extend 5 blocks past the outer 6 coils.")
print("Power consumption scales with the amount of cloaked blocks.")

View file

@ -5,7 +5,7 @@ end
Side = { "bottom", "top", "back", "left", "right" }
for i = 1,5 do
if peripheral.getType(Side[i]) == "cloakingdevicecore" then
if peripheral.getType(Side[i]) == "warpdriveCloakingCore" then
warp = peripheral.wrap(Side[i])
break
else
@ -16,22 +16,22 @@ end
if warp == nil then
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.write("No cloak core detected")
term.write("No cloaking core detected")
else
warp.tier(2)
warp.enable(true)
if warp.isAssemblyValid() then
term.setBackgroundColor(colors.lime)
term.setTextColor(colors.red)
term.write("Tier 2 cloak enabled")
term.write("Tier 2 cloaking is enabled")
else
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.write("Invalid assembly!")
term.write("Invalid cloaking assembly!")
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
print()
print("In each of the 6 directions, you need to place exactly 2 Cloaking device coils, for a total of 12 coils.")
print("In each of the 6 directions, you need to place exactly 2 Cloaking coils, for a total of 12 coils.")
print("The 6 inner coils shall be exactly one block away from the core.")
print("The cloaking field will extend 5 blocks past the outer 6 coils.")
print("Power consumption scales with the amount of cloaked blocks.")

View file

@ -5,7 +5,7 @@ end
Side = { "bottom", "top", "back", "left", "right" }
for i = 1,5 do
if peripheral.getType(Side[i]) == "cloakingdevicecore" then
if peripheral.getType(Side[i]) == "warpdriveCloakingCore" then
warp = peripheral.wrap(Side[i])
break
else
@ -16,12 +16,12 @@ end
if warp == nil then
term.setBackgroundColor(colors.red)
term.setTextColor(colors.white)
term.write("No cloak core detected")
term.write("No cloaking core detected")
else
warp.enable(false)
term.setBackgroundColor(colors.lightGray)
term.setTextColor(colors.black)
term.write("Cloak disabled")
term.write("Cloaking is disabled")
end
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)

View file

@ -6,7 +6,7 @@ end
sides = peripheral.getNames()
mininglasers = {}
for key,side in pairs(sides) do
if peripheral.getType(side) == "mininglaser" then
if peripheral.getType(side) == "warpdriveMiningLaser" then
print("Wrapping " .. side)
table.insert(mininglasers, peripheral.wrap(side))
end

View file

@ -6,7 +6,7 @@ end
sides = peripheral.getNames()
mininglasers = {}
for key,side in pairs(sides) do
if peripheral.getType(side) == "mininglaser" then
if peripheral.getType(side) == "warpdriveMiningLaser" then
print("Wrapping " .. side)
table.insert(mininglasers, peripheral.wrap(side))
end

View file

@ -1837,22 +1837,22 @@ for key,side in pairs(sides) do
lmonitor = peripheral.wrap(side)
table.insert(monitors, lmonitor)
lmonitor.setTextScale(monitor_textScale)
elseif peripheral.getType(side) == "warpcore" then
elseif peripheral.getType(side) == "warpdriveShipController" then
WriteLn("Wrapping " .. side)
warpcore = peripheral.wrap(side)
elseif peripheral.getType(side) == "warpdriveReactor" then
elseif peripheral.getType(side) == "warpdrivePowerReactor" then
WriteLn("Wrapping " .. side)
reactor = peripheral.wrap(side)
elseif peripheral.getType(side) == "warpdriveReactorLaser" then
elseif peripheral.getType(side) == "warpdrivePowerLaser" then
WriteLn("Wrapping " .. side)
table.insert(reactorlasers, peripheral.wrap(side))
elseif peripheral.getType(side) == "mininglaser" then
elseif peripheral.getType(side) == "warpdriveMiningLaser" then
WriteLn("Wrapping " .. side)
table.insert(mininglasers, peripheral.wrap(side))
elseif peripheral.getType(side) == "cloakingdevicecore" then
elseif peripheral.getType(side) == "warpdriveCloakingCore" then
WriteLn("Wrapping " .. side)
table.insert(cloakingcores, peripheral.wrap(side))
elseif peripheral.getType(side) == "radar" then
elseif peripheral.getType(side) == "warpdriveRadar" then
WriteLn("Wrapping " .. side)
radar = peripheral.wrap(side);
end

View file

@ -6,7 +6,7 @@ end
sides = peripheral.getNames()
mininglasers = {}
for key,side in pairs(sides) do
if peripheral.getType(side) == "radar" then
if peripheral.getType(side) == "warpdriveRadar" then
print("Wrapping " .. side)
radar = peripheral.wrap(side)
end

View file

@ -9,7 +9,7 @@ end
sides = peripheral.getNames()
mininglasers = {}
for key,side in pairs(sides) do
if peripheral.getType(side) == "radar" then
if peripheral.getType(side) == "warpdriveRadar" then
print("Wrapping " .. side)
radar = peripheral.wrap(side)
end

View file

@ -372,7 +372,7 @@ SetColorDeflt()
Side = { "bottom", "top", "back", "left", "right" }
for i = 1,5 do
if peripheral.getType(Side[i]) == "warpcore" then
if peripheral.getType(Side[i]) == "warpdriveShipController" then
warp = peripheral.wrap(Side[i])
break
else

View file

@ -0,0 +1,22 @@
local component = require("component")
local term = require("term")
if not component.isAvailable("cloakingdevicecore") then
print("No cloaking core detected")
else
local cloakingcore = component.warpdriveCloakingCore
cloakingcore.tier(1)
cloakingcore.enable(true)
if cloakingcore.isAssemblyValid() then
print("Tier 1 cloaking is enabled")
else
print("Invalid cloaking assembly")
print()
print("In each of the 6 directions, you need to place exactly 2 Cloaking coils, for a total of 12 coils.")
print("The 6 inner coils shall be exactly one block away from the core.")
print("The cloaking field will extend 5 blocks past the outer 6 coils.")
print("Power consumption scales with the amount of cloaked blocks.")
end
end
print("")

View file

@ -0,0 +1,22 @@
local component = require("component")
local term = require("term")
if not component.isAvailable("warpdriveCloakingCore") then
print("No cloaking core detected")
else
local cloakingcore = component.warpdriveCloakingCore
cloakingcore.tier(2)
cloakingcore.enable(true)
if cloakingcore.isAssemblyValid() then
print("Tier 2 cloaking is enabled")
else
print("Invalid cloaking assembly")
print()
print("In each of the 6 directions, you need to place exactly 2 Cloaking coils, for a total of 12 coils.")
print("The 6 inner coils shall be exactly one block away from the core.")
print("The cloaking field will extend 5 blocks past the outer 6 coils.")
print("Power consumption scales with the amount of cloaked blocks.")
end
end
print("")

View file

@ -0,0 +1,21 @@
local component = require("component")
if not component.isAvailable("warpdriveCloakingCore") then
print("No cloaking core detected")
else
local cloakingcore = component.warpdriveCloakingCore
cloakingcore.tier(2)
cloakingcore.enable(true)
if cloakingcore.isAssemblyValid() then
print("Cloaking is disabled")
else
print("Invalid assembly")
print()
print("In each of the 6 directions, you need to place exactly 2 Cloaking device coils, for a total of 12 coils.")
print("The 6 inner coils shall be exactly one block away from the core.")
print("The cloaking field will extend 5 blocks past the outer 6 coils.")
print("Power consumption scales with the amount of cloaked blocks.")
end
end
print("")

View file

@ -8,8 +8,8 @@ Jump to hyperspace for long-range traveling!
Set up laser cannons on your ship to fight with other players' ships, or craft a mining laser to collect valuable resources on Earth or in space.
Cloak your ship, base or a space station from your enemies!
And lots more!",
"version": "1.3.0.0",
"mcversion": "1.7.10",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "http://www.minecraftforum.net/topic/1444954-",
"updateUrl": "",
"authors": ["Cr0s", "DarkholmeTenk", "drpepper240", "ZLOFENIX", "LemADEC"],