Fixed 'place'-Methods
This commit is contained in:
parent
4bf09362be
commit
a82f30b95d
17 changed files with 103 additions and 52 deletions
|
@ -2,6 +2,8 @@ package ru.betterend.mixin.common;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -34,7 +36,7 @@ import ru.betterend.world.generator.GeneratorOptions;
|
|||
@Mixin(SpikeFeature.class)
|
||||
public class SpikeFeatureMixin {
|
||||
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
|
||||
private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SpikeConfiguration endSpikeFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||
private void be_place(FeaturePlaceContext<SpikeConfiguration> featurePlaceContext, CallbackInfoReturnable<Boolean> info) {
|
||||
if (!GeneratorOptions.hasPillars()) {
|
||||
info.setReturnValue(false);
|
||||
}
|
||||
|
@ -70,7 +72,7 @@ public class SpikeFeatureMixin {
|
|||
radius--;
|
||||
StructureTemplate base = StructureHelper.readStructure(BetterEnd.makeID("pillars/pillar_base_" + radius));
|
||||
StructureTemplate top = StructureHelper.readStructure(BetterEnd.makeID("pillars/pillar_top_" + radius + (spike.isGuarded() ? "_cage" : "")));
|
||||
BlockPos side = base.getSize();
|
||||
Vec3i side = base.getSize();
|
||||
BlockPos pos1 = new BlockPos(x - (side.getX() >> 1), minY - 3, z - (side.getZ() >> 1));
|
||||
minY = pos1.getY() + side.getY();
|
||||
side = top.getSize();
|
||||
|
@ -78,8 +80,8 @@ public class SpikeFeatureMixin {
|
|||
maxY = pos2.getY();
|
||||
|
||||
StructurePlaceSettings data = new StructurePlaceSettings();
|
||||
base.placeInWorldChunk(world, pos1, data, random);
|
||||
top.placeInWorldChunk(world, pos2, data, random);
|
||||
base.placeInWorld(world, pos1, pos1, data, random, 2);
|
||||
top.placeInWorld(world, pos2, pos2, data, random, 2);
|
||||
|
||||
int r2 = radius * radius + 1;
|
||||
MutableBlockPos mut = new MutableBlockPos();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue