Fixes
This commit is contained in:
parent
885e894633
commit
a81413caed
2 changed files with 16 additions and 7 deletions
|
@ -44,11 +44,13 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
||||||
private void beConnectionProperties(BlockView world, BlockPos pos, CallbackInfoReturnable<BlockState> info) {
|
private void beConnectionProperties(BlockView world, BlockPos pos, CallbackInfoReturnable<BlockState> info) {
|
||||||
BlockState plant = info.getReturnValue();
|
BlockState plant = info.getReturnValue();
|
||||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
||||||
if (!plant.get(Properties.DOWN) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||||
info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true));
|
info.setReturnValue(plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true));
|
||||||
|
info.cancel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
info.setReturnValue(plant.with(BlocksHelper.ROOTS, false));
|
info.setReturnValue(plant.with(BlocksHelper.ROOTS, false));
|
||||||
|
info.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,9 +70,11 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
||||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
||||||
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
if (world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||||
plant = plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true);
|
plant = plant.with(Properties.DOWN, true).with(BlocksHelper.ROOTS, true);
|
||||||
|
info.cancel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
plant = plant.with(BlocksHelper.ROOTS, false);
|
plant = plant.with(BlocksHelper.ROOTS, false);
|
||||||
|
info.cancel();
|
||||||
}
|
}
|
||||||
info.setReturnValue(plant);
|
info.setReturnValue(plant);
|
||||||
info.cancel();
|
info.cancel();
|
||||||
|
@ -81,12 +85,10 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
||||||
private void beGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> info) {
|
private void beGetPlacementState(ItemPlacementContext ctx, CallbackInfoReturnable<BlockState> info) {
|
||||||
BlockPos pos = ctx.getBlockPos();
|
BlockPos pos = ctx.getBlockPos();
|
||||||
World world = ctx.getWorld();
|
World world = ctx.getWorld();
|
||||||
if (ctx.canPlace() && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
BlockState plant = info.getReturnValue();
|
||||||
BlockState plant = info.getReturnValue();
|
if (ctx.canPlace() && plant.isOf(Blocks.CHORUS_PLANT) && world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND)) {
|
||||||
if (plant.isOf(Blocks.CHORUS_PLANT)) {
|
info.setReturnValue(plant.with(BlocksHelper.ROOTS, true).with(Properties.DOWN, true));
|
||||||
info.setReturnValue(plant.with(BlocksHelper.ROOTS, true).with(Properties.DOWN, true));
|
info.cancel();
|
||||||
info.cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.block.ChorusFlowerBlock;
|
import net.minecraft.block.ChorusFlowerBlock;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.StructureWorldAccess;
|
import net.minecraft.world.StructureWorldAccess;
|
||||||
|
@ -14,6 +16,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||||
import net.minecraft.world.gen.feature.ChorusPlantFeature;
|
import net.minecraft.world.gen.feature.ChorusPlantFeature;
|
||||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||||
import ru.betterend.registry.BlockRegistry;
|
import ru.betterend.registry.BlockRegistry;
|
||||||
|
import ru.betterend.util.BlocksHelper;
|
||||||
import ru.betterend.util.MHelper;
|
import ru.betterend.util.MHelper;
|
||||||
|
|
||||||
@Mixin(ChorusPlantFeature.class)
|
@Mixin(ChorusPlantFeature.class)
|
||||||
|
@ -22,6 +25,10 @@ public class ChorusPlantFeatureMixin {
|
||||||
private void onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
private void onGenerate(StructureWorldAccess structureWorldAccess, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, DefaultFeatureConfig defaultFeatureConfig, CallbackInfoReturnable<Boolean> info) {
|
||||||
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
if (structureWorldAccess.isAir(blockPos) && structureWorldAccess.getBlockState(blockPos.down()).isOf(BlockRegistry.CHORUS_NYLIUM)) {
|
||||||
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
ChorusFlowerBlock.generate(structureWorldAccess, blockPos, random, MHelper.randRange(8, 16, random));
|
||||||
|
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
|
||||||
|
if (bottom.isOf(Blocks.CHORUS_PLANT)) {
|
||||||
|
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.with(BlocksHelper.ROOTS, true));
|
||||||
|
}
|
||||||
info.setReturnValue(true);
|
info.setReturnValue(true);
|
||||||
info.cancel();
|
info.cancel();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue