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
  • [Solved] [1.12.2] Dimension change event for The End?
The update for 1.13 is being worked on - please be patient. (Updated 02/14/19)
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
FireController1847

[Solved] [1.12.2] Dimension change event for The End?

Started by FireController1847, June 5, 2018

10 posts in this topic

FireController1847    4

FireController1847

FireController1847    4

  • Creeper Killer
  • FireController1847
  • Members
  • 4
  • 247 posts
  • Report post
Posted June 5, 2018 (edited)

Okay, the dimension change event emits for the nether, in and out. Now, I try the end and.. wait what? It emits when the user enters the end, but does not emit when the user leaves the end via an end gateway. Okay, if this is the case, what's the event I should use for checking when a user leaves the end?

Here's my test code right now.
 

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onLogin(PlayerLoggedInEvent event) {
		UltimateDiscordPack.logger.info("Player Logged In");
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onChangeDimension(PlayerChangedDimensionEvent event) {
		UltimateDiscordPack.logger.info("Player Changed Dimension");
		UltimateDiscordPack.logger.info("New Dimension ID: " + event.player.dimension);
	}

	@SubscribeEvent
	@SideOnly(Side.CLIENT)
	public void onPlayerRespawn(PlayerRespawnEvent event) {
		UltimateDiscordPack.logger.info("Player Respawned");
	}

 

Edited June 6, 2018 by FireController1847

Share this post


Link to post
Share on other sites

diesieben07    6107

diesieben07

diesieben07    6107

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6107
  • 40209 posts
  • Report post
Posted June 5, 2018
  • Why are you using @SideOnly here? This makes no sense, these events fire on the server.
  • When leaving the end, PlayerRespawnEvent will fire. PlayerRespawnEvent#isEndConquered allows you to check for this case.

Share this post


Link to post
Share on other sites

FireController1847    4

FireController1847

FireController1847    4

  • Creeper Killer
  • FireController1847
  • Members
  • 4
  • 247 posts
  • Report post
Posted June 6, 2018

I've been using SideOnly because everything else I've tried doesn't give me the desired effect~

I use PlayerLoggedInEvent to detect when the player joins a singleplayer world and NOT a multiplayer world.
I use PlayerChangedDimensionEvent  to detect when the player changes dimensions... should I be using ServerSide for this?

This is a client-only section of the mod, it cannot run on servers.

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12864 posts
  • Report post
Posted June 6, 2018
1 minute ago, FireController1847 said:

I've been using SideOnly because everything else I've tried doesn't give me the desired effect

This is not how to use SideOnly

 

Share this post


Link to post
Share on other sites

FireController1847    4

FireController1847

FireController1847    4

  • Creeper Killer
  • FireController1847
  • Members
  • 4
  • 247 posts
  • Report post
Posted June 6, 2018

Oh? Have I been doing it wrong this whole time?

I have the events only being added via the ClientProxy. Do I just not need SideOnly in that case?

And yes, I have read your forge tutorial on sides. Was very confusing to me for some reason, but I understood most of it.

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12864 posts
  • Report post
Posted June 6, 2018 (edited)
4 minutes ago, FireController1847 said:

Oh? Have I been doing it wrong this whole time?

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

specifically the @SidedProxy section as well as the getSide and SideOnly portion:

Quote

Annotating a method or field with the @SideOnly annotation indicates to the loader that the respective member should be completely stripped out of the definition not on the specified physical side. Usually, these are only seen when browsing through the decompiled Minecraft code, indicating methods that the Mojang obfuscator stripped out. There is little to no reason for using this annotation directly. Only use it if you are overriding a vanilla method that already has @SideOnly defined. In most other cases where you need to dispatch behavior based on physical sides, use @SidedProxy or a check on getSide() instead.

 

Edited June 6, 2018 by Draco18s

Share this post


Link to post
Share on other sites

FireController1847    4

FireController1847

FireController1847    4

  • Creeper Killer
  • FireController1847
  • Members
  • 4
  • 247 posts
  • Report post
Posted June 6, 2018

Okay, interesting. That makes sense, compared to last time I read it.

I guess the most confusing part to me is, are these events logical-server only, or do they fire for both the logical-server and logical-client?

And how are you supposed to know if the events run on the logical-server or the logical-client? And when would be the use cases to run something on either side? 

Share this post


Link to post
Share on other sites

diesieben07    6107

diesieben07

diesieben07    6107

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6107
  • 40209 posts
  • Report post
Posted June 6, 2018
3 hours ago, FireController1847 said:

are these events logical-server only, or do they fire for both the logical-server and logical-client?

Server only.

 

3 hours ago, FireController1847 said:

And how are you supposed to know if the events run on the logical-server or the logical-client?

The linked documentation explains how to check for logical side.

 

3 hours ago, FireController1847 said:

And when would be the use cases to run something on either side? 

The idealized version is that the server does all the simulation and gameplay logic, the client only displays and submits user input. In reality that would be a bit too laggy, so the client does a bit more. But ultimately the server has the authority.

  • Like 1

Share this post


Link to post
Share on other sites

FireController1847    4

FireController1847

FireController1847    4

  • Creeper Killer
  • FireController1847
  • Members
  • 4
  • 247 posts
  • Report post
Posted June 6, 2018

Ah, okay. That makes sense, thanks!

Share this post


Link to post
Share on other sites

Draco18s    1928

Draco18s

Draco18s    1928

  • Reality Controller
  • Draco18s
  • Members
  • 1928
  • 12864 posts
  • Report post
Posted June 6, 2018
6 hours ago, diesieben07 said:

so the client does a bit more

For example, the client controls all player motion directly and as far as the server is concerned, the player basically teleports around in small increments.

The server can still say "nope, you are not allowed to go there" and the client is forced to listen, but in general, the client is in control.

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

    • Nerdsjam
      Mods are not working...

      By Nerdsjam · Posted 22 minutes ago

      I got it to work now. Thanks for the help anyways @diesieben07 and @DavidM
    • matieusz
      forge with optifine 1.13.2

      By matieusz · Posted 37 minutes ago

      support added after?
    • diesieben07
      forge with optifine 1.13.2

      By diesieben07 · Posted 49 minutes ago

      Optifine for 1.13.2 has not added Forge support yet.
    • Choonster
      [1.13.2] Open GUI in Block#onBlockActivated

      By Choonster · Posted 51 minutes ago

      Instead of constructing the PacketBuffer, writing to it and then calling openGui, simply call openGui with a lambda function that writes to the supplied PacketBuffer. Forge constructs the PacketBuffer for you.
    • Choonster
      {1.13.2} Crops aren't dropping seeds, just the food ?

      By Choonster · Posted 55 minutes ago

      Your most recent few posts with these pre-written snippets of advice have been poorly formatted on the dark theme:     To fix it, you should be able to use the Tx (Remove Format) button and then re-apply the code formatting to the necessary parts.   Normally I'd PM you this, but unfortunately the forum wants me to delete a whole lot of PMs in my inbox before I can send another one.
  • Topics

    • Nerdsjam
      4
      Mods are not working...

      By Nerdsjam
      Started Yesterday at 01:14 AM

    • matieusz
      2
      forge with optifine 1.13.2

      By matieusz
      Started 1 hour ago

    • DavidM
      6
      [1.13.2] Open GUI in Block#onBlockActivated

      By DavidM
      Started 2 hours ago

    • RedBullSlurpie
      3
      {1.13.2} Crops aren't dropping seeds, just the food ?

      By RedBullSlurpie
      Started 12 hours ago

    • d0048
      2
      (1.12.2)Problems trying to load .obj model with a 256x1 palette image as texture

      By d0048
      Started 5 hours ago

  • Who's Online (See full list)

    • DavidM
    • Ugdhar
    • xerca
    • loordgek
    • Choonster
    • derfl007
    • V0idWa1k3r
    • heyitsmenobodyy
    • Littoil
    • Nerdsjam
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved] [1.12.2] Dimension change event for The End?
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community