Skip to content

Commit

Permalink
feat: AA compat stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Mar 21, 2024
1 parent b045e04 commit a3efcea
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
import net.zepalesque.redux.recipe.ReduxRecipeTypes;
import net.zepalesque.redux.recipe.condition.DataRecipeCondition;
import net.zepalesque.redux.recipe.serializer.ReduxRecipeSerializers;
import net.zepalesque.redux.util.function.QuadConsumer;
import net.zepalesque.redux.util.compat.AncientCompatUtil;
import net.zepalesque.redux.world.biome.ReduxRegion;
import net.zepalesque.redux.world.biome.ReduxSurfaceData;
import net.zepalesque.redux.world.biome.modifier.ReduxBiomeModifierCodecs;
Expand Down Expand Up @@ -371,8 +371,10 @@ public void packSetup(AddPackFindersEvent event) {
if (deepAetherCompat()) { this.setupMandatoryDataPack(event, "data/deep_aether_data", "Deep Aether Compat", "Compatibility with Deep Aether"); }
if (ancientAetherCompat()) { this.setupMandatoryDataPack(event, "data/ancient_aether_data", "Ancient Aether Compat", "Compatibility with Ancient Aether"); }

if (ancientAetherCompat() && AncientCompatUtil.before090) { this.setupMandatoryDataPack(event, "data/ancient_aether_gold_tree", "Ancient Aether Golden Oak", "Compatibility with Ancient Aether, fixes crash"); }

if (ReduxConfig.COMMON.cloud_layer_gen.get()) { this.setupBuiltinDatapack(event, "data/cloudbed", "Redux - Cloudbed", "Highlands-like Cloudbed"); }

if (ReduxConfig.COMMON.bronze_boss_room.get() != BossRoomType.classic) { this.setupBuiltinDatapack(event, "data/dungeon/boss_room/" + ReduxConfig.COMMON.bronze_boss_room.get().getSerializedName(), "Bronze Boss Room", "Boss Room Override"); }
if (ReduxConfig.COMMON.bronze_chest_room.get() != ChestRoomType.classic) { this.setupBuiltinDatapack(event, "data/dungeon/chest_room/" + ReduxConfig.COMMON.bronze_chest_room.get().getSerializedName(), "Bronze Chest Room", "Chest Room Override"); }
if (ReduxConfig.COMMON.bronze_lobby.get() != LobbyType.classic) { this.setupBuiltinDatapack(event, "data/dungeon/lobby/" + ReduxConfig.COMMON.bronze_lobby.get().getSerializedName(), "Bronze Lobby", "Lobby Override"); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@
import net.builderdog.ancient_aether.block.AncientAetherBlocks;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.fml.ModList;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.client.particle.ReduxParticleTypes;
import org.jetbrains.annotations.Nullable;

import java.lang.module.ModuleDescriptor;
import java.util.Map;
import java.util.function.Supplier;

public class AncientCompatUtil {

// TODO: Remove version check once AA 0.9.0 releases
public static final boolean before090 = !Redux.ancientAetherCompat() || ModuleDescriptor.Version.parse(ModList.get().getModFileById("ancient_aether").versionString()).compareTo(ModuleDescriptor.Version.parse("0.9.0")) < 0;

private static final Lazy<Map<Block, Supplier<? extends ParticleOptions>>> PARTICLE_MAP = Lazy.of(() -> new ImmutableMap.Builder<Block, Supplier<? extends ParticleOptions>>()
.put(AncientAetherBlocks.CRYSTAL_SKYROOT_LEAVES.get(), ReduxParticleTypes.FALLING_CRYSTAL_SKYROOT_LEAVES)
.put(AncientAetherBlocks.ENCHANTED_SKYROOT_LEAVES.get(), ReduxParticleTypes.FALLING_ENCHANTED_SKYROOT_LEAVES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
import com.mojang.serialization.Codec;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.levelgen.XoroshiroRandomSource;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.synth.PerlinSimplexNoise;
import net.minecraftforge.fml.ModList;
import net.zepalesque.redux.Redux;
import net.zepalesque.redux.config.ReduxConfig;
import net.zepalesque.redux.util.compat.AncientCompatUtil;
import net.zepalesque.redux.util.math.MathUtil;
import net.zepalesque.redux.world.feature.config.CloudLayerConfig;

import java.lang.module.ModuleDescriptor;
import java.util.List;

public class CloudLayerFeature extends Feature<CloudLayerConfig> {
Expand All @@ -25,13 +22,10 @@ public class CloudLayerFeature extends Feature<CloudLayerConfig> {
public CloudLayerFeature(Codec<CloudLayerConfig> codec) {
super(codec);
}

// TODO: Remove version check once AA 0.9.0 releases
private static final boolean before089 = !Redux.ancientAetherCompat() || ModuleDescriptor.Version.parse(ModList.get().getModFileById("ancient_aether").versionString()).compareTo(ModuleDescriptor.Version.parse("0.9.0")) < 0;

@Override
public boolean place(FeaturePlaceContext<CloudLayerConfig> context) {
if (before089) {
if (AncientCompatUtil.before090) {
int chunkX = context.origin().getX() - (context.origin().getX() % 16);
int chunkZ = context.origin().getZ() - (context.origin().getZ() % 16);
float min = ReduxConfig.COMMON.cloud_layer_threshold_min.get().floatValue() / 2F;
Expand Down

0 comments on commit a3efcea

Please sign in to comment.