
com.yungnickyoung.minecraft.yungsapi.mixin.NoDeltasInStructuresMixin 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.server.level.WorldGenRegion;
import net.minecraft.world.level.levelgen.feature.DeltaFeature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.DeltaFeatureConfiguration;
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(DeltaFeature.class)
public class NoDeltasInStructuresMixin {
@Inject(
method = "place(Lnet/minecraft/world/level/levelgen/feature/FeaturePlaceContext;)Z",
at = @At(value = "HEAD"),
cancellable = true
)
private void yungsapi_noDeltasInStructures(FeaturePlaceContext context, CallbackInfoReturnable cir) {
if (!(context.level() instanceof WorldGenRegion worldGenRegion)) return;
if (MixinUtils.isPositionInTaggedStructure(worldGenRegion, context.origin(), TagModule.NO_DELTA)) {
cir.setReturnValue(false);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy