Skip to content

Commit

Permalink
Update for 1.20.5/1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jsorrell committed Jul 25, 2024
1 parent cada0dd commit 5125a92
Show file tree
Hide file tree
Showing 197 changed files with 797 additions and 1,292 deletions.
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ dependencies {
"fabric-registry-sync-v0",
"fabric-resource-loader-v0",
"fabric-transitive-access-wideners-v1",
// For ModMenu 10
"fabric-screen-api-v1",
"fabric-key-binding-api-v1",
"fabric-lifecycle-events-v1",
).forEach { modImplementation(fabricApi.module(it, versions.fabricApi)) }

modImplementation("me.shedaniel.cloth", "cloth-config-fabric", versions.clothConfig) {
Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ mod_id=carpetskyadditions
mod_name=Carpet Sky Additions
repository=https://github.com/jsorrell/CarpetSkyAdditions
mod_version=4.4.2
java_version=17
java_version=21
# Fabric Properties
# see https://fabricmc.net/develop/
minecraft_version=1.20.4
compatible_minecraft_versions=>=1.20.3 <=1.20.4
minecraft_version=1.20.6
compatible_minecraft_versions=>=1.20.5 <=1.20.6
loader_version=0.15.11
# Fabric Api
fabric_version=0.97.1+1.20.4
fabric_version=0.100.4+1.20.6
# see https://maven.parchmentmc.org/org/parchmentmc/data
parchment_mappings=1.20.4:2024.04.14
parchment_mappings=1.20.6:2024.06.16
# see https://masa.dy.fi/maven/carpet/fabric-carpet/
carpet_core_version=1.20.3-1.4.128+v231205
carpet_core_version=1.20.6-1.4.141+v240429
# see https://linkie.shedaniel.me/dependencies
cloth_config_version=13.0.121
modmenu_version=9.0.0
cloth_config_version=14.0.126
modmenu_version=10.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.jsorrell.carpetskyadditions;

import com.jsorrell.carpetskyadditions.util.SkyAdditionsResourceLocation;
import com.mojang.serialization.Codec;
import java.util.function.UnaryOperator;
import net.minecraft.core.Registry;
import net.minecraft.core.component.DataComponentType;
import net.minecraft.core.registries.BuiltInRegistries;

public class SkyAdditionsDataComponents {
public static final DataComponentType<Boolean> SWIFT_SNEAK_ENCHANTABLE_COMPONENT =
register("swift_sneak_enchantable", builder -> builder.persistent(Codec.BOOL));

public static void bootstrap() {}

private static <T> DataComponentType<T> register(
String string, UnaryOperator<DataComponentType.Builder<T>> unaryOperator) {
return Registry.register(
BuiltInRegistries.DATA_COMPONENT_TYPE,
new SkyAdditionsResourceLocation(string),
unaryOperator.apply(DataComponentType.builder()).build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.SpawnPlacementTypes;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.level.levelgen.Heightmap;

Expand All @@ -54,7 +55,7 @@ public void onInitialize() {
// Restrict Piglin Brute spawning when piglinsSpawningInBastions is true
SpawnPlacements.register(
EntityType.PIGLIN_BRUTE,
SpawnPlacements.Type.NO_RESTRICTIONS,
SpawnPlacementTypes.NO_RESTRICTIONS,
Heightmap.Types.MOTION_BLOCKING_NO_LEAVES,
new PiglinBruteSpawnPredicate());

Expand All @@ -65,6 +66,7 @@ public void onInitialize() {
SkyAdditionsFeatures.bootstrap();
SkyAdditionsCriteriaTriggers.bootstrap();
SkyAdditionsLootItemConditions.bootstrap();
SkyAdditionsDataComponents.bootstrap();
MinecartComparatorLogicRegistry.register(EntityType.MINECART, new SkyAdditionsMinecartComparatorLogic());
SkyAdditionsDataPacks.register();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.Optional;
import net.minecraft.advancements.critereon.*;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.entity.animal.allay.Allay;
import net.minecraft.world.entity.monster.Vex;
import net.minecraft.world.level.storage.loot.LootContext;
Expand All @@ -29,11 +30,12 @@ public record TriggerInstance(
implements SimpleInstance {

public static final Codec<TriggerInstance> CODEC = RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "player")
EntityPredicate.ADVANCEMENT_CODEC
.optionalFieldOf("player")
.forGetter(TriggerInstance::player),
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "vex")
.forGetter(TriggerInstance::vex),
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "allay")
EntityPredicate.ADVANCEMENT_CODEC.optionalFieldOf("vex").forGetter(TriggerInstance::vex),
EntityPredicate.ADVANCEMENT_CODEC
.optionalFieldOf("allay")
.forGetter(TriggerInstance::allay))
.apply(instance, TriggerInstance::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.Optional;
import net.minecraft.advancements.critereon.*;
import net.minecraft.advancements.critereon.ContextAwarePredicate;
import net.minecraft.advancements.critereon.EntityPredicate;
import net.minecraft.advancements.critereon.SimpleCriterionTrigger;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.entity.monster.CaveSpider;
import net.minecraft.world.entity.monster.Spider;
import net.minecraft.world.level.storage.loot.LootContext;
Expand All @@ -28,11 +29,14 @@ public record TriggerInstance(
Optional<ContextAwarePredicate> caveSpider)
implements SimpleInstance {
public static final Codec<TriggerInstance> CODEC = RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "player")
EntityPredicate.ADVANCEMENT_CODEC
.optionalFieldOf("player")
.forGetter(TriggerInstance::player),
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "spider")
EntityPredicate.ADVANCEMENT_CODEC
.optionalFieldOf("spider")
.forGetter(TriggerInstance::spider),
ExtraCodecs.strictOptionalField(EntityPredicate.ADVANCEMENT_CODEC, "cave_spider")
EntityPredicate.ADVANCEMENT_CODEC
.optionalFieldOf("cave_spider")
.forGetter(TriggerInstance::caveSpider))
.apply(instance, TriggerInstance::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.Optional;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;

public record SkyAdditionsEntityPredicate(
Optional<SkyAdditionsLocationPredicate> location, Optional<SkyAdditionsLocationPredicate> steppingOnLocation) {
public static final Codec<SkyAdditionsEntityPredicate> CODEC = ExtraCodecs.recursive(
public static final Codec<SkyAdditionsEntityPredicate> CODEC = Codec.recursive(
"SkyAdditionsEntityPredicate",
codec -> RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(SkyAdditionsLocationPredicate.CODEC, "location")
SkyAdditionsLocationPredicate.CODEC
.optionalFieldOf("location")
.forGetter(SkyAdditionsEntityPredicate::location),
ExtraCodecs.strictOptionalField(SkyAdditionsLocationPredicate.CODEC, "stepping_on")
SkyAdditionsLocationPredicate.CODEC
.optionalFieldOf("stepping_on")
.forGetter(SkyAdditionsEntityPredicate::steppingOnLocation))
.apply(instance, SkyAdditionsEntityPredicate::new)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
import java.util.Map;
import java.util.Optional;
import net.minecraft.ChatFormatting;
import net.minecraft.advancements.critereon.*;
import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.Rotation;
Expand All @@ -34,13 +33,17 @@ public record SkyAdditionsLocationPredicate(
Optional<Boolean> smallDripleafCanSpread) {
public static final Codec<SkyAdditionsLocationPredicate> CODEC =
RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(Codec.BOOL, "is_desert_pyramid_blue_terracotta")
Codec.BOOL
.optionalFieldOf("is_desert_pyramid_blue_terracotta")
.forGetter(SkyAdditionsLocationPredicate::desertPyramidCheck),
ExtraCodecs.strictOptionalField(Codec.BOOL, "coral_convertible")
Codec.BOOL
.optionalFieldOf("coral_convertible")
.forGetter(SkyAdditionsLocationPredicate::coralConvertible),
ExtraCodecs.strictOptionalField(MinMaxBounds.Doubles.CODEC, "coral_suitability")
MinMaxBounds.Doubles.CODEC
.optionalFieldOf("coral_suitability")
.forGetter(SkyAdditionsLocationPredicate::coralSuitability),
ExtraCodecs.strictOptionalField(Codec.BOOL, "small_dripleaf_spreadable")
Codec.BOOL
.optionalFieldOf("small_dripleaf_spreadable")
.forGetter(SkyAdditionsLocationPredicate::smallDripleafCanSpread))
.apply(instance, SkyAdditionsLocationPredicate::new));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Vec3i;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
Expand All @@ -17,15 +16,17 @@
public record SkyAdditionsLocationCheck(Optional<SkyAdditionsLocationPredicate> predicate, BlockPos offset)
implements LootItemCondition {
private static final MapCodec<BlockPos> OFFSET_CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
ExtraCodecs.strictOptionalField(Codec.INT, "offsetX", 0).forGetter(Vec3i::getX),
ExtraCodecs.strictOptionalField(Codec.INT, "offsetY", 0).forGetter(Vec3i::getY),
ExtraCodecs.strictOptionalField(Codec.INT, "offsetZ", 0).forGetter(Vec3i::getZ))
Codec.INT.optionalFieldOf("offsetX", 0).forGetter(Vec3i::getX),
Codec.INT.optionalFieldOf("offsetY", 0).forGetter(Vec3i::getY),
Codec.INT.optionalFieldOf("offsetZ", 0).forGetter(Vec3i::getZ))
.apply(instance, BlockPos::new));
public static final Codec<SkyAdditionsLocationCheck> CODEC = RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(SkyAdditionsLocationPredicate.CODEC, "predicate")
.forGetter(SkyAdditionsLocationCheck::predicate),
OFFSET_CODEC.forGetter(SkyAdditionsLocationCheck::offset))
.apply(instance, SkyAdditionsLocationCheck::new));
public static final MapCodec<SkyAdditionsLocationCheck> CODEC =
RecordCodecBuilder.mapCodec(instance -> instance.group(
SkyAdditionsLocationPredicate.CODEC
.optionalFieldOf("predicate")
.forGetter(SkyAdditionsLocationCheck::predicate),
OFFSET_CODEC.forGetter(SkyAdditionsLocationCheck::offset))
.apply(instance, SkyAdditionsLocationCheck::new));

@Override
public LootItemConditionType getType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.jsorrell.carpetskyadditions.advancements.predicates;

import com.jsorrell.carpetskyadditions.util.SkyAdditionsResourceLocation;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
Expand All @@ -13,7 +13,7 @@ public class SkyAdditionsLootItemConditions {
public static final LootItemConditionType ENTITY_PROPERTIES =
register("entity_properties", SkyAdditionsLootItemEntityPropertyCondition.CODEC);

private static LootItemConditionType register(String registryName, Codec<? extends LootItemCondition> codec) {
private static LootItemConditionType register(String registryName, MapCodec<? extends LootItemCondition> codec) {
return Registry.register(
BuiltInRegistries.LOOT_CONDITION_TYPE,
new SkyAdditionsResourceLocation(registryName),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import com.google.common.collect.ImmutableSet;
import com.jsorrell.carpetskyadditions.advancements.criterion.SkyAdditionsEntityPredicate;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import java.util.Optional;
import java.util.Set;
import net.minecraft.util.ExtraCodecs;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParam;
Expand All @@ -18,9 +17,10 @@
public record SkyAdditionsLootItemEntityPropertyCondition(
Optional<SkyAdditionsEntityPredicate> predicate, LootContext.EntityTarget entityTarget)
implements LootItemCondition {
public static final Codec<SkyAdditionsLootItemEntityPropertyCondition> CODEC =
RecordCodecBuilder.create(instance -> instance.group(
ExtraCodecs.strictOptionalField(SkyAdditionsEntityPredicate.CODEC, "predicate")
public static final MapCodec<SkyAdditionsLootItemEntityPropertyCondition> CODEC =
RecordCodecBuilder.mapCodec(instance -> instance.group(
SkyAdditionsEntityPredicate.CODEC
.optionalFieldOf("predicate")
.forGetter(SkyAdditionsLootItemEntityPropertyCondition::predicate),
LootContext.EntityTarget.CODEC
.fieldOf("entity")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import net.minecraft.util.Mth;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.LegacyRandomSource;
import net.minecraft.world.level.levelgen.WorldgenRandom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.jsorrell.carpetskyadditions.mixin.JigsawStructureAccessor;
import com.jsorrell.carpetskyadditions.mixin.SinglePoolElementAccessor;
import com.jsorrell.carpetskyadditions.settings.SkyAdditionsSettings;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import it.unimi.dsi.fastutil.ints.IntArraySet;
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
Expand Down Expand Up @@ -43,7 +43,7 @@
import net.minecraft.world.level.levelgen.structure.structures.StrongholdStructure;

public class SkyBlockChunkGenerator extends NoiseBasedChunkGenerator {
public static final Codec<SkyBlockChunkGenerator> CODEC = RecordCodecBuilder.create(instance -> instance.group(
public static final MapCodec<SkyBlockChunkGenerator> CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group(
BiomeSource.CODEC.fieldOf("biome_source").forGetter(SkyBlockChunkGenerator::getBiomeSource),
NoiseGeneratorSettings.CODEC
.fieldOf("settings")
Expand All @@ -55,7 +55,7 @@ public SkyBlockChunkGenerator(BiomeSource biomeSource, Holder<NoiseGeneratorSett
}

@Override
protected Codec<? extends ChunkGenerator> codec() {
protected MapCodec<? extends ChunkGenerator> codec() {
return CODEC;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class CoralSpreader {

// Returns a suitability value in the range of 0 to 1
public static double calculateCoralSuitability(ServerLevel level, BlockPos pos) {
if (level.dimensionTypeId() != BuiltinDimensionTypes.OVERWORLD) {
if (level.dimensionTypeRegistration() != BuiltinDimensionTypes.OVERWORLD) {
return 0;
}

Expand Down Expand Up @@ -82,7 +82,6 @@ private static float successChanceFromSuitability(double suitability) {
}

@Override
@SuppressWarnings("deprecation")
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (!SkyAdditionsSettings.spreadingCoral) return;
if (!Blocks.TUBE_CORAL_BLOCK.defaultBlockState().canSurvive(level, pos)) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static boolean tryDropSand(BlockState state, Level level, BlockPos pos, R

if (!level.isClientSide) {
Vec3 sandVelocity = waterVelocity.scale(0.1);
Item sandItem = state.getBlock().getLootTable().getPath().contains("fire") ? Items.RED_SAND : Items.SAND;
Item sandItem =
state.getBlock().getLootTable().location().getPath().contains("fire") ? Items.RED_SAND : Items.SAND;
ItemEntity itemEntity = new ItemEntity(
level,
pos.getX() + 0.5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Optional;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
Expand All @@ -17,7 +18,7 @@
import net.minecraft.world.phys.Vec3;

public class DeepslateConversionHelper {
public static final Potion CONVERSION_POTION = Potions.THICK;
public static final Holder<Potion> CONVERSION_POTION = Potions.THICK;

public static Optional<BlockState> canConvert(BlockState from) {
if (from.is(Blocks.STONE)) {
Expand Down
Loading

0 comments on commit 5125a92

Please sign in to comment.