Merge pull request #207 from Andrew2448/MFFS
Added MFFSFieldTeleporter module.
This commit is contained in:
commit
dbd14b065d
6 changed files with 111 additions and 5 deletions
10
build.xml
10
build.xml
|
@ -77,6 +77,7 @@
|
|||
<available file="${download.dir}/forestry-api-${forestryapi.version}.zip"/>
|
||||
<available file="${download.dir}/scalalib-${scala.version}.zip"/>
|
||||
<available file="${download.dir}/ThaumcraftApi ${thaumcraftapi.version}.zip" />
|
||||
<available file="${download.dir}/MFFS2_API.zip" />
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
|
@ -124,6 +125,10 @@
|
|||
<get src="http://machinemuse.minecraftforge.net/ThaumcraftApi ${thaumcraftapi.version}.zip"
|
||||
dest="${download.dir}/ThaumcraftApi ${thaumcraftapi.version}.zip"/>
|
||||
|
||||
<echo message="Downloading MFFS API..." />
|
||||
<get src="http://machinemuse.minecraftforge.net/MFFS2_API.zip"
|
||||
dest="${download.dir}/MFFS2_API.zip" />
|
||||
|
||||
<echo message="Downloading Scala Libraries..."/>
|
||||
<get src="http://machinemuse.minecraftforge.net/scalalib-${scala.version}.zip"
|
||||
dest="${download.dir}/scalalib-${scala.version}.zip"/>
|
||||
|
@ -231,6 +236,11 @@
|
|||
<move file="${download.dir}/thaumcraft/api/EnumTag.java" todir="${mcpsrc.dir}/thaumcraft/api"/>
|
||||
<move file="${download.dir}/thaumcraft/api/ThaumcraftApiHelper.java" todir="${mcpsrc.dir}/thaumcraft/api"/>
|
||||
|
||||
<echo message="Extracting MFFS API..." />
|
||||
<unzip src="${download.dir}/MFFS2_API.zip" dest="${download.dir}"/>
|
||||
<mkdir dir="${mcpsrc.dir}/mods/mffs/api" />
|
||||
<move file="${download.dir}/mods/mffs/api/IFieldTeleporter.java" todir="${mcpsrc.dir}/mods/mffs/api" />
|
||||
<move file="${download.dir}/mods/mffs/api/IMFFS_Wrench.java" todir="${mcpsrc.dir}/mods/mffs/api" />
|
||||
|
||||
<echo message="Extracting Scala Libraries..."/>
|
||||
<unzip src="${download.dir}/scalalib-${scala.version}.zip" dest="${mcp.dir}"/>
|
||||
|
|
BIN
mods/mmmPowersuits/textures/items/fieldteleporter.png
Normal file
BIN
mods/mmmPowersuits/textures/items/fieldteleporter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 268 B |
|
@ -10,7 +10,9 @@ import net.machinemuse.powersuits.powermodule.armor.HazmatModule;
|
|||
import net.machinemuse.powersuits.powermodule.misc.AirtightSealModule;
|
||||
import net.machinemuse.powersuits.powermodule.misc.ThaumGogglesModule;
|
||||
import net.machinemuse.powersuits.powermodule.tool.GrafterModule;
|
||||
import net.machinemuse.powersuits.powermodule.tool.MFFSFieldTeleporterModule;
|
||||
import net.machinemuse.powersuits.powermodule.tool.MultimeterModule;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
|
@ -51,6 +53,10 @@ public class ModCompatability {
|
|||
return Loader.isModLoaded("Forestry");
|
||||
}
|
||||
|
||||
public static boolean isMFFS2Loaded() {
|
||||
return Loader.isModLoaded("ModularForceFieldSystem");
|
||||
}
|
||||
|
||||
public static boolean enableThaumGogglesModule() {
|
||||
boolean defaultval = isThaumCraftLoaded();
|
||||
return Config.getConfig().get("Special Modules", "Thaumcraft Goggles Module", defaultval).getBoolean(defaultval);
|
||||
|
@ -164,6 +170,11 @@ public class ModCompatability {
|
|||
ModuleManager.addModule(new GrafterModule(Collections.singletonList((IModularItem) ModularPowersuits.powerTool)));
|
||||
ModuleManager.addModule(new ApiaristArmorModule(Arrays.<IModularItem>asList(ModularPowersuits.powerArmorHead, ModularPowersuits.powerArmorTorso, ModularPowersuits.powerArmorLegs, ModularPowersuits.powerArmorFeet)));
|
||||
}
|
||||
|
||||
// MFFS2
|
||||
if (isMFFS2Loaded()) {
|
||||
ModuleManager.addModule(new MFFSFieldTeleporterModule(Collections.singletonList((IModularItem) ModularPowersuits.powerTool)));
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack getThermexItem(String name, int quantity) {
|
||||
|
@ -192,4 +203,15 @@ public class ModCompatability {
|
|||
MuseLogger.logError("Failed to get Forestry item " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ItemStack getMFFSItem(String name, int quantity) {
|
||||
try {
|
||||
Object obj = Class.forName("mods.mffs.common.ModularForceFieldSystem").getField("MFFSitemFieldTeleporter").get(null);
|
||||
ItemStack stack = new ItemStack((Item) obj, quantity);
|
||||
return stack;
|
||||
} catch (Exception e) {
|
||||
}
|
||||
MuseLogger.logError("Failed to get MFFS item " + name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package net.machinemuse.powersuits.item;
|
||||
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.arboriculture.IToolGrafter;
|
||||
import mods.mffs.api.IFieldTeleporter;
|
||||
import mods.railcraft.api.core.items.IToolCrowbar;
|
||||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.api.IPowerModule;
|
||||
|
@ -14,6 +16,7 @@ import net.machinemuse.api.moduletrigger.IRightClickModule;
|
|||
import net.machinemuse.general.gui.MuseIcon;
|
||||
import net.machinemuse.powersuits.common.Config;
|
||||
import net.machinemuse.powersuits.powermodule.tool.GrafterModule;
|
||||
import net.machinemuse.powersuits.powermodule.tool.MFFSFieldTeleporterModule;
|
||||
import net.machinemuse.powersuits.powermodule.tool.OmniWrenchModule;
|
||||
import net.machinemuse.powersuits.powermodule.weapon.MeleeAssistModule;
|
||||
import net.machinemuse.utils.ElectricItemUtils;
|
||||
|
@ -45,7 +48,8 @@ public class ItemPowerGauntlet extends ItemElectricTool
|
|||
IToolCrowbar,
|
||||
IToolGrafter,
|
||||
IToolConfigurator,
|
||||
IToolHammer {
|
||||
IToolHammer,
|
||||
IFieldTeleporter {
|
||||
public static int assignedItemID;
|
||||
String iconpath = MuseIcon.ICON_PREFIX + "handitem";
|
||||
|
||||
|
@ -311,8 +315,7 @@ public class ItemPowerGauntlet extends ItemElectricTool
|
|||
player.swingItem();
|
||||
}
|
||||
|
||||
|
||||
// Forestry
|
||||
// Grafter Module
|
||||
@Override
|
||||
public float getSaplingModifier(ItemStack stack, World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (MuseItemUtils.itemHasActiveModule(stack, GrafterModule.MODULE_GRAFTER)) {
|
||||
|
@ -321,4 +324,28 @@ public class ItemPowerGauntlet extends ItemElectricTool
|
|||
}
|
||||
return 0F;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* MFFS Field Teleporter Module
|
||||
*
|
||||
*/
|
||||
public boolean canFieldTeleport(EntityPlayer player, ItemStack stack, int teleportCost) {
|
||||
if (MuseItemUtils.itemHasModule(stack, MFFSFieldTeleporterModule.MODULE_FIELD_TELEPORTER)) {
|
||||
if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, MFFSFieldTeleporterModule.FIELD_TELEPORTER_ENERGY_CONSUMPTION)) {
|
||||
return true;
|
||||
}
|
||||
else if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
player.sendChatToPlayer("[Field Security] Could not teleport through forcefield. 10,000J is required to teleport.");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void onFieldTeleportSuccess(EntityPlayer player, ItemStack stack, int teleportCost) {
|
||||
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(stack, MFFSFieldTeleporterModule.FIELD_TELEPORTER_ENERGY_CONSUMPTION));
|
||||
}
|
||||
|
||||
public void onFieldTeleportFailed(EntityPlayer player, ItemStack stack, int teleportCost) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package net.machinemuse.powersuits.powermodule.tool;
|
||||
|
||||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.powersuits.common.ModCompatability;
|
||||
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
|
||||
import net.machinemuse.utils.MuseCommonStrings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by User: Andrew2448
|
||||
* 7:21 PM 4/25/13
|
||||
*/
|
||||
public class MFFSFieldTeleporterModule extends PowerModuleBase {
|
||||
public static final String MODULE_FIELD_TELEPORTER = "MFFS Field Teleporter";
|
||||
public static final String FIELD_TELEPORTER_ENERGY_CONSUMPTION = "Field Teleporter Energy Consumption";
|
||||
|
||||
public MFFSFieldTeleporterModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addBaseProperty(FIELD_TELEPORTER_ENERGY_CONSUMPTION, 10000, "J");
|
||||
addInstallCost(ModCompatability.getMFFSItem("MFFSitemFieldTeleporter", 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return MuseCommonStrings.CATEGORY_TOOL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MODULE_FIELD_TELEPORTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "A tool which allows you to teleport through MFFS forcefields that you own if you have enough energy.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureFile() {
|
||||
return "fieldteleporter";
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
import ic2.api.energy.tile.IEnergySink;
|
||||
import ic2.api.energy.tile.IEnergySource;
|
||||
import ic2.api.tile.IWrenchable;
|
||||
import mods.mffs.api.IMFFS_Wrench;
|
||||
import net.machinemuse.api.IModularItem;
|
||||
import net.machinemuse.api.moduletrigger.IRightClickModule;
|
||||
import net.machinemuse.powersuits.item.ItemComponent;
|
||||
|
@ -30,12 +31,10 @@ import java.util.List;
|
|||
*/
|
||||
public class OmniWrenchModule extends PowerModuleBase implements IRightClickModule {
|
||||
public static final String MODULE_OMNI_WRENCH = "Prototype OmniWrench";
|
||||
public static final String OMNI_WRENCH_ENERGY_CONSUMPTION = "OmniWrench Energy Consumption";
|
||||
public static final int[] SIDE_OPPOSITE = {1, 0, 3, 2, 5, 4};
|
||||
|
||||
public OmniWrenchModule(List<IModularItem> validItems) {
|
||||
super(validItems);
|
||||
addBaseProperty(OMNI_WRENCH_ENERGY_CONSUMPTION, 100);
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.controlCircuit, 1));
|
||||
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.servoMotor, 2));
|
||||
}
|
||||
|
@ -100,6 +99,11 @@ public class OmniWrenchModule extends PowerModuleBase implements IRightClickModu
|
|||
if (player.isSneaking()) {
|
||||
side = OmniWrenchModule.SIDE_OPPOSITE[side];
|
||||
}
|
||||
|
||||
if (((tile instanceof IMFFS_Wrench)) && (!((IMFFS_Wrench)tile).wrenchCanManipulate(player, side))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((side == wrenchTile.getFacing()) && (wrenchTile.wrenchCanRemove(player))) {
|
||||
ItemStack dropBlock = wrenchTile.getWrenchDrop(player);
|
||||
|
||||
|
|
Loading…
Reference in a new issue