
com.yungnickyoung.minecraft.yungsapi.mixin.NoVinesInStructuresMixin Maven / Gradle / Ivy
package com.yungnickyoung.minecraft.yungsapi.mixin;
import com.yungnickyoung.minecraft.yungsapi.module.TagModule;
import com.yungnickyoung.minecraft.yungsapi.util.MixinUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.WorldGenRegion;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.VinesFeature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(VinesFeature.class)
public class NoVinesInStructuresMixin {
@Inject(method = "place", at = @At(value = "HEAD"), cancellable = true)
private void yungsapi_noVinesInStructures(FeaturePlaceContext context, CallbackInfoReturnable cir) {
if (!(context.level() instanceof WorldGenRegion worldGenRegion)) return;
BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos();
for (Direction direction : Direction.Plane.HORIZONTAL) {
mutable.set(context.origin()).move(direction);
if (MixinUtils.isPositionInTaggedStructure(worldGenRegion, mutable, TagModule.NO_VINES)) {
cir.setReturnValue(false);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy