Jump to content

[1.9] [SOLVED] EntityFX stuff


Recommended Posts



I've got a few questions:


1. How can I let particles move a specific path.

2. How do I get a "explosion" with particles. So I've got a circle around a block and then all particles move fast away from the block.


3. I've saw many people are doing this:

        float currentX = (float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks);
        float currentY = (float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks);
        float currentZ = (float) (this.prevPosX + (this.posX - this.prevPosX) * partialTicks);

What does this do?


4. How can I set the brightness and color and size of a custom particle?


5. What are 'partialTicks'?


That's all.


I hope someone can help me with this. Never done something before with particle effects.


Thx in advance. ;)


Developer of Primeval Forest.

Link to comment
Share on other sites

1. Particle is not your everyday Entity. It has no server-side, so only one seeing it is client, therefore - you can't make it move along non-constant path (meaning it generally can't react to server orders).

A constant path (updates defined by client) is possible, just define it if your FX class.


2. Spawn a lot of particles, make them move in random directions from center (block)?


3. This is partialTick interpolation - game (logical) thread operates with on 20 tick per sec basis. Client rendering logic operates on FPS-basis which only depends on your GPU power. Using logical variables of "prevPosX" and "posX" and interpolating them via partialTick allows FPS-based rendering to display smooth movement (making it NOT update 20 tps).


4. GL11.glSomething + GL11.glSomeState (e.g: Blend). - You NEED to learn at least GL basics.


5. Read 3.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

to 1: Well I could when I would send packets to each player informing them about the path. So basically a path is really hard-coded?

        So such things (

and other effects from other mods ) are really hard-coded? Seems like a lot of code... No other way?


to 3: Could you link me something about this. I really want to read more about it because I've never heard of such stuff. I just knew, never do FPS and logic as the same.... like some stupid AAA games do..... (nice games, but not really good in that terms of rendering)


to 4: Well, I learned some of the basics. But it was modern OpenGL. ;) Look into the spoiler to see what I mean. (it was never much what I learned back then, but I'm going to buy a OpenGL 4.5 book soon.... hopefully I can just work with matrix stuff without really understanding them because I'm going to learn that in 2 years in school and not yet.... currently doing that in school: an=a1*q^(n-1)

But you could link a book to OpenGL 4.5 which also teaches the GLSL shading language and the math behind if you want. ;)




Thats what I worked with.

This is the rendering code for my background of my small flappy bird which I made with the help of my opengl tutorial which

used flappy bird to teach modern opengl.... never finished the series thought...


#version 410 core

layout (location = 0) out vec4 color;

in DATA {
vec2 tc;
} fs_in;

uniform sampler2D tex;

void main() {
color = texture(tex, fs_in.tc);


#version 410 core

layout (location = 0) in vec4 position;
layout (location = 1) in vec2 tc;

uniform mat4 pr_matrix;
uniform mat4 vw_matrix;

out DATA {
vec2 tc;
} vs_out;

void main() {
gl_Position = pr_matrix * vw_matrix * position;
vs_out.tc = tc;




And thx for the answer. ;)

Developer of Primeval Forest.

Link to comment
Share on other sites

1. In short: Yup. Server should never really rely on particles and other way around. They were designed to display client effects, so yes - I think that linked effect is most likely hard-coded client animation which is most likely a little bit different on every client that sees the effect (difference will be coming at least from different time of receiving pakets telling to trigger particle-spawning). As to how they act - well, yeah you can code whatever you like, but it should still be client-only stuff. If you really need server to manipulate something you can always spawn normal Entity on server and apply standard server-client logic.


I've seen ppl spawn e.g 10 entities which then in their update method spawn more particles each allowing server-manipulated movements.

You can also mix then - e.g spawn stream of dozens of fire particles in which there is also few server Entities that would ignite hit targets (entities are used because particles are client-only and can lie).


3. Well, its pretty basic concept.


You take "previousPos" in e.g tick number "1" as starting point. You calculate difference of "currentPos - previousPos" which will give you how much you moved between tick number "1" and "2" on logical side of the game. Then you add this between-movement-amount to starting point, BUT before - you multiply it by "partialTick". PartialTick is a double from 0 to 1 that tells you what part of rendering frame relative to ticks are you in (and how much there are frames is defined by GPU, FPS). So basically the closer you are to firing tick "2", that double will be closed to 1, making movement smooth. Ofc. this is for display only, server still operates on tick logic.


4. I highly recommend learning basic-minecraft-rendering.

Lookup Gui.class and its methods. You can extend that class to use them or rewrite them to static utility (like I did, since they for example don't support some stuff, for one I think they only take integers as args, don't remember).


You will soon notice that VertexBuffer (previously called WorldRenderer) is just a wrapper aroungd GL's glBegin and addVertex and other methods like colorization, but it is really nice if you use it on 1.9 where you have those VertexFormats and nice colorization.


Note that vertexes used by MC are QUADS (which you can say are slower than making 2x TRIANGLES because you leave converting from QUADS to TRIANGLES to GPU, instead of deciding it on CPU).


Also note: GL vertexes should always be added anti-clockwise to be drawn face-to-screen.

If you ever want to use other formats: https://en.wikibooks.org/wiki/OpenGL_Programming/GLStart/Tut3


As to other stuff - well, a lot of examples (onve you understand 2d rendering) are in hierarchy of Render.class. There you have 3d rendering with translations and scaling. Also note that you always will be doing interpolation when rendering stuff in world.


Idk what more I can tell, those basics literally create most of MC rendering code. Most messed up things are probably learning using glStates which when not used with care will cause shitload of problems (especially if you render in some forge events where you are in mid-rendering of other vanilla things).

That I leave to google.


Hope it helps :D



1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

  • 3 weeks later...

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.

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.

  • Create New...

Important Information

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