Not sure if it was an artifact of copy/pasting through these forums, but there were a number of illegal white space characters in your source. (no-break spaces)
I managed to remove the Non-break spaces you told me, but the game still rejects the Java coding.
This is the error info:
Fatal: Error compiling [data.hullmods.pt_centuriondrive]
Cause: Parsing compilation unit "com.fs.starfarer.loading.A$1@1944F0c"
This is the coding I used now:
Spoiler
package data.hullmods.pt_centuriondrive;
import java.util.HashMap;
import java.util.Map;
import com.fs.starfarer.api.combat.BaseHullMod;
import com.fs.starfarer.api.combat.MutableShipStatsAPI;
import com.fs.starfarer.api.combat.ShipAPI.HullSize;
public class PT_CenturionDrive extends BaseHullMod {
public static final float EMP_REDUCTION = 25f;
public static final float ENGINE_HEALTH_BONUS = 125f;
// public static final float ZERO_FLUX_SPEED_CAPITAL = 15f;
// public static final float ZERO_FLUX_SPEED_CRUISER = 20f;
// public static final float ZERO_FLUX_SPEED_DESTROYER = 25f;
// public static final float ZERO_FLUX_SPEED_FRIGATE = 35f;
// public static final float ZERO_FLUX_BONUS_CAPITAL = 0.05f;
// public static final float ZERO_FLUX_BONUS_CRUISER = 0.1f;
// public static final float ZERO_FLUX_BONUS_DESTROYER = 0.15f;
// public static final float ZERO_FLUX_BONUS_FRIGATE = 0.2f;
public static final float WEAPON_HEALTH_BONUS = 75f;
private static final Map ZeroFluxBonus = new HashMap();
static {
ZeroFluxBonus.put(HullSize.FRIGATE, 0.2f);
ZeroFluxBonus.put(HullSize.DESTROYER, 0.15f);
ZeroFluxBonus.put(HullSize.CRUISER, 0.1f);
ZeroFluxBonus.put(HullSize.CAPITAL_SHIP, 0.05f);
}
private static final Map ZeroFluxSpeed = new HashMap();
static {
ZeroFluxSpeed.put(HullSize.FRIGATE, 35f);
ZeroFluxSpeed.put(HullSize.DESTROYER, 25f);
ZeroFluxSpeed.put(HullSize.CRUISER, 20f);
ZeroFluxSpeed.put(HullSize.CAPITAL_SHIP, 15f);
}
@Override
public void applyEffectsBeforeShipCreation(HullSize hullSize, MutableShipStatsAPI stats, String id) {
// stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, (Float) ZeroFluxBonus.get(hullSize));
// stats.getZeroFluxSpeedBoost().modifyFlat(id, (Float) ZeroFluxSpeed.get(hullSize));
// if (hullSize == HullSize.FRIGATE || hullSize == HullSize.FIGHTER) {
// stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, ZERO_FLUX_BONUS_FRIGATE);
// stats.getZeroFluxSpeedBoost().modifyFlat(id, ZERO_FLUX_SPEED_FRIGATE);
// } else if (hullSize == HullSize.DESTROYER) {
// stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, ZERO_FLUX_BONUS_DESTROYER);
// stats.getZeroFluxSpeedBoost().modifyFlat(id, ZERO_FLUX_SPEED_DESTROYER);
// } else if (hullSize == HullSize.CRUISER) {
// stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, ZERO_FLUX_BONUS_CRUISER);
// stats.getZeroFluxSpeedBoost().modifyPercent(id, ZERO_FLUX_SPEED_CRUISER);
// } else if (hullSize == HullSize.CAPITAL_SHIP) {
// stats.getZeroFluxMinimumFluxLevel().modifyFlat(id, ZERO_FLUX_BONUS_CAPITAL);
// stats.getZeroFluxSpeedBoost().modifyFlat(id, ZERO_FLUX_SPEED_CAPITAL);
// }
stats.getEmpDamageTakenMult().modifyPercent(id, -EMP_REDUCTION);
stats.getEngineHealthBonus().modifyPercent(id, ENGINE_HEALTH_BONUS);
stats.getWeaponHealthBonus().modifyPercent(id, WEAPON_HEALTH_BONUS);
}
@Override
public String getDescriptionParam(int index, HullSize hullSize) {
if (index == 0) return "" + (int) EMP_REDUCTION + "%";
if (index == 1) return "" + (int) ENGINE_HEALTH_BONUS + "%";
if (index == 2) return "" + (int) WEAPON_HEALTH_BONUS + "%";
// if (index == 0) return "" + ((int) ZeroFluxBonus.get(HullSize.FRIGATE)).intValue();
// if (index == 1) return "" + ((int) ZeroFluxBonus.get(HullSize.DESTROYER)).intValue();
// if (index == 2) return "" + ((int) ZeroFluxBonus.get(HullSize.CRUISER)).intValue();
// if (index == 3) return "" + ((int) ZeroFluxBonus.get(HullSize.CAPITAL_SHIP)).intValue();
// if (index == 4) return "" + ((int) ZeroFluxSpeed.get(HullSize.FRIGATE)).intValue();
// if (index == 5) return "" + ((int) ZeroFluxSpeed.get(HullSize.DESTROYER)).intValue();
// if (index == 6) return "" + ((int) ZeroFluxSpeed.get(HullSize.CRUISER)).intValue();
// if (index == 7) return "" + ((int) ZeroFluxSpeed.get(HullSize.CAPITAL_SHIP)).intValue();
// if (index == 0) {
// return "" + (int) ZERO_FLUX_BONUS_FRIGATE + "/" + (int) ZERO_FLUX_BONUS_DESTROYER + "/" + (int) ZERO_FLUX_BONUS_CRUISER + "/" + (int) ZERO_FLUX_BONUS_CAPITAL;
// } if (index == 1) {
// return "" + (int) ZERO_FLUX_SPEED_FRIGATE + "/" + (int) ZERO_FLUX_SPEED_DESTROYER + "/" + (int) ZERO_FLUX_SPEED_CRUISER + "/" + (int) ZERO_FLUX_SPEED_CAPITAL;
// if (index == return "" + (int) EMP_REDUCTION + "%";
// if (index == 9) return "" + (int) ENGINE_HEALTH_BONUS + "%";
// if (index == 10) return "" + (int) WEAPON_HEALTH_BONUS + "%";
return null;
}
}
Does that mean I should use a .class file of the code? Or is the coding I made is still wrong?
If the first is "yes", then how should I actually make a .class code that compliments the .Java file and which programs I should use?
I do see a lot of mods using .class files for their scripting.