mirror of
https://github.com/GTNewHorizons/Hardcore-Ender-Expansion.git
synced 2026-10-26 14:24:03 +00:00
OMG particlez
This commit is contained in:
1 parent
0378bacc72
commit
8d1c58eae2
10 files changed
+117
-67
No files matched your search
@@ -13,10 +13,11 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import chylex.hee.entity.block.EntityBlockFallingDragonEgg;
|
||||
import chylex.hee.entity.block.EntityBlockTempleDragonEgg;
|
||||
import chylex.hee.entity.fx.FXType;
|
||||
import chylex.hee.mechanics.knowledge.KnowledgeRegistrations;
|
||||
import chylex.hee.mechanics.knowledge.util.ObservationUtil;
|
||||
import chylex.hee.packets.PacketPipeline;
|
||||
import chylex.hee.packets.client.C13ParticleDragonEggTeleportation;
|
||||
import chylex.hee.packets.client.C22EffectLine;
|
||||
import chylex.hee.system.achievements.AchievementManager;
|
||||
import chylex.hee.system.savedata.ServerSavefile;
|
||||
import chylex.hee.world.biome.BiomeDecoratorHardcoreEnd;
|
||||
@@ -112,7 +113,7 @@ public class BlockDragonEggCustom extends BlockDragonEgg{
|
||||
world.setBlock(xx,yy,zz,this,world.getBlockMetadata(x,y,z),2);
|
||||
world.setBlockToAir(x,y,z);
|
||||
|
||||
PacketPipeline.sendToAllAround(world.provider.dimensionId,x,y,z,76D,new C13ParticleDragonEggTeleportation(x,y,z,xx,yy,zz));
|
||||
PacketPipeline.sendToAllAround(world.provider.dimensionId,x,y,z,64D,new C22EffectLine(FXType.Line.DRAGON_EGG_TELEPORT,x+0.5D,y+0.5D,z+0.5D,xx+0.5D,yy+0.5D,zz+0.5D));
|
||||
for(EntityPlayer observer:ObservationUtil.getAllObservers(world,x+0.5D,y+0.5D,z+0.5D,12D))KnowledgeRegistrations.ENDER_DRAGON.tryUnlockFragment(observer,0.25F,new byte[]{ 16,17 });
|
||||
|
||||
return;
|
||||
|
||||
@@ -13,6 +13,10 @@ public class EntityBigPortalFX extends EntityFX{
|
||||
public EntityBigPortalFX(World world, double x, double y, double z, double motionX, double motionY, double motionZ){
|
||||
super(world,x,y,z,motionX,motionY,motionZ);
|
||||
|
||||
this.motionX = motionX;
|
||||
this.motionY = motionY;
|
||||
this.motionZ = motionZ;
|
||||
|
||||
particleRed = particleGreen = particleBlue = 1F*rand.nextFloat()*0.6F+0.4F;
|
||||
particleGreen *= 0.3F;
|
||||
particleRed *= 0.9F;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package chylex.hee.entity.fx;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import chylex.hee.HardcoreEnderExpansion;
|
||||
import chylex.hee.block.BlockList;
|
||||
@@ -111,6 +112,30 @@ public final class FXHandler{
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleLine(World world, EntityClientPlayerMP player, FXType.Line fx, double x1, double y1, double z1, double x2, double y2, double z2){
|
||||
Vec3 lineVec = Vec3.createVectorHelper(x2-x1,y2-y1,z2-z1);
|
||||
double len = lineVec.lengthVector();
|
||||
lineVec = lineVec.normalize();
|
||||
|
||||
switch(fx){
|
||||
case DRAGON_EGG_TELEPORT:
|
||||
double addX = lineVec.xCoord*0.25D, addY = lineVec.yCoord*0.25D, addZ = lineVec.zCoord*0.25D;
|
||||
|
||||
for(int a = 0; a < 35; a++)world.spawnParticle("smoke",x1+randCenter(0.8D),y1+randCenter(0.8D),z1+randCenter(0.8D),randCenter(0.01D),randCenter(0.01D),randCenter(0.01D));
|
||||
|
||||
for(int a = 0; a < len*4D; a++){
|
||||
for(int b = 0; b < 4; b++)HardcoreEnderExpansion.fx.portalBig(world,x1,y1,z1,randCenter(0.01D),randCenter(0.01D),randCenter(0.01D),0.15F);
|
||||
|
||||
x1 += addX;
|
||||
y1 += addY;
|
||||
z1 += addZ;
|
||||
}
|
||||
|
||||
world.playSound(x1,y1,z1,"mob.endermen.portal",1.2F,1F,false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static double randCenter(double mp){
|
||||
return (rand.nextDouble()-rand.nextDouble())*mp;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,12 @@ public final class FXType{
|
||||
|
||||
public static FXType.Entity[] values = values();
|
||||
}
|
||||
|
||||
public enum Line{
|
||||
DRAGON_EGG_TELEPORT,
|
||||
CHARM_SLAUGHTER_IMPACT,
|
||||
CHARM_DAMAGE_REDIRECTION;
|
||||
|
||||
public static FXType.Line[] values = values();
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class EntityItemEndPowder extends EntityItem{
|
||||
}
|
||||
|
||||
if (emerald != null && string != null && ++progress > 8){
|
||||
for(int a = 0; a < 20; a++)HardcoreEnderExpansion.fx.portalBig(worldObj,posX,posY+0.5D,posZ,0D,0.2D+rand.nextDouble()*0.2D,0D);
|
||||
for(int a = 0; a < 20; a++)HardcoreEnderExpansion.fx.portalBig(worldObj,posX,posY+0.5D,posZ,(rand.nextDouble()-0.5D)*0.2D,0.15D+rand.nextDouble()*0.15D,(rand.nextDouble()-0.5D)*0.2D);
|
||||
emerald.setDead();
|
||||
string.setDead();
|
||||
setDead();
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
package chylex.hee.packets.client;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import chylex.hee.packets.AbstractClientPacket;
|
||||
import chylex.hee.system.util.MathUtil;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class C13ParticleDragonEggTeleportation extends AbstractClientPacket{
|
||||
private int startX,startY,startZ;
|
||||
private int endX,endY,endZ;
|
||||
|
||||
public C13ParticleDragonEggTeleportation(){}
|
||||
|
||||
public C13ParticleDragonEggTeleportation(int startX, int startY, int startZ, int endX, int endY, int endZ){
|
||||
this.startX = startX;
|
||||
this.startY = startY;
|
||||
this.startZ = startZ;
|
||||
this.endX = endX;
|
||||
this.endY = endY;
|
||||
this.endZ = endZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer){
|
||||
buffer.writeInt(startX).writeInt(startY).writeInt(startZ);
|
||||
buffer.writeInt(endX).writeInt(endY).writeInt(endZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buffer){
|
||||
startX = buffer.readInt();
|
||||
startY = buffer.readInt();
|
||||
startZ = buffer.readInt();
|
||||
endX = buffer.readInt();
|
||||
endY = buffer.readInt();
|
||||
endZ = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void handle(EntityClientPlayerMP player){
|
||||
float x1 = startX+0.5F, y1 = startY+0.5F, z1 = startZ+0.5F,
|
||||
x2 = endX+0.5F, y2 = endY+0.5F, z2 = endZ+0.5F,
|
||||
len = (float)Math.sqrt(MathUtil.square(x2-x1)+MathUtil.square(y2-y1)+MathUtil.square(z2-z1));
|
||||
|
||||
double dir = Math.atan2((z2-z1),(x2-x1)),cos = Math.cos(dir),sin = Math.sin(dir),
|
||||
cos2 = Math.cos(Math.atan2((z2-z1),(y2-y1)));
|
||||
|
||||
for(float i = 0f; i < len; i += 0.5f){
|
||||
for(int a = 0; a < 8; a++){
|
||||
player.worldObj.spawnParticle("portal",x1+(cos*i),y1+(cos2*i),z1+(sin*i),(rand.nextFloat()-0.5F)*0.2F,(rand.nextFloat()-0.5F)*0.2F,(rand.nextFloat()-0.5F)*0.2F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package chylex.hee.packets.client;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import chylex.hee.entity.fx.FXHandler;
|
||||
import chylex.hee.entity.fx.FXType;
|
||||
import chylex.hee.packets.AbstractClientPacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class C22EffectLine extends AbstractClientPacket{
|
||||
private FXType.Line type;
|
||||
private double x1,y1,z1,x2,y2,z2;
|
||||
|
||||
public C22EffectLine(){}
|
||||
|
||||
public C22EffectLine(FXType.Line type, double x1, double y1, double z1, double x2, double y2, double z2){
|
||||
this.type = type;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
this.z1 = z1;
|
||||
this.x2 = x2;
|
||||
this.y2 = y2;
|
||||
this.z2 = z2;
|
||||
}
|
||||
|
||||
public C22EffectLine(FXType.Line type, Entity entity1, Entity entity2){
|
||||
this(type,entity1.posX,entity1.posY,entity1.posZ,entity2.posX,entity2.posY,entity2.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ByteBuf buffer){
|
||||
buffer.writeByte(type.ordinal()).writeDouble(x1).writeDouble(y1).writeDouble(z1).writeDouble(x2).writeDouble(y2).writeDouble(z2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(ByteBuf buffer){
|
||||
byte fxType = buffer.readByte();
|
||||
|
||||
if (fxType >= 0 && fxType < FXType.Line.values.length){
|
||||
type = FXType.Line.values[fxType];
|
||||
x1 = buffer.readDouble();
|
||||
y1 = buffer.readDouble();
|
||||
z1 = buffer.readDouble();
|
||||
x2 = buffer.readDouble();
|
||||
y2 = buffer.readDouble();
|
||||
z2 = buffer.readDouble();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void handle(EntityClientPlayerMP player){
|
||||
if (type != null)FXHandler.handleLine(player.worldObj,player,type,x1,y1,z1,x2,y2,z2);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityAuraFX;
|
||||
import net.minecraft.client.particle.EntityBreakingFX;
|
||||
import net.minecraft.client.particle.EntityCritFX;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.particle.EntityFlameFX;
|
||||
@@ -87,11 +88,24 @@ public class FXClientProxy extends FXCommonProxy{
|
||||
spawn(new EntityBigPortalFX(world,x,y,z,motionX,motionY,motionZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void portalBig(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float scaleMp){
|
||||
spawn(new EntityBigPortalFX(world,x,y,z,motionX,motionY,motionZ,scaleMp));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void portalOrbiting(World world, double x, double y, double z, double motionY){
|
||||
spawn(new EntityOrbitingPortalFX(world,x,y,z,motionY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void magicCrit(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float redMp, float greenMp, float blueMp){
|
||||
EntityCritFX fx = new EntityCritFX(world,x,y,z,motionX,motionY,motionZ);
|
||||
fx.setRBGColorF(fx.getRedColorF()*redMp,fx.getGreenColorF()*greenMp,fx.getBlueColorF()*blueMp);
|
||||
fx.nextTextureIndexX();
|
||||
spawn(fx);
|
||||
}
|
||||
|
||||
/*
|
||||
* BLOCKS
|
||||
*/
|
||||
@@ -99,7 +113,7 @@ public class FXClientProxy extends FXCommonProxy{
|
||||
@Override
|
||||
public void corruptedEnergy(World world, int x, int y, int z){
|
||||
Random rand = world.rand;
|
||||
double motX = (rand.nextDouble()-rand.nextDouble())*0.05D, motY = (rand.nextDouble()-rand.nextDouble())*0.05D, motZ = (rand.nextDouble()-rand.nextDouble())*0.05D;
|
||||
double motX = (rand.nextDouble()-rand.nextDouble())*0.2D, motY = (rand.nextDouble()-rand.nextDouble())*0.2D, motZ = (rand.nextDouble()-rand.nextDouble())*0.2D;
|
||||
spawn(new EntityBigPortalFX(world,x+0.5D,y+0.5D,z+0.5D,motX,motY,motZ,rand.nextBoolean() ? 1F : 1.5F+rand.nextFloat()));
|
||||
}
|
||||
|
||||
@@ -192,11 +206,7 @@ public class FXClientProxy extends FXCommonProxy{
|
||||
public void spatialDash(EntityProjectileSpatialDash spatialDash){
|
||||
Random rand = spatialDash.worldObj.rand;
|
||||
|
||||
spawn(new EntityBigPortalFX(spatialDash.worldObj,spatialDash.posX+(rand.nextDouble()-rand.nextDouble())*0.3D,spatialDash.posY+(rand.nextDouble()-rand.nextDouble())*0.3D,spatialDash.posZ+(rand.nextDouble()-rand.nextDouble())*0.3D,0D,0D,0D,0.1F){{
|
||||
motionX *= 0.02D;
|
||||
motionY *= 0.02D;
|
||||
motionZ *= 0.02D;
|
||||
}});
|
||||
spawn(new EntityBigPortalFX(spatialDash.worldObj,spatialDash.posX+(rand.nextDouble()-rand.nextDouble())*0.3D,spatialDash.posY+(rand.nextDouble()-rand.nextDouble())*0.3D,spatialDash.posZ+(rand.nextDouble()-rand.nextDouble())*0.3D,(rand.nextDouble()-0.5D)*0.01D,(rand.nextDouble()-0.5D)*0.01D,(rand.nextDouble()-0.5D)*0.01D,0.1F));
|
||||
|
||||
for(int a = 0; a < 3; a++){
|
||||
double motX = (rand.nextDouble()-rand.nextDouble())*0.0002D, motY = (rand.nextDouble()-rand.nextDouble())*0.0002D, motZ = (rand.nextDouble()-rand.nextDouble())*0.0002D;
|
||||
@@ -207,7 +217,7 @@ public class FXClientProxy extends FXCommonProxy{
|
||||
@Override
|
||||
public void spatialDashExplode(EntityProjectileSpatialDash spatialDash){
|
||||
Random rand = spatialDash.worldObj.rand;
|
||||
spawn(new EntityBigPortalFX(spatialDash.worldObj,spatialDash.posX+(rand.nextDouble()-rand.nextDouble())*0.1D,spatialDash.posY+(rand.nextDouble()-rand.nextDouble())*0.1D,spatialDash.posZ+(rand.nextDouble()-rand.nextDouble())*0.1D,0D,-rand.nextDouble(),0D,1F));
|
||||
spawn(new EntityBigPortalFX(spatialDash.worldObj,spatialDash.posX+(rand.nextDouble()-rand.nextDouble())*0.1D,spatialDash.posY+(rand.nextDouble()-rand.nextDouble())*0.1D,spatialDash.posZ+(rand.nextDouble()-rand.nextDouble())*0.1D,(rand.nextDouble()-0.5D)*0.3D,(rand.nextDouble()-0.5D)*0.3D,(rand.nextDouble()-0.5D)*0.3D,1F));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,9 @@ public class FXCommonProxy{
|
||||
public void bubble(World world, double x, double y, double z, double motionX, double motionY, double motionZ){}
|
||||
public void flame(World world, double x, double y, double z, int maxAge){}
|
||||
public void portalBig(World world, double x, double y, double z, double motionX, double motionY, double motionZ){}
|
||||
public void portalBig(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float scaleMp){}
|
||||
public void portalOrbiting(World world, double x, double y, double z, double motionY){}
|
||||
public void magicCrit(World world, double x, double y, double z, double motionX, double motionY, double motionZ, float redMp, float greenMp, float blueMp){}
|
||||
|
||||
// BLOCKS
|
||||
public void corruptedEnergy(World world, int x, int y, int z){}
|
||||
|
||||
@@ -116,7 +116,7 @@ public final class DragonUtil{
|
||||
|
||||
public static double[] getNormalizedVector(double vecX, double vecZ){
|
||||
double len = Math.sqrt(vecX*vecX+vecZ*vecZ);
|
||||
return len == 0?new double[]{0,0}:new double[]{vecX/len,vecZ/len};
|
||||
return len == 0 ? new double[]{ 0, 0 } : new double[]{ vecX/len, vecZ/len };
|
||||
}
|
||||
|
||||
public static int getTopBlock(World worldObj, Block block, int x, int z, int starty){
|
||||
|
||||
Reference in new issue
Block a user