Skip to content

Commit 03250cc

Browse files
committed
feat: little fixes and changes
1 parent 1c6b446 commit 03250cc

4 files changed

Lines changed: 21 additions & 15 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ mappings=2024.06.23
3333
# Required Dependencies
3434
zenith_version=1.3.04
3535

36-
aether_version=1.5.3
36+
aether_version=1.5.4
3737
nitrogen_version=1.1.22
3838
cumulus_version=2.0.0
3939

src/main/java/net/zepalesque/unity/block/natural/AetherShortGrassBlock.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ public interface TintOverride {
121121
Integer tint(
122122
BlockState state,
123123
@Nullable BlockAndTintGetter level,
124-
@Nullable BlockPos pos, int index,
125-
Predicate<Integer> indexGoal,
124+
@Nullable BlockPos pos,
126125
boolean useBelowProperties
127126
);
128127
}

src/main/java/net/zepalesque/unity/client/UnityColors.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static int getColor(BlockState state, @Nullable BlockAndTintGetter level,
8080
if (level != null && pos != null) {
8181

8282
for (AetherShortGrassBlock.TintOverride override : AetherShortGrassBlock.COLOR_OVERRIDES) {
83-
@Nullable Integer i = override.tint(state, level, pos, index, indexGoal, useBelowProperties);
83+
@Nullable Integer i = override.tint(state, level, pos, useBelowProperties);
8484
if (i != null) return i;
8585
}
8686

@@ -95,10 +95,10 @@ public static int getColor(BlockState state, @Nullable BlockAndTintGetter level,
9595
/**
9696
* See {@link AetherShortGrassBlock#COLOR_OVERRIDES} and {@link UnityColors#getColor}
9797
*/
98-
public static Integer unityColors(BlockState state, BlockAndTintGetter level, BlockPos pos, int index, Predicate<Integer> indexGoal, boolean useBelowProperties) {
98+
public static Integer unityColors(BlockState state, BlockAndTintGetter level, BlockPos pos, boolean useBelowProperties) {
9999
if (state.hasProperty(UnityStates.ENCHANTED) && state.getValue(UnityStates.ENCHANTED))
100100
return 0xFFFFFF;
101-
else if (level.getBlockState(pos.below()).is(UnityTags.Blocks.SHORT_AETHER_GRASS_DEFAULT_COLORING))
101+
else if (useBelowProperties && level.getBlockState(pos.below()).is(UnityTags.Blocks.SHORT_AETHER_GRASS_DEFAULT_COLORING))
102102
return AETHER_GRASS_COLOR;
103103
return null;
104104
}

src/main/java/net/zepalesque/unity/data/prov/UnityBlockStateProvider.java

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import net.minecraft.world.level.block.Block;
99
import net.minecraft.world.level.block.CampfireBlock;
1010
import net.minecraft.world.level.block.SpreadingSnowyDirtBlock;
11+
import net.minecraft.world.level.block.state.BlockState;
12+
import net.minecraft.world.level.block.state.properties.Property;
1113
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder;
1214
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
1315
import net.neoforged.neoforge.client.model.generators.ModelFile;
@@ -18,6 +20,8 @@
1820
import net.zepalesque.unity.block.natural.leaves.LeafPileBlock;
1921
import net.zepalesque.unity.block.state.UnityStates;
2022

23+
import java.util.function.Function;
24+
2125
@SuppressWarnings("unused")
2226
public abstract class UnityBlockStateProvider extends AetherBlockStateProvider implements TextureExtensions {
2327

@@ -47,21 +51,21 @@ public void tintableShortGrass(AetherShortGrassBlock block, String location) {
4751
});
4852
}
4953

50-
public void tintableGrassBlock(Block block, Block dirt, String location, String dirtLocation) {
51-
tintableGrassBlock(block, dirt, location, dirtLocation, (snow, bottom, top) -> models().cubeBottomTop(texture(block).getNamespace() + ":" + name(block) + "_snow", snow, bottom, top));
54+
public void tintableGrassBlock(Block block, Block dirt, String location, String dirtLocation, Property<?>... ignored) {
55+
tintableGrassBlock(block, dirt, location, dirtLocation, (snow, bottom, top) -> models().cubeBottomTop(texture(block).getNamespace() + ":" + name(block) + "_snow", snow, bottom, top), ignored);
5256
}
5357

54-
public void tintableGrassBlockOverride(Block block, Block dirt, String location, String dirtLocation) {
55-
tintableGrassBlock(block, dirt, location, dirtLocation, (snow, bottom, top) -> models().getExistingFile(texture(block, "", "_snow")));
58+
public void tintableGrassBlockOverride(Block block, Block dirt, String location, String dirtLocation, Property<?>... ignored) {
59+
tintableGrassBlock(block, dirt, location, dirtLocation, (snow, bottom, top) -> models().getExistingFile(texture(block, "", "_snow")), ignored);
5660
}
5761

58-
public void tintableGrassBlock(Block block, Block dirt, String location, String dirtLocation, SnowGrassModelMaker snowModel) {
62+
public void tintableGrassBlock(Block block, Block dirt, String location, String dirtLocation, SnowGrassModelMaker snowModel, Property<?>... ignored) {
5963
ResourceLocation bottom = texture(dirt, dirtLocation);
6064
ResourceLocation top = texture(block, location, "_top");
6165
ResourceLocation overlay = texture(block, location, "_side_overlay");
6266
ResourceLocation side = texture(block, location, "_side");
6367
ResourceLocation snow = texture(block, location, "_side_snow");
64-
tintableGrassBlock(block, bottom, top, overlay, side, snowModel.create(snow, bottom, top));
68+
tintableGrassBlock(block, bottom, top, overlay, side, snowModel.create(snow, bottom, top), ignored);
6569
}
6670

6771
@FunctionalInterface
@@ -73,18 +77,21 @@ public void tintableGrassBlock(Block block, ResourceLocation bottom,
7377
ResourceLocation top,
7478
ResourceLocation overlay,
7579
ResourceLocation side,
76-
ModelFile snowModel) {
80+
ModelFile snowModel, Property<?>... ignored) {
7781

7882
ModelFile model = models().withExistingParent(texture(block).getNamespace() + ":" + name(block), Unity.loc(ModelProvider.BLOCK_FOLDER + "/template/tinted_grass_block"))
7983
.texture("overlay", overlay)
8084
.texture("side", side)
8185
.texture("top", top)
8286
.texture("bottom", bottom)
8387
.texture("particle", bottom);
84-
this.getVariantBuilder(block).forAllStates(state -> {
88+
Function<BlockState, ConfiguredModel[]> mapper = state -> {
8589
boolean isSnowy = state.getValue(SpreadingSnowyDirtBlock.SNOWY);
8690
return ConfiguredModel.allYRotations(isSnowy ? snowModel : model, 0, false);
87-
});
91+
};
92+
93+
if (ignored.length == 0) this.getVariantBuilder(block).forAllStates(mapper);
94+
else this.getVariantBuilder(block).forAllStatesExcept(mapper, ignored);
8895
}
8996

9097

0 commit comments

Comments
 (0)