added hoe module and tweaked recipes

This commit is contained in:
MachineMuse 2013-03-24 07:15:36 -06:00
parent 0a80f2bc88
commit fecac008c6
4 changed files with 128 additions and 6 deletions

View file

@ -35,6 +35,7 @@ import net.machinemuse.powersuits.powermodule.movement.SwimAssistModule;
import net.machinemuse.powersuits.powermodule.tool.AquaAffinityModule;
import net.machinemuse.powersuits.powermodule.tool.AxeModule;
import net.machinemuse.powersuits.powermodule.tool.DiamondPickUpgradeModule;
import net.machinemuse.powersuits.powermodule.tool.HoeModule;
import net.machinemuse.powersuits.powermodule.tool.PickaxeModule;
import net.machinemuse.powersuits.powermodule.tool.ShearsModule;
import net.machinemuse.powersuits.powermodule.tool.ShovelModule;
@ -209,6 +210,7 @@ public class Config {
addModule(new PickaxeModule(TOOLONLY));
addModule(new ShovelModule(TOOLONLY));
addModule(new ShearsModule(TOOLONLY));
addModule(new HoeModule(TOOLONLY));
// Weapon
module = new ToggleablePowerModule(MuseCommonStrings.MODULE_MELEE_ASSIST, TOOLONLY, "toolfist", MuseCommonStrings.CATEGORY_WEAPON)

View file

@ -49,10 +49,8 @@ import cpw.mods.fml.common.registry.EntityRegistry;
// things that add new blocks/items, false for things like Rei's Minimap or
// Inventory Tweaks.
@NetworkMod(clientSideRequired = true, serverSideRequired = true,
clientPacketHandlerSpec =
@SidedPacketHandler(channels = { "mmmPowersuits" }, packetHandler = MusePacketHandler.class),
serverPacketHandlerSpec =
@SidedPacketHandler(channels = { "mmmPowersuits" }, packetHandler = MusePacketHandler.class))
clientPacketHandlerSpec = @SidedPacketHandler(channels = { "mmmPowersuits" }, packetHandler = MusePacketHandler.class),
serverPacketHandlerSpec = @SidedPacketHandler(channels = { "mmmPowersuits" }, packetHandler = MusePacketHandler.class))
public class ModularPowersuits {
public static ItemPowerArmorHelmet powerArmorHead;
@ -75,7 +73,9 @@ public class ModularPowersuits {
* execute side-specific code like registering renderers (for the client) or
* different tick handlers (for the server).
*/
@SidedProxy(clientSide = "net.machinemuse.powersuits.client.ClientProxy", serverSide = "net.machinemuse.powersuits.common.CommonProxy")
@SidedProxy(
clientSide = "net.machinemuse.powersuits.client.ClientProxy",
serverSide = "net.machinemuse.powersuits.common.CommonProxy")
public static CommonProxy proxy;
/**

View file

@ -0,0 +1,120 @@
package net.machinemuse.powersuits.powermodule.tool;
import java.util.List;
import net.machinemuse.api.IModularItem;
import net.machinemuse.api.IPowerModule;
import net.machinemuse.api.ModuleManager;
import net.machinemuse.api.MuseCommonStrings;
import net.machinemuse.api.MuseItemUtils;
import net.machinemuse.api.electricity.ElectricItemUtils;
import net.machinemuse.api.moduletrigger.IRightClickModule;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.UseHoeEvent;
public class HoeModule extends PowerModuleBase implements IPowerModule, IRightClickModule {
public static final String HOE_ENERGY_CONSUMPTION = "Hoe Energy Consumption";
public HoeModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(new ItemStack(Item.ingotIron, 2));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
addBaseProperty(HOE_ENERGY_CONSUMPTION, 50);
}
@Override
public void onRightClick(EntityPlayer playerClicking, World world, ItemStack item) {
}
@Override
public void onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (!player.canPlayerEdit(x, y, z, side, itemStack))
{
return;
}
else
{
UseHoeEvent event = new UseHoeEvent(player, itemStack, world, x, y, z);
if (MinecraftForge.EVENT_BUS.post(event))
{
return;
}
if (event.getResult() == Result.ALLOW)
{
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(itemStack, HOE_ENERGY_CONSUMPTION));
return;
}
int i1 = world.getBlockId(x, y, z);
int j1 = world.getBlockId(x, y + 1, z);
if ((side == 0 || j1 != 0 || i1 != Block.grass.blockID) && i1 != Block.dirt.blockID)
{
return;
}
else
{
Block block = Block.tilledField;
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F),
block.stepSound.getStepSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if (world.isRemote)
{
return;
}
else
{
world.setBlock(x, y, z, block.blockID);
ElectricItemUtils.drainPlayerEnergy(player, ModuleManager.computeModularProperty(itemStack, HOE_ENERGY_CONSUMPTION));
return;
}
}
}
}
@Override
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY,
float hitZ) {
return false;
}
@Override
public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int par4) {
}
@Override
public String getCategory() {
return MuseCommonStrings.CATEGORY_TOOL;
}
@Override
public String getName() {
return "Rototiller";
}
@Override
public String getDescription() {
return "An automated tilling addon to make it easy to till large swaths of land at once.";
}
@Override
public String getTextureFile() {
return null;
}
@Override
public Icon getIcon(ItemStack item) {
return Item.hoeGold.getIconFromDamage(0);
}
}

View file

@ -37,7 +37,7 @@ public class ShearsModule extends PowerModuleBase implements IBlockBreakingModul
public ShearsModule(List<IModularItem> validItems) {
super(validItems);
addInstallCost(new ItemStack(Item.ingotIron, 3));
addInstallCost(new ItemStack(Item.ingotIron, 2));
addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.solenoid, 1));
addBaseProperty(SHEARING_ENERGY_CONSUMPTION, 50, "J");
addBaseProperty(SHEARING_HARVEST_SPEED, 8, "x");