Jump to content

Recommended Posts

Posted

I'm just wanting to know how to create my own like the Redstone particles that go off when you click/right-click/walkover This is what I have in my Uranium Ore Class 

package com.mrf.infinityweapons.blocks;

import java.util.Random;

import com.mrf.infinityweapons.init.ModBlocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class FuturiumOre extends BlockBase
{

	private final boolean isOn;

	public FuturiumOre(String name, Material material, boolean isOn)
	{
		super(name, material);
		setHardness(1.5F);
		setResistance(15);
		setHarvestLevel("pickaxe", 2);

		if (isOn) {
			this.setTickRandomly(true);
		}

		this.isOn = isOn;
	}

	@Override
	public int tickRate(World worldIn)
	{
		return 100;
	}

	@Override
	public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
	{
		this.activate(worldIn, pos);
		super.onBlockClicked(worldIn, pos, playerIn);
	}

	public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
	{
		this.activate(worldIn, pos);
		super.onEntityWalk(worldIn, pos, entityIn);
	}

	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
	{
		this.activate(worldIn, pos);
		return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
	}

	public void activate(World worldIn, BlockPos pos)
	{
		this.spawnParticles(worldIn, pos);

		if (this == ModBlocks.FUTURIUM_ORE.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE_LIT.getDefaultState());
		}
	}

	public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
	{
		if (this == ModBlocks.FUTURIUM_ORE_LIT.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE.getDefaultState());
		}
	}

	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
	{
		if (this.isOn) {
			this.spawnParticles(worldIn, pos);
		}
	}

	private void spawnParticles(World worldIn, BlockPos pos)
	{
		Random random = worldIn.rand;
		double d0 = 0.0625D;

		for (int i = 0; i < 6; ++i) {
			double d1 = (double) ((float) pos.getX() + random.nextFloat());
			double d2 = (double) ((float) pos.getY() + random.nextFloat());
			double d3 = (double) ((float) pos.getZ() + random.nextFloat());

			if (i == 0 && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
				d2 = (double) pos.getY() + 0.0625D + 1.0D;
			}

			if (i == 1 && !worldIn.getBlockState(pos.down()).isOpaqueCube()) {
				d2 = (double) pos.getY() - 0.0625D;
			}

			if (i == 2 && !worldIn.getBlockState(pos.south()).isOpaqueCube()) {
				d3 = (double) pos.getZ() + 0.0625D + 1.0D;
			}

			if (i == 3 && !worldIn.getBlockState(pos.north()).isOpaqueCube()) {
				d3 = (double) pos.getZ() - 0.0625D;
			}

			if (i == 4 && !worldIn.getBlockState(pos.east()).isOpaqueCube()) {
				d1 = (double) pos.getX() + 0.0625D + 1.0D;
			}

			if (i == 5 && !worldIn.getBlockState(pos.west()).isOpaqueCube()) {
				d1 = (double) pos.getX() - 0.0625D;
			}

			if (d1 < (double) pos.getX() || d1 > (double) (pos.getX() + 1) || d2 < 0.0D || d2 > (double) (pos.getY() + 1) || d3 < (double) pos.getZ() || d3 > (double) (pos.getZ() + 1)) {
				worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, 0.0D, 0.0D, 0.0D);
			}
		}
	}
}

 

Posted

So, what's not working?

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
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
{
    this.activate(worldIn, pos);
    super.onEntityWalk(worldIn, pos, entityIn);
}
private void activate(World worldIn, BlockPos pos)
{
    this.spawnParticles(worldIn, pos);

    if (this == Blocks.REDSTONE_ORE)
    {
        worldIn.setBlockState(pos, Blocks.LIT_REDSTONE_ORE.getDefaultState());
    }
}

Now, if you want to spawn a custom particle, that's a different story. However if you can understand code on your own, I'd recommend using Draco18s's Github folder, linked Here, which contains the code necessary to load a custom particle effect.

 

Cheers on your mod by the way! I've given up on mine myself because the Capability system confuses the living heck out of me.

Posted (edited)
11 minutes ago, MonolinkTV said:

Thanks, Man don't give up you can join our team if you want https://discord.gg/raR6DX

Sure, I'd be fine with that.

Also, I just realized you already implemented the code you needed to run a particle. So, the code you need to actual spawn it in is this.

 

worldObj.spawnParticle("reddust", posX, posY, posZ, 0.0D /*red*/, 1.0D /*green*/, 0.0D /*blue*/);

Where posX, posY, and posZ are will be replaced by the code of your current location.

And a list of various particles is:

 

largesmoke
portal
reddust
largeexplode (like shearing mooshrooms)
explode (when a mob dies)
largeexplosion (a bunch of largeexplode particles)
note
bubble
flame
crit
smoke (torches)
heart
splash
snowballpoof
suspended
depthsuspend
townaura
magicCrit
mobSpell
spell
instantSpell
enchantmenttable
lava
footstep
cloud
dripLava
dripWater
snowshovel
slime
iconcrack_ (after the underscore, put an item's id)
tilecrack_ (same here, except with block ids)

Edited by NolValue
Posted

Capture.PNG

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

I recently did something similar. I believe it's pretty tricky to get the right color with default particles, if possible at all.

My solution was to create custom particle that extends the particle you want to render (in my case ParticleSpell), and then change colors in CreateParticle method. This way you have almost complete control of the particle. 

My code:

public class ParticleEndlessDust extends ParticleSpell
{
	protected ParticleEndlessDust(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double ySpeed, double p_i1229_12_)
	{
		super(worldIn,xCoordIn,yCoordIn,zCoordIn,p_i1229_8_,ySpeed,p_i1229_12_);
	}
	
	@Override
    public boolean shouldDisableDepth()
    {
        return false;
    }
	
	
	public static ParticleEndlessDust CreateParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
	{
		ParticleEndlessDust particle = new ParticleEndlessDust(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
        ((ParticleSpell)particle).setBaseSpellTextureIndex(144);
        float f = worldIn.rand.nextFloat() * 0.05F +0.95F;
        particle.setRBGColorF(1.0F * f, 0.91F * f, 0.46F * f);
        return particle;
	}

}

And then you can spawn it with ParticleManager.addEffect()

	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
	{
		Minecraft.getMinecraft().effectRenderer.addEffect(ParticleEndlessDust.CreateParticle(worldIn, pos.getX()+0.5, pos.getY(), pos.getZ()+0.5, 0, 0, 0));
	}

 

Posted
23 hours ago, moonlyer said:

 


public class ParticleEndlessDust extends ParticleSpell
{
	protected ParticleEndlessDust(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double p_i1229_8_, double ySpeed, double p_i1229_12_)
	{
		super(worldIn,xCoordIn,yCoordIn,zCoordIn,p_i1229_8_,ySpeed,p_i1229_12_);
	}
	
	@Override
    public boolean shouldDisableDepth()
    {
        return false;
    }
	
	
	public static ParticleEndlessDust CreateParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
	{
		ParticleEndlessDust particle = new ParticleEndlessDust(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
        ((ParticleSpell)particle).setBaseSpellTextureIndex(144);
        float f = worldIn.rand.nextFloat() * 0.05F +0.95F;
        particle.setRBGColorF(1.0F * f, 0.91F * f, 0.46F * f);
        return particle;
	}

}

 

 

You don't  get an error here that you didn't define ParticleSpell because this is what I get
The constructor ParticleRedstone(World, double, double, double, double, double, double) is undefined

Posted (edited)
3 hours ago, MonolinkTV said:

The constructor ParticleRedstone(World, double, double, double, double, double, double) is undefined

Of course it's undefined. ParticleRedstone has a different constructor. Carefully examine ParticleRedstone class and change things accordingly. It's constructor is ParticleRedstone(World, double, double, double, float, float, float)

 

Edited by moonlyer
Posted
package com.mrf.infinityweapons.blocks;

import java.util.Random;

import com.mrf.infinityweapons.init.ModBlocks;
import com.mrf.infinityweapons.particles.UraniumOreParticles;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class FuturiumOre extends BlockBase
{

	private final boolean isOn;

	public FuturiumOre(String name, Material material, boolean isOn)
	{
		super(name, material);
		setHardness(1.5F);
		setResistance(15);
		setHarvestLevel("pickaxe", 2);

		if (isOn) {
			this.setTickRandomly(true);
		}

		this.isOn = isOn;
	}

	@Override
	public int tickRate(World worldIn)
	{
		return 100;
	}

	@Override
	public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
	{
		this.activate(worldIn, pos);
		super.onBlockClicked(worldIn, pos, playerIn);
	}

	public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
	{
		this.activate(worldIn, pos);
		super.onEntityWalk(worldIn, pos, entityIn);
	}

	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
	{
		this.activate(worldIn, pos);
		return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
	}

	public void activate(World worldIn, BlockPos pos)
	{
		this.spawnParticles(worldIn, pos);

		if (this == ModBlocks.FUTURIUM_ORE.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE_LIT.getDefaultState());
		}
	}

	public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
	{
		if (this == ModBlocks.FUTURIUM_ORE_LIT.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE.getDefaultState());
		}
	}

	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
	{
		if (this.isOn) {
			this.spawnParticles(worldIn, pos);
		}
	}

	private void spawnParticles(World worldIn, BlockPos pos)
	{

		Random random = worldIn.rand;
		double d0 = 0.0625D;

		for (int i = 0; i < 6; ++i) {
			double d1 = (double) ((float) pos.getX() + random.nextFloat());
			double d2 = (double) ((float) pos.getY() + random.nextFloat());
			double d3 = (double) ((float) pos.getZ() + random.nextFloat());

			if (i == 0 && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
				d2 = (double) pos.getY() + 0.0625D + 1.0D;
			}

			if (i == 1 && !worldIn.getBlockState(pos.down()).isOpaqueCube()) {
				d2 = (double) pos.getY() - 0.0625D;
			}

			if (i == 2 && !worldIn.getBlockState(pos.south()).isOpaqueCube()) {
				d3 = (double) pos.getZ() + 0.0625D + 1.0D;
			}

			if (i == 3 && !worldIn.getBlockState(pos.north()).isOpaqueCube()) {
				d3 = (double) pos.getZ() - 0.0625D;
			}

			if (i == 4 && !worldIn.getBlockState(pos.east()).isOpaqueCube()) {
				d1 = (double) pos.getX() + 0.0625D + 1.0D;
			}

			if (i == 5 && !worldIn.getBlockState(pos.west()).isOpaqueCube()) {
				d1 = (double) pos.getX() - 0.0625D;
			}

			if (d1 < (double) pos.getX() || d1 > (double) (pos.getX() + 1) || d2 < 0.0D || d2 > (double) (pos.getY() + 1) || d3 < (double) pos.getZ() || d3 > (double) (pos.getZ() + 1)) {
				Minecraft.getMinecraft().effectRenderer.addEffect(UraniumOreParticles.CreateParticle(worldIn, pos.getX(), pos.getY(), pos.getY(), 1f, 0, 0, 1));

				//worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, -10.0D, 8.0D, -10.0D);
			}
		}
	}
}
package com.mrf.infinityweapons.particles;

import net.minecraft.client.particle.ParticleRedstone;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class UraniumOreParticles extends ParticleRedstone
{

	public UraniumOreParticles(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
	{
		super(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
	}

	@Override
	public boolean shouldDisableDepth()
	{
		return false;
	}

	public static UraniumOreParticles CreateParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
	{
		UraniumOreParticles particle = new UraniumOreParticles(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
		((ParticleRedstone) particle).setParticleTextureIndex(0);
		float f1 = worldIn.rand.nextFloat() * 0.05F + 0.95F;
		particle.setRBGColorF(1.0F * f1, 0.91F * f1, 0.46F * f1);
		return particle;
	}

}

Did what you said nothing spawned

Posted (edited)
10 hours ago, MonolinkTV said:

Did what you said nothing spawned

Well, if something's not working - then you're doing it wrong. 

Here's your mistake. You spawn your particles not at your block's position.

Minecraft.getMinecraft().effectRenderer.addEffect(UraniumOreParticles.CreateParticle(worldIn, pos.getX(), pos.getY(), pos.getY(), 1f, 0, 0, 1));

I did not check your if statements, but without them your code runs perfectly fine. 

 

And about your isOn variable. The way you have it right now means that every block in the world would try to spawn particle if isOn is true. If you want your blocks to spawn particles independently - you probably should make isOn as boolean property.

Edited by moonlyer
Posted
1 hour ago, moonlyer said:

And about your isOn variable. The way you have it right now means that every block in the world would try to spawn particle if isOn is true. If you want your blocks to spawn particles independently - you probably should make isOn as boolean property.


 
private final boolean isOn;

And also i am getting my blocks position what do you mean and of course somethings wrong i was asking why

Posted
1 hour ago, MonolinkTV said: and of course somethings wrong i was asking why

Sry, didn't want to be mean. Just meant that this type of mistakes easily handled with a little bit of patience and attention.

And about isOn. You're right. I've looked at BlockRedstoneOre and it does the same thing. But I really don't see the point to have it, cause it does never change, and does absolutely nothing. Just like if (true)

Posted
On 5/24/2018 at 6:48 PM, MonolinkTV said:

package com.mrf.infinityweapons.blocks;

import java.util.Random;

import com.mrf.infinityweapons.init.ModBlocks;
import com.mrf.infinityweapons.particles.UraniumOreParticles;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class FuturiumOre extends BlockBase
{

	private final boolean isOn;

	public FuturiumOre(String name, Material material, boolean isOn)
	{
		super(name, material);
		setHardness(1.5F);
		setResistance(15);
		setHarvestLevel("pickaxe", 2);

		if (isOn) {
			this.setTickRandomly(true);
		}

		this.isOn = isOn;
	}

	@Override
	public int tickRate(World worldIn)
	{
		return 100;
	}

	@Override
	public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn)
	{
		this.activate(worldIn, pos);
		super.onBlockClicked(worldIn, pos, playerIn);
	}

	public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
	{
		this.activate(worldIn, pos);
		super.onEntityWalk(worldIn, pos, entityIn);
	}

	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
	{
		this.activate(worldIn, pos);
		return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
	}

	public void activate(World worldIn, BlockPos pos)
	{
		this.spawnParticles(worldIn, pos);

		if (this == ModBlocks.FUTURIUM_ORE.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE_LIT.getDefaultState());
		}
	}

	public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
	{
		if (this == ModBlocks.FUTURIUM_ORE_LIT.getDefaultState()) {
			worldIn.setBlockState(pos, ModBlocks.FUTURIUM_ORE.getDefaultState());
		}
	}

	@SideOnly(Side.CLIENT)
	public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
	{
		if (this.isOn) {
			this.spawnParticles(worldIn, pos);
		}
	}

	private void spawnParticles(World worldIn, BlockPos pos)
	{

		Random random = worldIn.rand;
		double d0 = 0.0625D;

		for (int i = 0; i < 6; ++i) {
			double d1 = (double) ((float) pos.getX() + random.nextFloat());
			double d2 = (double) ((float) pos.getY() + random.nextFloat());
			double d3 = (double) ((float) pos.getZ() + random.nextFloat());

			if (i == 0 && !worldIn.getBlockState(pos.up()).isOpaqueCube()) {
				d2 = (double) pos.getY() + 0.0625D + 1.0D;
			}

			if (i == 1 && !worldIn.getBlockState(pos.down()).isOpaqueCube()) {
				d2 = (double) pos.getY() - 0.0625D;
			}

			if (i == 2 && !worldIn.getBlockState(pos.south()).isOpaqueCube()) {
				d3 = (double) pos.getZ() + 0.0625D + 1.0D;
			}

			if (i == 3 && !worldIn.getBlockState(pos.north()).isOpaqueCube()) {
				d3 = (double) pos.getZ() - 0.0625D;
			}

			if (i == 4 && !worldIn.getBlockState(pos.east()).isOpaqueCube()) {
				d1 = (double) pos.getX() + 0.0625D + 1.0D;
			}

			if (i == 5 && !worldIn.getBlockState(pos.west()).isOpaqueCube()) {
				d1 = (double) pos.getX() - 0.0625D;
			}

			if (d1 < (double) pos.getX() || d1 > (double) (pos.getX() + 1) || d2 < 0.0D || d2 > (double) (pos.getY() + 1) || d3 < (double) pos.getZ() || d3 > (double) (pos.getZ() + 1)) {
				Minecraft.getMinecraft().effectRenderer.addEffect(UraniumOreParticles.CreateParticle(worldIn, pos.getX(), pos.getY(), pos.getY(), 1f, 0, 0, 1));

				//worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d1, d2, d3, -10.0D, 8.0D, -10.0D);
			}
		}
	}
}

package com.mrf.infinityweapons.particles;

import net.minecraft.client.particle.ParticleRedstone;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class UraniumOreParticles extends ParticleRedstone
{

	public UraniumOreParticles(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
	{
		super(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
	}

	@Override
	public boolean shouldDisableDepth()
	{
		return false;
	}

	public static UraniumOreParticles CreateParticle(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, float f, float p_i46349_8_, float p_i46349_9_, float p_i46349_10_)
	{
		UraniumOreParticles particle = new UraniumOreParticles(worldIn, xCoordIn, yCoordIn, zCoordIn, 1.0F, p_i46349_8_, p_i46349_9_, p_i46349_10_);
		((ParticleRedstone) particle).setParticleTextureIndex(0);
		float f1 = worldIn.rand.nextFloat() * 0.05F + 0.95F;
		particle.setRBGColorF(1.0F * f1, 0.91F * f1, 0.46F * f1);
		return particle;
	}

}

Did what you said nothing spawned

 

When you're debugging a problem with your own code, you can learn a lot by adding some console print statements in your code to help you check that the code is actually running and the key values of the code that is running. You don't need to guess. So for example, if you had a few console statements you could confirm that the createParticle method was even being called at all and furthermore you could double-check the position or whatever else might be the problem.

 

One other thing -- with rendering if you screw up the texture coordinates you can end up with something that is "invisible" because you don't actually have enough of the actual texture. Like if the u, v coordinates defined a really small area. Or if you texture atlas has places where there is just transparent part of the image.

 

Anyway, you don't need to guess or ask people here to guess what is wrong. Just print out what is happening and it should be obvious.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted
5 hours ago, MonolinkTV said:

So you said i wasn't getting my blocks position. I did pos.GetX,y and z 

 

You do pos.getY() where should be pos.getZ()

18 hours ago, moonlyer said:

Here's your mistake. You spawn your particles not at your block's position.


Minecraft.getMinecraft().effectRenderer.addEffect(UraniumOreParticles.CreateParticle(worldIn, pos.getX(), pos.getY(), pos.getY(), 1f, 0, 0, 1));

 

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.