Registered Machine command

This commit is contained in:
Robert S 2014-05-28 19:54:37 -04:00
parent a0e1f50aee
commit a88bc11666
2 changed files with 107 additions and 94 deletions

View file

@ -106,6 +106,10 @@ public class CommandMachine extends CommandBase
sender.sendChatToPlayer(ChatMessageComponent.createFromText("Failed to set energy! Maybe try a different side?"));
}
}
else
{
sender.sendChatToPlayer(ChatMessageComponent.createFromText("Invalid input value"));
}
}
else
{

View file

@ -4,6 +4,8 @@ import java.util.HashMap;
import java.util.logging.Logger;
import net.minecraft.block.Block;
import net.minecraft.command.ICommandManager;
import net.minecraft.command.ServerCommandManager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
@ -29,6 +31,7 @@ import resonantinduction.core.resource.ResourceGenerator;
import resonantinduction.core.resource.TileDust;
import resonantinduction.core.resource.fluid.ItemOreResourceBucket;
import resonantinduction.core.resource.fluid.TileFluidMixture;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
@ -38,29 +41,24 @@ import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* The core module of Resonant Induction
/** The core module of Resonant Induction
*
* @author Calclavia
*/
* @author Calclavia */
@Mod(modid = ResonantInduction.ID, name = ResonantInduction.NAME, version = Reference.VERSION, dependencies = "required-after:ForgeMultipart@[1.0.0.244,);required-after:ResonantEngine;before:ThermalExpansion;before:Mekanism")
@NetworkMod(channels = Reference.CHANNEL, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
@ModstatInfo(prefix = "resonantin")
public class ResonantInduction
{
/**
* Mod Information
*/
/** Mod Information */
public static final String ID = "ResonantInduction|Core";
public static final String NAME = Reference.NAME;
public static final Logger LOGGER = Logger.getLogger(Reference.NAME);
/**
* Packets
*/
/** Packets */
public static final PacketTile PACKET_TILE = new PacketTile(Reference.CHANNEL);
public static final PacketMultiPart PACKET_MULTIPART = new PacketMultiPart(Reference.CHANNEL);
public static final PacketAnnotation PACKET_ANNOTATION = new PacketAnnotation(Reference.CHANNEL);
@ -73,9 +71,7 @@ public class ResonantInduction
public static CommonProxy proxy;
@Mod.Metadata(ID)
public static ModMetadata metadata;
/**
* Blocks and Items
*/
/** Blocks and Items */
public static Block blockOre;
public static ItemOreResource itemRubble, itemDust, itemRefinedDust;
public static ItemOreResourceBucket itemBucketMixture, itemBucketMolten;
@ -96,9 +92,7 @@ public class ResonantInduction
blockMachinePart = contentRegistry.createBlock(BlockMachineMaterial.class, ItemBlockMetadata.class);
/**
* Melting dusts
*/
/** Melting dusts */
blockDust = contentRegistry.createBlock("dust", BlockDust.class, null, TileDust.class).setCreativeTab(null);
blockRefinedDust = contentRegistry.createBlock("refinedDust", BlockDust.class, null, TileDust.class).setCreativeTab(null);
@ -145,12 +139,27 @@ public class ResonantInduction
Settings.CONFIGURATION.save();
}
/**
* Recipe Types
*/
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
// Setup command
CommandMachine commandSentry = new CommandMachine();
MinecraftForge.EVENT_BUS.register(commandSentry);
ICommandManager commandManager = FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager();
ServerCommandManager serverCommandManager = ((ServerCommandManager) commandManager);
serverCommandManager.registerCommand(commandSentry);
}
/** Recipe Types */
public static enum RecipeType
{
CRUSHER, GRINDER, MIXER, SMELTER, SAWMILL;
CRUSHER,
GRINDER,
MIXER,
SMELTER,
SAWMILL;
}
}