Minor improvements

This commit is contained in:
Frank 2023-06-07 01:48:50 +02:00
parent eee0a8b9c8
commit bbdae36ac6
3 changed files with 17 additions and 4 deletions

View file

@ -30,7 +30,7 @@ public class BCLJigsawStructureBuilder extends BCLBaseStructureBuilder<JigsawStr
this.maxDepth = 6;
this.startHeight = ConstantHeight.of(VerticalAnchor.absolute(0));
this.maxDistanceFromCenter = 80;
this.useExpansionHack = true;
this.useExpansionHack = false;
this.startJigsawName = Optional.empty();
this.projectStartToHeightmap = Optional.empty();
}
@ -95,7 +95,7 @@ public class BCLJigsawStructureBuilder extends BCLBaseStructureBuilder<JigsawStr
maxDistanceFromCenter
);
};
return super.build();
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.structure.pools.LegacySinglePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList;
@ -22,4 +23,11 @@ public class StructurePools {
) {
return (projection) -> new SinglePoolElement(Either.left(id), holder, projection);
}
public static Function<StructureTemplatePool.Projection, SinglePoolElement> legacy(
ResourceLocation id,
Holder<StructureProcessorList> holder
) {
return (projection) -> new LegacySinglePoolElement(Either.left(id), holder, projection);
}
}

View file

@ -148,7 +148,7 @@ class PlaceCommandBuilder {
.then(pos.get().executes(cc -> placeJigsaw(cc, false, false, true)))
)
.then(rotate.get()
.then(pos.get().executes(cc -> placeJigsaw(cc, true, true, false))))
.then(pos.get().executes(cc -> placeJigsaw(cc, false, true, false))))
.then(
pos.get().executes(cc -> placeJigsaw(cc, false, false, false))
)
@ -259,6 +259,7 @@ class PlaceCommandBuilder {
blockInput,
controlBlocks,
replaceAir,
true,
s.location,
(p) -> s.getBoundingBox(p, Rotation.NONE, Mirror.NONE),
(level, p) -> s.generateAt(level, p, Rotation.NONE, Mirror.NONE)
@ -293,6 +294,7 @@ class PlaceCommandBuilder {
blockInput,
controlBlocks,
replaceAir,
true,
structureNBT.location,
(p) -> structureNBT.getBoundingBox(p, Rotation.NONE, Mirror.NONE),
(level, p) -> structureNBT.generateAt(level, p, Rotation.NONE, Mirror.NONE)
@ -319,7 +321,7 @@ class PlaceCommandBuilder {
blockInput,
controlBlocks,
replaceAir,
id,
false, id,
(p) -> BoundingBox.fromCorners(p, p.offset(span)),
(level, p) -> {
var box = BoundingBox.fromCorners(p, p.offset(span));
@ -544,6 +546,7 @@ public class PlaceCommand {
BlockInput blockInput,
boolean structureBlock,
boolean replaceAir,
boolean preFillStructureVoid,
ResourceLocation location,
Function<BlockPos, BoundingBox> getBounds,
BiConsumer<ServerLevel, BlockPos> generate
@ -583,6 +586,8 @@ public class PlaceCommand {
bb = adapt(bbNBT, false, structureBlock);
}
if (preFillStructureVoid)
replaceAir(stack.getLevel(), bb);
generate.accept(stack.getLevel(), pos);
if (replaceAir) {
replaceAir(stack.getLevel(), bbNBT);