Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10]Spawn a rotated cube particle
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
TominoCZ

[1.10]Spawn a rotated cube particle

By TominoCZ, August 11, 2016 in Modder Support

  • Reply to this topic
  • Start new topic
  • Prev
  • 1
  • 2
  • 3
  • 4
  • Next
  • Page 3 of 4  

Recommended Posts

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted August 14, 2016

Do a != null check aswell as a isEmpty check

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

Sure. I was about to say this(below), when you answered..

 

Wait... If you think about it... you can't get the particles when you join the world, because there aren't any and also it scans for them once, once you've joined the world... so the Queue<Particle> is empty.. that means we'd have to somehow use TickHandler...

 

*Testing with using a classic for()*

 

EDIT: Well shit that doesn't work either.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

Please post the whole updated code.

And you will need to use an Iterator, so you can remove properly. Removal (or any other modification) inside forEach or a for-each loop is not allowed.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

Alrigh. Did that. Trying it now.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

Well I can get the particles removed, I tested that, but I'd need to use ListIterator to add the particles.. but how do you make one out of a Queue? I'm so close to finally finish this!

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

You need to add the particles to the queue itself after you are done iterating/removing.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

well then how am I going to replace ALL of them I want if I can't modify the queue in a loop?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

Remove all and while you remove add the new ones to a temporary collection (

ArrayList

is a good choice here). Then in the end transfer all the new ones over to the queue (

queue.addAll(list)

) and clear the list.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

That clever AF :D

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

no matter if it's in a loop or not, it says te exact same:

 

[18:15:38] [Client thread/FATAL]: Reported exception thrown!

net.minecraft.util.ReportedException: Rendering Particle

at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:335) ~[ParticleManager.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1408) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1282) ~[EntityRenderer.class:?]

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) ~[EntityRenderer.class:?]

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1139) ~[Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:406) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_101]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_101]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_101]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.lang.NullPointerException

at net.minecraft.world.World.isBlockLoaded(World.java:276) ~[World.class:?]

at net.minecraft.world.World.isBlockLoaded(World.java:271) ~[World.class:?]

at com.TominoCZ.FBP.FBPParticleDigging.getBrightnessForRender(FBPParticleDigging.java:269) ~[FBPParticleDigging.class:?]

at com.TominoCZ.FBP.FBPParticleDigging.renderParticle(FBPParticleDigging.java:103) ~[FBPParticleDigging.class:?]

at net.minecraft.client.particle.ParticleManager.renderParticles(ParticleManager.java:315) ~[ParticleManager.class:?]

... 18 more

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

Show FBPParticleDigging.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

It's basically the same code as the original, but with one point of the vertex missing (so I can recognize it - it will be a traingle).

The problem seems to be the world instance..

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

Show it. And also your particle emitter class (the one where you create the new particles).

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

The emitter class:

public class FBPParticleEmitter extends ParticleEmitter {
Queue<Particle> queue;

public FBPParticleEmitter(Queue<Particle> q) {
	super(Minecraft.getMinecraft().theWorld, new EntityItem(Minecraft.getMinecraft().theWorld),
			EnumParticleTypes.SNOWBALL);
	queue = q;
}

@Override
public void setRBGColorF(float particleRedIn, float particleGreenIn, float particleBlueIn) {
}

@Override
public void setAlphaF(float alpha) {
}

@Override
public void setMaxAge(int p_187114_1_) {
}

@Override
public void onUpdate() {
	try {
		if (queue != null) // Exception being thrown at this line
		{
			if (queue.isEmpty() == false) {
				IBlockState bs = Block.getStateById(1);

				Iterator itr = queue.iterator();

				ArrayList<Particle> newParticles = new ArrayList<Particle>();

				while (itr.hasNext()) 
				{
					if (itr.next().getClass() == ParticleDigging.class) 
					{
						itr.remove();
						newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, interpPosX, interpPosY, interpPosZ, motionX, motionY, motionZ, bs));
					}
				}

				queue.addAll(newParticles); //here it all fucks up

				/*
				ParticleManager particleManager = new ParticleManager(Minecraft.getMinecraft().theWorld, null);

				Class<?> c = particleManager.getClass();

				Field field;

				if (Main.isDev() == true)
					field = c.getDeclaredField("queueEntityFX");
				else
					field = c.getDeclaredField("field_187241_h");

				field.setAccessible(true);

				Queue<Particle> q = (Queue<Particle>) field.get(particleManager);
				q = queue;
				*/
			}
		}
	} catch (Exception x) {
		System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):");
		x.printStackTrace();
	}
}

@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX,
		float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
}

@Override
public void setParticleTexture(TextureAtlasSprite texture) {
}

@Override
public void setParticleTextureIndex(int particleTextureIndex) {
}

@Override
public void nextTextureIndexX() {
}

@Override
public void setExpired() {
}

@Override
protected void setSize(float p_187115_1_, float p_187115_2_) {
}

@Override
public void setPosition(double p_187109_1_, double p_187109_3_, double p_187109_5_) {
}

@Override
public void moveEntity(double x, double y, double z) {
}

@Override
protected void resetPositionToBB() {
}

@Override
public void setEntityBoundingBox(AxisAlignedBB p_187108_1_) {
}
}

 

The custom particle class:

@SideOnly(Side.CLIENT)
public class FBPParticleDigging extends Particle
{
    private final IBlockState sourceState;
    private BlockPos sourcePos;

    protected FBPParticleDigging(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state)
    {
        super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
        this.sourceState = state;
        this.setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state));
        this.particleGravity = state.getBlock().blockParticleGravity;
        this.particleRed = 0.6F;
        this.particleGreen = 0.6F;
        this.particleBlue = 0.6F;
        this.particleScale /= 2.0F;
    }

    /**
     * Sets the position of the block that this particle came from. Used for calculating texture and color multiplier.
     */
    public FBPParticleDigging setBlockPos(BlockPos pos)
    {
        this.sourcePos = pos;

        if (this.sourceState.getBlock() == Blocks.GRASS)
        {
            return this;
        }
        else
        {
            this.multiplyColor(pos);
            return this;
        }
    }

    public FBPParticleDigging init()
    {
        this.sourcePos = new BlockPos(this.posX, this.posY, this.posZ);
        Block block = this.sourceState.getBlock();

        if (block == Blocks.GRASS)
        {
            return this;
        }
        else
        {
            this.multiplyColor((BlockPos)null);
            return this;
        }
    }

    protected void multiplyColor(@Nullable BlockPos p_187154_1_)
    {
        int i = Minecraft.getMinecraft().getBlockColors().colorMultiplier(this.sourceState, this.worldObj, p_187154_1_, 0);
        this.particleRed *= (float)(i >> 16 & 255) / 255.0F;
        this.particleGreen *= (float)(i >> 8 & 255) / 255.0F;
        this.particleBlue *= (float)(i & 255) / 255.0F;
    }

    public int getFXLayer()
    {
        return 1;
    }

    /**
     * Renders the particle
     */
    public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
    {
        float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
        float f1 = f + 0.015609375F;
        float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
        float f3 = f2 + 0.015609375F;
        float f4 = 0.1F * this.particleScale;

        if (this.particleTexture != null)
        {
            f = this.particleTexture.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
            f1 = this.particleTexture.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
            f2 = this.particleTexture.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
            f3 = this.particleTexture.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
        }

        float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
        float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
        float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
        int i = this.getBrightnessForRender(partialTicks);
        int j = i >> 16 & 65535;
        int k = i & 65535;
        worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
        worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
        worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
        //Here on this line was the fourth vertex
    }

    public int getBrightnessForRender(float p_189214_1_)
    {
        int i = super.getBrightnessForRender(p_189214_1_);
        int j = 0;

        if (this.worldObj.isBlockLoaded(this.sourcePos))
        {
            j = this.worldObj.getCombinedLight(this.sourcePos, 0);
        }

        return i == 0 ? j : i;
    }

    @SideOnly(Side.CLIENT)
    public static class Factory implements IParticleFactory
        {
            public Particle getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
            {
                return (new FBPParticleDigging(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Block.getStateById(p_178902_15_[0]))).init();
            }
        }
}

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016
IBlockState bs = Block.getStateById(1);
What in the heck is this?

 

Iterator itr = queue.iterator();
Why are you using a raw type here?

 

if (itr.next().getClass() == ParticleDigging.class)
Why not
instanceof

?

 

new FBPParticleDigging(Minecraft.getMinecraft().theWorld, interpPosX, interpPosY, interpPosZ, motionX, motionY, motionZ, bs)
You might want to transfer the values from the particle you removed here instead of just using the (uninitialized) ones of
this

.

 

queue.addAll(newParticles); //here it all fucks up
What do you mean by this comment?

 

The custom particle class:

[snip]

Yay, copypasta...

Why is that factory class there? It is never used. The error is that you never initialize the

sourcePos

field, but still use it.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

I don't know how you'd read private final fields without making a new instance of the previous particle class..

 

show me what it should look like.

 

public void onUpdate() {
	try {
		if (queue != null) // Exception being thrown at this line
		{
			if (queue.isEmpty() == false) {
				Iterator itr = queue.iterator();

				ArrayList<Particle> newParticles = new ArrayList<Particle>();

				while (itr.hasNext()) 
				{
					if (itr.next().getClass() == ParticleDigging.class) 
					{
						Class c = itr.next().getClass();

						Field sourcePos;
						Field sourceState;

						if (Main.isDev() == true)
						{
							sourcePos = c.getDeclaredField("sourcePos");
							sourceState = c.getDeclaredField("sourceState");
						}
						else
						{
							sourcePos = c.getDeclaredField("field_181019_az");
							sourceState = c.getDeclaredField("field_174847_a");
						}
						sourcePos.setAccessible(true);
						sourceState.setAccessible(true);

						BlockPos prevSourcePos = (BlockPos)sourcePos.get(/*HERE YOU WOULD HAVE TO DO SOMETHING LIKE THIS: new PreviousParticle()*/);
						IBlockState prevSourceState = (IBlockState)sourceState.get(/*SAME STUFF HERE*/);

						itr.remove();

						newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), motionX, motionY, motionZ, prevSourceState));
					}
				}

				queue.addAll(newParticles);

				/*
				ParticleManager particleManager = new ParticleManager(Minecraft.getMinecraft().theWorld, null);

				Class<?> c = particleManager.getClass();

				Field field;

				if (Main.isDev() == true)
					field = c.getDeclaredField("queueEntityFX");
				else
					field = c.getDeclaredField("field_187241_h");

				field.setAccessible(true);

				Queue<Particle> q = (Queue<Particle>) field.get(particleManager);
				q = queue;
				*/
			}
		}
	} catch (Exception x) {
		System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):");
		x.printStackTrace();
	}
}

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016
I don't know how you'd read private final fields without making a new instance of the previous particle class..
You have the digging particle that you remove, right? Copy the needed values from that. After all you want your replacement particles to spawn in the same position, right?

If a field is private, use reflection again.

 

For the code you posted: Every time you call Iterator::next it moves to the next element. If you want to use the result multiple times you must store it in a local variable.

 

/*HERE YOU WOULD HAVE TO DO SOMETHING LIKE THIS: new PreviousParticle()*/
No, you got the instance from the Iterator, you used it like 10 lines above....
  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016
No, you got the instance from the Iterator, you used it like 10 lines above.....

 

If you mean itr.next().getClass(), then no. I tried that.

I tried itr.next().getClass().newInstance() aswell.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted August 14, 2016

No, you got the instance from the Iterator, you used it like 10 lines above.....

 

If you mean itr.next().getClass(), then no. I tried that.

I believe he wants you to create a field of itr.next() and use that instead of calling itr.next()

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

already have that there

Class c = itr.next().getClass();

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2093

Draco18s

Draco18s    2093

  • Reality Controller
  • Draco18s
  • Members
  • 2093
  • 14022 posts
Posted August 14, 2016

For fuck's sake.

Object o = it.next();

Stop calling

.getClass()

on everything.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

For fuck's sake.

Object o = it.next();

Stop calling

.getClass()

on everything.

 

[00:08:10] [Client thread/INFO] [sTDOUT]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:106]: [Fancy Block Particles]: An error occured at onUpdate(int p_187114_1_):

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: java.util.NoSuchElementException

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.util.ArrayDeque$DeqIterator.next(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at com.TominoCZ.FBP.FBPParticleEmitter.onUpdate(FBPParticleEmitter.java:57)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.particle.ParticleManager.updateEffects(ParticleManager.java:171)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.runTick(Minecraft.java:1939)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1118)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.Minecraft.run(Minecraft.java:406)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.client.main.Main.main(Main.java:118)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.lang.reflect.Method.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at java.lang.reflect.Method.invoke(Unknown Source)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)

[00:08:10] [Client thread/INFO] [sTDERR]: [com.TominoCZ.FBP.FBPParticleEmitter:onUpdate:107]: at GradleStart.main(GradleStart.java:26)

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016

Always post updated code. We are not psychic.

  • Quote

Share this post


Link to post
Share on other sites

TominoCZ    0

TominoCZ

TominoCZ    0

  • Creeper Killer
  • TominoCZ
  • Members
  • 0
  • 117 posts
Posted August 14, 2016

well you can post some code too

 

It just looks like there's no way to get the fields there...

	public void onUpdate() {
	try {
		if (queue != null) // Exception being thrown at this line
		{
			if (queue.isEmpty() == false) {
				Iterator itr = queue.iterator();

				ArrayList<Particle> newParticles = new ArrayList<Particle>();

				while (itr.hasNext()) 
				{
					Object c = itr.next();

					if (c.toString().contains("ParticleDigging")) 
					{
						Field sourcePos;
						Field sourceState;

						if (Main.isDev() == true)
						{
							sourcePos = c.getClass().getDeclaredField("sourcePos");
							sourceState = c.getClass().getDeclaredField("sourceState");
						}
						else
						{
							sourcePos = c.getClass().getDeclaredField("field_181019_az");
							sourceState = c.getClass().getDeclaredField("field_174847_a");
						}
						sourcePos.setAccessible(true);
						sourceState.setAccessible(true);

						BlockPos prevSourcePos = (BlockPos)sourcePos.get(c);
						IBlockState prevSourceState = (IBlockState)sourceState.get(c);

						itr.remove();

						newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), motionX, motionY, motionZ, prevSourceState));
					}
				}

				queue.addAll(newParticles);
			}
		}
	} catch (Exception x) {
		System.out.println("[" + Main.name + "]: An error occured at onUpdate(int p_187114_1_):");
		x.printStackTrace();
	}
}

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45669 posts
Posted August 14, 2016
Iterator itr = queue.iterator();
Why is this still a raw type?

 

if (c.toString().contains("ParticleDigging"))
I seriously hope you are not serious about this.

 

sourcePos = c.getClass().getDeclaredField("sourcePos");
Instead of doing this here every time these Field instances should be in static fields. Initialized once.

 

newParticles.add(new FBPParticleDigging(Minecraft.getMinecraft().theWorld, prevSourcePos.getX(), prevSourcePos.getY(), prevSourcePos.getZ(), motionX, motionY, motionZ, prevSourceState));
You are still accessing prevSourcePos, etc. from
this

, which is completely meaningless here. You need to get them from the particle you remove from the queue.

  • Quote

Share this post


Link to post
Share on other sites
  • Prev
  • 1
  • 2
  • 3
  • 4
  • Next
  • Page 3 of 4  

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • GraciousCub5622
      All forge versions crash launcher

      By GraciousCub5622 · Posted 2 minutes ago

      i just cant send it for some reason
    • GraciousCub5622
      All forge versions crash launcher

      By GraciousCub5622 · Posted 3 minutes ago

      there is no error message when i take the screen
    • GraciousCub5622
      All forge versions crash launcher

      By GraciousCub5622 · Posted 5 minutes ago

      when i screenshot???
    • diesieben07
      All forge versions crash launcher

      By diesieben07 · Posted 6 minutes ago

      What is "it"? Do you get an error message?
    • matt1999rd
      [1-14-newer] how to make a button with a specified texture ?

      By matt1999rd · Posted 6 minutes ago

      and is it like multiple windows on computer or only one screen is activated at the same time ?
  • Topics

    • GraciousCub5622
      9
      All forge versions crash launcher

      By GraciousCub5622
      Started 29 minutes ago

    • matt1999rd
      15
      [1-14-newer] how to make a button with a specified texture ?

      By matt1999rd
      Started Saturday at 04:04 PM

    • MightyAhmed
      53
      Immediate Crash On Any Version Of Forge

      By MightyAhmed
      Started November 10

    • DragonITA
      0
      [1.14.4] How to create a custom Portal and Dimension?

      By DragonITA
      Started 29 minutes ago

    • DragonITA
      14
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started Yesterday at 10:06 AM

  • Who's Online (See full list)

    • GraciousCub5622
    • solitone
    • matt1999rd
    • bsrgin
    • MightyAhmed
    • Choonster
    • dylandmrl
    • DavidM
    • plugsmustard
    • diesieben07
    • Simon_kungen
    • kellywwqw11
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.10]Spawn a rotated cube particle
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community