I've been trying to get a GUI to open by right-clicking in Forge, but with no luck. It seems almost impossible, and I am on the verge of rage-quitting forge.
The problem is, whenever I right-click the block, I get this error message:
[WARNING] [ForgeModLoader] A mod tried to open a gui on the server without being a NetworkMod
But clearly, my mod is a NetworkMod (here is my code):
package net.minecraft.src;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
@Mod(modid ="RR", name = "Renewable Resources", version = "beta 2.2.1")
public class mod_RenewableResources
{
public static mod_RenewableResources instance;
public static final Block multiPurposeIdle;
public static final Block multiPurposeActive;
public static final Block recipeAdder;
public mod_RenewableResources()
{
super();
}
@Init
public void load(FMLInitializationEvent event)
{
MinecraftForgeClient.preloadTexture("/renewableResources.png");
GameRegistry.registerBlock(multiPurposeIdle);
GameRegistry.registerBlock(multiPurposeActive);
GameRegistry.registerBlock(recipeAdder);
LanguageRegistry.addName(multiPurposeIdle, "Multi-Purpose Block");
LanguageRegistry.addName(multiPurposeActive, "Multi-Purpose Block");
LanguageRegistry.addName(recipeAdder, "Recipe Adder");
Block.fire.setCreativeTab(CreativeTabs.tabDeco);
//Irrelevant recipes omitted for brevity
GameRegistry.registerTileEntity(net.minecraft.src.TileEntityMultiPurpose.class, "MultiPurpose");
GameRegistry.registerTileEntity(TileEntityRecipeAdder.class, "RecipeAdder");
MinecraftForge.EVENT_BUS.register(new EventHookRenewableResources());
GameRegistry.registerFuelHandler(new RenewableResourcesFuelHandler());
RenderingRegistry.registerBlockHandler(new RenewableResourcesBlockRenderHandler());
NetworkRegistry.instance().registerGuiHandler(this, new RenewableResourcesGuiHandler());
}
static
{
multiPurposeIdle = (new BlockMultiPurpose(160, false)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setBlockName("Multi-Purpose Block").setRequiresSelfNotify();
multiPurposeActive = (new BlockMultiPurpose(161, true)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setLightValue(0.875F).setBlockName("Multi-Purpose Block").setRequiresSelfNotify();
recipeAdder = (new BlockRecipeAdder(162)).setHardness(5F).setResistance(10F).setStepSound(Block.soundMetalFootstep).setLightValue(0.5F).setBlockName("Recipe Adder");
}
}
Does anyone have any idea what's going wrong? How can I make my mod a NetworkMod? Because that annotation clearly is not working.
So far, every time I have asked for modding help on these forums, no one has ever helped. I hope things will be different this time.
EDIT: The problem is now solved. Here is my new, working code.
package net.minecraft.src;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
@Mod(modid ="RR", name = "Renewable Resources", version = "beta 2.2.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false,
clientPacketHandlerSpec = @SidedPacketHandler(channels = {"RenewableResources" }, packetHandler = RenewableResourcesClientPacketHandler.class),
serverPacketHandlerSpec = @SidedPacketHandler(channels = {"RenewableResources" }, packetHandler = RenewableResourcesServerPacketHandler.class))
public class RenewableResourcesMod
{
@Instance
public static RenewableResourcesMod instance = new RenewableResourcesMod();
@SidedProxy(clientSide = "net.minecraft.src.RenewableResourcesClientProxy", serverSide = "net.minecraft.src.RenewableResourcesCommonProxy")
public static RenewableResourcesCommonProxy proxy;
public static final Block multiPurposeIdle;
public static final Block multiPurposeActive;
public static final Block recipeAdder;
public RenewableResourcesMod()
{
super();
}
@Init
public void load(FMLInitializationEvent event)
{
MinecraftForgeClient.preloadTexture("/renewableResources.png");
GameRegistry.registerBlock(multiPurposeIdle);
GameRegistry.registerBlock(multiPurposeActive);
GameRegistry.registerBlock(recipeAdder);
LanguageRegistry.addName(multiPurposeIdle, "Multi-Purpose Block");
LanguageRegistry.addName(multiPurposeActive, "Multi-Purpose Block");
LanguageRegistry.addName(recipeAdder, "Recipe Adder");
Block.fire.setCreativeTab(CreativeTabs.tabDeco);
//recipes omitted for brevity
GameRegistry.registerTileEntity(net.minecraft.src.TileEntityMultiPurpose.class, "MultiPurpose");
GameRegistry.registerTileEntity(TileEntityRecipeAdder.class, "RecipeAdder");
MinecraftForge.EVENT_BUS.register(new RenewableResourcesEvent());
GameRegistry.registerFuelHandler(new RenewableResourcesFuelHandler());
RenderingRegistry.registerBlockHandler(new RenewableResourcesBlockRenderHandler());
NetworkRegistry.instance().registerGuiHandler(this, new RenewableResourcesGuiHandler());
}
static
{
multiPurposeIdle = (new BlockMultiPurpose(160, false)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setBlockName("Multi-Purpose Block").setRequiresSelfNotify();
multiPurposeActive = (new BlockMultiPurpose(161, true)).setHardness(3.5F).setStepSound(Block.soundStoneFootstep).setLightValue(0.875F).setBlockName("Multi-Purpose Block").setRequiresSelfNotify();
recipeAdder = (new BlockRecipeAdder(162)).setHardness(5F).setResistance(10F).setStepSound(Block.soundMetalFootstep).setLightValue(0.5F).setBlockName("Recipe Adder");
}
}
i think you need to change the serverSideRequired from false to true if you are on a server. hope it helps. i just started coding myself, but i know some things.
While it probably doesn't matter I notice your @Mod is below @Networkmod, Mine is above it. So is the one in that tutorial. Perphaps Its not registering as a network mod is because your declaring @Network before you've told forge about your mod?
i think you need to change the serverSideRequired from false to true if you are on a server. hope it helps. i just started coding myself, but i know some things.
I know you don't need to enable it to true to run on a server. What I think this does is makes the server side component required for the mod to run at all. Which would be useful for serverside only mods.
While it probably doesn't matter I notice your @Mod is below @Networkmod, Mine is above it. So is the one in that tutorial. Perphaps Its not registering as a network mod is because your declaring @Network before you've told forge about your mod?
I know you don't need to enable it to true to run on a server. What I think this does is makes the server side component required for the mod to run at all. Which would be useful for serverside only mods.
Thanks for showing me the tutorial! After looking at it, I realized that I had to add more to the annotation, as well as add more variables and annotations. Everything works now.
The problem is, whenever I right-click the block, I get this error message:
But clearly, my mod is a NetworkMod (here is my code):
Does anyone have any idea what's going wrong? How can I make my mod a NetworkMod? Because that annotation clearly is not working.
So far, every time I have asked for modding help on these forums, no one has ever helped. I hope things will be different this time.
EDIT: The problem is now solved. Here is my new, working code.
Is it a container GUI, and have you checked out http://www.minecraft...-gui-tutorial/.
While it probably doesn't matter I notice your @Mod is below @Networkmod, Mine is above it. So is the one in that tutorial. Perphaps Its not registering as a network mod is because your declaring @Network before you've told forge about your mod?
I know you don't need to enable it to true to run on a server. What I think this does is makes the server side component required for the mod to run at all. Which would be useful for serverside only mods.
Thanks for showing me the tutorial! After looking at it, I realized that I had to add more to the annotation, as well as add more variables and annotations. Everything works now.