-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Added custom particles for mirrors; -Optimized loot manager and loot pools; -Changed configuration manager.
- Loading branch information
Codename Revy
committed
Jan 14, 2020
1 parent
daded17
commit b55f97f
Showing
26 changed files
with
257 additions
and
248 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
4 changes: 4 additions & 0 deletions
4
src/main/java/com/codenamerevy/magicmirror/content/items/ItemDimensionalMirror.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
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
17 changes: 17 additions & 0 deletions
17
src/main/java/com/codenamerevy/magicmirror/init/ParticleInit.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,17 @@ | ||
package com.codenamerevy.magicmirror.init; | ||
|
||
import com.codenamerevy.magicmirror.util.Ref; | ||
import net.minecraft.particles.BasicParticleType; | ||
import net.minecraftforge.registries.ObjectHolder; | ||
|
||
@ObjectHolder(Ref.MODID) | ||
public class ParticleInit | ||
{ | ||
public static final BasicParticleType MIRROR_PARTICLE = createBasicParticleType(false, "mirror_particle"); | ||
|
||
private static BasicParticleType createBasicParticleType(boolean alwaysShow, String name) { | ||
BasicParticleType particleType = new BasicParticleType(alwaysShow); | ||
particleType.setRegistryName(Ref.MODID, name); | ||
return particleType; | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
src/main/java/com/codenamerevy/magicmirror/particle/MirrorParticle.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,88 @@ | ||
package com.codenamerevy.magicmirror.particle; | ||
|
||
import net.minecraft.client.particle.*; | ||
import net.minecraft.particles.BasicParticleType; | ||
import net.minecraft.util.math.MathHelper; | ||
import net.minecraft.world.World; | ||
import net.minecraftforge.api.distmarker.Dist; | ||
import net.minecraftforge.api.distmarker.OnlyIn; | ||
|
||
import java.util.Random; | ||
|
||
public class MirrorParticle extends SpriteTexturedParticle | ||
{ | ||
private static final Random RAND = new Random(); | ||
protected final IAnimatedSprite animatedSprite; | ||
|
||
private MirrorParticle(IAnimatedSprite animatedSprite, World world, double x, double y, double z, double speedX, double speedY, double speedZ) { | ||
super(world, x, y, z, 0.5D - RAND.nextDouble(), speedY, 0.5D - RAND.nextDouble()); | ||
this.animatedSprite = animatedSprite; | ||
this.motionY *= 0.20000000029082000D; | ||
if(speedX == 0.0D && speedZ == 0.0D) { | ||
this.motionX *= 0.10000000029082000D; | ||
this.motionZ *= 0.10000000029082000D; | ||
} | ||
this.particleScale *= 0.5F; | ||
this.maxAge = (int)(7.5D / (Math.random() * 0.4D + 0.2D)); | ||
this.canCollide = false; | ||
this.selectSpriteWithAge(animatedSprite); | ||
} | ||
|
||
public void tick() | ||
{ | ||
this.prevPosX = this.posX; | ||
this.prevPosY = this.posY; | ||
this.prevPosZ = this.posZ; | ||
if(this.age++ >= this.maxAge){ | ||
this.setExpired(); | ||
}else{ | ||
this.selectSpriteWithAge(this.animatedSprite); | ||
this.motionY += 0.04D; | ||
this.move(this.motionX, this.motionY, this.motionZ); | ||
if(this.posY == this.prevPosY){ | ||
this.motionX *= 1.1D; | ||
this.motionZ *= 1.1D; | ||
} | ||
this.motionX *= 0.9599999785423279D; | ||
this.motionY *= 0.9599999785423279D; | ||
this.motionZ *= 0.9599999785423279D; | ||
if (this.onGround) { | ||
this.motionX *= 0.699999988079071D; | ||
this.motionZ *= 0.699999988079071D; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public IParticleRenderType getRenderType() { | ||
return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT; | ||
} | ||
|
||
@Override | ||
public int getBrightnessForRender(float partialTick) { | ||
float f = ((float) this.age + partialTick) / (float) this.maxAge; | ||
f = MathHelper.clamp(f, 0f, 1f); | ||
int i = super.getBrightnessForRender(partialTick); | ||
int j = i & 255; | ||
int k = i >> 16 & 255; | ||
j = j + (int) (f * 15f * 16f); | ||
if (j > 240) { | ||
j = 240; | ||
} | ||
return j | k << 16; | ||
} | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
public static class Factory implements IParticleFactory<BasicParticleType> { | ||
private IAnimatedSprite animatedSprite; | ||
|
||
public Factory(IAnimatedSprite animatedSprite) { | ||
this.animatedSprite = animatedSprite; | ||
} | ||
|
||
@Override | ||
public Particle makeParticle(BasicParticleType type, World world, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) { | ||
return new MirrorParticle(this.animatedSprite, world, x, y, z, xSpeed, ySpeed, zSpeed); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.