diff --git a/gradle.properties b/gradle.properties index 1fadebae..0dad9348 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,12 +4,12 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html - minecraft_version=22w43a + minecraft_version=22w44a loader_version=0.14.10 - fabric_version=0.65.1+1.19.3 + fabric_version=0.65.2+1.19.3 # Mod Properties - mod_version = 1.4.86 + mod_version = 1.4.87 maven_group = carpet archives_base_name = fabric-carpet diff --git a/src/main/java/carpet/CarpetSettings.java b/src/main/java/carpet/CarpetSettings.java index d27248d7..0302061e 100644 --- a/src/main/java/carpet/CarpetSettings.java +++ b/src/main/java/carpet/CarpetSettings.java @@ -47,7 +47,7 @@ import static carpet.api.settings.RuleCategory.CLIENT; @SuppressWarnings({"CanBeFinal", "removal"}) // removal should be removed after migrating rules to the new system public class CarpetSettings { - public static final String carpetVersion = "1.4.86+v221026"; + public static final String carpetVersion = "1.4.87+v221102"; public static final String releaseTarget = "1.19.3"; public static final Logger LOG = LoggerFactory.getLogger("carpet"); public static final ThreadLocal skipGenerationChecks = ThreadLocal.withInitial(() -> false); diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index 81f19f91..7593a742 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -11,13 +11,16 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.OptionalInt; +import java.util.function.Function; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; import net.minecraft.core.HolderSet; import net.minecraft.core.QuartPos; import net.minecraft.core.Registry; -import net.minecraft.data.BuiltinRegistries; +import net.minecraft.core.RegistryAccess; +import net.minecraft.data.worldgen.Pools; import net.minecraft.data.worldgen.ProcessorLists; import net.minecraft.data.worldgen.placement.PlacementUtils; import net.minecraft.resources.ResourceLocation; @@ -56,15 +59,16 @@ import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.minecraft.world.level.levelgen.structure.StructureStart; import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement; import net.minecraft.world.level.levelgen.structure.structures.JigsawStructure; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList; public class FeatureGenerator { synchronized public static Boolean plop(String featureName, ServerLevel world, BlockPos pos) { - Thing custom = featureMap.get(featureName); + Function custom = featureMap.get(featureName); if (custom != null) { - return custom.plop(world, pos); + return custom.apply(world).plop(world, pos); } ResourceLocation id = new ResourceLocation(featureName); Structure structure = world.registryAccess().registryOrThrow(Registry.STRUCTURE_REGISTRY).get(id); @@ -206,7 +210,7 @@ public class FeatureGenerator ChunkGeneratorInterface cgi = (ChunkGeneratorInterface) generator; List structureConfig = cgi.getPlacementsForFeatureCM(world, structure); ChunkPos chunkPos = new ChunkPos(pos); - boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isStructureChunk(generator, seed, world.getSeed(), chunkPos.x, chunkPos.z)); + boolean couldPlace = structureConfig.stream().anyMatch(p -> p.isStructureChunk(world.getChunkSource().getGeneratorState(), chunkPos.x, chunkPos.z)); if (!couldPlace) return null; final HolderSet structureBiomes = structure.biomes(); @@ -236,101 +240,138 @@ public class FeatureGenerator return new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(block), new StraightTrunkPlacer(i, j, k), BlockStateProvider.simple(block2), new BlobFoliagePlacer(ConstantInt.of(l), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1)); } - public static final Map featureMap = new HashMap<>() {{ + public static final Map> featureMap = new HashMap<>() {{ - put("oak_bees", simpleTree( createTree(Blocks.OAK_LOG, Blocks.OAK_LEAVES, 4, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); - put("fancy_oak_bees", simpleTree( (new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), new FancyFoliagePlacer(ConstantInt.of(2), ConstantInt.of(4), 4), new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(4)))).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); - put("birch_bees", simpleTree( createTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); + put("oak_bees", l -> simpleTree( createTree(Blocks.OAK_LOG, Blocks.OAK_LEAVES, 4, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); + put("fancy_oak_bees", l -> simpleTree( (new TreeConfiguration.TreeConfigurationBuilder(BlockStateProvider.simple(Blocks.OAK_LOG), new FancyTrunkPlacer(3, 11, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES), new FancyFoliagePlacer(ConstantInt.of(2), ConstantInt.of(4), 4), new TwoLayersFeatureSize(0, 0, 0, OptionalInt.of(4)))).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); + put("birch_bees", l -> simpleTree( createTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); - put("coral_tree", simplePlop(Feature.CORAL_TREE, FeatureConfiguration.NONE)); + put("coral_tree", l -> simplePlop(Feature.CORAL_TREE, FeatureConfiguration.NONE)); - put("coral_claw", simplePlop(Feature.CORAL_CLAW, FeatureConfiguration.NONE)); - put("coral_mushroom", simplePlop(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)); - put("coral", simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct( + put("coral_claw", l -> simplePlop(Feature.CORAL_CLAW, FeatureConfiguration.NONE)); + put("coral_mushroom", l -> simplePlop(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)); + put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct( PlacementUtils.inlinePlaced(Feature.CORAL_TREE, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_CLAW, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE) )))); - put("bastion_remnant_units", spawnCustomStructure( - new JigsawStructure( new Structure.StructureSettings( - BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), - Map.of(), - GenerationStep.Decoration.SURFACE_STRUCTURES, - TerrainAdjustment.NONE - ), - Holder.direct(new StructureTemplatePool( - new ResourceLocation("bastion/starts"), - new ResourceLocation("empty"), - ImmutableList.of( - Pair.of(StructurePoolElement.single("bastion/units/air_base", ProcessorLists.BASTION_GENERIC_DEGRADATION), 1) - ), - StructureTemplatePool.Projection.RIGID - )), - 6, - ConstantHeight.of(VerticalAnchor.absolute(33)), - false - ) - )); - put("bastion_remnant_hoglin_stable", spawnCustomStructure( - new JigsawStructure( new Structure.StructureSettings( - BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), - Map.of(), - GenerationStep.Decoration.SURFACE_STRUCTURES, - TerrainAdjustment.NONE - ), - Holder.direct(new StructureTemplatePool( - new ResourceLocation("bastion/starts"), - new ResourceLocation("empty"), - ImmutableList.of( - Pair.of(StructurePoolElement.single("bastion/hoglin_stable/air_base", ProcessorLists.BASTION_GENERIC_DEGRADATION), 1) - ), - StructureTemplatePool.Projection.RIGID - )), - 6, - ConstantHeight.of(VerticalAnchor.absolute(33)), - false - ) - )); - put("bastion_remnant_treasure", spawnCustomStructure( - new JigsawStructure( new Structure.StructureSettings( - BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), - Map.of(), - GenerationStep.Decoration.SURFACE_STRUCTURES, - TerrainAdjustment.NONE - ), - Holder.direct(new StructureTemplatePool( - new ResourceLocation("bastion/starts"), - new ResourceLocation("empty"), - ImmutableList.of( - Pair.of(StructurePoolElement.single("bastion/treasure/big_air_full", ProcessorLists.BASTION_GENERIC_DEGRADATION), 1) - ), - StructureTemplatePool.Projection.RIGID - )), - 6, - ConstantHeight.of(VerticalAnchor.absolute(33)), - false - ) - )); - put("bastion_remnant_bridge", spawnCustomStructure( - new JigsawStructure( new Structure.StructureSettings( - BuiltinRegistries.BIOME.getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), - Map.of(), - GenerationStep.Decoration.SURFACE_STRUCTURES, - TerrainAdjustment.NONE - ), - Holder.direct(new StructureTemplatePool( - new ResourceLocation("bastion/starts"), - new ResourceLocation("empty"), - ImmutableList.of( - Pair.of(StructurePoolElement.single("bastion/bridge/starting_pieces/entrance_base", ProcessorLists.BASTION_GENERIC_DEGRADATION), 1) - ), - StructureTemplatePool.Projection.RIGID - )), - 6, - ConstantHeight.of(VerticalAnchor.absolute(33)), - false - ) - )); + put("bastion_remnant_units", l -> { + RegistryAccess regs = l.registryAccess(); + + final HolderGetter processorLists = regs.lookupOrThrow(Registry.PROCESSOR_LIST_REGISTRY); + final Holder bastionGenericDegradation = processorLists.getOrThrow(ProcessorLists.BASTION_GENERIC_DEGRADATION); + + final HolderGetter pools = regs.lookupOrThrow(Registry.TEMPLATE_POOL_REGISTRY); + final Holder empty = pools.getOrThrow(Pools.EMPTY); + + + return spawnCustomStructure( + new JigsawStructure(new Structure.StructureSettings( + l.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + Map.of(), + GenerationStep.Decoration.SURFACE_STRUCTURES, + TerrainAdjustment.NONE + ), + Holder.direct(new StructureTemplatePool( + empty, + ImmutableList.of( + Pair.of(StructurePoolElement.single("bastion/units/air_base", bastionGenericDegradation), 1) + ), + StructureTemplatePool.Projection.RIGID + )), + 6, + ConstantHeight.of(VerticalAnchor.absolute(33)), + false + ) + ); + }); + put("bastion_remnant_hoglin_stable", l -> { + RegistryAccess regs = l.registryAccess(); + + final HolderGetter processorLists = regs.lookupOrThrow(Registry.PROCESSOR_LIST_REGISTRY); + final Holder bastionGenericDegradation = processorLists.getOrThrow(ProcessorLists.BASTION_GENERIC_DEGRADATION); + + final HolderGetter pools = regs.lookupOrThrow(Registry.TEMPLATE_POOL_REGISTRY); + final Holder empty = pools.getOrThrow(Pools.EMPTY); + + return spawnCustomStructure( + new JigsawStructure(new Structure.StructureSettings( + l.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + Map.of(), + GenerationStep.Decoration.SURFACE_STRUCTURES, + TerrainAdjustment.NONE + ), + Holder.direct(new StructureTemplatePool( + empty, + ImmutableList.of( + Pair.of(StructurePoolElement.single("bastion/hoglin_stable/air_base", bastionGenericDegradation), 1) + ), + StructureTemplatePool.Projection.RIGID + )), + 6, + ConstantHeight.of(VerticalAnchor.absolute(33)), + false + ) + ); + }); + put("bastion_remnant_treasure", l -> { + RegistryAccess regs = l.registryAccess(); + + final HolderGetter processorLists = regs.lookupOrThrow(Registry.PROCESSOR_LIST_REGISTRY); + final Holder bastionGenericDegradation = processorLists.getOrThrow(ProcessorLists.BASTION_GENERIC_DEGRADATION); + + final HolderGetter pools = regs.lookupOrThrow(Registry.TEMPLATE_POOL_REGISTRY); + final Holder empty = pools.getOrThrow(Pools.EMPTY); + + return spawnCustomStructure( + new JigsawStructure(new Structure.StructureSettings( + l.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + Map.of(), + GenerationStep.Decoration.SURFACE_STRUCTURES, + TerrainAdjustment.NONE + ), + Holder.direct(new StructureTemplatePool( + empty, + ImmutableList.of( + Pair.of(StructurePoolElement.single("bastion/treasure/big_air_full", bastionGenericDegradation), 1) + ), + StructureTemplatePool.Projection.RIGID + )), + 6, + ConstantHeight.of(VerticalAnchor.absolute(33)), + false + ) + ); + }); + put("bastion_remnant_bridge", l -> { + RegistryAccess regs = l.registryAccess(); + + final HolderGetter processorLists = regs.lookupOrThrow(Registry.PROCESSOR_LIST_REGISTRY); + final Holder bastionGenericDegradation = processorLists.getOrThrow(ProcessorLists.BASTION_GENERIC_DEGRADATION); + + final HolderGetter pools = regs.lookupOrThrow(Registry.TEMPLATE_POOL_REGISTRY); + final Holder empty = pools.getOrThrow(Pools.EMPTY); + + return spawnCustomStructure( + new JigsawStructure(new Structure.StructureSettings( + l.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getOrCreateTag(BiomeTags.HAS_BASTION_REMNANT), + Map.of(), + GenerationStep.Decoration.SURFACE_STRUCTURES, + TerrainAdjustment.NONE + ), + Holder.direct(new StructureTemplatePool( + empty, + ImmutableList.of( + Pair.of(StructurePoolElement.single("bastion/bridge/starting_pieces/entrance_base", bastionGenericDegradation), 1) + ), + StructureTemplatePool.Projection.RIGID + )), + 6, + ConstantHeight.of(VerticalAnchor.absolute(33)), + false + ) + ); + }); }}; diff --git a/src/main/java/carpet/helpers/OptimizedExplosion.java b/src/main/java/carpet/helpers/OptimizedExplosion.java index 7138678f..e63eddc4 100644 --- a/src/main/java/carpet/helpers/OptimizedExplosion.java +++ b/src/main/java/carpet/helpers/OptimizedExplosion.java @@ -208,7 +208,7 @@ public class OptimizedExplosion EXPLOSION_OUTCOME.onExplosion((ServerLevel) world, eAccess.getSource(), e::getIndirectSourceEntity, eAccess.getX(), eAccess.getY(), eAccess.getZ(), eAccess.getRadius(), eAccess.isFire(), e.getToBlow(), entityList, eAccess.getBlockInteraction()); } - boolean damagesTerrain = eAccess.getBlockInteraction() != Explosion.BlockInteraction.NONE; + boolean damagesTerrain = eAccess.getBlockInteraction() != Explosion.BlockInteraction.KEEP; // explosionSound incremented till disabling the explosion particles and sound if (explosionSound < 100 || explosionSound % 100 == 0) diff --git a/src/main/java/carpet/helpers/ParticleDisplay.java b/src/main/java/carpet/helpers/ParticleDisplay.java index 3be78b7b..83f18ef5 100644 --- a/src/main/java/carpet/helpers/ParticleDisplay.java +++ b/src/main/java/carpet/helpers/ParticleDisplay.java @@ -16,30 +16,30 @@ public class ParticleDisplay { private static Map particleCache = new HashMap<>(); - private static ParticleOptions parseParticle(String name) + private static ParticleOptions parseParticle(String name, ServerLevel level) // [SCARY SHIT] persistent caches over server reloads { try { - return ParticleArgument.readParticle(new StringReader(name), HolderLookup.forRegistry(Registry.PARTICLE_TYPE)); + return ParticleArgument.readParticle(new StringReader(name), level.holderLookup(Registry.PARTICLE_TYPE_REGISTRY)); } catch (CommandSyntaxException e) { throw new RuntimeException("No such particle: "+name); } } - public static ParticleOptions getEffect(String name) + public static ParticleOptions getEffect(String name, ServerLevel level) { if (name == null) return null; ParticleOptions res = particleCache.get(name); if (res != null) return res; - particleCache.put(name, parseParticle(name)); + particleCache.put(name, parseParticle(name, level)); return particleCache.get(name); } public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, String main, String accent, int count, double spread) { - ParticleOptions accentParticle = getEffect(accent); - ParticleOptions mainParticle = getEffect(main); + ParticleOptions accentParticle = getEffect(accent, player.getLevel()); + ParticleOptions mainParticle = getEffect(main, player.getLevel()); if (accentParticle != null) ((ServerLevel)player.level).sendParticles( player, diff --git a/src/main/java/carpet/mixins/ChunkGenerator_scarpetMixin.java b/src/main/java/carpet/mixins/ChunkGenerator_scarpetMixin.java index 1aae936b..a923c800 100644 --- a/src/main/java/carpet/mixins/ChunkGenerator_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ChunkGenerator_scarpetMixin.java @@ -4,30 +4,23 @@ import carpet.fakes.ChunkGeneratorInterface; import net.minecraft.core.Holder; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import java.util.List; @Mixin(ChunkGenerator.class) public abstract class ChunkGenerator_scarpetMixin implements ChunkGeneratorInterface { - - @Shadow public abstract void ensureStructuresGenerated(RandomState randomState); - - @Shadow protected abstract List getPlacementsForStructure(Holder holder, RandomState randomState); - @Override public void initStrongholds(final ServerLevel level) { - ensureStructuresGenerated(level.getChunkSource().randomState()); + level.getChunkSource().getGeneratorState().ensureStructuresGenerated(); } @Override public List getPlacementsForFeatureCM(final ServerLevel level, Structure structure) { - return getPlacementsForStructure(Holder.direct(structure), level.getChunkSource().randomState()); + return level.getChunkSource().getGeneratorState().getPlacementsForStructure(Holder.direct(structure)); } } diff --git a/src/main/java/carpet/mixins/FlatLevelSource_structuresMixin.java b/src/main/java/carpet/mixins/FlatLevelSource_structuresMixin.java index 18c6a706..1fe31c7d 100644 --- a/src/main/java/carpet/mixins/FlatLevelSource_structuresMixin.java +++ b/src/main/java/carpet/mixins/FlatLevelSource_structuresMixin.java @@ -9,14 +9,13 @@ import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.FlatLevelSource; -import java.util.Optional; - -@Mixin(FlatLevelSource.class) +@Mixin(FlatLevelSource.class) // YEET public abstract class FlatLevelSource_structuresMixin extends ChunkGenerator { - public FlatLevelSource_structuresMixin(Registry registry, Optional> optional, BiomeSource biomeSource) { - super(registry, optional, biomeSource); + public FlatLevelSource_structuresMixin(BiomeSource biomeSource) { + super(biomeSource); } + /* @Override public WeightedRandomList getMobsAt(Holder biome, StructureFeatureManager accessor, MobCategory group, BlockPos pos) diff --git a/src/main/java/carpet/mixins/PrimedTntMixin.java b/src/main/java/carpet/mixins/PrimedTntMixin.java index 521b1b3d..b3c29a5f 100644 --- a/src/main/java/carpet/mixins/PrimedTntMixin.java +++ b/src/main/java/carpet/mixins/PrimedTntMixin.java @@ -79,7 +79,7 @@ public abstract class PrimedTntMixin extends Entity implements TntEntityInterfac this.level.explode(this, this.getX(), this.getY() + (double)(this.getBbHeight() / 16.0F), this.getZ(), 4.0F, - Explosion.BlockInteraction.BREAK); + Level.ExplosionInteraction.TNT); } @Inject(method = "tick", at = @At(value = "INVOKE", diff --git a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java index 4ecab43a..7bde2865 100644 --- a/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLevel_scarpetMixin.java @@ -2,6 +2,8 @@ package carpet.mixins; import carpet.fakes.ServerWorldInterface; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.DifficultyInstance; @@ -11,10 +13,14 @@ import net.minecraft.world.entity.LightningBolt; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.ExplosionDamageCalculator; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.entity.LevelEntityGetter; import net.minecraft.world.level.entity.PersistentEntitySectionManager; import net.minecraft.world.level.storage.ServerLevelData; +import net.minecraft.world.level.storage.WritableLevelData; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -24,14 +30,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import java.util.function.Supplier; + import static carpet.script.CarpetEventServer.Event.EXPLOSION; import static carpet.script.CarpetEventServer.Event.LIGHTNING; import static carpet.script.CarpetEventServer.Event.CHUNK_UNLOADED; @Mixin(ServerLevel.class) -public class ServerLevel_scarpetMixin implements ServerWorldInterface +public abstract class ServerLevel_scarpetMixin extends Level implements ServerWorldInterface { + protected ServerLevel_scarpetMixin(WritableLevelData writableLevelData, ResourceKey resourceKey, Holder holder, Supplier supplier, boolean bl, boolean bl2, long l, int i) { + super(writableLevelData, resourceKey, holder, supplier, bl, bl2, l, i); + } + @Inject(method = "tickChunk", locals = LocalCapture.CAPTURE_FAILHARD, at = @At( value = "INVOKE", target = "Lnet/minecraft/server/level/ServerLevel;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z", @@ -45,11 +57,24 @@ public class ServerLevel_scarpetMixin implements ServerWorldInterface if (LIGHTNING.isNeeded()) LIGHTNING.onWorldEventFlag((ServerLevel) (Object)this, blockPos, bl2?1:0); } + private Explosion.BlockInteraction getCMDestroyType(final GameRules.Key rule) { + return getGameRules().getBoolean(rule) ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY; + } + @Inject(method = "explode", at = @At("HEAD")) - private void handleExplosion(/*@Nullable*/ Entity entity, /*@Nullable*/ DamageSource damageSource, /*@Nullable*/ ExplosionDamageCalculator explosionBehavior, double d, double e, double f, float g, boolean bl, Explosion.BlockInteraction destructionType, CallbackInfoReturnable cir) + private void handleExplosion(/*@Nullable*/ Entity entity, /*@Nullable*/ DamageSource damageSource, /*@Nullable*/ ExplosionDamageCalculator explosionBehavior, double d, double e, double f, float g, boolean bl, Level.ExplosionInteraction explosionInteraction, CallbackInfoReturnable cir) { - if (EXPLOSION.isNeeded()) - EXPLOSION.onExplosion((ServerLevel) (Object)this, entity, null, d, e, f, g, bl, null, null, destructionType); + if (EXPLOSION.isNeeded()) { + Explosion.BlockInteraction var10000 = switch (explosionInteraction) { + case NONE -> Explosion.BlockInteraction.KEEP; + case BLOCK -> this.getCMDestroyType(GameRules.RULE_BLOCK_EXPLOSION_DROP_DECAY); + case MOB -> this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? this.getCMDestroyType(GameRules.RULE_MOB_EXPLOSION_DROP_DECAY) : Explosion.BlockInteraction.KEEP; + case TNT -> this.getCMDestroyType(GameRules.RULE_TNT_EXPLOSION_DROP_DECAY); + default -> throw new IncompatibleClassChangeError(); + }; + + EXPLOSION.onExplosion((ServerLevel) (Object) this, entity, null, d, e, f, g, bl, null, null, var10000); + } } @Inject(method = "unload", at = @At("HEAD")) diff --git a/src/main/java/carpet/script/api/Auxiliary.java b/src/main/java/carpet/script/api/Auxiliary.java index 570c996d..975a1743 100644 --- a/src/main/java/carpet/script/api/Auxiliary.java +++ b/src/main/java/carpet/script/api/Auxiliary.java @@ -200,7 +200,7 @@ public class Auxiliary { } } } - ParticleOptions particle = ShapeDispatcher.getParticleData(particleName); + ParticleOptions particle = ShapeDispatcher.getParticleData(particleName, world.registryAccess()); Vec3 vec = locator.vec; if (player == null) { @@ -225,7 +225,7 @@ public class Auxiliary { CarpetContext cc = (CarpetContext)c; ServerLevel world = cc.s.getLevel(); String particleName = lv.get(0).getString(); - ParticleOptions particle = ShapeDispatcher.getParticleData(particleName); + ParticleOptions particle = ShapeDispatcher.getParticleData(particleName, world.registryAccess()); Vector3Argument pos1 = Vector3Argument.findIn(lv, 1); Vector3Argument pos2 = Vector3Argument.findIn(lv, pos1.offset); double density = 1.0; @@ -259,14 +259,14 @@ public class Auxiliary { )); }); - expression.addUnaryFunction("item_display_name", v -> new FormattedTextValue(ValueConversions.getItemStackFromValue(v, false).getHoverName())); + expression.addContextFunction("item_display_name", 1, (c, t, lv) -> new FormattedTextValue(ValueConversions.getItemStackFromValue(lv.get(0), false, ((CarpetContext)c).s.registryAccess() ).getHoverName())); expression.addContextFunction("particle_box", -1, (c, t, lv) -> { CarpetContext cc = (CarpetContext)c; ServerLevel world = cc.s.getLevel(); String particleName = lv.get(0).getString(); - ParticleOptions particle = ShapeDispatcher.getParticleData(particleName); + ParticleOptions particle = ShapeDispatcher.getParticleData(particleName, world.registryAccess() ); Vector3Argument pos1 = Vector3Argument.findIn(lv, 1); Vector3Argument pos2 = Vector3Argument.findIn(lv, pos1.offset); diff --git a/src/main/java/carpet/script/api/Inventories.java b/src/main/java/carpet/script/api/Inventories.java index c64e00c6..36fc61ab 100644 --- a/src/main/java/carpet/script/api/Inventories.java +++ b/src/main/java/carpet/script/api/Inventories.java @@ -4,7 +4,6 @@ import carpet.fakes.IngredientInterface; import carpet.fakes.RecipeManagerInterface; import carpet.script.CarpetContext; import carpet.script.Expression; -import carpet.script.argument.BlockArgument; import carpet.script.argument.FunctionArgument; import carpet.script.exception.InternalExpressionException; import carpet.script.exception.ThrowStatement; @@ -40,7 +39,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.AbstractCookingRecipe; @@ -50,14 +48,13 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.item.crafting.ShapelessRecipe; import net.minecraft.world.item.crafting.SingleItemRecipe; -import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.Vec3; public class Inventories { public static void apply(Expression expression) { - expression.addUnaryFunction("stack_limit", v -> - new NumericValue(NBTSerializableValue.parseItem(v.getString()).getItem().getMaxStackSize())); + expression.addContextFunction("stack_limit", 1, (c, t, lv) -> + new NumericValue(NBTSerializableValue.parseItem(lv.get(0).getString(), ((CarpetContext) c).s.registryAccess() ).getItem().getMaxStackSize())); expression.addContextFunction("item_category", -1, (c, t, lv) -> { CarpetContext cc = (CarpetContext)c; @@ -91,7 +88,7 @@ public class Inventories { Registry blocks = cc.s.getServer().registryAccess().registryOrThrow(Registry.ITEM_REGISTRY); if (lv.size() == 0) return ListValue.wrap(blocks.getTagNames().map(ValueConversions::of).collect(Collectors.toList())); - Item item = NBTSerializableValue.parseItem(lv.get(0).getString()).getItem(); + Item item = NBTSerializableValue.parseItem(lv.get(0).getString(), cc.s.registryAccess()).getItem(); if (lv.size() == 1) { return ListValue.wrap( blocks.getTags().filter(e -> e.getSecond().stream().anyMatch(h -> (h.value() == item))).map(e -> ValueConversions.of(e.getFirst())).collect(Collectors.toList())); @@ -280,7 +277,7 @@ public class Inventories { else nbt = new NBTSerializableValue(nbtValue.getString()).getCompoundTag(); } - ItemInput newitem = NBTSerializableValue.parseItem(lv.get(inventoryLocator.offset()+2).getString(), nbt); + ItemInput newitem = NBTSerializableValue.parseItem(lv.get(inventoryLocator.offset()+2).getString(), nbt, cc.s.registryAccess()); ItemStack previousStack = inventoryLocator.inventory().getItem(slot); try { @@ -305,7 +302,7 @@ public class Inventories { { Value secondArg = lv.get(inventoryLocator.offset()+0); if (!secondArg.isNull()) - itemArg = NBTSerializableValue.parseItem(secondArg.getString()); + itemArg = NBTSerializableValue.parseItem(secondArg.getString(), cc.s.registryAccess()); } int startIndex = 0; if (lv.size() > inventoryLocator.offset()+1) @@ -330,7 +327,7 @@ public class Inventories { if (inventoryLocator == null) return Value.NULL; if (lv.size() <= inventoryLocator.offset()) throw new InternalExpressionException("'inventory_remove' requires at least an item to be removed"); - ItemInput searchItem = NBTSerializableValue.parseItem(lv.get(inventoryLocator.offset()).getString()); + ItemInput searchItem = NBTSerializableValue.parseItem(lv.get(inventoryLocator.offset()).getString(), cc.s.registryAccess()); int amount = 1; if (lv.size() > inventoryLocator.offset()+1) amount = (int)NumericValue.asNumber(lv.get(inventoryLocator.offset()+1)).getLong(); diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 71819e3a..ca649d80 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -34,7 +34,6 @@ import carpet.script.value.StringValue; import carpet.script.value.Value; import carpet.script.value.ValueConversions; import carpet.utils.BlockInfo; -import carpet.utils.CommandHelper; import com.mojang.brigadier.exceptions.CommandSyntaxException; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; @@ -926,7 +925,7 @@ public class WorldAccess { throw new InternalExpressionException("'create_explosion' requires at least a position to explode"); CarpetContext cc = (CarpetContext)c; float powah = 4.0f; - Explosion.BlockInteraction mode = Explosion.BlockInteraction.BREAK; + Explosion.BlockInteraction mode = Explosion.BlockInteraction.DESTROY; // should probably read the gamerule for default behaviour boolean createFire = false; Entity source = null; LivingEntity attacker = null; @@ -994,7 +993,7 @@ public class WorldAccess { }; explosion.explode(); explosion.finalizeExplosion(false); - if (mode == Explosion.BlockInteraction.NONE) explosion.clearToBlow(); + if (mode == Explosion.BlockInteraction.KEEP) explosion.clearToBlow(); cc.s.getLevel().players().forEach(spe -> { if (spe.distanceToSqr(pos) < 4096.0D) spe.connection.send(new ClientboundExplodePacket(pos.x, pos.y, pos.z, thePowah, explosion.getToBlow(), explosion.getHitPlayers().get(spe))); @@ -1010,7 +1009,7 @@ public class WorldAccess { CarpetContext cc = (CarpetContext) c; String itemString = lv.get(0).getString(); Vector3Argument locator = Vector3Argument.findIn(lv, 1); - ItemInput stackArg = NBTSerializableValue.parseItem(itemString); + ItemInput stackArg = NBTSerializableValue.parseItem(itemString, cc.s.registryAccess()); BlockPos where = new BlockPos(locator.vec); String facing; if (lv.size() > locator.offset) { diff --git a/src/main/java/carpet/script/argument/BlockArgument.java b/src/main/java/carpet/script/argument/BlockArgument.java index eeb437d5..b32556d2 100644 --- a/src/main/java/carpet/script/argument/BlockArgument.java +++ b/src/main/java/carpet/script/argument/BlockArgument.java @@ -60,7 +60,7 @@ public class BlockArgument extends Argument } if (acceptString && v1 instanceof StringValue) { - return new BlockArgument(BlockValue.fromString(v1.getString()), 1 + offset); + return new BlockArgument(BlockValue.fromString(v1.getString(), c.s.registryAccess()), 1 + offset); } if (v1 instanceof BlockValue) { diff --git a/src/main/java/carpet/script/command/CommandArgument.java b/src/main/java/carpet/script/command/CommandArgument.java index c17ad044..0a9f0af3 100644 --- a/src/main/java/carpet/script/command/CommandArgument.java +++ b/src/main/java/carpet/script/command/CommandArgument.java @@ -1061,8 +1061,7 @@ public abstract class CommandArgument super(suffix, null, suggestFromExamples); try { - final CommandBuildContext context = new CommandBuildContext(server.registryAccess(), server.getWorldData().enabledFeatures()); - context.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY); + final CommandBuildContext context = CommandBuildContext.simple(server.registryAccess(), server.getWorldData().enabledFeatures()); this.examples = argumentTypeSupplier.get(context).getExamples(); } catch (CommandSyntaxException e) @@ -1122,7 +1121,7 @@ public abstract class CommandArgument protected ArgumentType getArgumentType(CarpetScriptHost host) throws CommandSyntaxException { if (argumentTypeSupplier != null) return argumentTypeSupplier.get(); - CommandBuildContext registryAccess = new CommandBuildContext(host.scriptServer().server.registryAccess(), host.scriptServer().server.getWorldData().enabledFeatures()); + CommandBuildContext registryAccess = CommandBuildContext.simple(host.scriptServer().server.registryAccess(), host.scriptServer().server.getWorldData().enabledFeatures()); return argumentTypeSupplierEx.get(registryAccess); } diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 51ee8ec9..1e12ce1f 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -29,8 +29,8 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.minecraft.commands.arguments.ParticleArgument; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.nbt.ByteTag; import net.minecraft.nbt.CompoundTag; @@ -172,14 +172,14 @@ public class ShapeDispatcher } } - public static ParticleOptions getParticleData(String name) + public static ParticleOptions getParticleData(String name, RegistryAccess regs) { - ParticleOptions particle = particleCache.get(name); + ParticleOptions particle = particleCache.get(name); // [SCARY SHIT] cache should be cleared between worlds if (particle != null) return particle; try { - particle = ParticleArgument.readParticle(new StringReader(name), HolderLookup.forRegistry(Registry.PARTICLE_TYPE)); + particle = ParticleArgument.readParticle(new StringReader(name), regs.lookupOrThrow(Registry.PARTICLE_TYPE_REGISTRY)); } catch (CommandSyntaxException e) { @@ -388,12 +388,12 @@ public class ShapeDispatcher NumericValue.asNumber( elements.get(2)).getDouble() ); } - protected ParticleOptions replacementParticle() + protected ParticleOptions replacementParticle(RegistryAccess regs) { String particleName = fa ==0 ? String.format(Locale.ROOT , "dust %.1f %.1f %.1f 1.0", r, g, b): String.format(Locale.ROOT , "dust %.1f %.1f %.1f 1.0", fr, fg, fb); - return getParticleData(particleName); + return getParticleData(particleName, regs); } @@ -645,19 +645,18 @@ public class ShapeDispatcher @Override public Consumer alternative() { - ParticleOptions particle; - if(this.isitem) - { - if (Block.byItem(this.item.getItem()).defaultBlockState().isAir()) return p->{}; - particle = getParticleData("block_marker "+Registry.BLOCK.getKey(Block.byItem(this.item.getItem()))); - } - else - { - particle = getParticleData("block_marker "+Registry.BLOCK.getKey(this.blockState.getBlock())); - } - - return p -> { + ParticleOptions particle; + if(this.isitem) + { + if (Block.byItem(this.item.getItem()).defaultBlockState().isAir()) return; + particle = getParticleData("block_marker "+Registry.BLOCK.getKey(Block.byItem(this.item.getItem())), p.level.registryAccess()); + } + else + { + particle = getParticleData("block_marker "+Registry.BLOCK.getKey(this.blockState.getBlock()), p.level.registryAccess()); + } + Vec3 v = relativiseRender(p.level, this.pos, 0); p.getLevel().sendParticles(p, particle , true, v.x, v.y, v.z, 1,0.0, 0.0, 0.0, 0.0); }; @@ -712,7 +711,6 @@ public class ShapeDispatcher @Override public Consumer alternative() { - ParticleOptions particle = replacementParticle(); double density = Math.max(2.0, from.distanceTo(to) /50/ (a+0.1)) ; return p -> { @@ -720,7 +718,7 @@ public class ShapeDispatcher { particleMesh( Collections.singletonList(p), - particle, + replacementParticle(p.level.registryAccess()), density, relativiseRender(p.level, from, 0), relativiseRender(p.level, to, 0) @@ -872,10 +870,10 @@ public class ShapeDispatcher } @Override public Consumer alternative() { - final ParticleOptions locparticledata = getParticleData(String.format(Locale.ROOT ,"dust %.1f %.1f %.1f %.1f", fr, fg, fb, fa)); return p->{ if(p.level.dimension() != this.shapeDimension){return;} if(!(fa>0.0f)){return;} + final ParticleOptions locparticledata = getParticleData(String.format(Locale.ROOT ,"dust %.1f %.1f %.1f %.1f", fr, fg, fb, fa), p.level.registryAccess()); for(Vec3 v : alter_point(p)){ p.getLevel().sendParticles(p,locparticledata , true, v.x, v.y, v.z, 1, @@ -973,13 +971,12 @@ public class ShapeDispatcher @Override public Consumer alternative() { - ParticleOptions particle = replacementParticle(); double density = Math.max(2.0, from.distanceTo(to) /50) / (a+0.1); return p -> { if (p.level.dimension() == shapeDimension) drawParticleLine( Collections.singletonList(p), - particle, + replacementParticle(p.level.registryAccess()), relativiseRender(p.level, from, 0), relativiseRender(p.level, to, 0), density @@ -1034,10 +1031,11 @@ public class ShapeDispatcher @Override public Consumer alternative() { return p -> { - ParticleOptions particle = replacementParticle(); + int partno = Math.min(1000,20*subdivisions); RandomSource rand = p.level.getRandom(); ServerLevel world = p.getLevel(); + ParticleOptions particle = replacementParticle(world.registryAccess()); Vec3 ccenter = relativiseRender(world, center, 0 ); @@ -1112,10 +1110,11 @@ public class ShapeDispatcher @Override public Consumer alternative() { return p -> { - ParticleOptions particle = replacementParticle(); + int partno = (int)Math.min(1000,Math.sqrt(20*subdivisions*(1+height))); RandomSource rand = p.level.getRandom(); ServerLevel world = p.getLevel(); + ParticleOptions particle = replacementParticle(world.registryAccess()); Vec3 ccenter = relativiseRender(world, center, 0 ); @@ -1307,7 +1306,7 @@ public class ShapeDispatcher if(value instanceof BlockValue blv){ return value; } - return BlockValue.fromString(value.getString()); + return BlockValue.fromString(value.getString(), server.registryAccess()); } @Override public Tag toTag(Value value) { @@ -1342,7 +1341,7 @@ public class ShapeDispatcher @Override public Value validate(Map options, MinecraftServer server, Value value) { - ItemStack item=ValueConversions.getItemStackFromValue(value, true); + ItemStack item=ValueConversions.getItemStackFromValue(value, true, server.registryAccess()); return new NBTSerializableValue(item.save(new CompoundTag())); } @Override diff --git a/src/main/java/carpet/script/value/BlockValue.java b/src/main/java/carpet/script/value/BlockValue.java index d6ac4898..d242ded6 100644 --- a/src/main/java/carpet/script/value/BlockValue.java +++ b/src/main/java/carpet/script/value/BlockValue.java @@ -18,8 +18,8 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; import net.minecraft.core.GlobalPos; -import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; @@ -54,13 +54,13 @@ public class BlockValue extends Value } private static final Map bvCache= new HashMap<>(); - public static BlockValue fromString(String str) + public static BlockValue fromString(String str, RegistryAccess regs) { try { - BlockValue bv = bvCache.get(str); + BlockValue bv = bvCache.get(str); // [SCARY SHIT] persistent caches over server reloads if (bv != null) return bv; - BlockStateParser.BlockResult foo = BlockStateParser.parseForBlock(HolderLookup.forRegistry(Registry.BLOCK), new StringReader(str), true ); + BlockStateParser.BlockResult foo = BlockStateParser.parseForBlock(regs.lookupOrThrow(Registry.BLOCK_REGISTRY), new StringReader(str), true ); if (foo.blockState() != null) { CompoundTag bd = foo.nbt(); diff --git a/src/main/java/carpet/script/value/EntityValue.java b/src/main/java/carpet/script/value/EntityValue.java index 718e15f5..9856cd15 100644 --- a/src/main/java/carpet/script/value/EntityValue.java +++ b/src/main/java/carpet/script/value/EntityValue.java @@ -1691,7 +1691,7 @@ public class EntityValue extends Value }); put("item", (e, v) -> { - ItemStack item=ValueConversions.getItemStackFromValue(v, true); + ItemStack item=ValueConversions.getItemStackFromValue(v, true, e.level.registryAccess()); if(e instanceof ItemEntity itementity) itementity.setItem(item); if(e instanceof ItemFrame itemframe) diff --git a/src/main/java/carpet/script/value/NBTSerializableValue.java b/src/main/java/carpet/script/value/NBTSerializableValue.java index 3bd290e4..1ed39b4d 100644 --- a/src/main/java/carpet/script/value/NBTSerializableValue.java +++ b/src/main/java/carpet/script/value/NBTSerializableValue.java @@ -23,8 +23,8 @@ import net.minecraft.commands.arguments.item.ItemInput; import net.minecraft.commands.arguments.item.ItemParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; -import net.minecraft.core.HolderLookup; import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CollectionTag; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.EndTag; @@ -290,22 +290,22 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa private static final Map itemCache = new HashMap<>(); - public static ItemInput parseItem(String itemString) + public static ItemInput parseItem(String itemString, RegistryAccess regs) { - return parseItem(itemString, null); + return parseItem(itemString, null, regs); } - public static ItemInput parseItem(String itemString, CompoundTag customTag) + public static ItemInput parseItem(String itemString, CompoundTag customTag, RegistryAccess regs) { try { - ItemInput res = itemCache.get(itemString); + ItemInput res = itemCache.get(itemString); // [SCARY SHIT] persistent caches over server reloads if (res != null) if (customTag == null) return res; else return new ItemInput(Holder.direct(res.getItem()), customTag); - ItemParser.ItemResult parser = ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(itemString)); + ItemParser.ItemResult parser = ItemParser.parseForItem(regs.lookupOrThrow(Registry.ITEM_REGISTRY), new StringReader(itemString)); res = new ItemInput(parser.item(), parser.nbt()); itemCache.put(itemString, res); diff --git a/src/main/java/carpet/script/value/ValueConversions.java b/src/main/java/carpet/script/value/ValueConversions.java index 670a102d..3337b662 100644 --- a/src/main/java/carpet/script/value/ValueConversions.java +++ b/src/main/java/carpet/script/value/ValueConversions.java @@ -413,7 +413,7 @@ public class ValueConversions ); } - public static ItemStack getItemStackFromValue(Value value, boolean withCount) + public static ItemStack getItemStackFromValue(Value value, boolean withCount, RegistryAccess regs) { if (value.isNull()) { @@ -444,7 +444,7 @@ public class ValueConversions { name = value.getString(); } - ItemInput itemInput = NBTSerializableValue.parseItem(name, nbtTag); + ItemInput itemInput = NBTSerializableValue.parseItem(name, nbtTag, regs); try { return itemInput.createItemStack(count,false); diff --git a/src/main/java/carpet/settings/SettingsManager.java b/src/main/java/carpet/settings/SettingsManager.java index a6f788a9..d7c9729e 100644 --- a/src/main/java/carpet/settings/SettingsManager.java +++ b/src/main/java/carpet/settings/SettingsManager.java @@ -208,8 +208,7 @@ public class SettingsManager extends carpet.api.settings.SettingsManager @Deprecated(forRemoval = true) public void registerCommand(CommandDispatcher dispatcher) { - final CommandBuildContext context = new CommandBuildContext(RegistryAccess.EMPTY, FeatureFlags.VANILLA_SET); - context.missingTagAccessPolicy(CommandBuildContext.MissingTagAccessPolicy.RETURN_EMPTY); + final CommandBuildContext context = CommandBuildContext.simple(RegistryAccess.EMPTY, FeatureFlags.VANILLA_SET); registerCommand(dispatcher, context); } }