Jump to content

Recommended Posts

Posted

I made what I thought was purely client-side: A mod where the player have 3 custom items that can be used as replacement of posting strings to chat. The plugin works fine when using it locally, but when I try to use the mod in a server, I have the items, but using them yields no results at all.

 

An example of one of my item classes:

package com.mta.utzonmod.items;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import com.mta.utzonmod.client.gui.signInputGui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.command.ICommandManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.gui.MinecraftServerGui;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;

public class Paste extends ItemBase{ 
    public Paste(String name) {
        
        super(name);
    }
    
    static boolean canPlace = false;
    
    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand handIn) {
            if(canPlace == true) {
                EntityPlayerSP playerSP = Minecraft.getMinecraft().player;
                playerSP.sendChatMessage("//paste");
                canPlace = false;
                Undo.setCanUndo(true);
            }
        return super.onItemRightClick(worldIn, player, handIn);    
    }
    
    public static void setCanPlace(boolean cPlace) {
        canPlace = cPlace;
    }
}

 

Am I using something that's server sided?
 

Posted (edited)
  On 5/3/2018 at 9:43 AM, diesieben07 said:

The code you posted above is completely broken.

Sponge is not needed, you need a Forge server.

Expand  

As it's been working fine locally, how can it be completely broken?

 

Edit: Just tried running it on my server and it is indeed absolutely broken - would however like to know why so I can fix it =)

 

Edit2: Added log if it helps in any way.

[11:58:05] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[11:58:05] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[11:58:05] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[11:58:05] [main/INFO] [FML]: Forge Mod Loader version 14.23.3.2655 for Minecraft 1.12.2 loading
[11:58:05] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_131, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_131
[11:58:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[11:58:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[11:58:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[11:58:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[11:58:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[11:58:09] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[11:58:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[11:58:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[11:58:11] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[11:58:11] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[11:58:11] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[11:58:18] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[11:58:18] [Server thread/INFO] [FML]: MinecraftForge v14.23.3.2655 Initialized
[11:58:18] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[11:58:18] [Server thread/INFO] [FML]: Replaced 1036 ore ingredients
[11:58:19] [Server thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer
[11:58:19] [Server thread/INFO] [FML]: Searching C:\Users\Frederik\Desktop\Forge server\mods for mods
[11:58:19] [Server thread/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[11:58:19] [Server thread/WARN] [FML]: Missing English translation for FML: assets/fml/lang/en_us.lang
[11:58:20] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, um] at CLIENT
[11:58:20] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, um] at SERVER
[11:58:21] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[11:58:21] [Server thread/INFO] [FML]: Found 1168 ObjectHolder annotations
[11:58:21] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[11:58:21] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[11:58:21] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[11:58:21] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[11:58:21] [Server thread/INFO] [FML]: Applying holder lookups
[11:58:22] [Server thread/INFO] [FML]: Holder lookups applied
[11:58:22] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@67fc26f6:
java.lang.NoClassDefFoundError: com/mta/utzonmod/client/gui/signInputGui
	at com.mta.utzonmod.items.SchematicSign.<init>(SchematicSign.java:21) ~[SchematicSign.class:?]
	at com.mta.utzonmod.init.ModItems.<clinit>(ModItems.java:15) ~[ModItems.class:?]
	at com.mta.utzonmod.util.handlers.RegistryHandler.onItemRegister(RegistryHandler.java:16) ~[RegistryHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_RegistryHandler_onItemRegister_Register.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) ~[EventBus$1.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) [EventBus.class:?]
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:739) [GameData.class:?]
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604) [Loader.class:?]
	at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) [FMLServerHandler.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:332) [FMLCommonHandler.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [nz.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Caused by: java.lang.ClassNotFoundException: com.mta.utzonmod.client.gui.signInputGui
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@28a2a3e7 from coremod FMLCorePlugin
	at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:262) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
Caused by: java.lang.RuntimeException: Attempted to load class com/mta/utzonmod/client/gui/signInputGui for invalid side SERVER
	at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:258) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
[11:58:22] [Server thread/ERROR] [FML]: Index: 2 Listeners:
[11:58:22] [Server thread/ERROR] [FML]: 0: NORMAL
[11:58:22] [Server thread/ERROR] [FML]: 1: net.minecraftforge.fml.common.eventhandler.EventBus$1@26df43d6
[11:58:22] [Server thread/ERROR] [FML]: 2: net.minecraftforge.fml.common.eventhandler.EventBus$1@56679711
[11:58:22] [Server thread/ERROR] [net.minecraft.server.MinecraftServer]: Encountered an unexpected exception
java.lang.NoClassDefFoundError: com/mta/utzonmod/client/gui/signInputGui
	at com.mta.utzonmod.items.SchematicSign.<init>(SchematicSign.java:21) ~[SchematicSign.class:?]
	at com.mta.utzonmod.init.ModItems.<clinit>(ModItems.java:15) ~[ModItems.class:?]
	at com.mta.utzonmod.util.handlers.RegistryHandler.onItemRegister(RegistryHandler.java:16) ~[RegistryHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_5_RegistryHandler_onItemRegister_Register.invoke(.dynamic) ~[?:?]
	at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus$1.invoke(EventBus.java:143) ~[EventBus$1.class:?]
	at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:179) ~[EventBus.class:?]
	at net.minecraftforge.registries.GameData.fireRegistryEvents(GameData.java:739) ~[GameData.class:?]
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:604) ~[Loader.class:?]
	at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98) ~[FMLServerHandler.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:332) ~[FMLCommonHandler.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) ~[nz.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_131]
Caused by: java.lang.ClassNotFoundException: com.mta.utzonmod.client.gui.signInputGui
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@28a2a3e7 from coremod FMLCorePlugin
	at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:262) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
Caused by: java.lang.RuntimeException: Attempted to load class com/mta/utzonmod/client/gui/signInputGui for invalid side SERVER
	at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:258) ~[forge-1.12.2-14.23.3.2655-universal.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) ~[launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) ~[launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_131]
	... 14 more
[11:58:22] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[11:58:22] [Server thread/ERROR] [net.minecraft.server.MinecraftServer]: This crash report has been saved to: C:\Users\Frederik\Desktop\Forge server\.\crash-reports\crash-2018-05-03_11.58.22-server.txt
[11:58:22] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[11:58:22] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds
[11:58:22] [Server thread/WARN] [FML]: Can't revert to frozen GameData state without freezing first.
[11:58:22] [Server thread/INFO] [FML]: The state engine was in incorrect state INITIALIZATION and forced into state SERVER_STOPPED. Errors may have been discarded.
[11:58:22] [Server Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[11:58:22] [Server Shutdown Thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds

 

Edited by Stenbergcsgo
Posted
  On 5/3/2018 at 9:46 AM, Stenbergcsgo said:

[11:58:22] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.RegistryEvent$Register@67fc26f6: java.lang.NoClassDefFoundError: com/mta/utzonmod/client/gui/signInputGui

Expand  

You cannot have any references to any client side classes outside of your ClientProxy on the server, otherwise it will crash, as the server does not know about those classes.

http://mcforge.readthedocs.io/en/latest/concepts/sides/

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

    • If you’ve lost crypto to a scam, don’t let shame or fear keep you silent. There are real experts out there who know how to fight back. Dexdert Net Recovery did the impossible for me, and they can do it for others too. Contact Dexdet Net Recovery For Help Visa Information Below:    
    • Hi everyone, I'm currently developing a Forge 1.21 mod for Minecraft and I want to display a custom HUD overlay for a minigame. My goal: When the game starts, all players should see an item/block icon (from the base game, not a custom texture) plus its name/text in the HUD – similar to how the bossbar overlay works. The HUD should appear centered above the hotbar (or at a similar prominent spot), and update dynamically (icon and name change as the target item changes). What I've tried: I looked at many online tutorials and several GitHub repos (e.g. SeasonHUD, MiniHUD), but most of them use NeoForge or Forge versions <1.20 that provide the IGuiOverlay API (e.g. implements IGuiOverlay, RegisterGuiOverlaysEvent). In Forge 1.21, it seems that neither IGuiOverlay nor RegisterGuiOverlaysEvent exist anymore – at least, I can't import them and they are missing from the docs and code completion. I tried using RenderLevelStageEvent as a workaround but it is probably not intended for custom HUDs. I am not using NeoForge, and switching the project to NeoForge is currently not an option for me. I tried to look at the original minecraft source code to see how elements like hearts, hotbar etc are drawn on the screen but I am too new to Minecraft modding to understand. What I'm looking for: What is the correct way to add a custom HUD element (icon + text) in Forge 1.21, given that the previous overlay API is missing? Is there a new recommended event, callback, or method in Forge 1.21 for custom HUD overlays, or is everyone just using a workaround? Is there a minimal open-source example repo for Forge 1.21 that demonstrates a working HUD overlay without relying on NeoForge or deprecated Forge APIs? My ideal solution: Centered HUD element with an in-game item/block icon (from the base game's assets, e.g. a diamond or any ItemStack / Item) and its name as text, with a transparent background rectangle. It should be visible to the players when the mini game is running. Easy to update the item (e.g. static variable or other method), so it can change dynamically during the game. Any help, code snippets, or up-to-date references would be really appreciated! If this is simply not possible right now in Forge 1.21, it would also help to know that for sure. Thank you very much in advance!
    • The simple answer is there is not an easy way. You would need to know how to program in Java, as well as at least some familiarity with how Forge works so you could port the differences. You would also need the sourcecode for the original mod, and permission from the author to modify it, if they did not use some sort of open source license. So it's not impossible, but it would take some effort, but doing so would open up a whole new world of possibilities for you!
    • Does it still crash if you remove holdmyitems? Looks like that mod doesn't work on a server as far as I can tell from the error.  
  • Topics

×
×
  • Create New...

Important Information

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