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

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

Try using the world parameter passed into the method and if that doesn't work you will need to use a custom packet.

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.

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

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.

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.

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.

  • Author

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

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.