SykoUSS
October 30, 2015, 12:18am
1
I’m trying to spawn a particle when a player issues a command, using this
Player player = (Player) commandSource;
Location oPos = player.getLocation();
GameRegistry reg = plugin.game.getRegistry();
Vector3d origin = new Vector3d(oPos.getPosition().getX(), oPos.getPosition().getY() + 1, oPos.getPosition().getZ());
player.getLocation().getExtent().spawnParticles(reg.createParticleEffectBuilder(ParticleTypes.ENCHANTMENT_TABLE).count(2000).build(), origin, 1);
but I just can’t seem to get anything to happen.
Yeah, that is where I got the base process from but when i try to use it nothing happens, no errors, just acts like it’s not even there,
Quick tip
can be written as:
Vector3d origin = oPos.add(0, 1, 0);
I did hear that there were some bugs with particle effects more than 1 block away from the player’s feet.
opened 01:08AM - 27 Oct 15 UTC
closed 08:43PM - 07 Nov 15 UTC
spongeforge-1.8-1521-2.1-DEV-750 with forge 1521, shadedAPI version 92; has been present in earlier combos.
Particles with or without the 'within-distance' parameter, when spawned...
Blue
October 30, 2015, 11:08am
6
@JBYoshi is right, but you already defined a radius of 1 … (or did u just edit that in? )
A radius of 1 however is not enough, is it? ^^
Try 50 or so.
The problem is that the effect of particle table is that it is very small, and at 0,1,0 offset, will be contained entirely within the torso of a character, and not visible outside of the model.
SykoUSS
October 30, 2015, 11:42pm
8
That’s what i was thinking, i got it to display, but is it like a radius or a point of origin?
all parrticles are spawned at a point, some are bigger than others though, the table effect is a small character about 1/8th of a block height tall, 1/12th wide about its center. The radius is how far away that is viewable, provideed it is viewable - inside of a block you cant see it, inside of a player model, you cant see it.
All 2000 of your particles will occupy the exact same tiny volume of space overlapped.
SykoUSS
November 3, 2015, 4:45am
10
A little snippet from the working code TY all that helped
public CommandResult {
public static Game game;
Player player = (Player) commandSource;
GameRegistry reg = game.getRegistry();
Vector3d motion = new Vector3d(0, 2, 0);
Location oPos = player.getLocation();
Vector3d origin = oPos.getPosition();
ParticleEffectBuilder eFF1 = reg.createParticleEffectBuilder(ParticleTypes.PORTAL).count(20).motion(motion);
for (double incr = 0; incr < 3.14; incr += 0.1) {
player.getLocation().getExtent().spawnParticles(eFF1.motion(motion.add(Math.cos(incr), 0, Math.sin(incr))).build(), origin, 500);
player.getLocation().getExtent().spawnParticles(eFF1.motion(motion.add(Math.cos(incr), 0, -Math.sin(incr))).build(), origin, 500);
player.getLocation().getExtent().spawnParticles(eFF1.motion(motion.add(-Math.cos(incr), 0, Math.sin(incr))).build(), origin, 500);
player.getLocation().getExtent().spawnParticles(eFF1.motion(motion.add(-Math.cos(incr), 0, -Math.sin(incr))).build(), origin, 500);
}
}
JBYoshi
November 3, 2015, 5:18pm
11