Skip to content

Commit

Permalink
refactor: slight tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed May 23, 2024
1 parent 5bb5c89 commit ea62905
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/zepalesque/zenith/Zenith.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void commonSetup(final FMLCommonSetupEvent event) {
}

private void registerDataMaps(RegisterDataMapTypesEvent event) {
BiomeTint.MAPS.forEach(event::register);
BiomeTints.TINT_REGISTRY.forEach(tint -> tint.register(event));
}

@Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/net/zepalesque/zenith/api/biometint/BiomeTint.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.neoforged.neoforge.registries.datamaps.DataMapType;
import net.neoforged.neoforge.registries.datamaps.RegisterDataMapTypesEvent;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -16,12 +17,9 @@ public class BiomeTint {
private final DataMapType<Biome, Integer> dataMap;
private Map<Biome, Integer> tints = null;
private final int defaultColor;

public static Collection<DataMapType<Biome, Integer>> MAPS = new ArrayList<>();


public BiomeTint(ResourceLocation loc, int defaultColor) {
DataMapType<Biome, Integer> dataMap = createTintMap(loc);
MAPS.add(dataMap);
this.dataMap = dataMap;
this.defaultColor = defaultColor;
}
Expand Down Expand Up @@ -56,4 +54,8 @@ public void addTint(Biome biome, int color) {
public DataMapType<Biome, Integer> getDataMap() {
return this.dataMap;
}

public void register(RegisterDataMapTypesEvent event) {
event.register(this.dataMap);
}
}

0 comments on commit ea62905

Please sign in to comment.