generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
253 additions
and
10 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
2 changes: 1 addition & 1 deletion
2
...eah/magisterium/MagisteriumBlockTags.java → ...gisterium/block/MagisteriumBlockTags.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
49 changes: 49 additions & 0 deletions
49
src/main/java/io/github/reoseah/magisterium/block/TestBlock.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,49 @@ | ||
package io.github.reoseah.magisterium.block; | ||
|
||
import io.github.reoseah.magisterium.particle.MagisteriumParticles; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockRenderType; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.particle.ParticleTypes; | ||
import net.minecraft.particle.SimpleParticleType; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.World; | ||
|
||
public class TestBlock extends Block { | ||
public static final Block INSTANCE = new TestBlock(Settings.create().nonOpaque().noCollision()); | ||
|
||
public TestBlock(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
protected BlockRenderType getRenderType(BlockState state) { | ||
return BlockRenderType.INVISIBLE; | ||
} | ||
|
||
@Override | ||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { | ||
super.randomDisplayTick(state, world, pos, random); | ||
|
||
var types = new SimpleParticleType[]{ // | ||
MagisteriumParticles.GLYPH_A, // | ||
MagisteriumParticles.GLYPH_B, // | ||
MagisteriumParticles.GLYPH_C // | ||
}; | ||
|
||
for (int i = 0; i < 1; i++) { | ||
double x = pos.getX() + .5 + random.nextGaussian(); | ||
double y = pos.getY() + .5 + random.nextGaussian(); | ||
double z = pos.getZ() + .5 + random.nextGaussian(); | ||
world.addParticle(types[random.nextInt(types.length)], x, y, z, 0.0D, 0.0D, 0.0D); | ||
} | ||
|
||
for (int i = 0; i < 4; i++) { | ||
double x = pos.getX() + .5 + random.nextGaussian(); | ||
double y = pos.getY() + .5 + random.nextGaussian(); | ||
double z = pos.getZ() + .5 + random.nextGaussian(); | ||
world.addParticle(MagisteriumParticles.ENERGY, x, y, z, 0.0D, 0.05D, 0.0D); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...seah/magisterium/MagisteriumItemTags.java → ...magisterium/item/MagisteriumItemTags.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
62 changes: 62 additions & 0 deletions
62
src/main/java/io/github/reoseah/magisterium/particle/EnergyParticle.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,62 @@ | ||
package io.github.reoseah.magisterium.particle; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.particle.*; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.particle.SimpleParticleType; | ||
|
||
public class EnergyParticle extends SpriteBillboardParticle { | ||
protected EnergyParticle(ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { | ||
super(clientWorld, x, y, z, velocityX, velocityY, velocityZ); | ||
this.maxAge = 8 + this.random.nextInt(24); | ||
this.setSprite(spriteProvider); | ||
float brightness = this.random.nextFloat() * 0.6F + 0.4F; | ||
this.red = brightness * 0.1F; | ||
this.green = brightness * 0.5F; | ||
this.blue = brightness; | ||
this.gravityStrength = 0.01F; | ||
this.scale = .25F; | ||
this.velocityX = this.velocityX * 0.05 + velocityX; | ||
this.velocityY = this.velocityY * 0.05 + velocityY; | ||
this.velocityZ = this.velocityZ * 0.05 + velocityZ; | ||
} | ||
|
||
@Override | ||
public ParticleTextureSheet getType() { | ||
return ParticleTextureSheet.PARTICLE_SHEET_OPAQUE; | ||
} | ||
|
||
@Override | ||
protected int getBrightness(float tint) { | ||
return 240; | ||
} | ||
|
||
@Override | ||
public void tick() { | ||
this.prevPosX = this.x; | ||
this.prevPosY = this.y; | ||
this.prevPosZ = this.z; | ||
if (this.maxAge-- <= 0) { | ||
this.markDead(); | ||
return; | ||
} | ||
this.move(this.velocityX, this.velocityY, this.velocityZ); | ||
this.velocityX *= 0.99D; | ||
this.velocityY *= 0.99D; | ||
this.velocityZ *= 0.99D; | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static class Factory implements ParticleFactory<SimpleParticleType> { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public Factory(SpriteProvider spriteProvider) { | ||
this.spriteProvider = spriteProvider; | ||
} | ||
|
||
public Particle createParticle(SimpleParticleType simpleParticleType, ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { | ||
return new EnergyParticle(clientWorld, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider); | ||
} | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/io/github/reoseah/magisterium/particle/GlyphParticle.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,61 @@ | ||
package io.github.reoseah.magisterium.particle; | ||
|
||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.particle.*; | ||
import net.minecraft.client.world.ClientWorld; | ||
import net.minecraft.particle.SimpleParticleType; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class GlyphParticle extends SpriteBillboardParticle { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public GlyphParticle(ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ, SpriteProvider spriteProvider) { | ||
super(clientWorld, x, y, z, velocityX, velocityY, velocityZ); | ||
this.spriteProvider = spriteProvider; | ||
this.maxAge = 16; | ||
this.setSpriteForAge(spriteProvider); | ||
|
||
this.scale = .5F; | ||
this.velocityX = this.velocityX * 0.05 + velocityX; | ||
this.velocityY = this.velocityY * 0.05 + velocityY; | ||
this.velocityZ = this.velocityZ * 0.05 + velocityZ; | ||
} | ||
|
||
@Override | ||
public ParticleTextureSheet getType() { | ||
return ParticleTextureSheet.PARTICLE_SHEET_OPAQUE; | ||
} | ||
|
||
@Override | ||
protected int getBrightness(float tint) { | ||
return 0xFF; | ||
} | ||
|
||
@Override | ||
public void tick() { | ||
this.prevPosX = this.x; | ||
this.prevPosY = this.y; | ||
this.prevPosZ = this.z; | ||
if (this.age++ >= this.maxAge) { | ||
this.markDead(); | ||
} else { | ||
this.velocityY = this.velocityY - this.gravityStrength; | ||
this.move(this.velocityX, this.velocityY, this.velocityZ); | ||
this.setSpriteForAge(this.spriteProvider); | ||
} | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static class Factory implements ParticleFactory<SimpleParticleType> { | ||
private final SpriteProvider spriteProvider; | ||
|
||
public Factory(SpriteProvider spriteProvider) { | ||
this.spriteProvider = spriteProvider; | ||
} | ||
|
||
public Particle createParticle(SimpleParticleType simpleParticleType, ClientWorld clientWorld, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { | ||
return new GlyphParticle(clientWorld, x, y, z, velocityX, velocityY, velocityZ, this.spriteProvider); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/io/github/reoseah/magisterium/particle/MagisteriumParticles.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 io.github.reoseah.magisterium.particle; | ||
|
||
import net.minecraft.particle.SimpleParticleType; | ||
|
||
public class MagisteriumParticles { | ||
public static final SimpleParticleType ENERGY = new MagisteriumParticleType(true); | ||
public static final SimpleParticleType GLYPH_A = new MagisteriumParticleType(true); | ||
public static final SimpleParticleType GLYPH_B = new MagisteriumParticleType(true); | ||
public static final SimpleParticleType GLYPH_C = new MagisteriumParticleType(true); | ||
|
||
// makes constructor public | ||
public static class MagisteriumParticleType extends SimpleParticleType { | ||
public MagisteriumParticleType(boolean alwaysShow) { | ||
super(alwaysShow); | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/io/github/reoseah/magisterium/recipe/AwakenFlameRecipe.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
2 changes: 1 addition & 1 deletion
2
src/main/java/io/github/reoseah/magisterium/recipe/QuenchFlameRecipe.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
2 changes: 1 addition & 1 deletion
2
src/main/java/io/github/reoseah/magisterium/screen/ArcaneTableScreenHandler.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"textures": [ | ||
"minecraft:generic_0" | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/resources/assets/magisterium/particles/glyph_a.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,12 @@ | ||
{ | ||
"textures": [ | ||
"magisterium:glyph_a_1", | ||
"magisterium:glyph_a_1", | ||
"magisterium:glyph_a_1", | ||
"magisterium:glyph_a_1", | ||
"magisterium:glyph_a_0", | ||
"magisterium:glyph_a_0", | ||
"magisterium:glyph_1", | ||
"magisterium:glyph_0" | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/resources/assets/magisterium/particles/glyph_b.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,12 @@ | ||
{ | ||
"textures": [ | ||
"magisterium:glyph_b_1", | ||
"magisterium:glyph_b_1", | ||
"magisterium:glyph_b_1", | ||
"magisterium:glyph_b_1", | ||
"magisterium:glyph_b_0", | ||
"magisterium:glyph_b_0", | ||
"magisterium:glyph_1", | ||
"magisterium:glyph_0" | ||
] | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/resources/assets/magisterium/particles/glyph_c.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,12 @@ | ||
{ | ||
"textures": [ | ||
"magisterium:glyph_c_1", | ||
"magisterium:glyph_c_1", | ||
"magisterium:glyph_c_1", | ||
"magisterium:glyph_c_1", | ||
"magisterium:glyph_c_0", | ||
"magisterium:glyph_c_0", | ||
"magisterium:glyph_1", | ||
"magisterium:glyph_0" | ||
] | ||
} |
Binary file added
BIN
+136 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_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
+162 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_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
+198 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_a_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
+182 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_a_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
+172 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_b_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
+177 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_b_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
+171 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_c_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
+197 Bytes
src/main/resources/assets/magisterium/textures/particle/glyph_c_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.