Skip to content

Commit

Permalink
Update to 24w13a.
Browse files Browse the repository at this point in the history
- Update to 24w13a
- Upgrade to Biolith 2
  • Loading branch information
gniftygnome committed Mar 27, 2024
1 parent ff1300f commit 6f9ea6a
Show file tree
Hide file tree
Showing 37 changed files with 82 additions and 116 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.structure.arch;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.terraformersmc.terrestria.feature.helpers.placement.StructureCanGenerate;
import com.terraformersmc.terrestria.init.TerrestriaStructures;
import net.minecraft.structure.*;
Expand All @@ -11,7 +11,7 @@
import java.util.Optional;

public class CanyonArchStructure extends Structure {
public static final Codec<CanyonArchStructure> CODEC = CanyonArchStructure.createCodec(CanyonArchStructure::new);
public static final MapCodec<CanyonArchStructure> CODEC = CanyonArchStructure.createCodec(CanyonArchStructure::new);

public CanyonArchStructure(Structure.Config config) {
super(config);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.terraformersmc.terrestria.feature.structure.volcano;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.Terrestria;
import com.terraformersmc.terrestria.init.TerrestriaBiomes;
Expand All @@ -17,7 +18,7 @@
import java.util.Optional;

public class VolcanoStructure extends Structure {
public static final Codec<VolcanoStructure> CODEC = RecordCodecBuilder.create(instance -> instance.group(VolcanoStructure.configCodecBuilder(instance),
public static final MapCodec<VolcanoStructure> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(VolcanoStructure.configCodecBuilder(instance),
IntProvider.NON_NEGATIVE_CODEC.fieldOf("height").forGetter(arg -> arg.height),
Codec.INT.fieldOf("base_y").forGetter(arg -> arg.baseY),
Codec.BOOL.fieldOf("thin_if_tall").forGetter(arg -> arg.thinIfTall)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.shapes.api.Position;
import com.terraformersmc.terraform.shapes.impl.Shapes;
Expand All @@ -18,8 +18,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class CanopyFoliagePlacer extends FoliagePlacer {

public static final Codec<CanopyFoliagePlacer> CODEC = RecordCodecBuilder.create(instance ->
public static final MapCodec<CanopyFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(instance ->
fillFoliagePlacerFields(instance).apply(instance, CanopyFoliagePlacer::new));

public CanopyFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.function.Consumer;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaFoliagePlacerTypes;

Expand All @@ -16,7 +16,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class CypressFoliagePlacer extends FoliagePlacer {
public static final Codec<CypressFoliagePlacer> CODEC = RecordCodecBuilder.create(instance ->
public static final MapCodec<CypressFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(instance ->
fillFoliagePlacerFields(instance).apply(instance, CypressFoliagePlacer::new));

public CypressFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaFoliagePlacerTypes;

Expand All @@ -15,8 +15,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class DotShrubPlacer extends FoliagePlacer {

public static final Codec<DotShrubPlacer> CODEC = RecordCodecBuilder.create(dotShrubPlacerInstance ->
public static final MapCodec<DotShrubPlacer> CODEC = RecordCodecBuilder.mapCodec(dotShrubPlacerInstance ->
fillFoliagePlacerFields(dotShrubPlacerInstance).apply(dotShrubPlacerInstance, DotShrubPlacer::new));

public DotShrubPlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.shapes.api.Position;
import com.terraformersmc.terraform.shapes.impl.Shapes;
Expand All @@ -18,8 +18,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class JapaneseCanopyFoliagePlacer extends FoliagePlacer {

public static final Codec<JapaneseCanopyFoliagePlacer> CODEC = RecordCodecBuilder.create(instance ->
public static final MapCodec<JapaneseCanopyFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(instance ->
fillFoliagePlacerFields(instance).apply(instance, JapaneseCanopyFoliagePlacer::new));

public JapaneseCanopyFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.terraformersmc.terrestria.init.TerrestriaFoliagePlacerTypes;

import net.minecraft.util.math.intprovider.ConstantIntProvider;
Expand All @@ -14,7 +14,7 @@
public class NoneFoliagePlacer extends FoliagePlacer {
private static final IntProvider ZERO = ConstantIntProvider.create(0);
// This has to come last, because static initialization order is important!
public static final Codec<NoneFoliagePlacer> CODEC = Codec.unit(new NoneFoliagePlacer());
public static final MapCodec<NoneFoliagePlacer> CODEC = MapCodec.unit(new NoneFoliagePlacer());

public NoneFoliagePlacer() {
super(ZERO, ZERO);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaFoliagePlacerTypes;

Expand All @@ -15,8 +15,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class PalmFanFoliagePlacer extends FoliagePlacer {

public static final Codec<PalmFanFoliagePlacer> CODEC = RecordCodecBuilder.create((instance) ->
public static final MapCodec<PalmFanFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec((instance) ->
fillFoliagePlacerFields(instance).apply(instance, PalmFanFoliagePlacer::new));

public PalmFanFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock;
import com.terraformersmc.terrestria.init.TerrestriaFoliagePlacerTypes;
Expand All @@ -19,7 +19,7 @@
public class PredictiveSpruceFoliagePlacer extends SpruceFoliagePlacer {
// Copied from SpruceFoliagePlacer. There doesn't appear to be a convenient way to turn a SpruceFoliagePlacer into a
// PredictiveSpruceFoliagePlacer.
public static final Codec<PredictiveSpruceFoliagePlacer> CODEC = RecordCodecBuilder.create(instance ->
public static final MapCodec<PredictiveSpruceFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(instance ->
fillFoliagePlacerFields(instance).and(
IntProvider.createValidatingCodec(0, 28)
.fieldOf("trunk_height")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.shapes.api.Position;
import com.terraformersmc.terraform.shapes.impl.Shapes;
Expand All @@ -18,8 +18,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class SmallCanopyFoliagePlacer extends SmallFoliagePlacer {

public static final Codec<SmallCanopyFoliagePlacer> CODEC = RecordCodecBuilder.create(smallCanopyFoliagePlacerInstance ->
public static final MapCodec<SmallCanopyFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(smallCanopyFoliagePlacerInstance ->
fillFoliagePlacerFields(smallCanopyFoliagePlacerInstance).apply(smallCanopyFoliagePlacerInstance, SmallCanopyFoliagePlacer::new));

public SmallCanopyFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.shapes.api.Position;
import com.terraformersmc.terraform.shapes.impl.Shapes;
Expand All @@ -16,8 +16,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class SmallLogSphereFoliagePlacer extends SmallFoliagePlacer {

public static final Codec<SmallLogSphereFoliagePlacer> CODEC = RecordCodecBuilder.create(smallLogSphereFoliagePlacerInstance ->
public static final MapCodec<SmallLogSphereFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(smallLogSphereFoliagePlacerInstance ->
fillFoliagePlacerFields(smallLogSphereFoliagePlacerInstance).apply(smallLogSphereFoliagePlacerInstance, SmallLogSphereFoliagePlacer::new));

public SmallLogSphereFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.foliageplacers;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.shapes.api.Position;
import com.terraformersmc.terraform.shapes.impl.Shapes;
Expand All @@ -17,8 +17,7 @@
import net.minecraft.world.gen.foliage.FoliagePlacerType;

public class SphereFoliagePlacer extends FoliagePlacer {

public static final Codec<SphereFoliagePlacer> CODEC = RecordCodecBuilder.create(instance ->
public static final MapCodec<SphereFoliagePlacer> CODEC = RecordCodecBuilder.mapCodec(instance ->
fillFoliagePlacerFields(instance).apply(instance, SphereFoliagePlacer::new));

public SphereFoliagePlacer(IntProvider radius, IntProvider offset) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.treedecorators;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTreeDecorators;
import net.minecraft.block.AbstractBlock;
Expand All @@ -13,7 +13,7 @@
import net.minecraft.world.gen.treedecorator.TreeDecoratorType;

public class DanglingLeavesTreeDecorator extends TreeDecorator {
public static final Codec<DanglingLeavesTreeDecorator> CODEC = RecordCodecBuilder.create(instance -> instance.group(
public static final MapCodec<DanglingLeavesTreeDecorator> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
BlockState.CODEC.fieldOf("state").forGetter(decorator -> decorator.state))
.apply(instance, DanglingLeavesTreeDecorator::new));
private final BlockState state;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.terraformersmc.terrestria.feature.tree.treedecorators;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.terraformersmc.terraform.wood.block.SmallLogBlock;
import com.terraformersmc.terrestria.init.TerrestriaBlocks;
import com.terraformersmc.terrestria.init.TerrestriaTreeDecorators;
Expand All @@ -16,7 +16,7 @@
import net.minecraft.world.gen.treedecorator.TreeDecoratorType;

public class SakuraTreeDecorator extends TreeDecorator {
public static Codec<SakuraTreeDecorator> CODEC = Codec.unit(new SakuraTreeDecorator());
public static MapCodec<SakuraTreeDecorator> CODEC = MapCodec.unit(new SakuraTreeDecorator());

@Override
protected TreeDecoratorType<?> getType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTrunkPlacerTypes;

Expand All @@ -19,8 +19,7 @@
import java.util.function.BiConsumer;

public class BentTrunkPlacer extends TrunkPlacer {

public static final Codec<BentTrunkPlacer> CODEC = RecordCodecBuilder.create((bentTrunkPlacerInstance) ->
public static final MapCodec<BentTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec((bentTrunkPlacerInstance) ->
fillTrunkPlacerFields(bentTrunkPlacerInstance).apply(bentTrunkPlacerInstance, BentTrunkPlacer::new));

public BentTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTrunkPlacerTypes;
import net.minecraft.block.BlockState;
Expand All @@ -20,8 +20,7 @@
import java.util.function.BiConsumer;

public class CanopyTree4BranchTrunkPlacer extends TrunkPlacer {

public static final Codec<CanopyTree4BranchTrunkPlacer> CODEC = RecordCodecBuilder.create((straightTrunkWith4BranchesPlacerInstance ->
public static final MapCodec<CanopyTree4BranchTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec((straightTrunkWith4BranchesPlacerInstance ->
fillTrunkPlacerFields(straightTrunkWith4BranchesPlacerInstance).apply(straightTrunkWith4BranchesPlacerInstance, CanopyTree4BranchTrunkPlacer::new)));

public CanopyTree4BranchTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.util.math.random.Random;

public class DirectionHelper {

/**
* A utility method for getting a direction not the same as the one specified in the horizontal direction
* Often used in tree generation for creating unique branches
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTrunkPlacerTypes;

Expand All @@ -22,7 +22,7 @@
import java.util.function.BiConsumer;

public class FallenStraightTrunkPlacer extends StraightTrunkPlacer {
public static final Codec<FallenStraightTrunkPlacer> CODEC = RecordCodecBuilder.create((instance) ->
public static final MapCodec<FallenStraightTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec((instance) ->
fillTrunkPlacerFields(instance).apply(instance, FallenStraightTrunkPlacer::new));

public FallenStraightTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.function.BiConsumer;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.wood.block.QuarterLogBlock;
import com.terraformersmc.terrestria.Terrestria;
Expand All @@ -25,7 +25,7 @@
import net.minecraft.world.gen.trunk.TrunkPlacerType;

public class MegaTrunkPlacer extends TrunkPlacer {
public static final Codec<MegaTrunkPlacer> CODEC = RecordCodecBuilder.create((instance) ->
public static final MapCodec<MegaTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec((instance) ->
fillTrunkPlacerFields(instance).apply(instance, MegaTrunkPlacer::new)
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTrunkPlacerTypes;

Expand All @@ -19,8 +19,7 @@
import java.util.function.BiConsumer;

public class QuarteredMegaCanopyTrunkPlacer extends MegaTrunkPlacer {

public static final Codec<QuarteredMegaCanopyTrunkPlacer> CODEC = RecordCodecBuilder.create(quarteredMegaCanopyTrunkPlacerInstance ->
public static final MapCodec<QuarteredMegaCanopyTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec(quarteredMegaCanopyTrunkPlacerInstance ->
fillTrunkPlacerFields(quarteredMegaCanopyTrunkPlacerInstance).apply(quarteredMegaCanopyTrunkPlacerInstance, QuarteredMegaCanopyTrunkPlacer::new));

public QuarteredMegaCanopyTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terrestria.init.TerrestriaTrunkPlacerTypes;

Expand All @@ -20,8 +20,7 @@
import java.util.function.BiConsumer;

public class RubberTreeTrunkPlacer extends TrunkPlacer {

public static final Codec<RubberTreeTrunkPlacer> CODEC = RecordCodecBuilder.create(rubberTreeTrunkPlacerInstance ->
public static final MapCodec<RubberTreeTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec(rubberTreeTrunkPlacerInstance ->
fillTrunkPlacerFields(rubberTreeTrunkPlacerInstance).apply(rubberTreeTrunkPlacerInstance, RubberTreeTrunkPlacer::new));

public RubberTreeTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.terraformersmc.terrestria.feature.tree.trunkplacers;

import com.google.common.collect.ImmutableList;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.terraformersmc.terraform.wood.block.BareSmallLogBlock;
import com.terraformersmc.terrestria.feature.tree.trunkplacers.templates.SmallTrunkPlacer;
Expand All @@ -20,8 +20,7 @@
import java.util.function.BiConsumer;

public class SaguaroCactusTrunkPlacer extends SmallTrunkPlacer {

public static final Codec<SaguaroCactusTrunkPlacer> CODEC = RecordCodecBuilder.create(saguaroCactusTrunkPlacerInstance ->
public static final MapCodec<SaguaroCactusTrunkPlacer> CODEC = RecordCodecBuilder.mapCodec(saguaroCactusTrunkPlacerInstance ->
fillTrunkPlacerFields(saguaroCactusTrunkPlacerInstance).apply(saguaroCactusTrunkPlacerInstance, SaguaroCactusTrunkPlacer::new));

public SaguaroCactusTrunkPlacer(int baseHeight, int firstRandomHeight, int secondRandomHeight) {
Expand Down
Loading

0 comments on commit 6f9ea6a

Please sign in to comment.