26.3-snap-2

This commit is contained in:
gnembon committed 2026-07-02 15:16:45 +02:00
1 parent 9241a6a127
commit 73fc5f1d13
20 files changed
+73 -130

No files matched your search

+2 -2
View File
@@ -637,7 +637,7 @@ with minecraft 1.16.1 and below or 1.16.2 and above since in 1.16.2 Mojang has a
meaning that since 1.16.2 - they have official names that can be used by datapacks and scarpet. If you have most recent meaning that since 1.16.2 - they have official names that can be used by datapacks and scarpet. If you have most recent
scarpet on 1.16.4, you can use `plop()` to get all available worldgen features including custom features and structures scarpet on 1.16.4, you can use `plop()` to get all available worldgen features including custom features and structures
controlled by datapacks. It returns a map of lists in the following categories: controlled by datapacks. It returns a map of lists in the following categories:
`'scarpet_custom'`, `'configured_features'`, `'structures'`, `'features'`, `'structure_types'` `'scarpet_custom'`, `'features'`, `'structures'`, `'feature_types'`, `'structure_types'`
### Previous Structure Names, including variants (for MC1.16.1 and below only) ### Previous Structure Names, including variants (for MC1.16.1 and below only)
* `'monument'`: Ocean Monument. Generates at fixed Y coordinate, surrounds itself with water. * `'monument'`: Ocean Monument. Generates at fixed Y coordinate, surrounds itself with water.
@@ -736,7 +736,7 @@ controlled by datapacks. It returns a map of lists in the following categories:
### World Generation Features and Structures (as of MC1.16.2+) ### World Generation Features and Structures (as of MC1.16.2+)
Use `plop():'structure_types'`, `plop():'structures'`, `plop():'features'`, and `plop():'configured_features'` for a list of available options. Your output may vary based on Use `plop():'structure_types'`, `plop():'structures'`, `plop():'features'`, and `plop():'feature_types'` for a list of available options. Your output may vary based on
datapacks installed in your world. datapacks installed in your world.
### Custom Scarpet Features ### Custom Scarpet Features
+2 -2
View File
@@ -7,7 +7,7 @@ org.gradle.configuration-cache=false
# Fabric Properties # Fabric Properties
# check https://fabricmc.net/develop/ # check https://fabricmc.net/develop/
minecraft_version=26.2 minecraft_version=26.3-snapshot-2
loader_version=0.19.3 loader_version=0.19.3
loom_version=1.17-SNAPSHOT loom_version=1.17-SNAPSHOT
@@ -20,7 +20,7 @@ org.gradle.configuration-cache=false
# The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5) # The Curseforge versions "names" or ids for the main branch (comma separated: 1.16.4,1.16.5)
# This is needed because CF uses too vague names for prereleases and release candidates # This is needed because CF uses too vague names for prereleases and release candidates
# Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN] # Can also be the version ID directly coming from https://minecraft.curseforge.com/api/game/versions?token=[API_TOKEN]
release-curse-versions = Minecraft 26.2:26.2 release-curse-versions = Minecraft 26.3:26.3-Snapshot
# Whether or not to build another branch on release # Whether or not to build another branch on release
release-extra-branch = false release-extra-branch = false
# The name of the second branch to release # The name of the second branch to release
@@ -1,12 +0,0 @@
package carpet.fakes;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
public interface CoralFeatureInterface
{
boolean growSpecific(Level worldIn, RandomSource random, BlockPos pos, BlockState blockUnder);
}
@@ -1,6 +1,5 @@
package carpet.helpers; package carpet.helpers;
import carpet.fakes.CoralFeatureInterface;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet; import net.minecraft.core.HolderSet;
@@ -20,7 +19,6 @@ import net.minecraft.world.level.levelgen.feature.CoralClawFeature;
import net.minecraft.world.level.levelgen.feature.CoralFeature; import net.minecraft.world.level.levelgen.feature.CoralFeature;
import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature; import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature;
import net.minecraft.world.level.levelgen.feature.CoralTreeFeature; import net.minecraft.world.level.levelgen.feature.CoralTreeFeature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.MapColor;
/** /**
@@ -51,9 +49,9 @@ public interface FertilizableCoral extends BonemealableBlock {
{ {
int variant = random.nextInt(3); int variant = random.nextInt(3);
CoralFeature coral = switch (variant) { CoralFeature coral = switch (variant) {
case 0 -> new CoralClawFeature(NoneFeatureConfiguration.CODEC); case 0 -> new CoralClawFeature();
case 1 -> new CoralTreeFeature(NoneFeatureConfiguration.CODEC); case 1 -> new CoralTreeFeature();
default -> new CoralMushroomFeature(NoneFeatureConfiguration.CODEC); default -> new CoralMushroomFeature();
}; };
MapColor color = blockUnder.getMapColor(worldIn, pos); MapColor color = blockUnder.getMapColor(worldIn, pos);
@@ -69,7 +67,7 @@ public interface FertilizableCoral extends BonemealableBlock {
} }
worldIn.setBlock(pos, Blocks.WATER.defaultBlockState(), Block.UPDATE_NONE); worldIn.setBlock(pos, Blocks.WATER.defaultBlockState(), Block.UPDATE_NONE);
if (!((CoralFeatureInterface)coral).growSpecific(worldIn, random, pos, properBlock)) if (!coral.placeFeature(worldIn, random, pos, properBlock))
{ {
worldIn.setBlock(pos, blockUnder, 3); worldIn.setBlock(pos, blockUnder, 3);
} }
@@ -1,26 +0,0 @@
package carpet.mixins;
import carpet.fakes.CoralFeatureInterface;
import net.minecraft.util.RandomSource;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.CoralFeature;
@Mixin(CoralFeature.class)
public abstract class CoralFeature_renewableCoralMixin implements CoralFeatureInterface
{
@Shadow protected abstract boolean placeFeature(LevelAccessor var1, RandomSource var2, BlockPos var3, BlockState var4);
@Override
public boolean growSpecific(Level worldIn, RandomSource random, BlockPos pos, BlockState blockUnder)
{
return placeFeature(worldIn, random, pos, blockUnder);
}
}
@@ -19,7 +19,7 @@ public class FlowingFluid_liquidDamageDisabledMixin
method = "canHoldAnyFluid", method = "canHoldAnyFluid",
at = @At( at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/world/level/block/state/BlockState;blocksMotion()Z" target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/tags/TagKey;)Z"
), ),
cancellable = true cancellable = true
) )
@@ -27,7 +27,7 @@ public class FlowingFluid_liquidDamageDisabledMixin
{ {
if (CarpetSettings.liquidDamageDisabled) if (CarpetSettings.liquidDamageDisabled)
{ {
cir.setReturnValue(state.isAir() || state.is(Blocks.WATER) || state.is(Blocks.LAVA)); cir.setReturnValue((state.isAir() || state.is(Blocks.WATER) || state.is(Blocks.LAVA)));
} }
} }
} }
@@ -2,23 +2,32 @@ package carpet.mixins;
import carpet.CarpetSettings; import carpet.CarpetSettings;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.levelgen.feature.HugeFungusConfiguration;
import net.minecraft.world.level.levelgen.feature.HugeFungusFeature; import net.minecraft.world.level.levelgen.feature.HugeFungusFeature;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.ModifyArgs;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args; import org.spongepowered.asm.mixin.injection.invoke.arg.Args;
import static carpet.CarpetSettings.FungusGrowthMode.*; import static carpet.CarpetSettings.FungusGrowthMode.*;
@Mixin(HugeFungusFeature.class) @Mixin(HugeFungusFeature.class)
public class HugeFungusFeatureMixin { public class HugeFungusFeatureMixin {
@ModifyArgs(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/HugeFungusFeature;placeStem(Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/feature/HugeFungusConfiguration;Lnet/minecraft/core/BlockPos;IZ)V")) @Inject( method = "planted", at = @At("HEAD"), cancellable = true)
private void planted(CallbackInfoReturnable<Boolean> cir) {
if (CarpetSettings.thickFungusGrowth == ALL) {
cir.setReturnValue(true);
}
}
/*@ModifyArgs(method = "place", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/levelgen/feature/HugeFungusFeature;placeStem(Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/util/RandomSource;Lnet/minecraft/world/level/levelgen/feature/HugeFungusConfiguration;Lnet/minecraft/core/BlockPos;IZ)V"))
private void mixin(Args args) { private void mixin(Args args) {
boolean natural = !((HugeFungusConfiguration) args.get(2)).planted; boolean natural = !((HugeFungusConfiguration) args.get(2)).planted;
args.set(5, natural && ((boolean) args.get(5)) || args.set(5, natural && ((boolean) args.get(5)) ||
!natural && (CarpetSettings.thickFungusGrowth == ALL || !natural && (CarpetSettings.thickFungusGrowth == ALL ||
CarpetSettings.thickFungusGrowth == RANDOM && ((RandomSource) args.get(1)).nextFloat() < 0.06F) CarpetSettings.thickFungusGrowth == RANDOM && ((RandomSource) args.get(1)).nextFloat() < 0.06F)
); );
} }*/
} }
@@ -22,7 +22,7 @@ public interface ItemStack_stackableShulkerBoxesMixin
&& ((ItemInstance)((Object)this)) instanceof final ItemStack itemStack && ((ItemInstance)((Object)this)) instanceof final ItemStack itemStack
&& itemStack.getItem() instanceof BlockItem blockItem && itemStack.getItem() instanceof BlockItem blockItem
&& blockItem.getBlock() instanceof ShulkerBoxBlock && blockItem.getBlock() instanceof ShulkerBoxBlock
&& ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).allItemsCopyStream().findAny().isEmpty() && ((ItemStack) ((Object) this)).getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY).itemCopies().findAny().isEmpty()
) { ) {
cir.setReturnValue(CarpetSettings.shulkerBoxStackSize); cir.setReturnValue(CarpetSettings.shulkerBoxStackSize);
} }
@@ -56,7 +56,8 @@ public class LevelRenderer_scarpetRenderMixin
@Inject(method = "render", at = @At( @Inject(method = "render", at = @At(
value = "INVOKE", value = "INVOKE",
target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;F)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lnet/minecraft/client/renderer/feature/FeatureRenderDispatcher$PreparedFrame;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;addAlwaysOnTopPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;submitFeatures(Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/client/renderer/SubmitNodeCollector;Z)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;submitFeatures(Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/client/renderer/SubmitNodeCollector;Z)V",
//target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V", //target = "Lnet/minecraft/client/renderer/LevelRenderer;addMainPass(Lcom/mojang/blaze3d/framegraph/FrameGraphBuilder;Lcom/mojang/blaze3d/buffers/GpuBufferSlice;Lnet/minecraft/client/renderer/state/level/LevelRenderState;Lnet/minecraft/util/profiling/ProfilerFiller;Lnet/minecraft/client/renderer/chunk/ChunkSectionsToRender;)V",
@@ -1,22 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.function.Predicate;
import net.minecraft.world.level.levelgen.structure.pieces.PieceGeneratorSupplier;
@Mixin(PieceGeneratorSupplier.class)
public interface PieceGeneratorSupplier_plopMixin
{
@Redirect(method = "lambda$simple$0", at = @At(
value = "INVOKE",
target = "java/util/function/Predicate.test(Ljava/lang/Object;)Z"
), remap = false)
private static boolean checkMate(Predicate<Object> predicate, Object o)
{
return CarpetSettings.skipGenerationChecks.get() || predicate.test(o);
}
}
@@ -106,14 +106,14 @@ public abstract class PistonMovingBlockEntity_movableBEMixin extends BlockEntity
} }
@Redirect(method = "finalTick", at = @At(value = "INVOKE", @Redirect(method = "finalTick", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/level/Level;setBlock(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;I)Z")) target = "Lnet/minecraft/world/level/Level;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z"))
private boolean movableTEsetBlockState1(Level world, BlockPos blockPos_1, BlockState blockState_2, int int_1) private boolean movableTESetBlockState1(Level world, BlockPos blockPos_1, BlockState blockState_2)
{ {
if (!CarpetSettings.movableBlockEntities) if (!CarpetSettings.movableBlockEntities)
return world.setBlock(blockPos_1, blockState_2, int_1); return world.setBlockAndUpdate(blockPos_1, blockState_2);
else else
{ {
boolean ret = ((LevelInterface) (world)).setBlockStateWithBlockEntity(blockPos_1, blockState_2, this.carriedBlockEntity, int_1); boolean ret = ((LevelInterface) (world)).setBlockStateWithBlockEntity(blockPos_1, blockState_2, this.carriedBlockEntity, Block.UPDATE_ALL);
this.carriedBlockEntity = null; //this will cancel the finishHandleBroken this.carriedBlockEntity = null; //this will cancel the finishHandleBroken
return ret; return ret;
} }
@@ -17,12 +17,12 @@ public abstract class Player_fakePlayersMixin
method = "causeExtraKnockback", method = "causeExtraKnockback",
at = @At( at = @At(
value = "FIELD", value = "FIELD",
target = "Lnet/minecraft/world/entity/Entity;hurtMarked:Z", target = "Lnet/minecraft/world/entity/Entity;syncVelocity:Z",
ordinal = 0 ordinal = 0
) )
) )
private boolean velocityModifiedAndNotCarpetFakePlayer(Entity target) private boolean velocityModifiedAndNotCarpetFakePlayer(Entity target)
{ {
return target.hurtMarked && !(target instanceof EntityPlayerMPFake); return target.syncVelocity && !(target instanceof EntityPlayerMPFake);
} }
} }
@@ -4,6 +4,7 @@ import carpet.helpers.ParticleDisplay;
import carpet.utils.Messenger; import carpet.utils.Messenger;
import carpet.utils.MobAI; import carpet.utils.MobAI;
import net.minecraft.core.particles.DustParticleOptions; import net.minecraft.core.particles.DustParticleOptions;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.entity.ai.village.poi.PoiTypes; import net.minecraft.world.entity.ai.village.poi.PoiTypes;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
@@ -33,7 +34,6 @@ import net.minecraft.world.entity.npc.villager.AbstractVillager;
import net.minecraft.world.entity.npc.villager.Villager; import net.minecraft.world.entity.npc.villager.Villager;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.schedule.Activity; import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.item.BedItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
@@ -140,7 +140,7 @@ public abstract class Villager_aiMixin extends AbstractVillager
while(countFoodPointsInInventory() >= 12) eatAndDigestFood(); while(countFoodPointsInInventory() >= 12) eatAndDigestFood();
} }
else if (itemStack_1.getItem() instanceof BedItem) else if (itemStack_1.is(ItemTags.BEDS))
{ {
List<PoiRecord> list_1 = ((ServerLevel) level()).getPoiManager().getInRange( List<PoiRecord> list_1 = ((ServerLevel) level()).getPoiManager().getInRange(
type -> type.is(PoiTypes.HOME), type -> type.is(PoiTypes.HOME),
@@ -857,12 +857,12 @@ public class Auxiliary
plopData.put(StringValue.of("scarpet_custom"), plopData.put(StringValue.of("scarpet_custom"),
ListValue.wrap(FeatureGenerator.featureMap.keySet().stream().sorted().map(StringValue::of)) ListValue.wrap(FeatureGenerator.featureMap.keySet().stream().sorted().map(StringValue::of))
); );
plopData.put(StringValue.of("feature_types"),
ListValue.wrap(cc.registry(Registries.FEATURE_TYPE).keySet().stream().sorted().map(ValueConversions::of))
);
plopData.put(StringValue.of("features"), plopData.put(StringValue.of("features"),
ListValue.wrap(cc.registry(Registries.FEATURE).keySet().stream().sorted().map(ValueConversions::of)) ListValue.wrap(cc.registry(Registries.FEATURE).keySet().stream().sorted().map(ValueConversions::of))
); );
plopData.put(StringValue.of("configured_features"),
ListValue.wrap(cc.registry(Registries.CONFIGURED_FEATURE).keySet().stream().sorted().map(ValueConversions::of))
);
plopData.put(StringValue.of("structure_types"), plopData.put(StringValue.of("structure_types"),
ListValue.wrap(cc.registry(Registries.STRUCTURE_TYPE).keySet().stream().sorted().map(ValueConversions::of)) ListValue.wrap(cc.registry(Registries.STRUCTURE_TYPE).keySet().stream().sorted().map(ValueConversions::of))
); );
@@ -1799,8 +1799,7 @@ public class WorldAccess
}; };
RandomState randomState = RandomState.create( RandomState randomState = RandomState.create(
noiseBasedChunkGenerator.generatorSettings().value(), level.registryAccess().lookupOrThrow(Registries.NOISE), level.getSeed(), noiseBasedChunkGenerator.generatorSettings().value()
level.registryAccess().lookupOrThrow(Registries.NOISE), level.getSeed()
); );
DensityFunction.Visitor visitor = Vanilla.RandomState_getVisitor(randomState); DensityFunction.Visitor visitor = Vanilla.RandomState_getVisitor(randomState);
@@ -19,7 +19,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.attribute.EnvironmentAttribute; import net.minecraft.world.attribute.EnvironmentAttribute;
import net.minecraft.world.attribute.EnvironmentAttributes; import net.minecraft.world.attribute.EnvironmentAttributes;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.Feature;
public class BiomeInfo public class BiomeInfo
{ {
@@ -36,7 +36,7 @@ public class BiomeInfo
put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall())); put("humidity", (w, b) -> NumericValue.of(Vanilla.Biome_getClimateSettings(b).downfall()));
put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT))); put("precipitation", (w, b) -> StringValue.of(b.getPrecipitationAt(new BlockPos(0, w.getSeaLevel(), 0), w.getSeaLevel()).name().toLowerCase(Locale.ROOT)));
put("features", (w, b) -> { put("features", (w, b) -> {
Registry<ConfiguredFeature<?, ?>> registry = w.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE); Registry<Feature> registry = w.registryAccess().lookupOrThrow(Registries.FEATURE);
return ListValue.wrap( return ListValue.wrap(
b.getGenerationSettings().features().stream().map(step -> b.getGenerationSettings().features().stream().map(step ->
ListValue.wrap(step.stream().map(cfp -> ListValue.wrap(step.stream().map(cfp ->
@@ -38,11 +38,12 @@ import net.minecraft.world.level.chunk.ChunkGeneratorStructureState;
import net.minecraft.world.level.levelgen.GenerationStep; import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.RandomState; import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.levelgen.feature.CoralClawFeature;
import net.minecraft.world.level.levelgen.feature.CoralMushroomFeature;
import net.minecraft.world.level.levelgen.feature.CoralTreeFeature;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.CompositeFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.SimpleRandomSelectorFeature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.TreeFeature;
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize; import net.minecraft.world.level.levelgen.feature.featuresize.TwoLayersFeatureSize;
import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.BlobFoliagePlacer;
import net.minecraft.world.level.levelgen.feature.foliageplacers.FancyFoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.FancyFoliagePlacer;
@@ -66,7 +67,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProc
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import static net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration.CAN_PLACE_BELOW_TREE_TRUNKS; import static net.minecraft.world.level.levelgen.feature.TreeFeature.CAN_PLACE_BELOW_TREE_TRUNKS;
public class FeatureGenerator public class FeatureGenerator
{ {
@@ -85,7 +86,7 @@ public class FeatureGenerator
return plopAnywhere(structure, world, pos, world.getChunkSource().getGenerator(), false); return plopAnywhere(structure, world, pos, world.getChunkSource().getGenerator(), false);
} }
ConfiguredFeature<?, ?> configuredFeature = world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).getValue(id); Feature configuredFeature = world.registryAccess().lookupOrThrow(Registries.FEATURE).getValue(id);
if (configuredFeature != null) if (configuredFeature != null)
{ {
ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(world); ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(world);
@@ -108,10 +109,10 @@ public class FeatureGenerator
return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false); return plopAnywhere(configuredStandard, world, pos, world.getChunkSource().getGenerator(), false);
} }
} }
Feature<?> feature = world.registryAccess().lookupOrThrow(Registries.FEATURE).getValue(id); Feature feature = world.registryAccess().lookupOrThrow(Registries.FEATURE).getValue(id);
if (feature != null) if (feature != null)
{ {
ConfiguredFeature<?, ?> configuredStandard = getDefaultFeature(feature, world, pos, true); Feature configuredStandard = getDefaultFeature(feature, world, pos, true);
if (configuredStandard != null) if (configuredStandard != null)
{ {
ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(world); ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(world);
@@ -157,7 +158,7 @@ public class FeatureGenerator
Boolean plop(ServerLevel world, BlockPos pos); Boolean plop(ServerLevel world, BlockPos pos);
} }
private static Thing simplePlop(ConfiguredFeature<?, ?> feature) private static Thing simplePlop(Feature feature)
{ {
return (w, p) -> { return (w, p) -> {
ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(w); ThreadLocal<Boolean> checks = Vanilla.skipGenerationChecks(w);
@@ -173,15 +174,10 @@ public class FeatureGenerator
}; };
} }
private static <FC extends FeatureConfiguration, F extends Feature<FC>> Thing simplePlop(F feature, FC config) private static Thing simpleTree(TreeFeature.Builder config)
{
return simplePlop(new ConfiguredFeature<>(feature, config));
}
private static Thing simpleTree(TreeConfiguration config)
{ {
//config.ignoreFluidCheck(); //config.ignoreFluidCheck();
return simplePlop(new ConfiguredFeature<>(Feature.TREE, config)); return simplePlop(config.build());
} }
private static Thing spawnCustomStructure(Structure structure) private static Thing spawnCustomStructure(Structure structure)
@@ -212,14 +208,14 @@ public class FeatureGenerator
return result; return result;
} }
private static ConfiguredFeature<?, ?> getDefaultFeature(Feature<?> feature, ServerLevel world, BlockPos pos, boolean tryHard) private static @Nullable Feature getDefaultFeature(Feature feature, ServerLevel world, BlockPos pos, boolean tryHard)
{ {
List<HolderSet<PlacedFeature>> configuredStepFeatures = world.getBiome(pos).value().getGenerationSettings().features(); List<HolderSet<PlacedFeature>> configuredStepFeatures = world.getBiome(pos).value().getGenerationSettings().features();
for (HolderSet<PlacedFeature> step : configuredStepFeatures) for (HolderSet<PlacedFeature> step : configuredStepFeatures)
{ {
for (Holder<PlacedFeature> provider : step) for (Holder<PlacedFeature> provider : step)
{ {
if (provider.value().feature().value().feature() == feature) if (provider.value().feature().value() == feature)
{ {
return provider.value().feature().value(); return provider.value().feature().value();
} }
@@ -229,13 +225,13 @@ public class FeatureGenerator
{ {
return null; return null;
} }
return world.registryAccess().lookupOrThrow(Registries.CONFIGURED_FEATURE).entrySet().stream(). return world.registryAccess().lookupOrThrow(Registries.FEATURE).entrySet().stream().
filter(cS -> cS.getValue().feature() == feature). filter(cS -> cS.getValue() == feature).
findFirst().map(Map.Entry::getValue).orElse(null); findFirst().map(Map.Entry::getValue).orElse(null);
} }
public static <T extends FeatureConfiguration> StructureStart shouldStructureStartAt(ServerLevel world, BlockPos pos, Structure structure, boolean computeBox) public static StructureStart shouldStructureStartAt(ServerLevel world, BlockPos pos, Structure structure, boolean computeBox)
{ {
ServerChunkCache chunkSource = world.getChunkSource(); ServerChunkCache chunkSource = world.getChunkSource();
RandomState seed = chunkSource.randomState(); RandomState seed = chunkSource.randomState();
@@ -277,28 +273,30 @@ public class FeatureGenerator
private static RuleBasedStateProvider belowTrees = RuleBasedStateProvider.ifTrueThenProvide(CAN_PLACE_BELOW_TREE_TRUNKS, Blocks.DIRT); private static RuleBasedStateProvider belowTrees = RuleBasedStateProvider.ifTrueThenProvide(CAN_PLACE_BELOW_TREE_TRUNKS, Blocks.DIRT);
private static TreeConfiguration.TreeConfigurationBuilder createTree(Block block, Block block2, int i, int j, int k, int l) private static TreeFeature.Builder createTree(Block block, Block block2, int i, int j, int k, int l)
{ {
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), belowTrees); return new TreeFeature.Builder(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), belowTrees);
} }
public static final Map<String, Function<ServerLevel, Thing>> featureMap = new HashMap<>() public static final Map<String, Function<ServerLevel, Thing>> featureMap = new HashMap<>()
{{ {{
// TODO remove this using what place feature is using // TODO remove this using what place feature is using
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("oak_bees", l -> simpleTree(createTree(Blocks.OAK_LOG, Blocks.OAK_LEAVES, 4, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F)))));
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)), belowTrees)).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F))).build())); put("fancy_oak_bees", l -> simpleTree(new TreeFeature.Builder(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)), belowTrees).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F)))));
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("birch_bees", l -> simpleTree(createTree(Blocks.BIRCH_LOG, Blocks.BIRCH_LEAVES, 5, 2, 0, 2).ignoreVines().decorators(List.of(new BeehiveDecorator(1.00F)))));
put("coral_tree", l -> simplePlop(Feature.CORAL_TREE, FeatureConfiguration.NONE)); put("coral_tree", l -> simplePlop(new CoralTreeFeature()));
put("coral_claw", l -> simplePlop(Feature.CORAL_CLAW, FeatureConfiguration.NONE)); put("coral_claw", l -> simplePlop(new CoralClawFeature()));
put("coral_mushroom", l -> simplePlop(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE)); put("coral_mushroom", l -> simplePlop(new CoralMushroomFeature()));
put("coral", l -> simplePlop(Feature.SIMPLE_RANDOM_SELECTOR, new CompositeFeatureConfiguration(HolderSet.direct( put("coral", l -> simplePlop(new SimpleRandomSelectorFeature(
PlacementUtils.inlinePlaced(Feature.CORAL_TREE, FeatureConfiguration.NONE), HolderSet.direct(
PlacementUtils.inlinePlaced(Feature.CORAL_CLAW, FeatureConfiguration.NONE), PlacementUtils.inlinePlaced(new CoralTreeFeature()),
PlacementUtils.inlinePlaced(Feature.CORAL_MUSHROOM, FeatureConfiguration.NONE) PlacementUtils.inlinePlaced(new CoralClawFeature()),
)))); PlacementUtils.inlinePlaced(new CoralMushroomFeature())
)
)));
put("bastion_remnant_units", l -> { put("bastion_remnant_units", l -> {
RegistryAccess regs = l.registryAccess(); RegistryAccess regs = l.registryAccess();
@@ -943,7 +943,7 @@ public class EntityValue extends Value
private static void updateVelocity(Entity e, double scale) private static void updateVelocity(Entity e, double scale)
{ {
e.hurtMarked = true; e.syncVelocity = true;
if (Math.abs(scale) > 10000) if (Math.abs(scale) > 10000)
{ {
CarpetScriptServer.LOG.warn("Moved entity " + e.getScoreboardName() + " " + e.getName() + " at " + e.position() + " extremely fast: " + e.getDeltaMovement()); CarpetScriptServer.LOG.warn("Moved entity " + e.getScoreboardName() + " " + e.getName() + " at " + e.position() + " extremely fast: " + e.getDeltaMovement());
@@ -532,7 +532,7 @@ public class ValueConversions
} }
if (o instanceof final Vec3i vec3i) if (o instanceof final Vec3i vec3i)
{ {
return of(new BlockPos(vec3i)); return of(new BlockPos(vec3i.getX(), vec3i.getY(), vec3i.getZ()));
} }
if (o instanceof final AABB aabb) if (o instanceof final AABB aabb)
{ {
-2
View File
@@ -67,7 +67,6 @@
"Level_getOtherEntitiesLimited", "Level_getOtherEntitiesLimited",
"CoralPlantBlock_renewableCoralMixin", "CoralPlantBlock_renewableCoralMixin",
"CoralFanBlock_renewableCoralMixin", "CoralFanBlock_renewableCoralMixin",
"CoralFeature_renewableCoralMixin",
"BuddingAmethystBlock_movableAmethystMixin", "BuddingAmethystBlock_movableAmethystMixin",
"LiquidBlock_renewableBlackstoneMixin", "LiquidBlock_renewableBlackstoneMixin",
"LiquidBlock_renewableDeepslateMixin", "LiquidBlock_renewableDeepslateMixin",
@@ -75,7 +74,6 @@
"Level_scarpetPlopMixin", "Level_scarpetPlopMixin",
"WorldGenRegion_scarpetPlopMixin", "WorldGenRegion_scarpetPlopMixin",
"StructurePiece_scarpetPlopMixin", "StructurePiece_scarpetPlopMixin",
"PieceGeneratorSupplier_plopMixin",
"ServerGamePacketListenerImpl_scarpetEventsMixin", "ServerGamePacketListenerImpl_scarpetEventsMixin",
"ServerPlayerGameMode_scarpetEventsMixin", "ServerPlayerGameMode_scarpetEventsMixin",
"Player_parrotMixin", "Player_parrotMixin",