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.16.5] get SeverWorld
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
Luis_ST

[1.16.5] get SeverWorld

By Luis_ST, January 21 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Luis_ST    7

Luis_ST

Luis_ST    7

  • Diamond Finder
  • Luis_ST
  • Members
  • 7
  • 392 posts
Posted January 21

How to get the ServerWorld from a World in version 1.16.5. There was .getWorld to get the ServerWorld in the version 1.16.1 but how to do this in 1.16.5 ?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    7706

diesieben07

diesieben07    7706

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7706
  • 56515 posts
Posted January 21

On the server every world is a ServerWorld. You use a cast.

  • Quote

Share this post


Link to post
Share on other sites

Luis_ST    7

Luis_ST

Luis_ST    7

  • Diamond Finder
  • Luis_ST
  • Members
  • 7
  • 392 posts
Posted January 21
45 minutes ago, diesieben07 said:

On the server every world is a ServerWorld. You use a cast.

but when i try this to set the weather to thunder

((ServerWorld) world).func_241113_a_(0, world.rand.nextInt(1000), true, true);

 

i get an error:

java.lang.ClassCastException: class net.minecraft.client.world.ClientWorld cannot be cast to class net.minecraft.world.server.ServerWorld (net.minecraft.client.world.ClientWorld and net.minecraft.world.server.ServerWorld are in unnamed module of loader cpw.mods.modlauncher.TransformingClassLoader @4cc36c19)
	at net.luis.cave.events.entity.OnEntityAttack.EntityAttack(OnEntityAttack.java:78) ~[main/:?] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_17_OnEntityAttack_EntityAttack_LivingAttackEvent.invoke(.dynamic) ~[?:?] {}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] {}
	at net.minecraftforge.common.ForgeHooks.onLivingAttack(ForgeHooks.java:325) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.LivingEntity.attackEntityFrom(LivingEntity.java:991) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.passive.AnimalEntity.attackEntityFrom(AnimalEntity.java:80) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading}
	at net.minecraft.entity.player.PlayerEntity.attackTargetEntityWithCurrentItem(PlayerEntity.java:1167) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.client.multiplayer.PlayerController.attackEntity(PlayerController.java:373) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1343) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:1688) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1507) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:979) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.run(Minecraft.java:612) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {}
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ~[?:?] {}
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {}
	at java.lang.reflect.Method.invoke(Method.java:564) ~[?:?] {}
	at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}
	at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.0.1_mapped_snapshot_20201028-1.16.3-recomp.jar:?] {}

 

  • Quote

Share this post


Link to post
Share on other sites

poopoodice    119

poopoodice

poopoodice    119

  • Dragon Slayer
  • poopoodice
  • Members
  • 119
  • 931 posts
Posted January 21

You need to check before casting, like we usually do.

https://mcforge.readthedocs.io/en/latest/concepts/sides/#performing-side-specific-operations

  • Thanks 1
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2417

Draco18s

Draco18s    2417

  • Reality Controller
  • Draco18s
  • Members
  • 2417
  • 16012 posts
Posted January 21
1 hour ago, Luis_ST said:

ClientWorld

Gasp, you're not on the server.

  • Thanks 1
  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • GenElectrovise
      [Answered, not solved] Automated testing in Forge

      By GenElectrovise · Posted 25 minutes ago

      There'd also be a small startup time tradeoff but I don't know how much of a difference that would make. Interesting idea with running tests later on... I hadn't thought of that... Might try that out just to satisfy curiosity!
    • troublemaker_47
      Custom Ore Generation help

      By troublemaker_47 · Posted 48 minutes ago

      now i get it. Tank you so much you have really made my day  
    • samjviana
      Custom Ore Generation help

      By samjviana · Posted 49 minutes ago

      As from the integer "6" you asked ... it represent the vein size that the ore will try to generate.
    • troublemaker_47
      Custom Ore Generation help

      By troublemaker_47 · Posted 50 minutes ago

      Thank you so much
    • troublemaker_47
      Custom Ore Generation help

      By troublemaker_47 · Posted 51 minutes ago

      Thank you but do i have to declare Feature
  • Topics

    • GenElectrovise
      3
      [Answered, not solved] Automated testing in Forge

      By GenElectrovise
      Started Thursday at 08:34 AM

    • troublemaker_47
      17
      Custom Ore Generation help

      By troublemaker_47
      Started Yesterday at 12:31 PM

    • CommandCore
      3
      Projectile Entity is Invisible

      By CommandCore
      Started February 26

    • ChocoCookies33
      1
      Description: Exception in server tick loop

      By ChocoCookies33
      Started 3 hours ago

    • LessyDoggy
      1
      Forge 1.12.2 Installing Bug

      By LessyDoggy
      Started 4 hours ago

  • Who's Online (See full list)

    • Aviator737
    • JDL
    • Luis_ST
    • samjviana
    • XcreepzioX
    • diesieben07
    • Tavi007
    • Choonster
    • brouttin85
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.16.5] get SeverWorld
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community