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

LivingUpdateEvent Player movement


shiosaku
 Share

Recommended Posts

As there isn't an event to know when the player walks, I'm using LivingUpdateEvent. So far I have this:

@EventBusSubscriber(modid = ShioUtilities.MOD_ID, bus = Bus.FORGE, value = Dist.CLIENT)
public class EventHandler {

	@SubscribeEvent
	public static void onWalkEvent(final LivingUpdateEvent event) {
		
		if(event.getEntity().getType().equals(EntityType.PLAYER)) {
			
			
			
		}
		
	}
	
}

Now I want to know if I can get a variable "Player" like in Bukkit (this is my first mod, I have experience making plugins with Bukkit). I'm using Forge 1.16.5

Edited by shiosaku
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 mean, you can, it would be a different forge mod loader version. I am asking mostly because I refuse to change to 1.19.x due to Microsoft's policies and decisions about the game (the in-game chat report system)
    • The main task - is to make your own gui for the inventory or just a separate gui, which will implement the basic functions for the marketplace (as in the various plugins). This needs to be implemented specifically by a mod. So far I've tried creating a class that inherits the Screen and setting as new ( minecraft.setScreen(new CustomScreen())), but the main inventory stops working (not moving things from slot to slot). Also tried overriding the InventoryScreen class, but the problem is the same as above. Decided to start simple, namely adding a button to the main inventory. Logic: listening for the ScreenEvent event, and setting the new button as a widget.  @SubscribeEvent public static void openInventoryGui(ScreenEvent e) { Minecraft minecraft = Minecraft.getInstance(); if (minecraft.screen != null) { Screen current = e.getScreen(); if (current.passEvents) { Button button = new Button(10, 10, 10, 10, Component.literal("TEST"), (a) -> { System.out.println("Press"); }); e.getScreen().renderables.add(button); } } } But so far the button does not work (should output text to the console).  Regarding ScreenEvent.InitScreenEvent - I could not do anything with it (it is not in the class, found no such event). What can I read or what guides to look at this topic? Or maybe someone has advice or experience in this matter?
    • FontManager although the details are in the GlyphProvider implementations.
    • What class handles the minecraft/font/default.json file?
    • forge server crashed   [26Sep2022 21:58:48.509] [main/ERROR] [net.minecraftforge.eventbus.EventBus/EVENTBUS]: Exception caught during firing event: 'net.minecraft.commands.Commands$CommandSelection net.minecraftforge.event.RegisterCommandsEvent.getEnvironment()' 98Index: 9 99Listeners: 1000: HIGH 1011: ASM: class dev.architectury.event.forge.EventHandlerImplCommon event(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 1022: NORMAL 1033: net.minecraftforge.eventbus.EventBus$$Lambda$4098/0x0000000801640998@f45879e 1044: ASM: class ovh.corail.tombstone.event.EventHandler onRegisterCommand(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 1055: ASM: class de.markusbordihn.playercompanions.commands.CommandManager handleRegisterCommandsEvent(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 1066: net.minecraftforge.eventbus.EventBus$$Lambda$4098/0x0000000801640998@296caa2a 1077: ASM: net.minecraftforge.common.ForgeInternalHandler@495ae68d onCommandsRegister(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 1088: net.minecraftforge.eventbus.EventBus$$Lambda$4098/0x0000000801640998@47ac9558 1099: ASM: class potionstudios.byg.BYGForgeEventsHandler registerCommands(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 11010: ASM: journeymap.common.events.forge.ForgeServerEvents@7253729a registerCommandEvent(Lnet/minecraftforge/event/RegisterCommandsEvent;)V 111java.lang.NoSuchMethodError: 'net.minecraft.commands.Commands$CommandSelection net.minecraftforge.event.RegisterCommandsEvent.getEnvironment()' 112at TRANSFORMER/byg@2.0.0.5/potionstudios.byg.BYGForgeEventsHandler.registerCommands(BYGForgeEventsHandler.java:63) 113at TRANSFORMER/byg@2.0.0.5/potionstudios.byg.__BYGForgeEventsHandler_registerCommands_RegisterCommandsEvent.invoke(.dynamic) 114at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:93) 115at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) 116at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) 117at TRANSFORMER/forge@41.1.0/net.minecraftforge.event.ForgeEventFactory.onCommandRegister(ForgeEventFactory.java:647) 118at TRANSFORMER/minecraft@1.19/net.minecraft.commands.Commands.<init>(Commands.java:202) 119at TRANSFORMER/minecraft@1.19/net.minecraft.server.ReloadableServerResources.<init>(ReloadableServerResources.java:44) 120at TRANSFORMER/minecraft@1.19/net.minecraft.server.ReloadableServerResources.m_206861_(ReloadableServerResources.java:86) 121at TRANSFORMER/minecraft@1.19/net.minecraft.server.WorldLoader.m_214362_(WorldLoader.java:28) 122at TRANSFORMER/minecraft@1.19/net.minecraft.server.WorldStem.m_214415_(WorldStem.java:18) 123at TRANSFORMER/minecraft@1.19/net.minecraft.server.Main.lambda$main$3(Main.java:158) 124at TRANSFORMER/minecraft@1.19/net.minecraft.Util.m_214652_(Util.java:768) 125at TRANSFORMER/minecraft@1.19/net.minecraft.Util.m_214679_(Util.java:763) 126at TRANSFORMER/minecraft@1.19/net.minecraft.server.Main.main(Main.java:157) 127at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 128at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) 129at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 130at java.base/java.lang.reflect.Method.invoke(Method.java:568) 131at MC-BOOTSTRAP/fmlloader@1.19-41.1.0/net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:29) 132at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) 133at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) 134at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) 135at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.run(Launcher.java:106) 136at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.Launcher.main(Launcher.java:77) 137at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) 138at MC-BOOTSTRAP/cpw.mods.modlauncher@10.0.8/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) 139at cpw.mods.bootstraplauncher@1.1.2/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
  • Topics

×
×
  • Create New...

Important Information

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