DanielDawn Posted August 8, 2016 Share Posted August 8, 2016 I was currently using the OnArmorTick method to spawn particles to create a sort of particle trail. It only shows up for me, how can I make it visible to all players? @Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 0, 1)); player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 0, 4)); for (int count = 0; count < 2; count++){ double X = player.posX; double Y = player.posY; double Z = player.posZ; Random random = player.worldObj.rand; for (int i = 0; i < 10; ++i) { int j1 = MathHelper.getRandomIntegerInRange(random, 0, 3); if(j1 == 0){ player.worldObj.spawnParticle("reddust", (double)((float)X + random.nextFloat()), (double)Y - 1.5, (double)((float)Z + random.nextFloat()), 0, 0, 0); } if(j1 == 1){ player.worldObj.spawnParticle("reddust", (double)((float)X - random.nextFloat()), (double)Y - 1.5, (double)((float)Z + random.nextFloat()), 0, 0, 0); } if(j1 == 2){ player.worldObj.spawnParticle("reddust", (double)((float)X + random.nextFloat()), (double)Y - 1.5, (double)((float)Z - random.nextFloat()), 0, 0, 0); } if(j1 == 3){ player.worldObj.spawnParticle("reddust", (double)((float)X - random.nextFloat()), (double)Y - 1.5, (double)((float)Z - random.nextFloat()), 0, 0, 0); } } } } Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 8, 2016 Share Posted August 8, 2016 Post your code. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 8, 2016 Share Posted August 8, 2016 Try using the world parameter passed into the method and if that doesn't work you will need to use a custom packet. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
DanielDawn Posted August 8, 2016 Author Share Posted August 8, 2016 I did not see that... Thank you, will try it. Quote Link to comment Share on other sites More sharing options...
DanielDawn Posted August 8, 2016 Author Share Posted August 8, 2016 Did not work, but can't believe I didn't notice the world parameter. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 8, 2016 Share Posted August 8, 2016 As said above you need to send a packet to nearby players and since there is a tutorial about it take this it is by Cool Alias he does a really good job a explaining things. :3 http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
Choonster Posted August 8, 2016 Share Posted August 8, 2016 Always specify the Minecraft version you're using in the thread title. Judging by the PotionEffect constructor you're using, I'd guess you're on 1.8.9. If you look at the implementation of World#spawnParticle , you'll see that it does nothing on the server and spawns the specified particle on the client. You need to send a packet from the server to all nearby players telling their clients to spawn the particles. You could do this with your own packet, but Minecraft already provides the WorldServer#spawnParticle method to do this for you. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
DanielDawn Posted August 8, 2016 Author Share Posted August 8, 2016 Funny, I was testing out if I could do this on the Event Handler, but the player wearing my armor sees particle effects below their feet. Other players see the particle effects two blocks below. @SubscribeEvent public void playerTickEvent(PlayerTickEvent event) { if(event.player.getCurrentArmor(3) != null){ ItemStack helmet = event.player.getCurrentArmor(3); if(helmet.getItem() == SmallEnhancements.charm_mobility){ for (int count = 0; count < 2; count++){ double X = event.player.posX; double Y = event.player.posY; double Z = event.player.posZ; Random random = event.player.getEntityWorld().rand; for (int i = 0; i < 10; ++i) { int j1 = MathHelper.getRandomIntegerInRange(random, 0, 3); if(j1 == 0){ event.player.getEntityWorld().spawnParticle("reddust", (double)((float)X + random.nextFloat()), (double)Y - 1.5, (double)((float)Z + random.nextFloat()), 0, 0.74901960784, 0.89803921568); } if(j1 == 1){ event.player.getEntityWorld().spawnParticle("reddust", (double)((float)X - random.nextFloat()), (double)Y - 1.5, (double)((float)Z + random.nextFloat()), 0, 0.74901960784, 0.89803921568); } if(j1 == 2){ event.player.getEntityWorld().spawnParticle("reddust", (double)((float)X + random.nextFloat()), (double)Y - 1.5, (double)((float)Z - random.nextFloat()), 0, 0.74901960784, 0.89803921568); } if(j1 == 3){ event.player.getEntityWorld().spawnParticle("reddust", (double)((float)X - random.nextFloat()), (double)Y - 1.5, (double)((float)Z - random.nextFloat()), 0, 0.74901960784, 0.89803921568); } } } } } } Also I use 1.7.10 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.