Improved warp-field isolation

Reduced default configuration from 132 to 60 default, 100 to 94 max
Added isolation rate to guide message
Fixed isolation rate going above 100% with extra blocks
Updated vanilla recipe to use emeralds
This commit is contained in:
LemADEC 2015-12-19 14:25:59 +01:00
parent 0338fd0b58
commit 00e95b8dd9
9 changed files with 34 additions and 35 deletions

View file

@ -164,12 +164,18 @@ public abstract class TileEntityAbstractEnergy extends TileEntityAbstractInterfa
return new Object[] { getEnergyStored(), getMaxEnergyStored() };
}
public String getStatus() {
if (getMaxEnergyStored() != 0) {
return getBlockType().getLocalizedName() + String.format(" energy level is %.0f/%.0f EU.", convertInternalToEU(getEnergyStored()), convertInternalToEU(getMaxEnergyStored()));
} else {
return getBlockType().getLocalizedName();
public String getEnergyStatus() {
if (getMaxEnergyStored() == 0) {
return "";
}
return String.format("\nEnergy level is %1$.0f/%2$.0f EU.",
convertInternalToEU(getEnergyStored()),
convertInternalToEU(getMaxEnergyStored()));
}
public String getStatus() {
return getBlockType().getLocalizedName()
+ getEnergyStatus();
}
// OpenComputer callback methods

View file

@ -181,7 +181,7 @@ public class TileEntityIC2reactorLaserMonitor extends TileEntityAbstractEnergy {
public String getStatus() {
Set<IReactor> reactors = findReactors();
return getBlockType().getLocalizedName()
+ String.format("\nEnergy level is %.0f/%.0f EU.", convertInternalToEU(getEnergyStored()), convertInternalToEU(getMaxEnergyStored()))
+ getEnergyStatus()
+ "\n" + ((reactors == null || reactors.size() == 0) ? "No reactor found!" : reactors.size() + " reactor(s) connected.");
}

View file

@ -81,15 +81,15 @@ public class BlockShipCore extends BlockContainer {
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
if (par5EntityPlayer.getHeldItem() == null) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityShipCore) {
WarpDrive.addChatMessage(par5EntityPlayer, ((TileEntityShipCore)te).getStatus());
if (entityPlayer.getHeldItem() == null) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null && tileEntity instanceof TileEntityShipCore) {
WarpDrive.addChatMessage(entityPlayer, ((TileEntityShipCore)tileEntity).getStatus());
return true;
}
}

View file

@ -23,7 +23,6 @@ import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.FMLCommonHandler;
import cr0s.warpdrive.EntityJump;
import cr0s.warpdrive.LocalProfiler;
import cr0s.warpdrive.WarpDrive;
import cr0s.warpdrive.block.TileEntityAbstractEnergy;
import cr0s.warpdrive.config.WarpDriveConfig;
@ -377,15 +376,15 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
}
isolationBlocksCount = newCount;
if (isolationBlocksCount >= WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS) {
isolationRate = WarpDriveConfig.RADAR_MIN_ISOLATION_EFFECT
isolationRate = Math.min(1.0, WarpDriveConfig.RADAR_MIN_ISOLATION_EFFECT
+ (isolationBlocksCount - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS) // bonus blocks
* (WarpDriveConfig.RADAR_MAX_ISOLATION_EFFECT - WarpDriveConfig.RADAR_MIN_ISOLATION_EFFECT)
/ (WarpDriveConfig.RADAR_MAX_ISOLATION_BLOCKS - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS);
/ (WarpDriveConfig.RADAR_MAX_ISOLATION_BLOCKS - WarpDriveConfig.RADAR_MIN_ISOLATION_BLOCKS));
} else {
isolationRate = 0.0D;
}
if (WarpDriveConfig.LOGGING_JUMPBLOCKS) {
WarpDrive.logger.info(this + " Isolation updated to " + isolationBlocksCount + " (" + String.format("%.1f", isolationRate * 100) + "%)");
WarpDrive.logger.info(this + " Isolation updated to " + isolationBlocksCount + " (" + String.format("%.1f", isolationRate * 100.0) + "%)");
}
}
@ -988,13 +987,10 @@ public class TileEntityShipCore extends TileEntityAbstractEnergy {
@Override
public String getStatus() {
return getBlockType().getLocalizedName()
+ String.format(" '%s' energy level is %.0f/%.0f EU.",
shipName,
convertInternalToEU(getEnergyStored()),
convertInternalToEU(getMaxEnergyStored()))
+ ((cooldownTime > 0) ? ("\n" + (cooldownTime / 20) + " s left of cooldown.")
: ((isolationBlocksCount > 0) ? ("\n" + isolationBlocksCount + " active isolation blocks") : ""));
return getBlockType().getLocalizedName() + " '" + shipName + "'"
+ getEnergyStatus()
+ ((cooldownTime > 0) ? String.format("\n%1$d s left of cooldown.", cooldownTime / 20) : ""
+ ((isolationBlocksCount > 0) ? String.format("\n%1$d active isolation blocks providing %2$2.1f%% absorption.", isolationBlocksCount, isolationRate * 100.0) : ""));
}
public static int calculateRequiredEnergy(ShipCoreMode shipCoreMode, int shipVolume, int jumpDistance) {

View file

@ -79,10 +79,7 @@ public class TileEntityTransporter extends TileEntityAbstractEnergy implements I
@Override
public String getStatus() {
return getBlockType().getLocalizedName()
+ String.format("Energy level is %.0f/%.0f EU.",
convertInternalToEU(getEnergyStored()),
convertInternalToEU(getMaxEnergyStored())
)
+ getEnergyStatus()
+ String.format("\nSource: %.0f %.0f %.0f",
sourceVec.x,
sourceVec.y,

View file

@ -868,18 +868,18 @@ public class Recipes {
// Warp isolation is 1 EV Machine casing (Ti), 8 Iridium reinforced plate
// or 1 Nether star, 8 diamond
String oreDiamondOrReinforcedIridiumPlate = "gemDiamond";
String oreEmeraldOrReinforcedIridiumPlate = "gemEmerald";
if (OreDictionary.doesOreNameExist("plateAlloyIridium") && !OreDictionary.getOres("plateAlloyIridium").isEmpty()) {// IndustricalCraft2 and Gregtech
oreDiamondOrReinforcedIridiumPlate = "plateAlloyIridium";
oreEmeraldOrReinforcedIridiumPlate = "plateAlloyIridium";
} else if (WarpDriveConfig.isEnderIOloaded) {// EnderIO
ItemStack itemStackFranckNZombie = WarpDriveConfig.getModItemStack("EnderIO", "itemFrankenSkull", 2);
OreDictionary.registerOre("plateAlloyIridium", itemStackFranckNZombie);
oreDiamondOrReinforcedIridiumPlate = "plateAlloyIridium";
oreEmeraldOrReinforcedIridiumPlate = "plateAlloyIridium";
} else if (WarpDriveConfig.isThermalExpansionLoaded) {
oreDiamondOrReinforcedIridiumPlate = "ingotLumium";
oreEmeraldOrReinforcedIridiumPlate = "ingotLumium";
}
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockWarpIsolation), false, "iii", "imi", "iii",
'i', oreDiamondOrReinforcedIridiumPlate,
'i', oreEmeraldOrReinforcedIridiumPlate,
'm', itemMachineCasingEV));
// Air generator is 1 power interface, 4 activated carbon, 1 motor, 1 MV Machine casing, 2 tanks
@ -1115,7 +1115,7 @@ public class Recipes {
}
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(WarpDrive.blockCloakingCoil), false, "iti", "cmc", "iti",
't', oreEmeraldOrTitaniumPlate,
'i', oreDiamondOrReinforcedIridiumPlate,
'i', oreEmeraldOrReinforcedIridiumPlate,
'c', itemStackGoldIngotOrCoil,
'm', itemMachineCasingEV ));

View file

@ -180,7 +180,7 @@ public class WarpDriveConfig {
public static int RADAR_MAX_ENERGY_STORED = 100000000; // 100kk eU
public static int RADAR_MAX_ISOLATION_RANGE = 2;
public static int RADAR_MIN_ISOLATION_BLOCKS = 5;
public static int RADAR_MAX_ISOLATION_BLOCKS = 132;
public static int RADAR_MAX_ISOLATION_BLOCKS = 60;
public static double RADAR_MIN_ISOLATION_EFFECT = 0.12;
public static double RADAR_MAX_ISOLATION_EFFECT = 1.00;
@ -647,8 +647,8 @@ public class WarpDriveConfig {
RADAR_MIN_ISOLATION_BLOCKS = clamp(0, 20,
config.get("radar", "min_isolation_blocks", RADAR_MIN_ISOLATION_BLOCKS, "number of isolation blocks required to get some isolation (0 to 20)").getInt());
RADAR_MAX_ISOLATION_BLOCKS = clamp(5, 100,
config.get("radar", "max_isolation_blocks", RADAR_MAX_ISOLATION_BLOCKS, "number of isolation blocks required to reach maximum effect (5 to 100)").getInt());
RADAR_MAX_ISOLATION_BLOCKS = clamp(5, 94,
config.get("radar", "max_isolation_blocks", RADAR_MAX_ISOLATION_BLOCKS, "number of isolation blocks required to reach maximum effect (5 to 94)").getInt());
RADAR_MIN_ISOLATION_EFFECT = clamp(0.01D, 0.95D,
config.get("radar", "min_isolation_effect", RADAR_MIN_ISOLATION_EFFECT, "isolation effect achieved with min number of isolation blocks (0.01 to 0.95)").getDouble(0.12D));

BIN
wiki/Isolation_max.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

BIN
wiki/Isolation_min.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB