Moved module name constants to their respective classes.

This commit is contained in:
Andrew2448 2013-03-16 14:25:51 -04:00 committed by MachineMuse
parent 4809b71b82
commit 25a0547621
15 changed files with 30 additions and 37 deletions

View file

@ -70,28 +70,16 @@ public abstract class MuseCommonStrings {
public static final String MODULE_BATTERY_ADVANCED = "Advanced Battery"; public static final String MODULE_BATTERY_ADVANCED = "Advanced Battery";
public static final String MODULE_BATTERY_ELITE = "Elite Battery"; public static final String MODULE_BATTERY_ELITE = "Elite Battery";
public static final String MODULE_BASIC_PLATING = "Iron Plating"; public static final String MODULE_BASIC_PLATING = "Iron Plating";
public static final String MODULE_BLINK_DRIVE = "Blink Drive";
public static final String MODULE_DIAMOND_PLATING = "Diamond Plating"; public static final String MODULE_DIAMOND_PLATING = "Diamond Plating";
public static final String MODULE_ENERGY_SHIELD = "Energy Shield"; public static final String MODULE_ENERGY_SHIELD = "Energy Shield";
public static final String MODULE_DIAMOND_PICK_UPGRADE = "Diamond Drill Upgrade"; public static final String MODULE_DIAMOND_PICK_UPGRADE = "Diamond Drill Upgrade";
public static final String MODULE_SPRINT_ASSIST = "Sprint Assist";
public static final String MODULE_JUMP_ASSIST = "Jump Assist";
public static final String MODULE_SHOCK_ABSORBER = "Shock Absorber"; public static final String MODULE_SHOCK_ABSORBER = "Shock Absorber";
public static final String MODULE_TRANSPARENT_ARMOR = "Transparent Armor"; public static final String MODULE_TRANSPARENT_ARMOR = "Transparent Armor";
public static final String MODULE_GLIDER = "Glider";
public static final String MODULE_JETPACK = "Jetpack";
public static final String MODULE_JETBOOTS = "Jet Boots";
public static final String MODULE_PARACHUTE = "Parachute";
public static final String MODULE_ANTIGRAVITY = "Antigravity Drive"; public static final String MODULE_ANTIGRAVITY = "Antigravity Drive";
public static final String MODULE_WATER_ELECTROLYZER = "Water Electrolyzer"; public static final String MODULE_WATER_ELECTROLYZER = "Water Electrolyzer";
public static final String MODULE_AQUA_AFFINITY = "Aqua Affinity"; public static final String MODULE_AQUA_AFFINITY = "Aqua Affinity";
public static final String MODULE_TINT = "Custom Colour Module"; public static final String MODULE_TINT = "Custom Colour Module";
public static final String MODULE_CLIMB_ASSIST = "Uphill Step Assist";
public static final String MODULE_SWIM_BOOST = "Swim Boost";
public static final String MODULE_PLASMA_CANNON = "Plasma Cannon";
public static final String MODULE_MELEE_ASSIST = "Melee Assist"; public static final String MODULE_MELEE_ASSIST = "Melee Assist";
public static final String MODULE_NIGHT_VISION = "Night Vision";
public static final String MODULE_ACTIVE_CAMOUFLAGE = "Active Camouflage";
public static final String MODULE_FLIGHT_CONTROL = "Flight Control"; public static final String MODULE_FLIGHT_CONTROL = "Flight Control";
public static final String MODULE_AUTO_FEEDER = "Auto-Feeder"; public static final String MODULE_AUTO_FEEDER = "Auto-Feeder";
public static final String MODULE_SOLAR_GENERATOR = "Solar Generator"; public static final String MODULE_SOLAR_GENERATOR = "Solar Generator";

View file

@ -8,6 +8,7 @@ import net.machinemuse.api.MuseCommonStrings;
import net.machinemuse.api.ModuleManager; import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.MuseItemUtils; import net.machinemuse.api.MuseItemUtils;
import net.machinemuse.powersuits.item.ItemPowerArmor; import net.machinemuse.powersuits.item.ItemPowerArmor;
import net.machinemuse.powersuits.powermodule.modules.JumpAssistModule;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.ForgeSubscribe;
@ -35,7 +36,7 @@ public class MovementManager {
EntityPlayer player = (EntityPlayer) event.entityLiving; EntityPlayer player = (EntityPlayer) event.entityLiving;
ItemStack stack = player.getCurrentArmor(1); ItemStack stack = player.getCurrentArmor(1);
if (stack != null && stack.getItem() instanceof ItemPowerArmor if (stack != null && stack.getItem() instanceof ItemPowerArmor
&& MuseItemUtils.itemHasActiveModule(stack, MuseCommonStrings.MODULE_JUMP_ASSIST)) { && MuseItemUtils.itemHasActiveModule(stack, JumpAssistModule.MODULE_JUMP_ASSIST)) {
double jumpAssist = ModuleManager.computeModularProperty(stack, MuseCommonStrings.JUMP_MULTIPLIER) * 2; double jumpAssist = ModuleManager.computeModularProperty(stack, MuseCommonStrings.JUMP_MULTIPLIER) * 2;
double drain = ModuleManager.computeModularProperty(stack, MuseCommonStrings.JUMP_ENERGY_CONSUMPTION); double drain = ModuleManager.computeModularProperty(stack, MuseCommonStrings.JUMP_ENERGY_CONSUMPTION);
double avail = ElectricItemUtils.getPlayerEnergy(player); double avail = ElectricItemUtils.getPlayerEnergy(player);

View file

@ -18,7 +18,7 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlinkDriveModule extends PowerModuleBase implements IRightClickModule { public class BlinkDriveModule extends PowerModuleBase implements IRightClickModule {
public static final String MODULE_BLINK_DRIVE = "Blink Drive";
public BlinkDriveModule(List<IModularItem> validItems) { public BlinkDriveModule(List<IModularItem> validItems) {
super(validItems); super(validItems);
addBaseProperty(MuseCommonStrings.BLINK_DRIVE_ENERGY_CONSUMPTION, 1000, "J"); addBaseProperty(MuseCommonStrings.BLINK_DRIVE_ENERGY_CONSUMPTION, 1000, "J");
@ -41,7 +41,7 @@ public class BlinkDriveModule extends PowerModuleBase implements IRightClickModu
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_BLINK_DRIVE; return MODULE_BLINK_DRIVE;
} }
@Override @Override

View file

@ -19,7 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3; import net.minecraft.util.Vec3;
public class GliderModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class GliderModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_GLIDER = "Glider";
public GliderModule() { public GliderModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.gliderWing, 2)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.gliderWing, 2));
@ -37,7 +37,7 @@ public class GliderModule extends PowerModuleBase implements IToggleableModule,
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_GLIDER; return MODULE_GLIDER;
} }
@Override @Override
@ -56,7 +56,7 @@ public class GliderModule extends PowerModuleBase implements IToggleableModule,
ItemStack torso = player.getCurrentArmor(2); ItemStack torso = player.getCurrentArmor(2);
boolean hasParachute = false; boolean hasParachute = false;
if (torso != null && torso.getItem() instanceof IModularItem) { if (torso != null && torso.getItem() instanceof IModularItem) {
hasParachute = MuseItemUtils.itemHasActiveModule(torso, MuseCommonStrings.MODULE_PARACHUTE); hasParachute = MuseItemUtils.itemHasActiveModule(torso, ParachuteModule.MODULE_PARACHUTE);
} }
if (sneakkey && player.motionY < -0.1 && (!hasParachute || forwardkey > 0)) { if (sneakkey && player.motionY < -0.1 && (!hasParachute || forwardkey > 0)) {
if (player.motionY < -0.1) { if (player.motionY < -0.1) {

View file

@ -18,6 +18,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
public class InvisibilityModule extends PowerModuleBase implements IPlayerTickModule, IToggleableModule { public class InvisibilityModule extends PowerModuleBase implements IPlayerTickModule, IToggleableModule {
public static final String MODULE_ACTIVE_CAMOUFLAGE = "Active Camouflage";
public InvisibilityModule() { public InvisibilityModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.laserHologram, 4)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.laserHologram, 4));
@ -37,7 +38,7 @@ public class InvisibilityModule extends PowerModuleBase implements IPlayerTickMo
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_ACTIVE_CAMOUFLAGE; return MODULE_ACTIVE_CAMOUFLAGE;
} }
@Override @Override

View file

@ -18,7 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class JetBootsModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class JetBootsModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_JETBOOTS = "Jet Boots";
public JetBootsModule() { public JetBootsModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorFeet)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorFeet));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 2)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 2));
@ -40,7 +40,7 @@ public class JetBootsModule extends PowerModuleBase implements IToggleableModule
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_JETBOOTS; return MODULE_JETBOOTS;
} }
@Override @Override

View file

@ -18,7 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class JetPackModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class JetPackModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_JETPACK = "Jetpack";
public JetPackModule() { public JetPackModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 4)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 4));
@ -40,7 +40,7 @@ public class JetPackModule extends PowerModuleBase implements IToggleableModule,
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_JETPACK; return MODULE_JETPACK;
} }
@Override @Override

View file

@ -17,7 +17,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class JumpAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class JumpAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_JUMP_ASSIST = "Jump Assist";
public JumpAssistModule() { public JumpAssistModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs));
addSimpleTradeoff(this, "Power", MuseCommonStrings.JUMP_ENERGY_CONSUMPTION, "J", 0, 25, MuseCommonStrings.JUMP_MULTIPLIER, "%", 1, 4); addSimpleTradeoff(this, "Power", MuseCommonStrings.JUMP_ENERGY_CONSUMPTION, "J", 0, 25, MuseCommonStrings.JUMP_MULTIPLIER, "%", 1, 4);
@ -37,7 +37,7 @@ public class JumpAssistModule extends PowerModuleBase implements IToggleableModu
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_JUMP_ASSIST; return MODULE_JUMP_ASSIST;
} }
@Override @Override

View file

@ -18,6 +18,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
public class NightVisionModule extends PowerModuleBase implements IPlayerTickModule, IToggleableModule { public class NightVisionModule extends PowerModuleBase implements IPlayerTickModule, IToggleableModule {
public static final String MODULE_NIGHT_VISION = "Night Vision";
public NightVisionModule() { public NightVisionModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorHead));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.laserHologram, 1)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.laserHologram, 1));
@ -36,7 +37,7 @@ public class NightVisionModule extends PowerModuleBase implements IPlayerTickMod
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_NIGHT_VISION; return MODULE_NIGHT_VISION;
} }
@Override @Override

View file

@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ParachuteModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class ParachuteModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_PARACHUTE = "Parachute";
public ParachuteModule() { public ParachuteModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorTorso));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.parachute, 2)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.parachute, 2));
@ -34,7 +34,7 @@ public class ParachuteModule extends PowerModuleBase implements IToggleableModul
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_PARACHUTE; return MODULE_PARACHUTE;
} }
@Override @Override
@ -50,7 +50,7 @@ public class ParachuteModule extends PowerModuleBase implements IToggleableModul
ItemStack torso = player.getCurrentArmor(2); ItemStack torso = player.getCurrentArmor(2);
boolean hasGlider = false; boolean hasGlider = false;
if (torso != null && torso.getItem() instanceof IModularItem) { if (torso != null && torso.getItem() instanceof IModularItem) {
hasGlider = MuseItemUtils.itemHasActiveModule(torso, MuseCommonStrings.MODULE_GLIDER); hasGlider = MuseItemUtils.itemHasActiveModule(torso, GliderModule.MODULE_GLIDER);
} }
if (sneakkey && player.motionY < -0.1 && (!hasGlider || forwardkey <= 0)) { if (sneakkey && player.motionY < -0.1 && (!hasGlider || forwardkey <= 0)) {
double totalVelocity = Math.sqrt(player.motionX * player.motionX + player.motionZ * player.motionZ + player.motionY * player.motionY) double totalVelocity = Math.sqrt(player.motionX * player.motionX + player.motionZ * player.motionZ + player.motionY * player.motionY)

View file

@ -14,7 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
public class PlasmaCannonModule extends PowerModuleBase implements IRightClickModule { public class PlasmaCannonModule extends PowerModuleBase implements IRightClickModule {
public static final String MODULE_PLASMA_CANNON = "Plasma Cannon";
public PlasmaCannonModule(List<IModularItem> validItems) { public PlasmaCannonModule(List<IModularItem> validItems) {
super(validItems); super(validItems);
addBaseProperty(MuseCommonStrings.PLASMA_CANNON_ENERGY_PER_TICK, 10, "J"); addBaseProperty(MuseCommonStrings.PLASMA_CANNON_ENERGY_PER_TICK, 10, "J");
@ -39,7 +39,7 @@ public class PlasmaCannonModule extends PowerModuleBase implements IRightClickMo
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_PLASMA_CANNON; return MODULE_PLASMA_CANNON;
} }
@Override @Override

View file

@ -21,6 +21,7 @@ import net.minecraft.world.World;
public class RailgunModule extends PowerModuleBase implements IRightClickModule { public class RailgunModule extends PowerModuleBase implements IRightClickModule {
// private List<String> particles; // private List<String> particles;
// private Iterator<String> iterator; // private Iterator<String> iterator;
public static final String MODULE_RAILGUN = "Railgun";
private static String IMPULSE = "Railgun Total Impulse"; private static String IMPULSE = "Railgun Total Impulse";
private static String ENERGY = "Railgun Energy Cost"; private static String ENERGY = "Railgun Energy Cost";
@ -52,7 +53,7 @@ public class RailgunModule extends PowerModuleBase implements IRightClickModule
@Override @Override
public String getName() { public String getName() {
return "Railgun"; return MODULE_RAILGUN;
} }
@Override @Override

View file

@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class SprintAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class SprintAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_SPRINT_ASSIST = "Sprint Assist";
public SprintAssistModule() { public SprintAssistModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs));
addInstallCost(Config.copyAndResize(ItemComponent.servoMotor, 4)); addInstallCost(Config.copyAndResize(ItemComponent.servoMotor, 4));
@ -46,7 +46,7 @@ public class SprintAssistModule extends PowerModuleBase implements IToggleableMo
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_SPRINT_ASSIST; return MODULE_SPRINT_ASSIST;
} }
@Override @Override

View file

@ -15,6 +15,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class StepAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class StepAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_CLIMB_ASSIST = "Uphill Step Assist";
public StepAssistModule() { public StepAssistModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.servoMotor, 2)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.servoMotor, 2));
@ -32,7 +33,7 @@ public class StepAssistModule extends PowerModuleBase implements IToggleableModu
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_CLIMB_ASSIST; return MODULE_CLIMB_ASSIST;
} }
@Override @Override

View file

@ -18,7 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class SwimAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule { public class SwimAssistModule extends PowerModuleBase implements IToggleableModule, IPlayerTickModule {
public static final String MODULE_SWIM_BOOST = "Swim Boost";
public SwimAssistModule() { public SwimAssistModule() {
super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs)); super(Arrays.asList((IModularItem) ModularPowersuits.powerArmorLegs));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 1)); addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.ionThruster, 1));
@ -39,7 +39,7 @@ public class SwimAssistModule extends PowerModuleBase implements IToggleableModu
@Override @Override
public String getName() { public String getName() {
return MuseCommonStrings.MODULE_SWIM_BOOST; return MODULE_SWIM_BOOST;
} }
@Override @Override