Vibrant Quartz Glass + Particles
This commit is contained in:
@@ -19,35 +19,49 @@
|
||||
package appeng.client.render.effects;
|
||||
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public class VibrantFX extends Particle
|
||||
public class VibrantFX extends SpriteTexturedParticle
|
||||
{
|
||||
|
||||
public VibrantFX( final World par1World, final double x, final double y, final double z, final double par8, final double par10, final double par12 )
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "vibrant_fx");
|
||||
}
|
||||
|
||||
public VibrantFX( final World par1World, final double x, final double y, final double z, final double par8, final double par10, final double par12, IAnimatedSprite sprite)
|
||||
{
|
||||
super( par1World, x, y, z, par8, par10, par12 );
|
||||
final float f = this.rand.nextFloat() * 0.1F + 0.8F;
|
||||
this.particleRed = f * 0.7f;
|
||||
this.particleGreen = f * 0.89f;
|
||||
this.particleBlue = f * 0.9f;
|
||||
this.setParticleTextureIndex( 0 );
|
||||
this.selectSpriteRandomly(sprite);
|
||||
this.setSize( 0.04F, 0.04F );
|
||||
this.particleScale *= this.rand.nextFloat() * 0.6F + 1.9F;
|
||||
this.motionX = 0.0D;
|
||||
this.motionY = 0.0D;
|
||||
this.motionZ = 0.0D;
|
||||
this.prevPosX = this.getPosX();
|
||||
this.prevPosY = this.getPosY();
|
||||
this.prevPosZ = this.getPosZ();
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.maxAge = (int) ( 20.0D / ( Math.random() * 0.8D + 0.1D ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IParticleRenderType getRenderType() {
|
||||
// FIXME Might be PARTICLE_SHEET_LIT
|
||||
return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender( final float par1 )
|
||||
{
|
||||
@@ -61,9 +75,9 @@ public class VibrantFX extends Particle
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
this.prevPosX = this.getPosX();
|
||||
this.prevPosY = this.getPosY();
|
||||
this.prevPosZ = this.getPosZ();
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.particleScale *= 0.95;
|
||||
|
||||
@@ -73,4 +87,18 @@ public class VibrantFX extends Particle
|
||||
}
|
||||
this.maxAge--;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Factory implements IParticleFactory<BasicParticleType> {
|
||||
private final IAnimatedSprite spriteSet;
|
||||
|
||||
public Factory(IAnimatedSprite spriteSet) {
|
||||
this.spriteSet = spriteSet;
|
||||
}
|
||||
|
||||
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new VibrantFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.client.render.effects.VibrantFX;
|
||||
import appeng.client.render.model.GlassModelLoader;
|
||||
import appeng.core.stats.AeStats;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -265,10 +266,12 @@ final class Registration
|
||||
{
|
||||
final IForgeRegistry<ParticleType<?>> registry = event.getRegistry();
|
||||
registry.register(ChargedOreFX.TYPE);
|
||||
registry.register(VibrantFX.TYPE);
|
||||
}
|
||||
|
||||
public void registerParticleFactories(ParticleFactoryRegisterEvent event) {
|
||||
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
|
||||
Minecraft.getInstance().particles.registerFactory(VibrantFX.TYPE, VibrantFX.Factory::new);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -30,11 +30,9 @@ import appeng.bootstrap.IItemRendering;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import appeng.decorative.solid.BlockChargedQuartzOre;
|
||||
import appeng.decorative.solid.BlockQuartzGlass;
|
||||
import appeng.decorative.solid.BlockQuartzOre;
|
||||
import appeng.decorative.solid.BlockQuartzPillar;
|
||||
import appeng.decorative.solid.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -145,7 +143,7 @@ public final class ApiBlocks implements IBlocks
|
||||
this.chiseledQuartzBlock = deco.block( "chiseled_quartz_block", () -> new AEDecorativeBlock(QUARTZ_PROPERTIES) ).build();
|
||||
|
||||
this.quartzGlass = registry.features( AEFeature.QUARTZ_GLASS )
|
||||
.block( "quartz_glass", BlockQuartzGlass::new )
|
||||
.block( "quartz_glass", () -> new BlockQuartzGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).notSolid()) )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -154,15 +152,22 @@ public final class ApiBlocks implements IBlocks
|
||||
}
|
||||
})
|
||||
.build();
|
||||
// this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", BlockQuartzLamp::new )
|
||||
// .addFeatures( AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", () -> new BlockQuartzLamp(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).lightValue(15).notSolid()) )
|
||||
.addFeatures( AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
}
|
||||
})
|
||||
.build();
|
||||
|
||||
// this.quartzFixture = registry.block( "quartz_fixture", BlockQuartzFixture::new )
|
||||
// .features( AEFeature.DECORATIVE_LIGHTS )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
//
|
||||
|
||||
// this.fluixBlock = registry.features( AEFeature.FLUIX ).block( "fluix_block", BlockFluix::new ).build();
|
||||
//
|
||||
// this.skyStoneBlock = registry.features( AEFeature.SKY_STONE )
|
||||
|
||||
@@ -29,8 +29,8 @@ import net.minecraft.util.Direction;
|
||||
|
||||
public class BlockQuartzGlass extends AbstractGlassBlock {
|
||||
|
||||
public BlockQuartzGlass() {
|
||||
super(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).notSolid());
|
||||
public BlockQuartzGlass(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.decorative.solid;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -36,9 +35,8 @@ import appeng.core.AppEng;
|
||||
public class BlockQuartzLamp extends BlockQuartzGlass
|
||||
{
|
||||
|
||||
public BlockQuartzLamp()
|
||||
{
|
||||
this.setLightLevel( 1.0f );
|
||||
public BlockQuartzLamp(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,9 +54,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass
|
||||
final double d1 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
final double d2 = ( r.nextFloat() - 0.5F ) * 0.96D;
|
||||
|
||||
final VibrantFX fx = new VibrantFX( w, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D );
|
||||
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
w.addParticle(VibrantFX.TYPE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user