Skip to content

Commit

Permalink
Update 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
NemoNotFound committed Oct 23, 2024
1 parent 27a46e7 commit 82f712a
Show file tree
Hide file tree
Showing 40 changed files with 67 additions and 157 deletions.
6 changes: 3 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Changelog v1.2
# Changelog v1.3

## Changes
- Particles now change color by biome
## Additions
- Added falling leaf particles for pale oak leaves
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.2
yarn_mappings=1.21.2+build.1
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.7

# Mod Properties
mod_version=1.2
mod_version=1.3
maven_group=com.nemonotfound
archives_base_name=nemos-ambience

# Dependencies
fabric_version=0.106.1+1.21.2
fabric_version=0.106.1+1.21.3
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ public class NemosAmbienceClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
registerParticle(OAK_LEAVES_Particle);
registerParticle(DARK_OAK_LEAVES_Particle);
registerParticle(BIRCH_LEAVES_Particle);
registerParticle(SPRUCE_LEAVES_Particle);
registerParticle(JUNGLE_LEAVES_Particle);
registerParticle(MANGROVE_LEAVES_Particle);
registerParticle(ACACIA_LEAVES_Particle);
registerParticle(FALLING_LEAVES_PARTICLE);
registerParticle(PALE_OAK_FALLING_LEAVES_PARTICLE);
}

private void registerParticle(SimpleParticleType particleType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,32 @@ public LeavesParticle(ClientWorld world, double x, double y, double z, SpritePro
}

private void setParticleColor(ClientWorld world) {
int color = getFoliageColor(world);
BlockPos pos = BlockPos.ofFloored(x, y, z);
Block leavesBlock = world.getBlockState(pos.up()).getBlock();
String leavesName = Registries.BLOCK.getId(leavesBlock).getPath();

float red = ((color >> 16) & 0xFF) / 255.0f;
float green = ((color >> 8) & 0xFF) / 255.0f;
float blue = (color & 0xFF) / 255.0f;
if (!leavesName.equals("pale_oak_leaves")) {
int color = getFoliageColor(world, pos, leavesName);

this.setColor(red, green, blue);
float red = ((color >> 16) & 0xFF) / 255.0f;
float green = ((color >> 8) & 0xFF) / 255.0f;
float blue = (color & 0xFF) / 255.0f;

this.setColor(red, green, blue);
}
}

private int getFoliageColor(ClientWorld world) {
private int getFoliageColor(ClientWorld world, BlockPos pos, String leavesName) {
if (world == null) {
return FoliageColors.getDefaultColor();
}

BlockPos pos = BlockPos.ofFloored(x, y, z);
Block leavesBlock = world.getBlockState(pos.up()).getBlock();
String leavesName = Registries.BLOCK.getId(leavesBlock).getPath();

if (leavesName.equals("birch_leaves")) {
return FoliageColors.getBirchColor();
} else if (leavesName.equals("spruce_leaves")) {
return FoliageColors.getSpruceColor();
}
return switch (leavesName) {
case "birch_leaves" -> FoliageColors.getBirchColor();
case "spruce_leaves" -> FoliageColors.getSpruceColor();
default -> BiomeColors.getFoliageColor(world, pos);
};

return BiomeColors.getFoliageColor(world, pos);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@

public class ModParticles {

public static final SimpleParticleType OAK_LEAVES_Particle = registerParticle("oak_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType DARK_OAK_LEAVES_Particle = registerParticle("dark_oak_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType BIRCH_LEAVES_Particle = registerParticle("birch_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType SPRUCE_LEAVES_Particle = registerParticle("spruce_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType JUNGLE_LEAVES_Particle = registerParticle("jungle_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType MANGROVE_LEAVES_Particle = registerParticle("mangrove_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType ACACIA_LEAVES_Particle = registerParticle("acacia_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType FALLING_LEAVES_PARTICLE = registerParticle("falling_leaves", FabricParticleTypes.simple());
public static final SimpleParticleType PALE_OAK_FALLING_LEAVES_PARTICLE = registerParticle("pale_oak_falling_leaves", FabricParticleTypes.simple());

public static void registerParticles() {
log.info("Register Nemo's particles");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,22 @@ private void init(BlockState state, World world, BlockPos pos, Random random, Ca
@Unique
private void generateLeafParticles(World world, BlockPos pos, Random random, String leavesName) {
switch (leavesName) {
case "oak_leaves" -> generateParticles(world, pos, random, OAK_LEAVES_Particle);
case "dark_oak_leaves" -> generateParticles(world, pos, random, DARK_OAK_LEAVES_Particle);
case "birch_leaves" -> generateParticles(world, pos, random, BIRCH_LEAVES_Particle);
case "spruce_leaves" -> generateParticles(world, pos, random, SPRUCE_LEAVES_Particle);
case "jungle_leaves" -> generateParticles(world, pos, random, JUNGLE_LEAVES_Particle);
case "mangrove_leaves" -> generateParticles(world, pos, random, MANGROVE_LEAVES_Particle);
case "acacia_leaves" -> generateParticles(world, pos, random, ACACIA_LEAVES_Particle);
}
case "oak_leaves", "dark_oak_leaves", "birch_leaves", "spruce_leaves", "jungle_leaves", "mangrove_leaves",
"acacia_leaves" -> generateParticles(world, pos, random, FALLING_LEAVES_PARTICLE);
case "pale_oak_leaves" -> generateParticles(world, pos, random, PALE_OAK_FALLING_LEAVES_PARTICLE);
}
}

@Unique
private void generateParticles(World world, BlockPos pos, Random random, SimpleParticleType particleType) {
if (random.nextInt(20) == 0) {
BlockPos blockPos = pos.down();
BlockState blockState = world.getBlockState(blockPos);

if (LeavesBlock.isFaceFullSquare(blockState.getCollisionShape(world, blockPos), Direction.UP)) {
return;
}

ParticleUtil.spawnParticle(world, pos, random, particleType);
}
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"textures": [
"nemos-ambience:falling_leaf_0",
"nemos-ambience:falling_leaf_1",
"nemos-ambience:falling_leaf_2",
"nemos-ambience:falling_leaf_3",
"nemos-ambience:falling_leaf_4",
"nemos-ambience:falling_leaf_5",
"nemos-ambience:falling_leaf_6",
"nemos-ambience:falling_leaf_7",
"nemos-ambience:falling_leaf_8",
"nemos-ambience:falling_leaf_9",
"nemos-ambience:falling_leaf_10",
"nemos-ambience:falling_leaf_11"
]
}

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions src/main/resources/assets/nemos-ambience/particles/oak_leaves.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"textures": [
"nemos-ambience:pale_oak_falling_leaf_0",
"nemos-ambience:pale_oak_falling_leaf_1",
"nemos-ambience:pale_oak_falling_leaf_2",
"nemos-ambience:pale_oak_falling_leaf_3",
"nemos-ambience:pale_oak_falling_leaf_4",
"nemos-ambience:pale_oak_falling_leaf_5",
"nemos-ambience:pale_oak_falling_leaf_6",
"nemos-ambience:pale_oak_falling_leaf_7",
"nemos-ambience:pale_oak_falling_leaf_8",
"nemos-ambience:pale_oak_falling_leaf_9",
"nemos-ambience:pale_oak_falling_leaf_10",
"nemos-ambience:pale_oak_falling_leaf_11"
]
}

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"depends": {
"fabricloader": ">=0.16.7",
"minecraft": [
"~1.21.3",
"~1.21.2"
],
"java": ">=21",
Expand Down

0 comments on commit 82f712a

Please sign in to comment.