Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5cf843bde7
6 changed files with 42 additions and 16 deletions
|
@ -17,5 +17,5 @@ archives_base_name = better-end
|
|||
patchouli_version = 50-FABRIC
|
||||
fabric_version = 0.32.9+1.16
|
||||
canvas_version = 1.0.+
|
||||
bclib_version = 0.1.18
|
||||
bclib_version = 0.1.19
|
||||
rei_version = 5.8.10
|
|
@ -20,7 +20,6 @@ public class BlockProperties {
|
|||
public static final BooleanProperty NATURAL = BooleanProperty.create("natural");
|
||||
public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
|
||||
public static final BooleanProperty SMALL = BooleanProperty.create("small");
|
||||
public static final BooleanProperty ROOTS = BooleanProperty.create("roots");
|
||||
|
||||
public static final IntegerProperty DESTRUCTION_LONG = IntegerProperty.create("destruction", 0, 8);
|
||||
public static final IntegerProperty DESTRUCTION = IntegerProperty.create("destruction", 0, 2);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
|
||||
public class VanillaBlockProperties {
|
||||
public static final BooleanProperty ROOTS = BooleanProperty.create("roots");
|
||||
}
|
|
@ -28,7 +28,7 @@ import net.minecraft.world.phys.shapes.CollisionContext;
|
|||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.VanillaBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
|
@ -62,7 +62,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
if (i < 5) {
|
||||
this.placeGrownFlower(world, up, i + 1);
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true).setValue(BlockProperties.ROOTS, true));
|
||||
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true).setValue(VanillaBlockProperties.ROOTS, true));
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, plant.defaultBlockState().setValue(ChorusPlantBlock.UP, true).setValue(ChorusPlantBlock.DOWN, true));
|
||||
|
@ -77,7 +77,7 @@ public abstract class ChorusFlowerBlockMixin extends Block {
|
|||
private static void be_generatePlant(LevelAccessor world, BlockPos pos, Random random, int size, CallbackInfo info) {
|
||||
BlockState state = world.getBlockState(pos);
|
||||
if (GeneratorOptions.changeChorusPlant() && state.is(Blocks.CHORUS_PLANT)) {
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(BlockProperties.ROOTS, true));
|
||||
BlocksHelper.setWithoutUpdate(world, pos, state.setValue(VanillaBlockProperties.ROOTS, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,29 @@
|
|||
package ru.betterend.mixin.common;
|
||||
|
||||
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.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.ChorusPlantBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import ru.bclib.api.TagAPI;
|
||||
import ru.betterend.blocks.VanillaBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
@Mixin(value = ChorusPlantBlock.class, priority = 100)
|
||||
public abstract class ChorusPlantBlockMixin extends Block {
|
||||
|
@ -11,10 +31,10 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
super(settings);
|
||||
}
|
||||
|
||||
/*@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
@Inject(method = "<init>*", at = @At("TAIL"))
|
||||
private void beOnInit(BlockBehaviour.Properties settings, CallbackInfo info) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(BlockProperties.ROOTS, false));
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(VanillaBlockProperties.ROOTS, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +42,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
private void be_createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder, CallbackInfo info) {
|
||||
GeneratorOptions.init();
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
builder.add(BlockProperties.ROOTS);
|
||||
builder.add(VanillaBlockProperties.ROOTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +53,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
BlockState plant = info.getReturnValue();
|
||||
if (ctx.canPlace() && plant.is(Blocks.CHORUS_PLANT) && world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
info.setReturnValue(plant.setValue(BlockProperties.ROOTS, true).setValue(BlockStateProperties.DOWN, true));
|
||||
info.setReturnValue(plant.setValue(VanillaBlockProperties.ROOTS, true).setValue(BlockStateProperties.DOWN, true));
|
||||
}
|
||||
else {
|
||||
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true));
|
||||
|
@ -51,7 +71,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
if (plant.is(Blocks.CHORUS_PLANT)) {
|
||||
if (blockGetter.getBlockState(blockPos.below()).is(TagAPI.END_GROUND)) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true).setValue(BlockProperties.ROOTS, true));
|
||||
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true).setValue(VanillaBlockProperties.ROOTS, true));
|
||||
}
|
||||
else {
|
||||
info.setReturnValue(plant.setValue(BlockStateProperties.DOWN, true));
|
||||
|
@ -60,7 +80,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
}
|
||||
else {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
info.setReturnValue(plant.setValue(BlockProperties.ROOTS, false));
|
||||
info.setReturnValue(plant.setValue(VanillaBlockProperties.ROOTS, false));
|
||||
}
|
||||
info.cancel();
|
||||
}
|
||||
|
@ -82,7 +102,7 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
if (plant.is(Blocks.CHORUS_PLANT)) {
|
||||
if (world.getBlockState(pos.below()).is(TagAPI.END_GROUND)) {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
plant = plant.setValue(BlockStateProperties.DOWN, true).setValue(BlockProperties.ROOTS, true);
|
||||
plant = plant.setValue(BlockStateProperties.DOWN, true).setValue(VanillaBlockProperties.ROOTS, true);
|
||||
}
|
||||
else {
|
||||
plant = plant.setValue(BlockStateProperties.DOWN, true);
|
||||
|
@ -91,12 +111,12 @@ public abstract class ChorusPlantBlockMixin extends Block {
|
|||
}
|
||||
else {
|
||||
if (GeneratorOptions.changeChorusPlant()) {
|
||||
plant = plant.setValue(BlockProperties.ROOTS, false);
|
||||
plant = plant.setValue(VanillaBlockProperties.ROOTS, false);
|
||||
}
|
||||
info.cancel();
|
||||
}
|
||||
info.setReturnValue(plant);
|
||||
info.cancel();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import net.minecraft.world.level.levelgen.feature.ChorusPlantFeature;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import ru.bclib.util.BlocksHelper;
|
||||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.VanillaBlockProperties;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.world.generator.GeneratorOptions;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class ChorusPlantFeatureMixin {
|
|||
BlockState bottom = structureWorldAccess.getBlockState(blockPos);
|
||||
if (bottom.is(Blocks.CHORUS_PLANT)) {
|
||||
if ((GeneratorOptions.changeChorusPlant())) {
|
||||
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(BlockProperties.ROOTS, true).setValue(PipeBlock.DOWN, true));
|
||||
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(VanillaBlockProperties.ROOTS, true).setValue(PipeBlock.DOWN, true));
|
||||
}
|
||||
else {
|
||||
BlocksHelper.setWithoutUpdate(structureWorldAccess, blockPos, bottom.setValue(PipeBlock.DOWN, true));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue