Jump to content

Recommended Posts

Posted

Hi Everyone,

 

I was wondering if anyone could explain how the vanilla particles are registered to a string. I want to try and set up a system where I can use my custom particle sheet in tandem with the vanilla particle sheet that contains their textures, to add more particles to the game. I like their spawning of particles using the string but I have been looking at this and I dont really understand how it works. (the string part - how exactly does vanilla associate the "snowshovel" string with the particle class that is the EntityFX for snowshovel particle)

 

 public void spawnParticle(String particleName, double xCoord, double yCoord, double zCoord, double velX, double velY, double velZ)

 

if the particle name is snowshovel I know how to spawn it but lets say I wanted to add a particle with name dustydesert how would I map this name to that particle EntityFX so that I can spawn it the same way vanilla does it.

 

This is currently how I spawn vanilla particles - nothing fancy but I want to be able to create my own custom particle with custom parameters such as (particleMaxAge, Scale,...etc etc) so that I can give it custom motion and all of that good stuff. Then register it in such a way so that I can spawn it the same way vanilla does it. Is this even possible

 

@Override
public void spawnParticles(World world, double xCoord, double yCoord, double zCoord, float radius, Vec3 lookVector)
{

	yCoord += 1.62D;
	for (float f = 0; f < radius; f += 0.5F) {
		xCoord += lookVector.xCoord;
		yCoord += lookVector.yCoord;
		zCoord += lookVector.zCoord;
		for (int numberOfParticles = 0; numberOfParticles < maxNumberOfPrticles; ++numberOfParticles) {
			world.spawnParticle("snowshovel",
					xCoord + 0.5F - world.rand.nextFloat(),
					yCoord + 0.5F - world.rand.nextFloat(),
					zCoord + 0.5F - world.rand.nextFloat(),
					lookVector.xCoord * (0.5F * world.rand.nextFloat()),
					lookVector.yCoord * (0.5F * world.rand.nextFloat()),
					lookVector.zCoord * (0.5F * world.rand.nextFloat()));
		}
	}
}

Posted

After some major digging around I have found the function that seems to do the "registering of particles" but I dont think there is an easy way to register new ones...

 

Located in public class RenderGlobal

public EntityFX doSpawnParticle(String p_72726_1_, double p_72726_2_, double p_72726_4_, double p_72726_6_, double p_72726_8_, double p_72726_10_, double p_72726_12_){
}

 

it seems to be called by the following method located in public class RenderGlobal

public void spawnParticle(String p_72708_1_, final double p_72708_2_, final double p_72708_4_, final double p_72708_6_, double p_72708_8_, double p_72708_10_, double p_72708_12_){}  

 

which is called by the following method located in public abstract class World

public void spawnParticle(String p_72869_1_, double p_72869_2_, double p_72869_4_, double p_72869_6_, double p_72869_8_, double p_72869_10_, double p_72869_12_){}

 

which is called by everything that spawns particles in vanilla... Does anyone have any idea how to access this in a smart way to allow registration of new particles in the same way vanilla does it?

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, My modded forge server was working with no issues up until last night. The current issue is that the server crashes as soon as another player joins.   Steps I have already tried: Deleted these files: banned-ips.json, banned-players.json, ops.json, usercache.json, whitelist.json. Deleted all player files Deleted the chunk that player was in   Mods: Pixelmon 1.20.2, 9.2.10 Crash log: https://pastebin.com/qauuZLRE Latest Log: https://pastebin.com/TxCGS4sc Other issue I get when starting up the server: [LanServerPinger #1/WARN] [net.minecraft.client.server.LanServerPinger/]: LanServerPinger: Network is unreachable
    • I tried to reinstall the server multiple times but nothing worked and I keep getting the same error... I do have the correct java 21 installed or whatever it was. I couldn't find whats causing this problem as I tried a lot to reinstall the files again and again.
    • OK, what I need is to be able to take a JSON string, from a config file or data pack, and convert into NBT that can be applied to any arbitrary item (technically, item stack). This could easily be done in 1.12.2 using JsonToNBT.getTagFromJson(String data) like so: NBTFromJsonWrapper(String label, String data) { super(label, label); try { wrapped = JsonToNBT.getTagFromJson(data); } catch (NBTException e) { System.err.println("Exception reading json-nbt string: " + e.getMessage()); wrapped = new NBTTagCompound(); } } However, I can't seem to find a way to do this in newer version, specifically 1.19.4 (though once I'm done updating to that version I plan to be updating the latest 1.20 and 1.21 version). This was previously used for several purposes, one was simply to create purely vanilla potions.  The other was to create special items, primarily as trophies albeit practically useful trophies, often in the form of Easter Eggs. (I also had a homebrew system along side it, but I don't think I'll be updating it.) Any help would be appreciated.  Surely there is still a way to do this, and codecs do not seem to be the answer.  
    • The security check is a captcha which shows below the question. If it doesn’t show for you, make sure your ad blocker is disabled as it may be hiding it.
    • well thanks anyway, i will see if i can still fix it somehow.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.