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

Alright, so I've run into a problem while trying to spawn particles. I believe I'm using the spawnParticle method correctly, as it's mostly copy/pasted from the enderpearl source code, yet I don't see any particles when I run the code (yes, my video settings are set to 'All' for particles). This is being called in an onEntityItemUpdate(...) method in a custom item class I wrote (the item has its own custom entityItem). Any help solving this conundrum would be appreciated.

 

onEntityItemUpdate method:

 

 

private int cleanTime = -1;

@Override
public boolean onEntityItemUpdate(EntityItem entityItem) {
	if (entityItem instanceof EntityEmotionDust) {
		EntityEmotionDust entity = (EntityEmotionDust) entityItem;
		if (!entity.getEntityItem().getItem().equals(EmotionModItems.empathy_dust)) {
			if (entity.checkAreaForBlock(Blocks.dragon_egg, 2)) { //checkAreaForBlock is a method I wrote that works fine, it isn't the issue
				if (cleanTime == -1)
					cleanTime = 40;
				else if (cleanTime == 0) {
					if (!entity.worldObj.isRemote) {
						for (int i = 0; i < 32; ++i) {
							entity.worldObj.spawnParticle(EnumParticleTypes.PORTAL, entity.posX,
									entity.posY + entity.random.nextDouble() * 2.0D, entity.posZ,
									entity.random.nextGaussian(), 0.0D, entity.random.nextGaussian(), new int[0]);
				        }
					}
					entity.setEntityItemStack(new ItemStack(EmotionModItems.empathy_dust, entity.getEntityItem().stackSize));
				}

				cleanTime--;
			} else {
				cleanTime = -1;
			}
		}
	}

        return false;
    }

 

 

P.S I've tried the onEntityItemUpdate code both in that method and in the EntityItem's onUpdate method.

While editing ItemStack will happen on server, the particles can only spawn on client. Basically - particle is "special" (retarded) brother of normal entity and should be spawned on client, not on server.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Thanks! I spawned it on the client and it worked. I modified the code from Jabelar's particle tutorial for anyone who wants to know.

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.