As someone who has been using command blocks in the PC addition of Minecraft for several years now, I'm well aware that there are several particle effects that can be manipulated to display an RGB color instead of the normal color. The list, at least for PC is reddust (redstone dust) mobSpell mobSpellAmbient and fallingdust However I can only seem to get PMMP to color the fallingdust type and none others. The following code works as expected: Spoiler: php Code: $level->addParticle(new DustParticle(new Vector3($x, $y, $z), $r, $g, $b)); It creates a particle with the specified RGB values. However when I tried to change out DustParticle for RedstoneParticle it didn't work at all. It resulted in this nightmare: Upon looking in the source of PMMP I found that there are no particle effects that seem to support RGB values other than DustParticle. My question is this: Is there any way to color any of the other particles that are supposed to be supported (preferably the RedstoneParticle), or will only DustParticle work? I don't want to use DustParticle since the particle is affected by gravity, and falls down ruining the effect.
PHP: new GenericParticle($pos, Particle::YOUR_PARTICLE, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff)); should do the trick for all particles that support rgba color. $a is alpha, if you don't know what that is set 255 [transparency]
I know that alpha means transparency. But using GenericParticle results in the same issue. RGB values seem to scale the redstone particle rather than color it. I suppose PMMP, or maybe just PocketEdition itself doesn't support coloring the redstone particle
yes, pocket edition doesn't support it for red stone. Try https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/level/particle/Particle.php#L54
TYPE_MOB_SPELL, TYPE_MOB_SPELL_AMBIENT, and TYPE_MOB_SPELL_AMBIENT all only make blue colored ones. I know for a fact that the RGBA values are correct because when I use the Dust type it colors the particles correctly. It would probably help if I provided what I'm trying to accomplish. In short I have a plugin that reads 16x16 images images of wings from a directory and then displays them on the backs of players via particle effects. I already have it basically all done, it reads the RGBA values properly and can display the particles correctly as well. But I cannot color the particles. The falling dust particle seems to be the only one which accepts RGB values correctly, however that particle falls and ruins the look of the wings. I've made something similar on the PC version using the redstone particle and it worked very well. Any suggestions on a possible work around? Every particle type I've tried has failed to work. Spoiler: Example of wings on PC
well, sad enough. maybe mcpe simply doesn't support it or the way we're trying to encode RGB(A) is not right, someone with IDA skills might find out. Maybe try striking out alpha helps? PHP: new GenericParticle($pos, Particle::YOUR_PARTICLE, (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff)); #just removing it should work, we have 8bit values here, and shift them 8 bits each.
PMMP may just not support them then. Removing the alpha made my game lag to absolute hell, unplayable levels of lag. Maybe the issue is before the particle? Do you think it could be I'm pulling the RGB values in a way that the particle doesn't like? Spoiler: php Code: $image = imagecreatefrompng($fullPath); //$fullPath is the path to the image file for($h=0;$h<16;$h++) { for($w=0;$w<16;$w++) { $rgb = imagecolorat($image, $w, $h); $a = ($rgb >> 24) & 0xFF; $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; // Some other code that isn't related to getting colors } }