Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

setParticleIcon()


bigbaddevil6
 Share

Recommended Posts

While trying to do some custom Icon textures, I was told that you are unable to register the IIcon within the entity class you would setup for your particles, and that the best way would to be register the Icon in the corresponding block's class(the particle is coming off a block). Then just to reference the Icon from the block class to the setParticleIcon() inside the entity class to set the Icon. Is the information I was given just terrible information or good? I've looked at other examples where one was using tesselators, but this seems more simple. If this is a good method, how would I properly reference the Icon, the method I saw was for 1.6 so it doesn't work anymore. If everything about this post seems wrong how would I properly create a custom textured particle. 

Link to comment
Share on other sites

You can do it the way you described.

 

I used an event (TextureStitchEvent.Pre) for registering my icons, because they neither correspond to an item nor a block:

https://github.com/SanAndreasP/ClaySoldiersMod/blob/master/java/de/sanandrew/mods/claysoldiers/client/util/Textures.java

 

event.map.getTextureType

returns 0 if it's currently stitching the blocks texture together, 1 if it's the items texture.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Out of curiosity how would I do the reference like the way I described. It will bug me not figuring it out. Like I always say I know its simple most likely, just for some reason haven't figured it out.

You mean having your icon in your block class? Make an

IIcon

field, use the

registerBlockIcons

method to instanciate it and use that field as the IIcon parameter in your particle.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

see thats what I thought. When I try to do it though it just acts like its not there. The Icon is name particleIcon and is inside the BlockPosion.class so wouldn't it be setParticleIcon(BlockPoison.particleIcon); The person that I'm getting it from setup so that the BlockPoison was registered in his Blocks.class as poison so his. setParticleIcon(Blocks.poison.particleIcon); I tried that method as well and still just acts like nothing is there. Makes me feel stupid when I run into this stuff, because I know its little thing but idk what it is just doesn't click until someone shows me.

Link to comment
Share on other sites

Makes me feel stupid when I run into this stuff, because I know its little thing but idk what it is just doesn't click until someone shows me.

Ha welcome to the world of Minecraft modding, happens to me regularly too :)

 

> The Icon is name particleIcon and is inside the BlockPosion.class so wouldn't it be setParticleIcon(BlockPoison.particleIcon);

Maybe BlockPosion.particleIcon is still null at the point you copy it, if the BlockPoison hasn't been set up yet.  A breakpoint will show you..

 

Alternatively a breakpoint in your particle renderer will let you look at the IIcon and see what's wrong with it

 

-TGG

Link to comment
Share on other sites

Possibly I've even setup a method to return the Icon just for this to see if that helps it and still to no avail. I haven't done anymore testing with cause been busy. It's not like I did anything Strange or unusual that Im aware of the only thing that is different is that I declare only the particleIcon in my registerBlockIcons() because I use a BlockRustic.class to setup all my stuff then override what I need to, but I don't see why that would make a difference. Here's the code for the block. The particles I have there already are temporarily until I get this worked out.

 

 

package com.bigbaddevil7.rustic.test;

import com.bigbaddevil7.rustic.block.BlockRustic;
import com.bigbaddevil7.rustic.particles.EntityPoisonFX;
import com.bigbaddevil7.rustic.reference.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;

import java.util.Random;


/**
* Created by bigbaddevil7 on 10/22/2014.
*/
public class BlockPoison extends BlockRustic{

    public BlockPoison(){
        super();
        setBlockName(Reference.POISON_BLOCK_NAME);
    }

    public static IIcon particleIcon;

    @Override
    @SideOnly(Side.CLIENT)
    public void randomDisplayTick(World world, int x, int y, int z, Random random){
        for(int i = 0; i < 4; i++){
            float particleX = x + random.nextFloat();
            float particleY = y + random.nextFloat();
            float particleZ = z + random.nextFloat();

            float particleMotionX = -0.5F + random.nextFloat();
            float particleMotionY = -0.5F + random.nextFloat();
            float particleMotionZ = -0.5F + random.nextFloat();

            world.spawnParticle("portal", particleX, particleY, particleZ, particleMotionX, particleMotionY, particleMotionZ);
        }
    }

    @Override
    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister register){
        particleIcon = register.registerIcon(Reference.MOD_ID + ":" + Reference.POISON_PARTICLE);
    }
}

 

 

 

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.