Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] Data exchanging between Client and Server
The update for 1.13 is being worked on - please be patient. (Updated 02/19/19)
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
IvanSteklow

[1.12.2] Data exchanging between Client and Server

Started by IvanSteklow, May 13, 2018

  • advanced

11 posts in this topic

IvanSteklow    61

IvanSteklow

IvanSteklow    61

  • Stone Miner
  • IvanSteklow
  • Forge Modder
  • 61
  • 62 posts
  • Report post
Posted May 13, 2018

Hello Modders! Sorry for my bad English:$

I have Tile Entity that have working time and I have GUI with Progress Bar that need this working time. And I don't know how to do it. Pls help:D

Block: *CLICK*

Tile Entity: *CLICK*

Container: *CLICK*

GUI: *CLICK*

  • Like 1

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12868 posts
  • Report post
Posted May 13, 2018

Packets.

Share this post


Link to post
Share on other sites

IvanSteklow    61

IvanSteklow

IvanSteklow    61

  • Stone Miner
  • IvanSteklow
  • Forge Modder
  • 61
  • 62 posts
  • Report post
Posted May 13, 2018
1 minute ago, Draco18s said:

Packets.

Can U give me some tutorials, pls?

  • Like 1

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12868 posts
  • Report post
Posted May 13, 2018

https://mcforge.readthedocs.io/en/latest/networking/simpleimpl/

Share this post


Link to post
Share on other sites

jabelar    584

jabelar

jabelar    584

  • Reality Controller
  • jabelar
  • Members
  • 584
  • 3266 posts
  • Report post
Posted May 13, 2018

As mentioned, the client and server are always only connected by a network connection (even when in "single player" integrated server mode). So you need network packets to communicate in both directions.

 

For most modding purposes, the built-in packets aren't always going to help, but sometimes you might want to look at them if you feel that what you're doing is likely also communicated by vanilla. For example, the container system already communicates the inventories and actions between client and server.

 

Tile entities have a data packet system (using tag compounds), so I think you can just hook into that.

 

For entities, with little bits of information there is a mechanism called data watcher (or I think that is old name, maybe data manager now).

 

Lastly, there is fully custom packets. There is a custom packet already available, but it is also easy to use Forge simple networking implementation. 

Share this post


Link to post
Share on other sites

IvanSteklow    61

IvanSteklow

IvanSteklow    61

  • Stone Miner
  • IvanSteklow
  • Forge Modder
  • 61
  • 62 posts
  • Report post
Posted May 13, 2018
1 hour ago, jabelar said:

As mentioned, the client and server are always only connected by a network connection (even when in "single player" integrated server mode). So you need network packets to communicate in both directions.

 

For most modding purposes, the built-in packets aren't always going to help, but sometimes you might want to look at them if you feel that what you're doing is likely also communicated by vanilla. For example, the container system already communicates the inventories and actions between client and server.

 

Tile entities have a data packet system (using tag compounds), so I think you can just hook into that.

 

For entities, with little bits of information there is a mechanism called data watcher (or I think that is old name, maybe data manager now).

 

Lastly, there is fully custom packets. There is a custom packet already available, but it is also easy to use Forge simple networking implementation. 

So, I try to get 'TIME' from NBT, but I don't know why it didn't working. So, writeToNBT in my Tile Entity class looks like that:

	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		super.writeToNBT(compound);
		compound.setInteger("time", this.time);
		compound.setInteger("maxTime", METAL_REFINERY_WORKTIME);
		compound.setTag("items", this.itemStackHandler.serializeNBT());
		return compound;
	}

And my GUI Screen Updater looks like that:

	@Override
	public void updateScreen() {
		NBTTagCompound compound = new NBTTagCompound();
		compound = this.te.writeToNBT(compound);
		this.time = compound.getInteger("time");
		this.maxTime = compound.getInteger("maxTime");
		Core.logger.info(compound);
		super.updateScreen();
	}

What's wrong?

Full code:

Block: *CLICK*

Tile Entity: *CLICK*

Container: *CLICK*

GUI: *CLICK*

  • Like 1

Share this post


Link to post
Share on other sites

jabelar    584

jabelar

jabelar    584

  • Reality Controller
  • jabelar
  • Members
  • 584
  • 3266 posts
  • Report post
Posted May 13, 2018

You didn't read my suggestions closely enough. Writing NBT is only really for server side and there is no syncing for that. You need to look at the TileEntity getUpdatePacket() and onDataPacket(). Some other methods that might be useful are getUpdateTag(), getTileData().

Share this post


Link to post
Share on other sites

diesieben07    6114

diesieben07

diesieben07    6114

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6114
  • 40244 posts
  • Report post
Posted May 14, 2018

The tile-entity based syncing is pretty unsuitable for GUI data.

Share this post


Link to post
Share on other sites

V0idWa1k3r    308

V0idWa1k3r

V0idWa1k3r    308

  • World Shaper
  • V0idWa1k3r
  • Members
  • 308
  • 1443 posts
  • Report post
Posted May 14, 2018

You can use the built-in gui sync methods in Container class: Container#addListener(IContainerListener listener) is for initial sync when the player opens the GUI, Container#detectAndSendChanges() is for periodic detection of changes and sending those changes to the client and Container#updateProgressBar(int id, int data) is for receiving updates on the client. You send updates with IContainerListener#sendWindowProperty. See ContainerFurnace or ContainerBrewingStand for examples.

This obviously only works for the GUIs. If you want the data for a progress bar in the world or for something else you will have to use packets as Draco said.

Share this post


Link to post
Share on other sites

IvanSteklow    61

IvanSteklow

IvanSteklow    61

  • Stone Miner
  • IvanSteklow
  • Forge Modder
  • 61
  • 62 posts
  • Report post
Posted May 14, 2018
On 5/13/2018 at 5:15 PM, Draco18s said:

Packets.

So, I tried. Crash:

Spoiler

[18:43:07] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for level 0
[18:43:08] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 3%
[18:43:09] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 50%
[18:43:10] [Server thread/FATAL] [FML]: Fatal errors were detected during the transition from SERVER_ABOUT_TO_START to SERVER_STARTING. Loading cannot continue
[18:43:10] [Server thread/FATAL] [FML]: 
	States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

	| State    | ID        | Version      | Source                           | Signature |
	|:-------- |:--------- |:------------ |:-------------------------------- |:--------- |
	| UCHIJAAA | minecraft | 1.12.2       | minecraft.jar                    | None      |
	| UCHIJAAA | mcp       | 9.42         | minecraft.jar                    | None      |
	| UCHIJAAA | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.3.2655.jar | None      |
	| UCHIJAAA | forge     | 14.23.3.2655 | forgeSrc-1.12.2-14.23.3.2655.jar | None      |
	| UCHIJAAA | isdev     | 2.1.0        | bin                              | None      |
	| UCHIJAAE | tf2mod    | 1.0.0        | bin                              | None      |

[18:43:10] [Server thread/FATAL] [FML]: The following problems were captured during this phase
[18:43:10] [Server thread/ERROR] [FML]: Caught exception from tf2mod (Team Fortress 2 Mod)
java.lang.RuntimeException: java.lang.InstantiationException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:170) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:159) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at ru.ivansteklow.tf2mod.Core.serverStarting(Core.java:70) ~[bin/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:278) ~[LoadController.class:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:256) [LoadController.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) [LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:771) [Loader.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:296) [FMLCommonHandler.class:?]
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:162) [IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:550) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_161]
Caused by: java.lang.InstantiationException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler
	at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:166) ~[SimpleNetworkWrapper.class:?]
	... 36 more
Caused by: java.lang.NoSuchMethodException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler.<init>()
	at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_161]
	at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:166) ~[SimpleNetworkWrapper.class:?]
	... 36 more
[18:43:10] [Server thread/ERROR] [FML]: A fatal exception occurred during the server starting event
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Team Fortress 2 Mod (tf2mod)

Caused by: java.lang.RuntimeException: java.lang.InstantiationException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:170) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:159) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at ru.ivansteklow.tf2mod.Core.serverStarting(Core.java:70) ~[bin/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:278) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:256) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) ~[LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:771) [Loader.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:296) [FMLCommonHandler.class:?]
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:162) [IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:550) [MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_161]
Caused by: java.lang.InstantiationException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler
	at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:166) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:159) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at ru.ivansteklow.tf2mod.Core.serverStarting(Core.java:70) ~[bin/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:278) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:256) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) ~[LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:771) ~[Loader.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:296) ~[FMLCommonHandler.class:?]
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:162) ~[IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:550) ~[MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_161]
Caused by: java.lang.NoSuchMethodException: ru.ivansteklow.tf2mod.network.PacketMetalRefinery$PacketMetalRefineryHandler.<init>()
	at java.lang.Class.getConstructor0(Unknown Source) ~[?:1.8.0_161]
	at java.lang.Class.newInstance(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.instantiate(SimpleNetworkWrapper.java:166) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper.registerMessage(SimpleNetworkWrapper.java:159) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at ru.ivansteklow.tf2mod.Core.serverStarting(Core.java:70) ~[bin/:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:602) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:278) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:256) ~[forgeSrc-1.12.2-14.23.3.2655.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76) ~[guava-21.0.jar:?]
	at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116) ~[guava-21.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:217) ~[guava-21.0.jar:?]
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148) ~[LoadController.class:?]
	at net.minecraftforge.fml.common.Loader.serverStarting(Loader.java:771) ~[Loader.class:?]
	at net.minecraftforge.fml.common.FMLCommonHandler.handleServerStarting(FMLCommonHandler.java:296) ~[FMLCommonHandler.class:?]
	at net.minecraft.server.integrated.IntegratedServer.init(IntegratedServer.java:162) ~[IntegratedServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:550) ~[MinecraftServer.class:?]
	at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_161]
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Stopping server
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving players
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving worlds
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'New World'/overworld
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'New World'/the_nether
[18:43:10] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Saving chunks for level 'New World'/the_end
[18:43:10] [Server thread/INFO] [FML]: Unloading dimension 0
[18:43:10] [Server thread/INFO] [FML]: Unloading dimension -1
[18:43:10] [Server thread/INFO] [FML]: Unloading dimension 1
[18:43:11] [Server thread/INFO] [FML]: Applying holder lookups
[18:43:11] [Server thread/INFO] [FML]: Holder lookups applied
[18:43:11] [Server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED. Errors may have been discarded.
[18:43:11] [Server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state AVAILABLE. Errors may have been discarded.

 

Packet Handler: *CLICK*

What's wrong. Yeah, I don't like packets and never work with it:(

  • Like 1

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12868 posts
  • Report post
Posted May 14, 2018

The fuck is this for? You never set it to true.
https://github.com/IvanSteklow/TF2Mod/blob/master/src/main/java/ru/ivansteklow/tf2mod/network/PacketMetalRefinery.java#L18

Why is this empty?

https://github.com/IvanSteklow/TF2Mod/blob/master/src/main/java/ru/ivansteklow/tf2mod/network/PacketMetalRefinery.java#L33

This should be public static class, or in another file entirely.

https://github.com/IvanSteklow/TF2Mod/blob/master/src/main/java/ru/ivansteklow/tf2mod/network/PacketMetalRefinery.java#L47

As such, this will crash the server:

https://github.com/IvanSteklow/TF2Mod/blob/master/src/main/java/ru/ivansteklow/tf2mod/network/PacketMetalRefinery.java#L53

As to the crash you have, it's trying to find an init method or a constructor on your handler, I'm not entirely sure.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 1
Go To Topic Listing Modder Support

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • MajikalExplosions
      [1.12.2] Templates causing lag

      By MajikalExplosions · Posted 22 minutes ago

      Here it is: https://github.com/MajikalExplosions/ruins/tree/bambiraptor
    • SparHawke
      Error when installing forge 1.13.2-25.0.45

      By SparHawke · Posted 42 minutes ago

      I had the same issue try installing 1.13.2 - 25.0.44 then install 1.13.2 - 25.0.45. It worked just fine for me
    • Apocrypha
      Error when installing forge 1.13.2-25.0.45

      By Apocrypha · Posted 51 minutes ago

      I keep running into an error while the installer is installing, got no idea what to do
    • SparHawke
      1.13.2 - 25.0.45 Crashes Game

      By SparHawke · Posted 1 hour ago

      Hope that's the right way to post logs  
    • diesieben07
      1.13.2 - 25.0.45 Crashes Game

      By diesieben07 · Posted 1 hour ago

      Post logs.
  • Topics

    • MajikalExplosions
      5
      [1.12.2] Templates causing lag

      By MajikalExplosions
      Started February 12

    • Apocrypha
      1
      Error when installing forge 1.13.2-25.0.45

      By Apocrypha
      Started 51 minutes ago

    • SparHawke
      2
      1.13.2 - 25.0.45 Crashes Game

      By SparHawke
      Started 1 hour ago

    • RedBullSlurpie
      0
      Error when installing forge-1.13.2-25.0.45-installer

      By RedBullSlurpie
      Started 1 hour ago

    • kl1230
      0
      1.13 working but 1.12.2 freezes system

      By kl1230
      Started 1 hour ago

  • Who's Online (See full list)

    • Bella1980
    • SparHawke
    • RedBullSlurpie
    • BeardlessBrady
    • Keksuccino
    • Nuchaz
    • DavidM
    • FY1
    • MajikalExplosions
    • ArisuOngaku
    • diesieben07
    • elemperador
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] Data exchanging between Client and Server
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community