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
4 minutes ago, diesieben07 said:

Yes, adding new items requires a server-side component.

So what would make sense in this situation? I'm using a Spigot server, so would the preferable way to go make a bukkit plugin?

Posted
1 minute ago, diesieben07 said:

No, you can't add new items using bukkit as far as I know.

You need to install your Forge mod on the server.

Would this require me to modify code, or simple set up something like sponge and add the mod?

Posted (edited)
19 minutes ago, diesieben07 said:

The code you posted above is completely broken.

Sponge is not needed, you need a Forge server.

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
50 minutes ago, 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

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

    • I want to create block with entity, that will have height of 3 or more(configurable) and I tried to change first VoxelShape by increasing collision box on height I want and for changing block height on visual side i tried to configure BlockModelBuilder:  base.element() .from(0, 0, 0) .to(16f, 48f, 16f) .face(Direction.UP).texture("#top").end() .face(Direction.DOWN).texture("#bottom").end() .face(Direction.NORTH).texture("#side").end() .face(Direction.SOUTH).texture("#side").end() .face(Direction.WEST).texture("#side").end() .face(Direction.EAST).texture("#side").end() .end(); but, getting crash with next error: Position y out of range, must be within [-16, 32]. Found: %d [48.0]; Looks like game wont to block height modified by more than 32. Is there any way to fix that problem?
    • As long as the packets you are sending aren't lost, there's nothing wrong with what you're currently doing. Although, this sounds like something that would benefit from you making your own datapack registry instead of trying to arbitrarily sync static maps. Check out `DataPackRegistryEvent.NewRegistry`.
    • Hey all, I've been working a lot with datapacks lately, and I'm wondering what the most efficient way to get said data from server to client is.  I'm currently using packets, but given that a lot of the data I'm storing involves maps along the lines of Map<ResourceLocation, CustomDataType>, it can easily start to get messy if I need to transmit a lot of that data all at once. Recently I started looking into the ReloadableServerResources class, which is where Minecraft stores its built-ins.  I see you can access it via the server from the server's resources.managers, and it seems like this can be done even from the client to appropriately retrieve data from the server, unless I'm misunderstanding.  However, from what I can tell, this only works via built-in methods such as getRecipeManager() or getLootTables(), etc.  These are all SimpleJsonResourceReloadListeners, just like my datapack entries are, so it seems like it could be possible for me to access my datapack entries similarly?  But I don't see anywhere in ReloadableServerResources that stores loaded modded entries, so either I'm looking in the wrong place or it doesn't seem to be a thing. Are packets really the best way of doing this, or am I missing a method that would let me use ReloadableServerResources or something similar?
    • Hi, everyone! I'm new to minecraft modding stuff and want ask you some questions. 1. I checked forge references and saw there com.mojang and net.minecraft (not net.minecraftforge) and as I understand it's original game packages with all minecraft logic inside including renderers and so on, right? 2. Does it mean that forge has a limited set of instruments which doesn't cover all the aspects of the game? If make my question more specific then does forge provide such instruments that allow me totally change minecraft itself, like base mechanics and etc.? Or I have to use "original game packages" to implement such things? 3. I actively learning basic concepts with forge documentation and tutorials. So in my plans make different inventory system like in diabloids. Is that possible with forge? 4. It is last question related to the second one. So how deeply I can change minecraft with forge? I guess all my questions above because of that I haven't globally understanding what forge is and how it works inside and how it works with minecraft. It would be great if you provide some links or topics about it or explain it by yourself but I guess it's to big to be explained in that post at once. Anyway, thank you all for any help!
    • Im trying add to block a hole in center, just a usual block and in center of it on up side, there is should be a hole. I tried to add it via BlockModelBuilder, but its not working. Problem is that it only can change block size outside. I tried it to do with VoxelShape and its working, but its has been on server side and looks like its just changed collision shape, but for client, there is a texture covering this hole. I tried to use: base.renderType("cutout"); and removed some pixels from texture. I thought its should work, but game optimization makes block inside looks transparent. So, only custom model?
  • Topics

×
×
  • Create New...

Important Information

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