Jump to content

Recommended Posts

Posted

Hello,

I want to Make mod that Adds Block, and When Player will right click it, it will open gui with

buttons and textboxes. when player will click one of the buttons mod will execute server command as console.

 

I made Mod that Adds Block but it can only open GUI when player is in singleplayer. when i start mcpc-plus 1.5.2 server it says that it cant find GuiScreen class. i wont my mod to work on server and players were able to place blocks on server, open GUI when they rightclick block and when they will click buttons it will execute server command as console. How to do this?

Posted

so its means its impossible to make block that opens GUI when more than two players are playing ?

(i have already made block and GUI but they are working only on test mode)

 

Heres My Code to open GUI:

    @Override
    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)
    {
    	if(player.getCurrentEquippedItem() != null)
    	{
    		Item equipped = player.getCurrentEquippedItem() != null ? player.getCurrentEquippedItem().getItem() : null;
    		Item it123 = Main.myitem;
    		if(equipped.equals(it123))
    		{
    			ModLoader.openGUI(player, new mygui(player));
    		}
    	}
    	return true;
    }

Posted
  On 10/16/2013 at 4:43 AM, Gigi10012 said:

so its means its impossible to make block that opens GUI when more than two players are playing ?

No, not if you do it like the tutorials say it should be done.

 

ModLoader.openGUI(player, new mygui(player));

Which is not with a ModLoader method. Use IGuiHandler, and use EntityPlayer.openGui() on the server side only. Like GotoLink said twice, check tutorials.

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Posted

Ok. i added Gui Handler and changed code.

 

Gui Handler:

public class myGuiHandler implements IGuiHandler {
    //returns an instance of the Container you made earlier
    @Override
    public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) 
    {
    	if(id == 0)
    	{
            return new myGui1(player);
    	}
    	else if(id == 1)
    	{
    		return new myGui2(player);
    	}
    	return null;
    }

    //returns an instance of the Gui you made earlier
    @Override
    public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) 
    {
    	if(id == 0)
    	{
            return new myGui1(player);
    	}
    	else if(id == 1)
    	{
    		return new myGui2(player);
    	}
    	return null;
    }
}

 

on test run it says that mod tried to open gui without being a NetworkMod

and on block to open GuiScreen i used:

player.openGui(gigsMod.instance, 0, world, x, y, z);

 

i have compiled it and placed it on mcpc-plus server but it gave strange error:

 

	at cpw.mods.fml.common.LoadController.transition(LoadController.java:147)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:516)
at cpw.mods.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:85)
at cpw.mods.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:350)
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:94)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:574)
at net.minecraft.server.ThreadMinecraftServer.run(SourceFile:573)
Caused by: java.lang.NoSuchMethodError: net.minecraft.block.Block.func_94330_A()Ljava/lang/String;
at Gigi10012.gigisMod.preInit(gigisMod.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

Posted
  Quote

Caused by: java.lang.NoSuchMethodError: net.minecraft.block.Block.func_94330_A()Ljava/lang/String;

at Gigi10012.gigisMod.preInit(gigisMod.java:59)

Show us your gigisMod.java, and highlight line 59, please.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • My name is Richie Leo, and I’m sharing this message with a heart full of gratitude and hope. Several months ago, I was a victim of a devastating online scam that cost me a staggering $873,463. I was devastated, confused, and had nearly given up on ever recovering my money — until I came across Wizard George Cyber Service. Through their exceptional cyber recovery expertise and deep investigative skills, Wizard George and his team were able to trace, track, and recover the full amount that was stolen from me. Their professionalism, speed, and transparency truly amazed me. If you’re reading this and you’ve been scammed — whether it’s crypto, investment fraud, or any kind of online theft — don’t give up. I strongly recommend reaching out to Wizard George Cyber Service. 📧 Em: wizardgeorgecyberservice(AT) g m a l L. C o M
    • Alright, here is the log file https://mclo.gs/5eCwafV
    • Please read the FAQ (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/) and post log files as described there, using a site such as https://mclo.gs/ and post the link here.  
    • I tried updating the mods in my modpack which caused incompatibilities so i have tried to revert them back to their older versions i was using before. In the logs it doesnt show me any clear incompatibilities except for tfmg & entity texture features, but when i try to remove those it still doesn't work. I have tried removing the forge-client.toml file which was a suggestion i found on  a few other posts. This is the log file i get. [inline log removed] Any help would be appreciated. Thanks in advance
    • I don't use KubeJS, never even heard of it. But after doing what "Ugdhar" suggested earlier in this post with the "config/Mekanism/generator-storage.toml", I tried going into an individual save's serverconfig folder, and just deleting everything except the parcool folder (I have that mod installed.) Then, a bit of loading and temporary freezing later, seems to have worked. Even when quitting to menu and loading back in, or also when quitting to menu, exiting to desktop, and re-launching MC, choose a save and loading it.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.