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

Hello everyone,

I've made a "onPlayerTick" function which is working great but i've got a little problem.

private void onPlayerTick(EntityPlayer player) {
	ItemStack plate = player.getCurrentItemOrArmor(3);

	if (plate != null) {
		if (plate.getItem() == Items.jetpack) {
			if(player.isJumping){
				player.worldObj.spawnParticle("heart", player.posX, player.posY - 1, player.posZ, 0.0D, 0.0D, 0.0D);
				player.motionY += .15F;
			}
		}
	}
}

On singleplayer the particle work correctly but on multiplayer, the other players cant see it. Any solutions?

can you check that other players see "isJumping" as a good value, this might not be updated through all the clients :\

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

  • Author

So in the "onWorldTick" i do something like that ?

for (Entity e : world.getEntities()){
ย  ย  if (e instanceof EntityPlayer) {
ย  ย  ย  ย  if (e.getArmor(3) != null & e.getArmor(3).getID() == Items.plate & e.isJumping)[
ย  ย  ย  ย  ย  ย   //Show particle
ย  ย  ย  ย  }
ย  ย  }
}

no, you use System.out.println() to check wether or not the variable "isJumping" is true for other players when a player is jumping, like i said this variable might not necessarelly be synchronized with all the clients

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

  • Author

Where am I supposed to write this? Because onPlayerTick seems only tick the client player :S (But its in the ServerTickHandler)

ย 

I've got another problem. I rewrited the mod because I changed computer and forget to save it -_-

But the coremod doesnt work. Its written this in the log:

2013-08-17 19:59:21 [iNFO] [ForgeModLoader] FML has found a non-mod file KnuxCore.jar in your mods directory. It will now be injected into your classpath. This could severe stability issues, it should be removed if possible.

And the variable isJumping now return ALWAYS false. :(

Thats what currently has the tick

public void playerTick(EntityPlayer player) {
		ItemStack is = player.getCurrentArmor(2);
		if(is != null){
			if (is.getItem() == Items.jetpack){
				System.out.println("isJumping: " + player.isJumping);
			}
		}
}

And my console is spammed with "isJumping: false" when i am ingame, both if i jump or not

  • Author

onPlayerTick is in the tick handler which is registred with

TickRegistry.registerTick(new TickHandlerServer(), Side.SERVER);

  • Author

Yes I know, but if i do this, the client will be kicked because "Flight is not enabled", doesnt it ?

And for the particle I probably should do that. Let me try

All you need is isJumping set to true at some point.

The rest you can handle with packets if needed.

ย 

Edit: You can use LivingJumpEvent instead of a TickHandler, too.

  • Author

This event seems not to work. It happens when player is on ground then jump, but when its in the air, the event is no longer called, even if the keyboard stay pressed :(

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.