Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'd got some kind of anomaly during creation of my Forge 1.12.2 modification.
 

Short description: world.isRemote somehow returns true on server side.

 

Long description:

I have a class which extends Entity. I have put logic into onUpdate function and I was suprised when I figured out that this method is called on client side. I have added check to make sure that my logic is performed on server side. However, this check always fails. I have decided to test if I had accidentally called

world.spawnEntity

on client side (which is impossible!), so I put

logger.info(world.isRemote);

after that line (btw, what is the best method for testing?).

 

This check has returned "true", what means that it was executed at the client side, but console thread says that this text was printed from server thread. I am feeling competely lost.

 

The only one my proposition is that the problem is that I am using common logger for client and server sides, but I have never seen such

 

Github repository: https://github.com/mystery-coder/Souls-Industry/tree/dev

Problematical code parts:

forgemod.mystery.soulsindustry.tile.TileLamp.consume(...)

(Event is called from TickEvent.ServerTickEvent handler),

forgemod.mystery.soulsindustry.entity.EntityWisp.onUpdate()

 

Any help would be appreciated.

 

Well, your TileLamp only registers itself as an event subscriber on the client, so the event handler method only fires on the client, and as such the wisp is only spawned on the client.

  • Author
1 minute ago, V0idWa1k3r said:

Well, your TileLamp only registers itself as an event subscriber on the client, so the event handler method only fires on the client, and as such the wisp is only spawned on the client.

Oh, God! How could I miss that?!
 

Thank you very much. I am filling myself so stupid...

 

But can you explain me then why are

PowerDistributionEvent

being called if they are server-side? (They are posted only on server)

I think this happens because the event bus doesn't care about threads(and is static), and simply sends the event to all listeners. While you are posting the event on the server thread it goes to the event bus which iterates through all listeners, which the client-sided TEs are and gives the event to them. So in a way you made a jump from a server event to a client listener.

I don't know for sure though and can only be guessing from my inspection of the EventBus class.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.