Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

ServerPlayerEntity in Event


urbanxx001
 Share

Recommended Posts

I have a RightClickEmpty event that needs to pass the server player into a method from an item class. However, event.getPlayer() only returns the client player. I heard that it should be done with packet handlers then, is that right? Alternatively, I could achieve the same thing with the onArmorTick method in the item class. But for that I would need to detect right clicking, which doesn't seem possible without an event. 

Edited by urbanxx001
Link to comment
Share on other sites

It's not for interacting with another entity though, which is why I'm using PlayerInteractEvent$RightClickEmpty. Or are you recommending the other two methods as they can access ServerPlayerEntity? My main issue is getting the server player. I can already get the slot from player.getItemStackFromSlot(EquipmentSlotType.CHEST);

Edited by urbanxx001
Link to comment
Share on other sites

Ah, I'm sorry. I'm quite tired and misread for some reason. So yes, you would need a packet setup. As the javadoc says, 'The server is not aware of when the client right clicks empty space with an empty hand, you will need to tell the server yourself.' However, I'm assuming this handles only the case when there is no item in the hand while the armor is on. You would also need to hook into RightClickItem to cover all use cases. However, that one is called on the server. So you can create a separate method to call the packet instance and the other event instance from.

  • Thanks 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I have a ios device right now (iphone) is there any other way? 
    • On Android in Chrome you do it the same way: Click the lock icon and then click through to certificate info. On iOS I do not know.
    • Update 321 is currently not yet supported. A fix is in the works. Downgrade one version for the time being.
    • I uninstalled Java 17, and installed java 8. I launch the server and now have a different error: [19Jan2022 16:51:20.604] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.23, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [19Jan2022 16:51:20.608] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_321 by Oracle Corporation [19Jan2022 16:51:21.615] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust [19Jan2022 16:51:21.654] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/D:/MCS/Vault%20Hunters/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar Service=ModLauncher Env=SERVER [19Jan2022 16:51:23.376] [main/INFO] [STDERR/]: [org.antlr.v4.runtime.ConsoleErrorListener:syntaxError:38]: line 1:0 token recognition error at: '~' [19Jan2022 16:51:24.498] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: java.lang.NoSuchMethodError: sun.security.util.ManifestEntryVerifier.<init>(Ljava/util/jar/Manifest;)V [19Jan2022 16:51:24.499] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.SecureJarHandler.createCodeSource(SecureJarHandler.java:66) [19Jan2022 16:51:24.499] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:275) [19Jan2022 16:51:24.499] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:136) [19Jan2022 16:51:24.499] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:98) [19Jan2022 16:51:24.499] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.ClassLoader.loadClass(Unknown Source) [19Jan2022 16:51:24.500] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.Class.forName0(Native Method) [19Jan2022 16:51:24.500] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.lang.Class.forName(Unknown Source) [19Jan2022 16:51:24.500] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.service.modlauncher.ModLauncherClassProvider.findClass(ModLauncherClassProvider.java:67) [19Jan2022 16:51:24.500] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.platform.MixinConnectorManager.loadConnectors(MixinConnectorManager.java:70) [19Jan2022 16:51:24.501] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.platform.MixinConnectorManager.inject(MixinConnectorManager.java:59) [19Jan2022 16:51:24.502] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.platform.MixinPlatformManager.inject(MixinPlatformManager.java:196) [19Jan2022 16:51:24.502] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.MixinBootstrap.inject(MixinBootstrap.java:202) [19Jan2022 16:51:24.503] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.initializeLaunch(MixinLaunchPluginLegacy.java:201) [19Jan2022 16:51:24.503] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at org.spongepowered.asm.launch.MixinLaunchPluginLegacy.initializeLaunch(MixinLaunchPluginLegacy.java:195) [19Jan2022 16:51:24.504] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.LaunchPluginHandler.lambda$announceLaunch$9(LaunchPluginHandler.java:97) [19Jan2022 16:51:24.504] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at java.util.HashMap.forEach(Unknown Source) [19Jan2022 16:51:24.505] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.LaunchPluginHandler.announceLaunch(LaunchPluginHandler.java:97) [19Jan2022 16:51:24.505] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:52) [19Jan2022 16:51:24.505] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [19Jan2022 16:51:24.506] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [19Jan2022 16:51:24.506] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [19Jan2022 16:51:24.507] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) [19Jan2022 16:51:24.509] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) [19Jan2022 16:51:24.510] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:-1]: at net.minecraftforge.server.ServerMain.main(ServerMain.java:57)
    • I do not know how to check the sites certificate on my phone
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.