Posted February 27, 20214 yr Hello good guys, I'm trying to change the texture of the particles for the biome, but it doesn't work for me, someone knows why, I've been with the same thing for days, I've debugged it and the Factory class doesn't stop and doesn't show messages with println, well Oh, I'll leave the code in case someone helps me, thanks. @Mod.EventBusSubscriber(modid = MainMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ParticleTextureColor extends SpriteTexturedParticle { public ParticleTextureColor(ClientWorld world, double x, double y, double z, double motionX, double motionY, double motionZ) { super ( world, x, y, z, motionX, motionY, motionZ ); } @SubscribeEvent public static TextureAtlasSprite textureAtlasSpriteEvent (TextureStitchEvent.Pre event) { System.out.println ("TextureAtlasSprite found"); return event.getMap ().getSprite (new ResourceLocation ( MainMod.MOD_ID, "sprite/particles" )); } @SubscribeEvent public static void onParticleFactoryRegistration(ParticleFactoryRegisterEvent event) { IParticleData.IDeserializer <IParticleData> particleData = new IParticleData.IDeserializer <IParticleData> () { @Override public IParticleData deserialize(ParticleType <IParticleData> particleTypeIn, @NotNull StringReader reader) throws CommandSyntaxException { return particleTypeIn.getDeserializer ().deserialize (particleTypeIn, reader); } @Override public IParticleData read(ParticleType <IParticleData> particleTypeIn, @NotNull PacketBuffer buffer) { return particleTypeIn.getDeserializer ().read ( particleTypeIn, buffer ); } }; ParticleType <IParticleData> particleType = new ParticleType <IParticleData> (true, particleData) { @Override public Codec <IParticleData> func_230522_e_() { return Codec.of ( Encoder.error ("Error Encode"), Decoder.error ( "Error Decode" ) ); } @Override public boolean getAlwaysShow() { return true; } }; Minecraft.getInstance().particles.registerFactory (particleType, new Factory()); System.out.println ( "Yes found particles!!!!" ); } @Override public void setSprite(@NotNull TextureAtlasSprite sprite) { super.setSprite ( Minecraft.getInstance().getAtlasSpriteGetter(new ResourceLocation(MainMod.MOD_ID, "sprite/particles" )) .apply (new ResourceLocation ( MainMod.MOD_ID, "sprite/particles" ) ) ); System.out.println ("TextureAtlasSprite found yes"); } @Override public @NotNull IParticleRenderType getRenderType() { return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; } @Override public void setColor(float particleRedIn, float particleGreenIn, float particleBlueIn) { super.setColor ( 1.0F, 0.2F, 0.2F ); } @Override public void renderParticle(@NotNull IVertexBuilder buffer, @NotNull ActiveRenderInfo renderInfo, float partialTicks) { System.out.println ( "Yes found particles texture!!!!" ); Minecraft.getInstance().getAtlasSpriteGetter(new ResourceLocation(MainMod.MOD_ID, "sprite/particles")) .apply(new ResourceLocation(MainMod.MOD_ID, "sprite/particles")); super.renderParticle ( buffer, renderInfo, partialTicks ); } public static class Factory implements IParticleFactory<IParticleData> { @Nullable @Override public Particle makeParticle(@NotNull IParticleData typeIn, @NotNull ClientWorld world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { System.out.println ( "Yes found particles Factory!!!!" ); return new ParticleTextureColor ( world, x, y, z, xSpeed, ySpeed, zSpeed ); } } }
February 28, 20214 yr Author I do not know if I explained well, what I try is to change the color of the water particles since my biome is all reddish, I have been looking at the classes of the forge particles and I do not see that it can be modified as I am doing, any Subjection, because you told me to update the forge version to give support, but so if I see that each time the private class is forge, and they cannot be accessed, and also the setParticleTextureIndex method with which it could be select the index of the texture of the particle, in the end I think it will get worse instead of better, if someone thinks otherwise than say 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.