mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08:34 +01:00
Replace particles with laser renderers
This commit is contained in:
parent
465ca21843
commit
063459ed93
11 changed files with 105 additions and 66 deletions
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityEmpowerer;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
|
@ -20,6 +22,8 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public class RenderEmpowerer extends TileEntitySpecialRenderer{
|
public class RenderEmpowerer extends TileEntitySpecialRenderer{
|
||||||
|
|
||||||
|
@ -49,5 +53,18 @@ public class RenderEmpowerer extends TileEntitySpecialRenderer{
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int index = ((TileEntityEmpowerer)tile).recipeForRenderIndex;
|
||||||
|
if(index >= 0 && ActuallyAdditionsAPI.EMPOWERER_RECIPES.size() > index){
|
||||||
|
EmpowererRecipe recipe = ActuallyAdditionsAPI.EMPOWERER_RECIPES.get(index);
|
||||||
|
if(recipe != null){
|
||||||
|
for(int i = 0; i < EnumFacing.HORIZONTALS.length; i++){
|
||||||
|
EnumFacing facing = EnumFacing.HORIZONTALS[i];
|
||||||
|
BlockPos offset = tile.getPos().offset(facing, 3);
|
||||||
|
|
||||||
|
AssetUtil.renderLaser(tile.getPos().getX()+0.5, tile.getPos().getY()+0.5, tile.getPos().getZ()+0.5, offset.getX()+0.5, offset.getY()+0.95, offset.getZ()+0.5, 80, 1F, 0.1F, recipe.particleColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* This file ("ParticleBeam.java") is part of the Actually Additions mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://ellpeck.de/actaddlicense
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2015-2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.misc;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import net.minecraft.client.particle.Particle;
|
||||||
|
import net.minecraft.client.renderer.VertexBuffer;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class ParticleBeam extends Particle{
|
||||||
|
|
||||||
|
private final double endX;
|
||||||
|
private final double endY;
|
||||||
|
private final double endZ;
|
||||||
|
private final float[] color;
|
||||||
|
private final double rotationTime;
|
||||||
|
private final float size;
|
||||||
|
private final float alpha;
|
||||||
|
|
||||||
|
public ParticleBeam(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha){
|
||||||
|
super(world, startX, startY, startZ);
|
||||||
|
this.endX = endX;
|
||||||
|
this.endY = endY;
|
||||||
|
this.endZ = endZ;
|
||||||
|
this.color = color;
|
||||||
|
this.rotationTime = rotationTime;
|
||||||
|
this.size = size;
|
||||||
|
this.particleMaxAge = maxAge;
|
||||||
|
this.alpha = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderParticle(VertexBuffer buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ){
|
||||||
|
float ageRatio = (float)this.particleAge/(float)this.particleMaxAge;
|
||||||
|
float currAlpha = this.alpha-ageRatio*this.alpha;
|
||||||
|
AssetUtil.renderLaser(this.posX+0.5, this.posY+0.5, this.posZ+0.5, this.endX+0.5, this.endY+0.5, this.endZ+0.5, this.rotationTime, currAlpha, this.size, this.color);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFXLayer(){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,27 +0,0 @@
|
||||||
/*
|
|
||||||
* This file ("ParticleColored.java") is part of the Actually Additions mod for Minecraft.
|
|
||||||
* It is created and owned by Ellpeck and distributed
|
|
||||||
* under the Actually Additions License to be found at
|
|
||||||
* http://ellpeck.de/actaddlicense
|
|
||||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
||||||
*
|
|
||||||
* © 2015-2016 Ellpeck
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.misc;
|
|
||||||
|
|
||||||
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 ParticleColored extends ParticleRedstone{
|
|
||||||
|
|
||||||
public ParticleColored(World world, double x, double y, double z, float size, float r, float g, float b, float ageMulti){
|
|
||||||
super(world, x, y, z, size, r, g, b);
|
|
||||||
//To work around Reddust particles resetting the color to red if it's 0 (which is really stupid to be honest)
|
|
||||||
this.particleRed = ((float)(Math.random()*0.2)+0.8F)*r*((float)Math.random()*0.4F+0.6F);
|
|
||||||
this.particleMaxAge = (int)((8.0D/(Math.random()*0.8D+0.2D))*ageMulti);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -42,7 +42,7 @@ public final class PacketHandler{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void handleData(NBTTagCompound compound){
|
public void handleData(NBTTagCompound compound){
|
||||||
AssetUtil.renderParticlesFromAToB(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), compound.getInteger("ParticleAmount"), compound.getFloat("ParticleSize"), new float[]{compound.getFloat("Color1"), compound.getFloat("Color2"), compound.getFloat("Color3")}, compound.getFloat("AgeMultiplier"));
|
AssetUtil.spawnLaserWithTimeClient(compound.getDouble("StartX"), compound.getDouble("StartY"), compound.getDouble("StartZ"), compound.getDouble("EndX"), compound.getDouble("EndY"), compound.getDouble("EndZ"), new float[]{compound.getFloat("Color1"), compound.getFloat("Color2"), compound.getFloat("Color3")}, compound.getInteger("MaxAge"), compound.getDouble("RotationTime"), compound.getFloat("Size"), compound.getFloat("Alpha"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler(){
|
public static final IDataHandler TILE_ENTITY_HANDLER = new IDataHandler(){
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple
|
||||||
|
|
||||||
public static void shootLaser(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens){
|
public static void shootLaser(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, Lens currentLens){
|
||||||
world.playSound(null, startX, startY, startZ, SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F);
|
world.playSound(null, startX, startY, startZ, SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F);
|
||||||
AssetUtil.shootParticles(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 8, 2F, 1F);
|
AssetUtil.spawnLaserWithTimeServer(world, startX, startY, startZ, endX, endY, endZ, currentLens.getColor(), 25, 0, 0.2F, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.api.recipe.EmpowererRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -30,6 +29,8 @@ import java.util.List;
|
||||||
public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
||||||
|
|
||||||
private int processTime;
|
private int processTime;
|
||||||
|
public int recipeForRenderIndex;
|
||||||
|
private int lastRecipe;
|
||||||
|
|
||||||
public TileEntityEmpowerer(){
|
public TileEntityEmpowerer(){
|
||||||
super(1, "empowerer");
|
super(1, "empowerer");
|
||||||
|
@ -57,6 +58,7 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
||||||
for(EmpowererRecipe recipe : recipes){
|
for(EmpowererRecipe recipe : recipes){
|
||||||
TileEntityDisplayStand[] modifierStands = this.getFittingModifiers(recipe, recipe.time);
|
TileEntityDisplayStand[] modifierStands = this.getFittingModifiers(recipe, recipe.time);
|
||||||
if(modifierStands != null){ //Meaning the display stands around match all the criteria
|
if(modifierStands != null){ //Meaning the display stands around match all the criteria
|
||||||
|
this.recipeForRenderIndex = ActuallyAdditionsAPI.EMPOWERER_RECIPES.indexOf(recipe);
|
||||||
|
|
||||||
this.processTime++;
|
this.processTime++;
|
||||||
boolean done = this.processTime >= recipe.time;
|
boolean done = this.processTime >= recipe.time;
|
||||||
|
@ -67,27 +69,32 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
||||||
if(done){
|
if(done){
|
||||||
stand.decrStackSize(0, 1);
|
stand.decrStackSize(0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetUtil.shootParticles(this.worldObj, stand.getPos().getX(), stand.getPos().getY()+0.45F, stand.getPos().getZ(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), recipe.particleColor, 8, 0.5F, 1F);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.processTime%5 == 0 && this.worldObj instanceof WorldServer){
|
if(this.processTime%5 == 0 && this.worldObj instanceof WorldServer){
|
||||||
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 3, 0, 0, 0, 0.1D);
|
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.FIREWORKS_SPARK, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 2, 0, 0, 0, 0.1D);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(done){
|
if(done){
|
||||||
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 300, 0, 0, 0, 0.25D);
|
((WorldServer)this.worldObj).spawnParticle(EnumParticleTypes.END_ROD, false, this.pos.getX()+0.5, this.pos.getY()+1.1, this.pos.getZ()+0.5, 100, 0, 0, 0, 0.25D);
|
||||||
|
|
||||||
this.slots[0] = recipe.output.copy();
|
this.slots[0] = recipe.output.copy();
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.recipeForRenderIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.recipeForRenderIndex = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.lastRecipe != this.recipeForRenderIndex){
|
||||||
|
this.lastRecipe = this.recipeForRenderIndex;
|
||||||
|
this.sendUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +134,9 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
||||||
if(type == NBTType.SAVE_TILE){
|
if(type == NBTType.SAVE_TILE){
|
||||||
compound.setInteger("ProcessTime", this.processTime);
|
compound.setInteger("ProcessTime", this.processTime);
|
||||||
}
|
}
|
||||||
|
if(type == NBTType.SYNC){
|
||||||
|
compound.setInteger("RenderIndex", this.recipeForRenderIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,6 +145,9 @@ public class TileEntityEmpowerer extends TileEntityInventoryBase{
|
||||||
if(type == NBTType.SAVE_TILE){
|
if(type == NBTType.SAVE_TILE){
|
||||||
this.processTime = compound.getInteger("ProcessTime");
|
this.processTime = compound.getInteger("ProcessTime");
|
||||||
}
|
}
|
||||||
|
if(type == NBTType.SYNC){
|
||||||
|
this.recipeForRenderIndex = compound.getInteger("RenderIndex");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements ISharingE
|
||||||
|
|
||||||
this.storage.receiveEnergy(ENERGY_PRODUCED, false);
|
this.storage.receiveEnergy(ENERGY_PRODUCED, false);
|
||||||
|
|
||||||
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F, 1F);
|
AssetUtil.spawnLaserWithTimeServer(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 25, 0, 0.075F, 0.8F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements ICustomE
|
||||||
}
|
}
|
||||||
|
|
||||||
private void shootParticles(int endX, int endY, int endZ){
|
private void shootParticles(int endX, int endY, int endZ){
|
||||||
AssetUtil.shootParticles(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F, 1F);
|
AssetUtil.spawnLaserWithTimeServer(this.worldObj, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{65F/255F, 150F/255F, 2F/255F}, 10, 120, 0.1F, 0.8F);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlacklisted(Block block){
|
private boolean isBlacklisted(Block block){
|
||||||
|
|
|
@ -169,10 +169,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
|
||||||
double d3 = (double)(this.worldObj.rand.nextFloat()*1.0F*(float)i1);
|
double d3 = (double)(this.worldObj.rand.nextFloat()*1.0F*(float)i1);
|
||||||
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.ticksElapsed%80 == 0){
|
|
||||||
AssetUtil.renderParticlesFromAToB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.boundPosition.getX(), this.boundPosition.getY(), this.boundPosition.getZ(), 2, 0.35F, TileEntityPhantomface.COLORS, 3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -151,10 +151,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
double d3 = (double)(this.worldObj.rand.nextFloat()*1.0F*(float)i1);
|
double d3 = (double)(this.worldObj.rand.nextFloat()*1.0F*(float)i1);
|
||||||
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, d3, d4, d5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.ticksElapsed%80 == 0){
|
|
||||||
AssetUtil.renderParticlesFromAToB(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.boundPosition.getX(), this.boundPosition.getY(), this.boundPosition.getZ(), 2, 0.35F, COLORS, 3);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.util;
|
package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.ParticleColored;
|
import de.ellpeck.actuallyadditions.mod.misc.ParticleBeam;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
import de.ellpeck.actuallyadditions.mod.network.PacketServerToClient;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
@ -34,8 +35,6 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public final class AssetUtil{
|
public final class AssetUtil{
|
||||||
|
|
||||||
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
|
public static final ResourceLocation GUI_INVENTORY_LOCATION = getGuiLocation("guiInventory");
|
||||||
|
@ -168,7 +167,7 @@ public final class AssetUtil{
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shootParticles(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int particleAmount, float particleSize, float ageMultiplier){
|
public static void spawnLaserWithTimeServer(World world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha){
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
data.setDouble("StartX", startX);
|
data.setDouble("StartX", startX);
|
||||||
|
@ -180,35 +179,25 @@ public final class AssetUtil{
|
||||||
data.setFloat("Color1", color[0]);
|
data.setFloat("Color1", color[0]);
|
||||||
data.setFloat("Color2", color[1]);
|
data.setFloat("Color2", color[1]);
|
||||||
data.setFloat("Color3", color[2]);
|
data.setFloat("Color3", color[2]);
|
||||||
data.setInteger("ParticleAmount", particleAmount);
|
data.setDouble("RotationTime", rotationTime);
|
||||||
data.setFloat("ParticleSize", particleSize);
|
data.setFloat("Size", size);
|
||||||
data.setFloat("AgeMultiplier", ageMultiplier);
|
data.setInteger("MaxAge", maxAge);
|
||||||
|
data.setFloat("Alpha", alpha);
|
||||||
PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.PARTICLE_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
|
PacketHandler.theNetwork.sendToAllAround(new PacketServerToClient(data, PacketHandler.PARTICLE_HANDLER), new NetworkRegistry.TargetPoint(world.provider.getDimension(), startX, startY, startZ, 96));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public static void renderParticlesFromAToB(double startX, double startY, double startZ, double endX, double endY, double endZ, int particleAmount, float particleSize, float[] color, float ageMultiplier){
|
public static void spawnLaserWithTimeClient(double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha){
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
int particleSetting = mc.gameSettings.particleSetting;
|
|
||||||
|
|
||||||
if(mc.thePlayer.getDistance(startX, startY, startZ) <= 64 || mc.thePlayer.getDistance(endX, endY, endZ) <= 64){
|
if(mc.thePlayer.getDistance(startX, startY, startZ) <= 64 || mc.thePlayer.getDistance(endX, endY, endZ) <= 64){
|
||||||
double difX = startX-endX;
|
Particle fx = new ParticleBeam(mc.theWorld, startX, startY, startZ, endX, endY, endZ, color, maxAge, rotationTime, size, alpha);
|
||||||
double difY = startY-endY;
|
mc.effectRenderer.addEffect(fx);
|
||||||
double difZ = startZ-endZ;
|
|
||||||
double distance = new Vec3d(startX, startY, startZ).distanceTo(new Vec3d(endX, endY, endZ));
|
|
||||||
|
|
||||||
for(int times = 0; times < Math.max(particleAmount/2, 1); times++){
|
|
||||||
for(double i = 0; i <= 1; i += 1/(distance*particleAmount)){
|
|
||||||
if(particleSetting == 0 || (particleSetting == 1 && mc.theWorld.rand.nextFloat() >= 0.8F) || (particleSetting > 1 && mc.theWorld.rand.nextFloat() >= 0.98F)){
|
|
||||||
ParticleColored fx = new ParticleColored(mc.theWorld, (difX*i)+endX+0.5, (difY*i)+endY+0.5, (difZ*i)+endZ+0.5, particleSize, color[0], color[1], color[2], ageMultiplier);
|
|
||||||
mc.effectRenderer.addEffect(fx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Thanks to feldim2425 for this.
|
//Thanks to feldim2425 for this.
|
||||||
//I can't do rendering code. Ever.
|
//I can't do rendering code. Ever.
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
|
|
Loading…
Reference in a new issue