Merging PowerStore & ItemUpgrade

This commit is contained in:
LemADEC 2014-08-15 13:33:08 +02:00
parent 512a38f629
commit 3e12e537e3
8 changed files with 144 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,4 @@
{
"animation": {
}
}

View file

@ -77,6 +77,7 @@ public class WarpDrive implements LoadingCallback {
public static Block reactorMonitorBlock;
public static Block powerReactorBlock;
public static Block powerLaserBlock;
public static Block powerStoreBlock;
public static Block airBlock;
public static Block gasBlock;
@ -294,7 +295,10 @@ public class WarpDrive implements LoadingCallback {
powerLaserBlock = new BlockPowerLaser(WarpDriveConfig.powerLaserID);
GameRegistry.registerBlock(powerLaserBlock, "powerLaser");
GameRegistry.registerTileEntity(TileEntityPowerLaser.class, "powerLaser");
powerStoreBlock = new BlockPowerStore(WarpDriveConfig.powerStoreID);
GameRegistry.registerBlock(powerStoreBlock,"powerStore");
GameRegistry.registerTileEntity(TileEntityPowerStore.class, "powerStore");
// REACTOR LASER FOCUS
reactorLaserFocusItem = new ItemReactorLaserFocus(WarpDriveConfig.reactorLaserFocusID);
GameRegistry.registerItem(reactorLaserFocusItem, "reactorLaserFocus");

View file

@ -21,7 +21,7 @@ public class WarpDriveConfig
{
private static Configuration config;
public static int coreID, controllerID, radarID, isolationID, airID, airgenID, gasID, laserID, miningLaserID, particleBoosterID, liftID, laserCamID, camID, monitorID, iridiumBlockID, shipScannerID, cloakCoreID, cloakCoilID;
public static int laserTreeFarmID, transporterID, transportBeaconID, reactorLaserFocusID, reactorMonitorID, powerReactorID, powerLaserID, componentID;
public static int laserTreeFarmID, transporterID, transportBeaconID, reactorLaserFocusID, reactorMonitorID, powerReactorID, powerLaserID, powerStoreID, componentID;
//
/*
* The variables which store whether or not individual mods are loaded
@ -158,6 +158,9 @@ public class WarpDriveConfig
public static int PR_TICK_TIME = 20;
public static int PR_MAX_LASERS = 3;
// POWER STORE
public static int PS_MAX_ENERGY = 1000000;
// REACTOR MONITOR
public static int RM_MAX_ENERGY = 1000000;
public static double RM_EU_PER_HEAT = 2;
@ -299,9 +302,12 @@ public class WarpDriveConfig
// Reactor
PR_MAX_ENERGY = config.get("Reactor", "max_energy", 100000000).getInt();
PR_TICK_TIME = config.get("Reactor", "ticks_per_update",20).getInt();
PR_MAX_LASERS = config.get("Reactor", "max_lasers", 4).getInt();
PR_TICK_TIME = config.get("Reactor", "ticks_per_update", 5).getInt();
PR_MAX_LASERS = config.get("Reactor", "max_lasers", 7).getInt();
// Store
PS_MAX_ENERGY = config.get("Power Store", "max_energy", 10000000).getInt();
// Reactor monitor
RM_MAX_ENERGY = config.get("Reactor Monitor", "max_rm_energy", 1000000).getInt();
RM_EU_PER_HEAT = config.get("Reactor Monitor", "eu_per_heat", 2).getDouble(2);
@ -350,9 +356,10 @@ public class WarpDriveConfig
laserTreeFarmID = config.getBlock("lasertreefarm", 519).getInt();
transporterID = config.getBlock("transporter", 520).getInt();
transportBeaconID = config.getBlock("transportBeacon", 521).getInt();
reactorMonitorID = config.getBlock("reactorMonitor",522).getInt();
reactorMonitorID = config.getBlock("reactorMonitor", 522).getInt();
powerLaserID = config.getBlock("powerLaser", 523).getInt();
powerReactorID = config.getBlock("powerReactor",524).getInt();
powerReactorID = config.getBlock("powerReactor", 524).getInt();
powerStoreID = config.getBlock("powerStore", 525).getInt();
reactorLaserFocusID = config.getItem("reactorLaserFocus", 8700).getInt();
componentID = config.getItem("component", 8701).getInt();

View file

@ -0,0 +1,14 @@
package cr0s.WarpDrive.item;
import net.minecraft.item.Item;
public class ItemWarpUpgrade extends Item {
public static enum upgradeTypes { POWER, ENERGY, SPEED, RANGE };
public ItemWarpUpgrade(int par1)
{
super(par1);
}
}

View file

@ -0,0 +1,35 @@
package cr0s.WarpDrive.machines;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import cr0s.WarpDrive.WarpBlockContainer;
public class BlockPowerStore extends WarpBlockContainer {
private Icon iconBuffer;
public BlockPowerStore(int par1) {
super(par1);
setUnlocalizedName("warpdrive.power.Store");
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileEntityPowerStore();
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta) {
return iconBuffer;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
iconBuffer = par1IconRegister.registerIcon("warpdrive:powerStore");
}
}

View file

@ -0,0 +1,73 @@
package cr0s.WarpDrive.machines;
import cr0s.WarpDrive.WarpDriveConfig;
import dan200.computercraft.api.lua.ILuaContext;
import dan200.computercraft.api.peripheral.IComputerAccess;
import dan200.computercraft.api.peripheral.IPeripheral;
import net.minecraftforge.common.ForgeDirection;
public class TileEntityPowerStore extends WarpEnergyTE implements IPeripheral {
private String[] methodArray = {
"energy"
};
@Override
public int getPotentialEnergyOutput() {
return getEnergyStored();
}
@Override
protected void energyOutputDone(int energyOutput) {
consumeEnergy(energyOutput, false);
}
@Override
public int getMaxEnergyStored() {
return WarpDriveConfig.PS_MAX_ENERGY;
}
@Override
public boolean canInputEnergy(ForgeDirection from) {
return true;
}
@Override
public boolean canOutputEnergy(ForgeDirection to) {
return true;
}
// ComputerCraft
@Override
public String getType() {
return "warpdrivePowerStore";
}
@Override
public String[] getMethodNames() {
return methodArray;
}
@Override
public Object[] callMethod(IComputerAccess computer, ILuaContext context, int method, Object[] arguments) throws Exception {
String name = methodArray[method];
if (name == "energy") {
return getEnergyObject();
}
return null;
}
@Override
public void attach(IComputerAccess computer) {
// nothing to see here
}
@Override
public void detach(IComputerAccess computer) {
// nothing to see here
}
@Override
public boolean equals(IPeripheral other) {
return this == other;
}
}