Jump to content

Recommended Posts

Posted

public class TileEntityRunecraftFire extends BlockContainer {

    public TileEntityRunecraftFire(int id) {
            super(id, Material.fire);
            this.setCreativeTab(Main.tabRuneCraft);
    }

    @Override
    public TileEntity createNewTileEntity(World world) {
            return new TileEntityRunecraftFireEntity();
    }
    
    @SideOnly(Side.CLIENT)
    public void randomDisplayTick(World world, int x, int y, int z, Random random){
    	
    	if (random.nextInt(24) == 0)
        {
            world.playSound((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "fire.fire", 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false);
        }
    	
    	float f1 = (float)x + 0.6F;
    	float f2 = (float)y + 0.1F;
    	float f3 = (float)z + 0.6F;
    	float f4 = random.nextFloat() * 0.3F -0.3F;
    	float f5 = random.nextFloat() * 0.3F -0.3F;
    	float f6 = (float)y + 0.2F;
    	float f7 = (float)y + 0.3F;
    	float f8 = (float)y + 0.4F;
    	float f9 = (float)y + 0.5F;
    	float f10 = (float)y + 0.6F;
    	float f11 = (float)x + 0.6F;
    	float f12 = (float)z + 0.6F;
    	
    	world.spawnParticle("flame", (double)(f1+f4), (double)f2, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f6, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f7, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f8, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f9, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f10, (double)(f3+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f6, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f7, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f8, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f9, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f10, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f11+f4), (double)f2, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f6, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f7, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f8, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f9, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f10, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	world.spawnParticle("flame", (double)(f1+f4), (double)f2, (double)(f12+f5), 0.0D, 0.0D, 0.0D);
    	
    }
    
    @Override
    public int getRenderType() {
            return -1;
    }
    
    @Override
    public boolean isOpaqueCube() {
            return false;
    }
    
    public boolean renderAsNormalBlock() {
            return false;
    }
    
    public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
    {
        par1World.setBlock(par2, par3, par4, FireMaking.ITEM_ASHES_ID);
    }
    
    public void registerIcons(IconRegister icon) {
            this.blockIcon = icon.registerIcon("runecraft:textures/blocks/Fire");
    }
}

 

Old fire code that spawned fire particles, I don't know if it still works for 1.7.2 but you can try.

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Posted

Ok, so here are a few bugs.

One, I do not want it to replace the block with a flame particle, I want it to spawn void particles around it that disappear over time.

Two, whenever Minecraft is minimized, it spams Open GL Error @post render 1286: invalid framebuffer operation.

Three, It doesn't display the block anymore, just the Flame particle effect, while I want the void particle effect.

Four, in the inventory, it doesn't show the block, just a bunch of blackness.

Posted

Ok, I realized that @stjnhero's was just not working out for me. I am updating Forge because after I deleted stjnhero's code, it is still spamming the open GL Error. Anyone else know how to make void particles?

Posted

Particles.

 

Are a b*tch if you want them to look like something that Minecraft doesn't have.  Fortunately for you, the void particle exists and is what you want.

 

I forget what class Minecraft uses where it figures out what string matches what particle (FX[something something]?) but you can find it by just tracing through existing code (hover over a function and you'll get the Javadoc, click the green dot in the upper left corner or the name of the function to jump to that point in the code).  It's only four jumps through a couple of vanilla classes (start with world.spawnParticle).

 

Once you find the name you're looking for (I know that redstone is "reddust" for instance) you can just use that instead of "flame" when calling spawnParticle.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Minecraft's particles are terribly hardcoded. The particle name you are looking for is "depthsuspend".

 

Yes, yes they are.

And adding new types is a right pain, because if you don't change the texture right and change it back everything just falls apart.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Minecraft's particles are terribly hardcoded. The particle name you are looking for is "depthsuspend".

 

Yes, yes they are.

And adding new types is a right pain, because if you don't change the texture right and change it back everything just falls apart.

 

Ok, I will test this out. Thanks for your help!

Posted

If you do move to your own particles, you'll want this:

 

public class ParticleUtils
{
static Map<String, ResourceLocation> boundTextures = new HashMap();

public static void bindTexture(String texture)
{
	ResourceLocation rl = null;
	if (boundTextures.containsKey(texture))
		rl = (ResourceLocation)boundTextures.get(texture);
	else {
		rl = new ResourceLocation("MODID", texture);
	}
	Minecraft.getMinecraft().renderEngine.bindTexture(rl);
}

public static ResourceLocation getParticleTexture()
{
	try
	{
		return (ResourceLocation)ReflectionHelper.getPrivateValue(EffectRenderer.class, null, new String[] { "particleTextures", "b", "field_110737_b" }); } catch (Exception e) {
		}
	return null;
}
}

 

That will let you switch textures without buggering anything.  Call the first function to change to your texture (the code there just caches the resource location so it doesn't have to make new file references all the time) and then call the second function when you're done rendering your particles to reset the texture back to Minecraft's vanilla particle sheet.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

If you do move to your own particles, you'll want this:

 

public class ParticleUtils
{
static Map<String, ResourceLocation> boundTextures = new HashMap();

public static void bindTexture(String texture)
{
	ResourceLocation rl = null;
	if (boundTextures.containsKey(texture))
		rl = (ResourceLocation)boundTextures.get(texture);
	else {
		rl = new ResourceLocation("MODID", texture);
	}
	Minecraft.getMinecraft().renderEngine.bindTexture(rl);
}

public static ResourceLocation getParticleTexture()
{
	try
	{
		return (ResourceLocation)ReflectionHelper.getPrivateValue(EffectRenderer.class, null, new String[] { "particleTextures", "b", "field_110737_b" }); } catch (Exception e) {
		}
	return null;
}
}

 

That will let you switch textures without buggering anything.  Call the first function to change to your texture (the code there just caches the resource location so it doesn't have to make new file references all the time) and then call the second function when you're done rendering your particles to reset the texture back to Minecraft's vanilla particle sheet.

Thank you very much! In order to make this to work, would i have to just have a class extend Particle and call these two methods?

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



×
×
  • Create New...

Important Information

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