Jump to content

[1.6.2] PlayerTick on other player


Knux14

Recommended Posts

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?

Link to comment
Share on other sites

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
        }
    }
}

Link to comment
Share on other sites

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-

Link to comment
Share on other sites

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

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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