@Override public Particle spawnParticle(EnumHarshenParticle type, Vec3d position, Vec3d directionSpeed, float scale, boolean disableMoving, Object...info) { Minecraft minecraft = Minecraft.getMinecraft(); Particle entityFx = null; if(minecraft.world != null) switch (type) { case BLOOD: entityFx = new ParticleBlood(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale, disableMoving); break; case CAULDRON: if(info.length > 0 ) if(info[0] instanceof ResourceLocation) entityFx = new ParticleCauldron(minecraft.world, (ResourceLocation) info[0], position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving); if(info[0] instanceof IBlockState) entityFx = new ParticleCauldron(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving, ((IBlockState)info[0])); break; case ITEM: if(info.length > 0 && info[0] instanceof ItemStack) entityFx = new ParticleItem(minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z, scale / 5f, disableMoving, (ItemStack) info[0]); break; case PORTAL: entityFx = new ParticlePortal.Factory().createParticle(EnumParticleTypes.PORTAL.getParticleID(), minecraft.world, position.x, position.y, position.z, directionSpeed.x, directionSpeed.y, directionSpeed.z); entityFx.setMaxAge((int)(Math.random() * 20.0D) + 100); case CAULDRON_LIQUID: if(info.length > 0) if(info[0] instanceof ResourceLocation) entityFx = new ParticleCauldronTop(minecraft.world, position.x, position.y, position.z, scale, (ResourceLocation) info[0]).setDirectScale(scale); else if(info[0] instanceof IBlockState) entityFx = new ParticleCauldronTop(minecraft.world, position.x, position.y, position.z, scale, ((IBlockState) info[0])).setDirectScale(scale); break; default: break; } if (entityFx != null) {minecraft.effectRenderer.addEffect(entityFx);} return entityFx; }
@SideOnly(Side.CLIENT) public static void doTeleportEffect(World world, double x, double y, double z) { Random random = world.rand; for (int i = 0; i < 100; ++i) { double d = random.nextDouble() * 2D; double mag = 2; double motionX = (0.5 - random.nextDouble()) * mag * d; double motionY = (0.5 - random.nextDouble()) * mag; double motionZ = (0.5 - random.nextDouble()) * mag * d; Particle entityfx = new ParticlePortal.Factory().createParticle (i, world, x + motionX * 0.1, y + motionY * 0.1, z + motionZ * 0.1, motionX, motionY, motionZ, (int[])null); Minecraft.getMinecraft().effectRenderer.addEffect(entityfx); } }