Added a disk particle. Will use this for portals, as soon as I figure out ovals...

This commit is contained in:
Sollace 2019-02-06 20:36:44 +02:00
parent f95be4762e
commit c1d5203926
3 changed files with 63 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import com.minelittlepony.unicopia.particle.client.ParticleUnicornMagic;
import com.minelittlepony.unicopia.particle.client.ParticleRaindrops;
import com.minelittlepony.unicopia.particle.client.ParticleSphere;
import com.minelittlepony.unicopia.particle.client.ParticleChanglingMagic;
import com.minelittlepony.unicopia.particle.client.ParticleDisk;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -17,6 +18,7 @@ public class UParticles {
public static int RAIN_DROPS;
public static int SPHERE;
public static int DISK;
@SideOnly(Side.CLIENT)
static void init() {
@ -24,5 +26,6 @@ public class UParticles {
RAIN_DROPS = Particles.instance().registerParticle(ParticleRaindrops::new);
CHANGELING_MAGIC = Particles.instance().registerParticle(ParticleChanglingMagic::new);
SPHERE = Particles.instance().registerParticle(ParticleSphere::new);
DISK = Particles.instance().registerParticle(ParticleDisk::new);
}
}

View file

@ -0,0 +1,16 @@
package com.minelittlepony.unicopia.model;
import org.lwjgl.util.glu.Disk;
import org.lwjgl.util.glu.GLU;
public class ModelDisk extends ModelSphere {
@Override
protected void drawShape() {
Disk sphere = new Disk();
sphere.setDrawStyle(GLU.GLU_FILL);
sphere.setNormals(GLU.GLU_SMOOTH);
sphere.draw(0, 1, 32, 32);
}
}

View file

@ -0,0 +1,44 @@
package com.minelittlepony.unicopia.particle.client;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import com.minelittlepony.unicopia.model.ModelDisk;
import com.minelittlepony.util.render.Color;
public class ParticleDisk extends ParticleSphere {
private static final ModelDisk model = new ModelDisk();
protected float rotX;
protected float rotY;
protected float rotZ;
public ParticleDisk(int id, World w, double x, double y, double z, double vX, double vY, double vZ, int... args) {
this(w, x, y, z, args[0]/255F, args[1]/255F, args[2]/255F, args[3], args[4], args[5]/255F);
}
public ParticleDisk(World w, double x, double y, double z, float rX, float rY, float rZ, int radius, int tint, float alpha) {
super(w, x, y, z, radius, tint, alpha);
rotX = rX;
rotY = rY;
rotZ = rZ;
}
public void renderParticle(BufferBuilder buffer, Entity viewer, float partialTicks, float x, float z, float yz, float xy, float xz) {
if (alpha <= 0) {
return;
}
Color.glColor(tint, alpha);
model.setPosition(posX, posY, posZ);
model.render(radius);
GlStateManager.color(1, 1, 1, 1);
}
}