Jump to content

[1.8.9] [Solved] spawnParticle(...) trouble


Recommended Posts

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.

Posted

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.

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.