-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Null particles, more improvements to Anomaly blocks
- Loading branch information
Showing
12 changed files
with
172 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/******************************************************************************* | ||
* Copyright 2022, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package biomesoplenty.block; | ||
|
||
import biomesoplenty.init.ModParticles; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.Direction; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
public class NullBlock extends Block | ||
{ | ||
public NullBlock(Properties properties) | ||
{ | ||
super(properties); | ||
} | ||
|
||
@Override | ||
public void animateTick(BlockState p_221253_, Level p_221254_, BlockPos p_221255_, RandomSource p_221256_) | ||
{ | ||
if (p_221256_.nextInt(5) == 0) | ||
{ | ||
Direction direction = Direction.getRandom(p_221256_); | ||
Direction.Axis direction$axis = direction.getAxis(); | ||
BlockPos blockpos = p_221255_.relative(direction); | ||
BlockState blockstate = p_221254_.getBlockState(blockpos); | ||
|
||
if (!isFaceFull(blockstate.getCollisionShape(p_221254_, blockpos), direction)) | ||
{ | ||
double d0 = (double)p_221255_.getX() + 0.5D; | ||
double d1 = (double)p_221255_.getY() + 0.5D; | ||
double d2 = (double)p_221255_.getZ() + 0.5D; | ||
|
||
double d3 = (p_221256_.nextDouble() * 0.5D) - (p_221256_.nextDouble() * 0.5D); | ||
double d4 = direction$axis == Direction.Axis.X ? (double)direction.getStepX() * 0.55D : d3; | ||
double d5 = direction$axis == Direction.Axis.Y ? (double)direction.getStepY() * 0.55D : d3; | ||
double d6 = direction$axis == Direction.Axis.Z ? (double)direction.getStepZ() * 0.55D : d3; | ||
|
||
double ymove = 0.1D; | ||
if (direction == Direction.DOWN) | ||
{ | ||
ymove = -0.1D; | ||
} | ||
|
||
p_221254_.addParticle(ModParticles.NULL, d0 + d4, d1 + d5, d2 + d6, 0.0D, ymove, 0.0D); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
common/src/main/java/biomesoplenty/particle/NullParticle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************* | ||
* Copyright 2022, the Glitchfiend Team. | ||
* All rights reserved. | ||
******************************************************************************/ | ||
package biomesoplenty.particle; | ||
|
||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.client.particle.*; | ||
import net.minecraft.core.particles.SimpleParticleType; | ||
|
||
public class NullParticle extends TextureSheetParticle | ||
{ | ||
NullParticle(ClientLevel p_105856_, double p_105857_, double p_105858_, double p_105859_, double p_105860_, double p_105861_, double p_105862_) | ||
{ | ||
super(p_105856_, p_105857_, p_105858_, p_105859_); | ||
this.setSize(0.02F, 0.02F); | ||
this.lifetime = this.random.nextInt(24) + 8; | ||
this.xd = p_105860_; | ||
this.yd = p_105861_; | ||
this.zd = p_105862_; | ||
} | ||
|
||
@Override | ||
public void tick() | ||
{ | ||
this.xo = this.x; | ||
this.yo = this.y; | ||
this.zo = this.z; | ||
if (this.age++ < this.lifetime) | ||
{ | ||
this.move(this.xd, this.yd, this.zd); | ||
} | ||
else | ||
{ | ||
this.remove(); | ||
} | ||
} | ||
|
||
@Override | ||
public ParticleRenderType getRenderType() { | ||
return ParticleRenderType.PARTICLE_SHEET_OPAQUE; | ||
} | ||
|
||
public static class Provider implements ParticleProvider<SimpleParticleType> | ||
{ | ||
private final SpriteSet sprites; | ||
|
||
public Provider(SpriteSet p_105899_) { | ||
this.sprites = p_105899_; | ||
} | ||
|
||
public Particle createParticle(SimpleParticleType p_105910_, ClientLevel p_105911_, double p_105912_, double p_105913_, double p_105914_, double p_105915_, double p_105916_, double p_105917_) | ||
{ | ||
NullParticle particle = new NullParticle(p_105911_, p_105912_, p_105913_, p_105914_, p_105915_, p_105916_, p_105917_); | ||
particle.pickSprite(this.sprites); | ||
return particle; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
common/src/main/resources/assets/biomesoplenty/particles/null.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"textures": [ | ||
"biomesoplenty:null_0", | ||
"biomesoplenty:null_1", | ||
"biomesoplenty:null_2" | ||
] | ||
} |
Binary file added
BIN
+141 Bytes
common/src/main/resources/assets/biomesoplenty/textures/particle/null_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+144 Bytes
common/src/main/resources/assets/biomesoplenty/textures/particle/null_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+146 Bytes
common/src/main/resources/assets/biomesoplenty/textures/particle/null_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.