Posted August 14, 201312 yr 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?
August 16, 201312 yr 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-
August 16, 201312 yr 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 } } }
August 16, 201312 yr 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-
August 17, 201312 yr Author Where am I supposed to write this? Because onPlayerTick seems only tick the client player (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
August 17, 201312 yr Author onPlayerTick is in the tick handler which is registred with TickRegistry.registerTick(new TickHandlerServer(), Side.SERVER);
August 17, 201312 yr 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
August 17, 201312 yr 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.
August 18, 201312 yr 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.