Various smaller updates

This commit is contained in:
Frank Bauer 2021-06-24 17:11:48 +02:00
parent fdd61262c5
commit 10a9a81725
64 changed files with 372 additions and 276 deletions

View file

@ -1,31 +1,33 @@
package ru.betterend.mixin.common;
import java.util.Random;
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;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ChorusFlowerBlock;
import net.minecraft.world.level.block.PipeBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkGenerator;
import net.minecraft.world.level.levelgen.feature.ChorusPlantFeature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
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;
import ru.bclib.util.BlocksHelper;
import ru.bclib.util.MHelper;
import ru.betterend.blocks.VanillaBlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.world.generator.GeneratorOptions;
import java.util.Random;
@Mixin(ChorusPlantFeature.class)
public class ChorusPlantFeatureMixin {
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
private void be_place(WorldGenLevel structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, NoneFeatureConfiguration defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
private void be_place(FeaturePlaceContext<NoneFeatureConfiguration> featureConfig, CallbackInfoReturnable<Boolean> info) {
final Random random = featureConfig.random();
final BlockPos blockPos = featureConfig.origin();
final WorldGenLevel structureWorldAccess = featureConfig.level();
if (structureWorldAccess.isEmptyBlock(blockPos) && structureWorldAccess.getBlockState(blockPos.below()).is(EndBlocks.CHORUS_NYLIUM)) {
ChorusFlowerBlock.generatePlant(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
BlockState bottom = structureWorldAccess.getBlockState(blockPos);