-
Notifications
You must be signed in to change notification settings - Fork 11
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
1 parent
e12947a
commit ae9e16d
Showing
15 changed files
with
343 additions
and
12 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
12 changes: 12 additions & 0 deletions
12
src/main/java/net/zepalesque/redux/client/audio/ReduxMusic.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,12 @@ | ||
package net.zepalesque.redux.client.audio; | ||
|
||
import com.aetherteam.aether.client.AetherSoundEvents; | ||
import net.minecraft.sounds.Music; | ||
|
||
public class ReduxMusic { | ||
public static final Music DEFAULT_AETHER_MUSIC = new Music(AetherSoundEvents.MUSIC_AETHER.getHolder().orElseThrow(), 12000, 24000, true); | ||
// public static final Music REDUX_MENU = new Music(ReduxSoundEvents.REDUX_MENU.getHolder().orElseThrow(), 0, 0, true); | ||
|
||
public static final int MUSIC_MIN = 1200; | ||
public static final int MUSIC_MAX = 3600; | ||
} |
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
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
23 changes: 23 additions & 0 deletions
23
src/main/java/net/zepalesque/redux/data/gen/tags/ReduxBiomeTagsGen.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,23 @@ | ||
package net.zepalesque.redux.data.gen.tags; | ||
|
||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.tags.BiomeTagsProvider; | ||
import net.neoforged.neoforge.common.data.ExistingFileHelper; | ||
import net.zepalesque.redux.Redux; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class ReduxBiomeTagsGen extends BiomeTagsProvider { | ||
|
||
public ReduxBiomeTagsGen(PackOutput output, CompletableFuture<HolderLookup.Provider> registries, @Nullable ExistingFileHelper helper) { | ||
super(output, registries, Redux.MODID, helper); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public void addTags(HolderLookup.Provider provider) { | ||
|
||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/net/zepalesque/redux/data/resource/ReduxBiomeModifiers.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,52 @@ | ||
package net.zepalesque.redux.data.resource; | ||
|
||
import net.minecraft.core.HolderGetter; | ||
import net.minecraft.core.HolderSet; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.worldgen.BootstapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.GenerationStep; | ||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import net.neoforged.neoforge.common.world.BiomeModifier; | ||
import net.neoforged.neoforge.common.world.BiomeModifiers; | ||
import net.neoforged.neoforge.registries.NeoForgeRegistries; | ||
import net.zepalesque.redux.Redux; | ||
import net.zepalesque.redux.client.audio.ReduxMusic; | ||
import net.zepalesque.redux.data.ReduxTags; | ||
import net.zepalesque.zenith.Zenith; | ||
import net.zepalesque.zenith.api.condition.Condition; | ||
import net.zepalesque.zenith.util.codec.CodecPredicates; | ||
import net.zepalesque.zenith.world.biome.modifier.MusicModifier; | ||
import net.zepalesque.zenith.world.biome.modifier.SkyModifier; | ||
|
||
import java.util.Optional; | ||
|
||
public class ReduxBiomeModifiers { | ||
public static final ResourceKey<BiomeModifier> ADD_CLOUDBED = createKey("add_cloudbed"); | ||
public static final ResourceKey<BiomeModifier> SKY_COLOR_AETHER = createKey("modify_sky_color"); | ||
public static final ResourceKey<BiomeModifier> MUSIC_MODIFY = createKey("modify_music"); | ||
|
||
private static ResourceKey<BiomeModifier> createKey(String name) { | ||
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, Redux.loc(name)); | ||
} | ||
|
||
public static void bootstrap(BootstapContext<BiomeModifier> context) { | ||
HolderGetter<Biome> biomes = context.lookup(Registries.BIOME); | ||
HolderGetter<ConfiguredWorldCarver<?>> carvers = context.lookup(Registries.CONFIGURED_CARVER); | ||
HolderGetter<PlacedFeature> features = context.lookup(Registries.PLACED_FEATURE); | ||
HolderGetter<Condition<?>> conditions = context.lookup(Zenith.Keys.CONDITION); | ||
|
||
context.register(ADD_CLOUDBED, new BiomeModifiers.AddFeaturesBiomeModifier( | ||
biomes.getOrThrow(ReduxTags.Biomes.HAS_CLOUDBED), HolderSet.direct(features.getOrThrow(ReduxPlacements.CLOUDBED)), | ||
GenerationStep.Decoration.RAW_GENERATION)); | ||
|
||
context.register(SKY_COLOR_AETHER, new SkyModifier(biomes.getOrThrow(ReduxTags.Biomes.MODIFY_SKY_COLOR), | ||
CodecPredicates.DualInt.of(12632319, 9671612), 0x9FA4DD, 0xBEC4E5, Optional.of(conditions.get(ReduxConditions.SKY_COLORS).orElseThrow()))); | ||
|
||
// TODO: MusicPredicate, with optional fields for each field of the Music class | ||
context.register(MUSIC_MODIFY, new MusicModifier(biomes.getOrThrow(ReduxTags.Biomes.MODIFY_MUSIC), | ||
Optional.empty(), Optional.of(CodecPredicates.DualInt.of(ReduxMusic.MUSIC_MIN, ReduxMusic.MUSIC_MAX)), Optional.of(false), Optional.empty(), Optional.empty(), Optional.empty())); | ||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
src/main/java/net/zepalesque/redux/data/resource/ReduxDensityFunctions.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,55 @@ | ||
package net.zepalesque.redux.data.resource; | ||
|
||
import net.minecraft.core.HolderGetter; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.RegistryAccess; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.data.worldgen.BootstapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.levelgen.DensityFunction; | ||
import net.minecraft.world.level.levelgen.DensityFunctions; | ||
import net.minecraft.world.level.levelgen.synth.BlendedNoise; | ||
import net.minecraft.world.level.levelgen.synth.NormalNoise; | ||
import net.zepalesque.redux.Redux; | ||
import net.zepalesque.zenith.world.density.PerlinNoiseFunction; | ||
|
||
import java.util.Optional; | ||
|
||
public class ReduxDensityFunctions { | ||
|
||
public static final ResourceKey<DensityFunction> CLOUDBED_NOISE = createKey("cloudbed_noise"); | ||
public static final ResourceKey<DensityFunction> CLOUDBED_Y_OFFSET = createKey("cloudbed_y_offset"); | ||
|
||
public static void bootstrap(BootstapContext<DensityFunction> context) { | ||
context.register(CLOUDBED_NOISE, DensityFunctions.mul(new PerlinNoiseFunction(new NormalNoise.NoiseParameters(0, 1, 1, 1, 1, 1, 1), 0.01D, 0.0D, 42), DensityFunctions.constant(1.5D))); | ||
|
||
context.register(CLOUDBED_Y_OFFSET, DensityFunctions.mul(new PerlinNoiseFunction(new NormalNoise.NoiseParameters(0, 1, 1), 0.005D, 0.0D, 95), DensityFunctions.constant(1.5D))); | ||
|
||
} | ||
|
||
private static ResourceKey<DensityFunction> createKey(String name) { | ||
return ResourceKey.create(Registries.DENSITY_FUNCTION, new ResourceLocation(Redux.MODID, name)); | ||
} | ||
|
||
public static DensityFunction get(HolderGetter<DensityFunction> densityFunctions, ResourceKey<DensityFunction> key) { | ||
return new DensityFunctions.HolderHolder(densityFunctions.getOrThrow(key)); | ||
} | ||
|
||
public static DensityFunction get(RegistryAccess access, ResourceKey<DensityFunction> key) { | ||
Optional<HolderLookup.RegistryLookup<DensityFunction>> optional = access.lookup(Registries.DENSITY_FUNCTION); | ||
if (optional.isPresent()) { | ||
HolderLookup.RegistryLookup<DensityFunction> lookup = optional.get(); | ||
return lookup.getOrThrow(key).value(); | ||
|
||
} else { | ||
throw new NullPointerException("Optional value is not present!"); | ||
} | ||
} | ||
|
||
public static DensityFunction get(Level level, ResourceKey<DensityFunction> key) { | ||
return level.registryAccess().registryOrThrow(Registries.DENSITY_FUNCTION).getOrThrow(key); | ||
} | ||
|
||
} |
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.