Made plant creation consistent with BehaviourBuilders

This commit is contained in:
Frank 2023-06-13 17:01:36 +02:00
parent c340d575c5
commit f259496ba0
56 changed files with 363 additions and 396 deletions

View file

@ -45,7 +45,7 @@ public class BetterEnd implements ModInitializer {
EndBiomes.register(); EndBiomes.register();
EndTags.register(); EndTags.register();
EndBlocks.ensureStaticallyLoaded(); EndBlocks.ensureStaticallyLoaded();
EndItems.ensureStaticallyLoaded(); EndItems.register();
EndTemplates.ensureStaticallyLoaded(); EndTemplates.ensureStaticallyLoaded();
EndEnchantments.register(); EndEnchantments.register();
EndPotions.register(); EndPotions.register();

View file

@ -1,22 +1,24 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.blocks.basis.FurBlock; import org.betterx.betterend.blocks.basis.FurBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrMycelium;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor;
public class BlueVineSeedBlock extends EndPlantWithAgeBlock { public class BlueVineSeedBlock extends EndPlantWithAgeBlock implements SurvivesOnMossOrMycelium, BehaviourSeed {
public BlueVineSeedBlock() { public BlueVineSeedBlock() {
super(BehaviourBuilders.createPlant()); super(BehaviourBuilders.createSeed(MapColor.COLOR_BLUE).ignitedByLava());
} }
@Override @Override
@ -73,9 +75,4 @@ public class BlueVineSeedBlock extends EndPlantWithAgeBlock {
); );
} }
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM);
}
} }

View file

@ -1,8 +1,9 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnRutiscus;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
@ -11,8 +12,8 @@ import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
@ -21,17 +22,17 @@ import com.google.common.collect.Lists;
import java.util.List; import java.util.List;
public class BoluxMushroomBlock extends EndPlantBlock { public class BoluxMushroomBlock extends EndPlantBlock implements SurvivesOnRutiscus, BehaviourPlant {
private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 9, 15); private static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 9, 15);
public BoluxMushroomBlock() { public BoluxMushroomBlock() {
super(BehaviourBuilders.createPlant().lightLevel((bs)->10)); super(BehaviourBuilders
.createPlant(MapColor.COLOR_ORANGE)
.ignitedByLava()
.lightLevel((bs) -> 10)
);
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.RUTISCUS);
}
@Override @Override
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {

View file

@ -26,10 +26,8 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements Behavio
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16); private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16);
public BubbleCoralBlock() { public BubbleCoralBlock() {
super(baseUnderwaterPlantSettings( super(BehaviourBuilders
BehaviourBuilders.createWaterPlant(), .createWaterPlant()
0
)
.sound(SoundType.CORAL_BLOCK) .sound(SoundType.CORAL_BLOCK)
.offsetType(BlockBehaviour.OffsetType.NONE) .offsetType(BlockBehaviour.OffsetType.NONE)
); );

View file

@ -1,25 +1,29 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnEndStoneOrTrees;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
public class BulbVineSeedBlock extends EndPlantWithAgeBlock { public class BulbVineSeedBlock extends EndPlantWithAgeBlock implements BehaviourSeed, SurvivesOnEndStoneOrTrees {
public BulbVineSeedBlock() {
super(BehaviourBuilders.createSeed(MapColor.COLOR_PURPLE));
}
@Override @Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState up = world.getBlockState(pos.above()); return canSurviveOnBottom(world, pos);
return up.is(CommonBlockTags.GEN_END_STONES) || up.is(BlockTags.LOGS) || up.is(BlockTags.LEAVES);
} }
@Override @Override

View file

@ -1,8 +1,10 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnEndStone;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -15,20 +17,20 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock { public class CavePumpkinVineBlock extends EndPlantWithAgeBlock implements SurvivesOnEndStone, BehaviourPlant {
public CavePumpkinVineBlock() { public CavePumpkinVineBlock() {
super(BehaviourBuilders.createPlant()); super(BehaviourBuilders.createPlant(MapColor.TERRACOTTA_ORANGE));
} }
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12); private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
@Override @Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState down = world.getBlockState(pos.above()); return canSurviveOnBottom(world, pos);
return isTerrain(down);
} }
@Override @Override

View file

@ -1,5 +1,8 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
import org.betterx.bclib.interfaces.SurvivesOnWater;
import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock; import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -8,10 +11,20 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.Fluids;
public class CharniaBlock extends EndUnderwaterPlantBlock { public class CharniaBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant, SurvivesOnWater {
public CharniaBlock() {
super(
BehaviourBuilders.createWaterPlant()
);
}
@Override @Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return canSupportCenter(world, pos.below(), Direction.UP) && world.getFluidState(pos).getType() == Fluids.WATER; return canSupportCenter(world, pos.below(), Direction.UP) && world.getFluidState(pos).getType() == Fluids.WATER;
} }
@Override
public boolean isTerrain(BlockState state) {
return SurvivesOnWater.super.isTerrain(state);
}
} }

View file

@ -1,17 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnChorusNylium;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor;
public class ChorusGrassBlock extends EndPlantBlock { public class ChorusGrassBlock extends EndPlantBlock implements SurvivesOnChorusNylium, BehaviourPlant {
public ChorusGrassBlock() { public ChorusGrassBlock() {
super(true); super(BehaviourBuilders.createGrass(MapColor.COLOR_PURPLE).replaceable());
}
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.CHORUS_NYLIUM;
} }
} }

View file

@ -29,9 +29,7 @@ public class CrystalMossCoverBlock extends MultifaceBlock implements Bonemealabl
private final MultifaceSpreader spreader = new MultifaceSpreader(this); private final MultifaceSpreader spreader = new MultifaceSpreader(this);
public CrystalMossCoverBlock(MapColor color) { public CrystalMossCoverBlock(MapColor color) {
super(BehaviourBuilders.createReplaceablePlant(color) super(BehaviourBuilders.createPlantCover(color)
.strength(0.2f)
.sound(SoundType.GLOW_LICHEN)
.lightLevel(GlowLichenBlock.emission(7))); .lightLevel(GlowLichenBlock.emission(7)));
this.registerDefaultState(this.defaultBlockState().setValue(WATERLOGGED, false)); this.registerDefaultState(this.defaultBlockState().setValue(WATERLOGGED, false));
} }

View file

@ -1,28 +1,20 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnShadowGrass;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.DragonTreeFeature; import org.betterx.betterend.world.features.trees.DragonTreeFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class DragonTreeSaplingBlock extends PottableFeatureSapling<DragonTreeFeature, NoneFeatureConfiguration> { public class DragonTreeSaplingBlock extends PottableFeatureSapling<DragonTreeFeature, NoneFeatureConfiguration> implements SurvivesOnShadowGrass {
public DragonTreeSaplingBlock() { public DragonTreeSaplingBlock() {
super((state) -> EndFeatures.DRAGON_TREE.configuredFeature); super((state) -> EndFeatures.DRAGON_TREE.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.SHADOW_GRASS);
}
@Override @Override
public boolean canPlantOn(Block block) { public boolean canPlantOn(Block block) {
return block == EndBlocks.SHADOW_GRASS; return isSurvivable(block.defaultBlockState());
} }
} }

View file

@ -1,6 +1,7 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.interfaces.tools.AddMineableShears; import org.betterx.bclib.interfaces.tools.AddMineableShears;
@ -37,16 +38,14 @@ import com.google.common.collect.Lists;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class EndLilyBlock extends EndUnderwaterPlantBlock implements AddMineableShears { public class EndLilyBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant, AddMineableShears {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE; public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 16, 12); private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 16, 12);
private static final VoxelShape SHAPE_TOP = Block.box(2, 0, 2, 14, 6, 14); private static final VoxelShape SHAPE_TOP = Block.box(2, 0, 2, 14, 6, 14);
public EndLilyBlock() { public EndLilyBlock() {
super(baseUnderwaterPlantSettings( super(BehaviourBuilders
BehaviourBuilders.createWaterPlant(), .createWaterPlant()
0
)
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0) .lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
); );
} }

View file

@ -1,5 +1,6 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSeed;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock; import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
@ -12,7 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.Fluids;
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock { public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSeed {
@Override @Override
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) { public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {
if (canGrow(world, pos)) { if (canGrow(world, pos)) {

View file

@ -28,11 +28,11 @@ public class EndLotusFlowerBlock extends EndPlantBlock implements BehaviourPlant
private static final VoxelShape SHAPE_COLLISION = Block.box(0, 0, 0, 16, 2, 16); private static final VoxelShape SHAPE_COLLISION = Block.box(0, 0, 0, 16, 2, 16);
public EndLotusFlowerBlock() { public EndLotusFlowerBlock() {
super(BehaviourBuilders.createPlant(MapColor.COLOR_PINK, true).lightLevel((bs) -> 15)); super(BehaviourBuilders.createPlant(MapColor.COLOR_PINK).lightLevel((bs) -> 15));
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_LOTUS_STEM); return state.is(EndBlocks.END_LOTUS_STEM);
} }

View file

@ -37,7 +37,7 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
private static final VoxelShape VSHAPE = Block.box(0, 0, 0, 16, 1, 16); private static final VoxelShape VSHAPE = Block.box(0, 0, 0, 16, 1, 16);
public EndLotusLeafBlock() { public EndLotusLeafBlock() {
super(BehaviourBuilders.createPlant(MapColor.PLANT, true).noOcclusion().sound(SoundType.WET_GRASS)); super(BehaviourBuilders.createWalkablePlant(MapColor.COLOR_PINK).sound(SoundType.WET_GRASS));
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSeed;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock; import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
@ -14,7 +15,7 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids; import net.minecraft.world.level.material.Fluids;
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock { public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSeed {
@Override @Override
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) { public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {
if (canGrow(world, pos)) { if (canGrow(world, pos)) {

View file

@ -11,6 +11,7 @@ import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
@ -24,7 +25,7 @@ public class FilaluxWingsBlock extends BaseAttachedBlock implements RenderLayerP
public FilaluxWingsBlock() { public FilaluxWingsBlock() {
super(BehaviourBuilders super(BehaviourBuilders
.createPlant() .createPlant(MapColor.COLOR_RED)
.sound(SoundType.WET_GRASS) .sound(SoundType.WET_GRASS)
); );
} }

View file

@ -1,9 +1,9 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant; import org.betterx.bclib.behaviours.interfaces.BehaviourShearablePlant;
import org.betterx.bclib.interfaces.CustomItemProvider; import org.betterx.bclib.interfaces.CustomItemProvider;
import org.betterx.bclib.interfaces.tools.AddMineableShears; import org.betterx.bclib.interfaces.SurvivesOnWater;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -14,10 +14,9 @@ import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PlaceOnWaterBlockItem; import net.minecraft.world.item.PlaceOnWaterBlockItem;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
@ -26,22 +25,16 @@ import com.google.common.collect.Lists;
import java.util.List; import java.util.List;
public class FlamaeaBlock extends EndPlantBlock implements CustomItemProvider, BehaviourPlant, AddMineableShears { public class FlamaeaBlock extends EndPlantBlock implements CustomItemProvider, BehaviourShearablePlant, SurvivesOnWater {
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 1, 16); private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 1, 16);
public FlamaeaBlock() { public FlamaeaBlock() {
super(BehaviourBuilders super(BehaviourBuilders
.createPlant() .createPlant(MapColor.COLOR_ORANGE)
.sound(SoundType.WET_GRASS) .sound(SoundType.WET_GRASS)
.offsetType(BlockBehaviour.OffsetType.NONE)
); );
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(Blocks.WATER);
}
@Override @Override
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE; return SHAPE;

View file

@ -4,7 +4,7 @@ import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant; import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.client.models.ModelsHelper; import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvicesOnPallidium;
import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -19,21 +19,13 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class FlammalixBlock extends EndPlantBlock implements BehaviourPlant { public class FlammalixBlock extends EndPlantBlock implements BehaviourPlant, SurvicesOnPallidium {
private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14); private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14);
public FlammalixBlock() { public FlammalixBlock() {
super(BehaviourBuilders.createPlant(MapColor.COLOR_ORANGE).lightLevel((bs) -> 12)); super(BehaviourBuilders.createPlant(MapColor.COLOR_ORANGE).lightLevel((bs) -> 12));
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.PALLIDIUM_FULL) ||
state.is(EndBlocks.PALLIDIUM_HEAVY) ||
state.is(EndBlocks.PALLIDIUM_THIN) ||
state.is(EndBlocks.PALLIDIUM_TINY);
}
@Override @Override
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) { public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
return SHAPE; return SHAPE;

View file

@ -1,24 +1,26 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrMycelium;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class GlowingMossBlock extends EndPlantBlock { public class GlowingMossBlock extends EndPlantBlock implements SurvivesOnMossOrMycelium, BehaviourPlant {
public GlowingMossBlock(int light) { public GlowingMossBlock(int light) {
super(light); super(BehaviourBuilders
.createGrass(MapColor.COLOR_LIGHT_BLUE)
.lightLevel((bs) -> light)
.ignitedByLava()
);
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.END_MOSS || state.getBlock() == EndBlocks.END_MYCELIUM;
}
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public boolean hasEmissiveLighting(BlockGetter world, BlockPos pos) { public boolean hasEmissiveLighting(BlockGetter world, BlockPos pos) {

View file

@ -1,12 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.bclib.interfaces.tools.AddMineableShears; import org.betterx.bclib.interfaces.tools.AddMineableShears;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -17,16 +19,17 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.material.MapColor;
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock implements AddMineableShears { public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock implements AddMineableShears, SurvivesOnAmberMoss, BehaviourSeed {
public GlowingPillarSeedBlock() { public GlowingPillarSeedBlock() {
super(BehaviourBuilders super(BehaviourBuilders
.createPlant() .createSeed(MapColor.COLOR_ORANGE)
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
.lightLevel(state -> state.getValue(AGE) * 3 + 3) .lightLevel(state -> state.getValue(AGE) * 3 + 3)
.offsetType(OffsetType.XZ)
.randomTicks() .randomTicks()
.noCollission()
); );
} }
@ -73,9 +76,4 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock implements AddM
); );
} }
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.AMBER_MOSS);
}
} }

View file

@ -1,28 +1,21 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.HelixTreeFeature; import org.betterx.betterend.world.features.trees.HelixTreeFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class HelixTreeSaplingBlock extends PottableFeatureSapling<HelixTreeFeature, NoneFeatureConfiguration> { public class HelixTreeSaplingBlock extends PottableFeatureSapling<HelixTreeFeature, NoneFeatureConfiguration> implements SurvivesOnAmberMoss {
public HelixTreeSaplingBlock() { public HelixTreeSaplingBlock() {
super((state) -> EndFeatures.HELIX_TREE.configuredFeature); super((state) -> EndFeatures.HELIX_TREE.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS);
}
@Override @Override
public boolean canPlantOn(Block block) { public boolean canPlantOn(Block block) {
return block == EndBlocks.AMBER_MOSS; return isSurvivable(block.defaultBlockState());
} }
} }

View file

@ -1,6 +1,7 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
import org.betterx.bclib.blocks.UnderwaterPlantBlock; import org.betterx.bclib.blocks.UnderwaterPlantBlock;
import org.betterx.bclib.interfaces.tools.AddMineableShears; import org.betterx.bclib.interfaces.tools.AddMineableShears;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
@ -29,15 +30,14 @@ import com.google.common.collect.Lists;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class HydraluxBlock extends UnderwaterPlantBlock implements AddMineableShears { public class HydraluxBlock extends UnderwaterPlantBlock implements BehaviourWaterPlant, AddMineableShears {
public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE; public static final EnumProperty<HydraluxShape> SHAPE = EndBlockProperties.HYDRALUX_SHAPE;
public HydraluxBlock() { public HydraluxBlock() {
super(baseUnderwaterPlantSettings( super(
BehaviourBuilders.createWaterPlant(), BehaviourBuilders
0 .createWaterPlant()
)
.lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0) .lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0)
); );
} }

View file

@ -14,7 +14,7 @@ public class HydraluxPetalBlock extends BaseBlock.Wood {
public HydraluxPetalBlock() { public HydraluxPetalBlock() {
this( this(
BehaviourBuilders BehaviourBuilders
.createPlant(MapColor.PODZOL) .createWalkablePlant(MapColor.PODZOL)
.strength(1) .strength(1)
.sound(SoundType.WART_BLOCK) .sound(SoundType.WART_BLOCK)
); );

View file

@ -1,5 +1,6 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSapling;
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock; import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
@ -12,7 +13,7 @@ import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock { public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling {
@Override @Override
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) { public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {

View file

@ -1,29 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrDust;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.LacugroveFeature; import org.betterx.betterend.world.features.trees.LacugroveFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class LacugroveSaplingBlock extends PottableFeatureSapling<LacugroveFeature, NoneFeatureConfiguration> { public class LacugroveSaplingBlock extends PottableFeatureSapling<LacugroveFeature, NoneFeatureConfiguration> implements SurvivesOnMossOrDust {
public LacugroveSaplingBlock() { public LacugroveSaplingBlock() {
super((state) -> EndFeatures.LACUGROVE.configuredFeature); super((state) -> EndFeatures.LACUGROVE.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below())
.is(EndBlocks.ENDSTONE_DUST);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.END_MOSS;
}
} }

View file

@ -1,9 +1,12 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.PentaShape; import org.betterx.bclib.blocks.BlockProperties.PentaShape;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -17,18 +20,19 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public class LanceleafBlock extends EndPlantBlock { public class LanceleafBlock extends EndPlantBlock implements SurvivesOnAmberMoss, BehaviourPlant {
public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE; public static final EnumProperty<PentaShape> SHAPE = BlockProperties.PENTA_SHAPE;
public static final IntegerProperty ROTATION = BlockProperties.ROTATION; public static final IntegerProperty ROTATION = BlockProperties.ROTATION;
public LanceleafBlock() { public LanceleafBlock() {
super(); super(BehaviourBuilders.createPlant(MapColor.TERRACOTTA_BROWN).ignitedByLava().offsetType(OffsetType.XZ));
} }
@Override @Override
@ -42,8 +46,7 @@ public class LanceleafBlock extends EndPlantBlock {
if (shape == PentaShape.TOP) { if (shape == PentaShape.TOP) {
return world.getBlockState(pos.below()).is(this); return world.getBlockState(pos.below()).is(this);
} else if (shape == PentaShape.BOTTOM) { } else if (shape == PentaShape.BOTTOM) {
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS) && world.getBlockState(pos.above()) return canSurviveOnTop(world, pos) && world.getBlockState(pos.above()).is(this);
.is(this);
} else { } else {
return world.getBlockState(pos.below()).is(this) && world.getBlockState(pos.above()).is(this); return world.getBlockState(pos.below()).is(this) && world.getBlockState(pos.above()).is(this);
} }

View file

@ -1,11 +1,13 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.PentaShape; import org.betterx.bclib.blocks.BlockProperties.PentaShape;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -14,10 +16,11 @@ import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
public class LanceleafSeedBlock extends EndPlantWithAgeBlock { public class LanceleafSeedBlock extends EndPlantWithAgeBlock implements SurvivesOnAmberMoss, BehaviourSeed {
public LanceleafSeedBlock() { public LanceleafSeedBlock() {
super(BehaviourBuilders.createPlant().offsetType(OffsetType.NONE)); super(BehaviourBuilders.createSeed(MapColor.TERRACOTTA_BROWN));
} }
@Override @Override
@ -54,9 +57,4 @@ public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.TOP) plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.TOP)
); );
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.AMBER_MOSS);
}
} }

View file

@ -5,7 +5,7 @@ import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BlockProperties; import org.betterx.bclib.blocks.BlockProperties;
import org.betterx.bclib.blocks.BlockProperties.TripleShape; import org.betterx.bclib.blocks.BlockProperties.TripleShape;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnEndBone;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
@ -16,18 +16,20 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
public class LargeAmaranitaBlock extends EndPlantBlock implements BehaviourPlant { public class LargeAmaranitaBlock extends EndPlantBlock implements BehaviourPlant, SurvivesOnEndBone {
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE; public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 14, 12); private static final VoxelShape SHAPE_BOTTOM = Block.box(4, 0, 4, 12, 14, 12);
private static final VoxelShape SHAPE_TOP = Shapes.or(Block.box(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM); private static final VoxelShape SHAPE_TOP = Shapes.or(Block.box(1, 3, 1, 15, 16, 15), SHAPE_BOTTOM);
public LargeAmaranitaBlock() { public LargeAmaranitaBlock() {
super(BehaviourBuilders super(BehaviourBuilders
.createPlant() .createWalkablePlant(MapColor.COLOR_RED)
.ignitedByLava()
.lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0) .lightLevel((state) -> (state.getValue(SHAPE) == TripleShape.TOP) ? 15 : 0)
); );
} }
@ -37,11 +39,6 @@ public class LargeAmaranitaBlock extends EndPlantBlock implements BehaviourPlant
return state.getValue(SHAPE) == TripleShape.TOP ? SHAPE_TOP : SHAPE_BOTTOM; return state.getValue(SHAPE) == TripleShape.TOP ? SHAPE_TOP : SHAPE_BOTTOM;
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.SANGNUM) || state.is(EndBlocks.MOSSY_OBSIDIAN) || state.is(EndBlocks.MOSSY_DRAGON_BONE);
}
@Override @Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) { protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
stateManager.add(SHAPE); stateManager.add(SHAPE);

View file

@ -1,28 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnRutiscus;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.LucerniaFeature; import org.betterx.betterend.world.features.trees.LucerniaFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class LucerniaSaplingBlock extends PottableFeatureSapling<LucerniaFeature, NoneFeatureConfiguration> { public class LucerniaSaplingBlock extends PottableFeatureSapling<LucerniaFeature, NoneFeatureConfiguration> implements SurvivesOnRutiscus {
public LucerniaSaplingBlock() { public LucerniaSaplingBlock() {
super((state) -> EndFeatures.LUCERNIA.configuredFeature); super((state) -> EndFeatures.LUCERNIA.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.RUTISCUS);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.RUTISCUS;
}
} }

View file

@ -3,23 +3,23 @@ package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed; import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock; import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnEndMoss;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource; import net.minecraft.util.RandomSource;
import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
import net.minecraft.world.level.material.MapColor;
import java.util.Optional; import java.util.Optional;
public class LumecornSeedBlock extends EndPlantWithAgeBlock implements BehaviourSeed { public class LumecornSeedBlock extends EndPlantWithAgeBlock implements BehaviourSeed, SurvivesOnEndMoss {
public LumecornSeedBlock() { public LumecornSeedBlock() {
super(BehaviourBuilders.createPlant()); super(BehaviourBuilders.createSeed(MapColor.COLOR_LIGHT_BLUE));
} }
@Override @Override
@ -33,9 +33,4 @@ public class LumecornSeedBlock extends EndPlantWithAgeBlock implements Behaviour
null null
)); ));
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS);
}
} }

View file

@ -1,29 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrMycelium;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.MossyGlowshroomFeature; import org.betterx.betterend.world.features.trees.MossyGlowshroomFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling<MossyGlowshroomFeature, NoneFeatureConfiguration> { public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling<MossyGlowshroomFeature, NoneFeatureConfiguration> implements SurvivesOnMossOrMycelium {
public MossyGlowshroomSaplingBlock() { public MossyGlowshroomSaplingBlock() {
super(7, (state) -> EndFeatures.MOSSY_GLOWSHROOM.configuredFeature); super(7, (state) -> EndFeatures.MOSSY_GLOWSHROOM.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.END_MOSS) || world.getBlockState(pos.below())
.is(EndBlocks.END_MYCELIUM);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.END_MOSS || block == EndBlocks.END_MYCELIUM;
}
} }

View file

@ -1,7 +1,8 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnShadowGrass;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
@ -13,12 +14,19 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class MurkweedBlock extends EndPlantBlock { public class MurkweedBlock extends EndPlantBlock implements SurvivesOnShadowGrass {
public MurkweedBlock() {
super(
BehaviourBuilders.createPlant(MapColor.COLOR_BLACK).ignitedByLava()
);
}
@Override @Override
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)
public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) {
@ -37,11 +45,6 @@ public class MurkweedBlock extends EndPlantBlock {
} }
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.SHADOW_GRASS);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {

View file

@ -1,9 +1,10 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.items.tool.BaseShearsItem; import org.betterx.bclib.items.tool.BaseShearsItem;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnShadowGrass;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
@ -15,6 +16,7 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@ -23,7 +25,15 @@ import com.google.common.collect.Lists;
import java.util.List; import java.util.List;
public class NeedlegrassBlock extends EndPlantBlock { public class NeedlegrassBlock extends EndPlantBlock implements SurvivesOnShadowGrass {
public NeedlegrassBlock() {
super(BehaviourBuilders
.createGrass(MapColor.COLOR_BLACK)
.ignitedByLava()
.offsetType(OffsetType.XZ)
);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
@ -45,11 +55,6 @@ public class NeedlegrassBlock extends EndPlantBlock {
} }
} }
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.SHADOW_GRASS);
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) { public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {

View file

@ -389,6 +389,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
} }
} }
static { static {
BIG_SHAPES.put(Axis.X, Block.box(0, 2, 2, 16, 14, 14)); BIG_SHAPES.put(Axis.X, Block.box(0, 2, 2, 16, 14, 14));
BIG_SHAPES.put(Axis.Y, Block.box(2, 0, 2, 14, 16, 14)); BIG_SHAPES.put(Axis.Y, Block.box(2, 0, 2, 14, 16, 14));

View file

@ -1,6 +1,7 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders; import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
import org.betterx.bclib.interfaces.tools.AddMineableShears; import org.betterx.bclib.interfaces.tools.AddMineableShears;
import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock; import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock;
@ -19,15 +20,16 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements AddMineableShears { public class PondAnemoneBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant, AddMineableShears {
private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14); private static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 14, 14);
public PondAnemoneBlock() { public PondAnemoneBlock() {
super(baseUnderwaterPlantSettings( super(
BehaviourBuilders.createWaterPlant(), BehaviourBuilders
13 .createWaterPlant()
).sound(SoundType.CORAL_BLOCK) .sound(SoundType.CORAL_BLOCK)
.offsetType(OffsetType.NONE) .offsetType(OffsetType.NONE)
.lightLevel(state -> 13)
); );
} }

View file

@ -1,28 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnChorusNylium;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.PythadendronTreeFeature; import org.betterx.betterend.world.features.trees.PythadendronTreeFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class PythadendronSaplingBlock extends PottableFeatureSapling<PythadendronTreeFeature, NoneFeatureConfiguration> { public class PythadendronSaplingBlock extends PottableFeatureSapling<PythadendronTreeFeature, NoneFeatureConfiguration> implements SurvivesOnChorusNylium {
public PythadendronSaplingBlock() { public PythadendronSaplingBlock() {
super((state) -> EndFeatures.PYTHADENDRON_TREE.configuredFeature); super((state) -> EndFeatures.PYTHADENDRON_TREE.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.CHORUS_NYLIUM);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.CHORUS_NYLIUM;
}
} }

View file

@ -1,8 +1,10 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnEndBone;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -14,19 +16,22 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import java.util.Optional; import java.util.Optional;
public class SmallAmaranitaBlock extends EndPlantBlock { public class SmallAmaranitaBlock extends EndPlantBlock implements SurvivesOnEndBone, BehaviourPlant {
public SmallAmaranitaBlock() {
super(
BehaviourBuilders.createPlant(MapColor.COLOR_RED).offsetType(OffsetType.XZ)
);
}
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12); private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 10, 12);
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.SANGNUM) || state.is(EndBlocks.MOSSY_OBSIDIAN) || state.is(EndBlocks.MOSSY_DRAGON_BONE);
}
@Override @Override
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {

View file

@ -25,8 +25,10 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.BonemealableBlock; import net.minecraft.world.level.block.BonemealableBlock;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
@ -47,7 +49,9 @@ public class SmallJellyshroomBlock extends BaseAttachedBlock implements RenderLa
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public SmallJellyshroomBlock() { public SmallJellyshroomBlock() {
super(BehaviourBuilders.createPlant().sound(SoundType.NETHER_WART)); super(BehaviourBuilders.createPlant(MapColor.COLOR_LIGHT_BLUE)
.sound(SoundType.NETHER_WART)
.offsetType(BlockBehaviour.OffsetType.XZ));
} }
@Override @Override

View file

@ -1,28 +1,14 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnPinkMoss;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.TenaneaFeature; import org.betterx.betterend.world.features.trees.TenaneaFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class TenaneaSaplingBlock extends PottableFeatureSapling<TenaneaFeature, NoneFeatureConfiguration> { public class TenaneaSaplingBlock extends PottableFeatureSapling<TenaneaFeature, NoneFeatureConfiguration> implements SurvivesOnPinkMoss {
public TenaneaSaplingBlock() { public TenaneaSaplingBlock() {
super((state) -> EndFeatures.TENANEA.configuredFeature); super((state) -> EndFeatures.TENANEA.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.PINK_MOSS);
}
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.PINK_MOSS;
}
} }

View file

@ -1,25 +1,28 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.interfaces.SurvivesOnBlocks;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor;
public class TerrainPlantBlock extends EndPlantBlock { import java.util.List;
private final Block[] ground;
public class TerrainPlantBlock extends EndPlantBlock implements SurvivesOnBlocks, BehaviourPlant {
private final List<Block> ground;
public TerrainPlantBlock(Block... ground) { public TerrainPlantBlock(Block... ground) {
super(true); super(BehaviourBuilders.createPlant(ground.length == 0 ? MapColor.PLANT : ground[0].defaultMapColor())
this.ground = ground; .ignitedByLava()
.offsetType(OffsetType.XZ)
.replaceable());
this.ground = List.of(ground);
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public List<Block> getSurvivableBlocks() {
for (Block block : ground) { return ground;
if (state.is(block)) {
return true;
}
}
return false;
} }
} }

View file

@ -1,8 +1,11 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BaseDoublePlantBlock; import org.betterx.bclib.blocks.BaseDoublePlantBlock;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -11,18 +14,14 @@ import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class TwistedUmbrellaMossBlock extends EndPlantBlock { public class TwistedUmbrellaMossBlock extends EndPlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
public TwistedUmbrellaMossBlock() { public TwistedUmbrellaMossBlock() {
super(11); super(BehaviourBuilders.createPlant(MapColor.COLOR_BLUE).lightLevel((state) -> 12));
}
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -2,6 +2,7 @@ package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant; import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BaseDoublePlantBlock; import org.betterx.bclib.blocks.BaseDoublePlantBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -11,7 +12,7 @@ import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant { public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
public TwistedUmbrellaMossTallBlock() { public TwistedUmbrellaMossTallBlock() {
super(12); super(12);
} }
@ -29,7 +30,7 @@ public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implement
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS); return SurvivesOnJungleMossOrMycelium.super.isTerrain(state);
} }
} }

View file

@ -1,8 +1,11 @@
package org.betterx.betterend.blocks; package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BaseDoublePlantBlock; import org.betterx.bclib.blocks.BaseDoublePlantBlock;
import org.betterx.bclib.util.BlocksHelper; import org.betterx.bclib.util.BlocksHelper;
import org.betterx.betterend.blocks.basis.EndPlantBlock; import org.betterx.betterend.blocks.basis.EndPlantBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -11,18 +14,14 @@ import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
public class UmbrellaMossBlock extends EndPlantBlock { public class UmbrellaMossBlock extends EndPlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
public UmbrellaMossBlock() { public UmbrellaMossBlock() {
super(11); super(BehaviourBuilders.createGrass(MapColor.COLOR_ORANGE).ignitedByLava().lightLevel((state) -> 11));
}
@Override
protected boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
} }
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -2,6 +2,7 @@ package org.betterx.betterend.blocks;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant; import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BaseDoublePlantBlock; import org.betterx.bclib.blocks.BaseDoublePlantBlock;
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -11,7 +12,7 @@ import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant { public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
public UmbrellaMossTallBlock() { public UmbrellaMossTallBlock() {
super(12); super(12);
} }
@ -29,7 +30,7 @@ public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements Behav
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS); return SurvivesOnJungleMossOrMycelium.super.isTerrain(state);
} }
} }

View file

@ -2,33 +2,19 @@ package org.betterx.betterend.blocks;
import org.betterx.bclib.client.render.BCLRenderLayer; import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.betterend.blocks.basis.PottableFeatureSapling; import org.betterx.betterend.blocks.basis.PottableFeatureSapling;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMoss;
import org.betterx.betterend.registry.EndFeatures; import org.betterx.betterend.registry.EndFeatures;
import org.betterx.betterend.world.features.trees.UmbrellaTreeFeature; import org.betterx.betterend.world.features.trees.UmbrellaTreeFeature;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling<UmbrellaTreeFeature, NoneFeatureConfiguration> { public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling<UmbrellaTreeFeature, NoneFeatureConfiguration> implements SurvivesOnJungleMoss {
public UmbrellaTreeSaplingBlock() { public UmbrellaTreeSaplingBlock() {
super((state) -> EndFeatures.UMBRELLA_TREE.configuredFeature); super((state) -> EndFeatures.UMBRELLA_TREE.configuredFeature);
} }
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
return world.getBlockState(pos.below()).is(EndBlocks.JUNGLE_MOSS);
}
@Override @Override
public BCLRenderLayer getRenderLayer() { public BCLRenderLayer getRenderLayer() {
return BCLRenderLayer.TRANSLUCENT; return BCLRenderLayer.TRANSLUCENT;
} }
@Override
public boolean canPlantOn(Block block) {
return block == EndBlocks.JUNGLE_MOSS;
}
} }

View file

@ -1,6 +1,5 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BasePlantBlock; import org.betterx.bclib.blocks.BasePlantBlock;
import org.betterx.betterend.interfaces.PottablePlant; import org.betterx.betterend.interfaces.PottablePlant;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
@ -8,25 +7,13 @@ import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class EndPlantBlock extends BasePlantBlock implements PottablePlant, BehaviourPlant { public abstract class EndPlantBlock extends BasePlantBlock implements PottablePlant {
protected EndPlantBlock() {
super();
}
protected EndPlantBlock(boolean replaceable) {
super(replaceable);
}
protected EndPlantBlock(int light) {
super(light);
}
protected EndPlantBlock(Properties props) { protected EndPlantBlock(Properties props) {
super(props); super(props);
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(CommonBlockTags.END_STONES); return state.is(CommonBlockTags.END_STONES);
} }

View file

@ -1,22 +1,18 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BasePlantWithAgeBlock; import org.betterx.bclib.blocks.BasePlantWithAgeBlock;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock implements BehaviourPlant { public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock {
protected EndPlantWithAgeBlock() {
super();
}
public EndPlantWithAgeBlock(Properties settings) { public EndPlantWithAgeBlock(Properties settings) {
super(settings); super(settings);
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(CommonBlockTags.END_STONES); return state.is(CommonBlockTags.END_STONES);
} }
} }

View file

@ -6,10 +6,6 @@ import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class EndUnderwaterPlantBlock extends UnderwaterPlantBlock { public class EndUnderwaterPlantBlock extends UnderwaterPlantBlock {
public EndUnderwaterPlantBlock() {
}
public EndUnderwaterPlantBlock(Properties settings) { public EndUnderwaterPlantBlock(Properties settings) {
super(settings); super(settings);
} }

View file

@ -1,17 +1,21 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.blocks.BaseUnderwaterWallPlantBlock; import org.betterx.bclib.blocks.BaseUnderwaterWallPlantBlock;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.betterend.interfaces.survives.SurvivesOnEndStone;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
public class EndUnderwaterWallPlantBlock extends BaseUnderwaterWallPlantBlock { public class EndUnderwaterWallPlantBlock extends BaseUnderwaterWallPlantBlock implements SurvivesOnEndStone {
public EndUnderwaterWallPlantBlock() { public EndUnderwaterWallPlantBlock(MapColor color) {
super(BehaviourBuilders.createWaterPlant(color));
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(CommonBlockTags.END_STONES); return SurvivesOnEndStone.super.isTerrain(state);
} }
} }

View file

@ -1,21 +1,24 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.BehaviourBuilders;
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant; import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
import org.betterx.bclib.blocks.BaseWallPlantBlock; import org.betterx.bclib.blocks.BaseWallPlantBlock;
import org.betterx.worlds.together.tag.v3.CommonBlockTags; import org.betterx.betterend.interfaces.survives.SurvivesOnEndStone;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
public class EndWallPlantBlock extends BaseWallPlantBlock implements BehaviourPlant { public class EndWallPlantBlock extends BaseWallPlantBlock implements BehaviourPlant, SurvivesOnEndStone {
public EndWallPlantBlock() { public EndWallPlantBlock(MapColor color) {
super(BehaviourBuilders.createPlant(color));
} }
public EndWallPlantBlock(int light) { public EndWallPlantBlock(MapColor color, int light) {
super(light); super(BehaviourBuilders.createPlant(color).lightLevel((bs) -> light));
} }
@Override @Override
protected boolean isTerrain(BlockState state) { public boolean isTerrain(BlockState state) {
return state.is(CommonBlockTags.END_STONES); return SurvivesOnEndStone.super.isTerrain(state);
} }
} }

View file

@ -5,20 +5,24 @@ import org.betterx.bclib.behaviours.interfaces.BehaviourShearablePlant;
import org.betterx.bclib.blocks.BaseAttachedBlock; import org.betterx.bclib.blocks.BaseAttachedBlock;
import org.betterx.bclib.client.render.BCLRenderLayer; import org.betterx.bclib.client.render.BCLRenderLayer;
import org.betterx.bclib.interfaces.RenderLayerProvider; import org.betterx.bclib.interfaces.RenderLayerProvider;
import org.betterx.bclib.interfaces.TagProvider;
import org.betterx.bclib.items.tool.BaseShearsItem; import org.betterx.bclib.items.tool.BaseShearsItem;
import org.betterx.bclib.util.MHelper; import org.betterx.bclib.util.MHelper;
import org.betterx.worlds.together.tag.v3.TagManager;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper; import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
@ -31,28 +35,26 @@ import com.google.common.collect.Maps;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.List; import java.util.List;
public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider, BehaviourShearablePlant { public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider, BehaviourShearablePlant, TagProvider {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
private final ItemLike drop; private final ItemLike drop;
private final int dropChance; private final int dropChance;
public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) { public FurBlock(MapColor color, ItemLike drop, int light, int dropChance, boolean wet) {
super(BehaviourBuilders.createReplaceablePlant() super(BehaviourBuilders
.createPlant(color)
.replaceable()
.lightLevel(bs -> light) .lightLevel(bs -> light)
.ignitedByLava()
.sound(wet ? SoundType.WET_GRASS : SoundType.GRASS) .sound(wet ? SoundType.WET_GRASS : SoundType.GRASS)
); );
this.drop = drop; this.drop = drop;
this.dropChance = dropChance; this.dropChance = dropChance;
TagManager.BLOCKS.add(BlockTags.LEAVES, this);
} }
public FurBlock(ItemLike drop, int dropChance) { public FurBlock(MapColor color, ItemLike drop, int dropChance) {
super(BehaviourBuilders.createReplaceablePlant() this(color, drop, 0, dropChance, false);
.sound(SoundType.GRASS)
);
this.drop = drop;
this.dropChance = dropChance;
TagManager.BLOCKS.add(BlockTags.LEAVES, this);
} }
@Override @Override
@ -89,4 +91,9 @@ public class FurBlock extends BaseAttachedBlock implements RenderLayerProvider,
BOUNDING_SHAPES.put(Direction.WEST, Shapes.box(0.5, 0.0, 0.0, 1.0, 1.0, 1.0)); BOUNDING_SHAPES.put(Direction.WEST, Shapes.box(0.5, 0.0, 0.0, 1.0, 1.0, 1.0));
BOUNDING_SHAPES.put(Direction.EAST, Shapes.box(0.0, 0.0, 0.0, 0.5, 1.0, 1.0)); BOUNDING_SHAPES.put(Direction.EAST, Shapes.box(0.0, 0.0, 0.0, 0.5, 1.0, 1.0));
} }
@Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(BlockTags.LEAVES);
}
} }

View file

@ -2,31 +2,34 @@ package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed; import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
import org.betterx.bclib.blocks.BaseCropBlock; import org.betterx.bclib.blocks.BaseCropBlock;
import org.betterx.bclib.interfaces.SurvivesOnBlocks;
import org.betterx.betterend.interfaces.PottablePlant; import org.betterx.betterend.interfaces.PottablePlant;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
public class PottableCropBlock extends BaseCropBlock implements PottablePlant, BehaviourSeed { import java.util.List;
private final Block[] terrain;
public class PottableCropBlock extends BaseCropBlock implements PottablePlant, BehaviourSeed, SurvivesOnBlocks {
private final List<Block> terrain;
public PottableCropBlock(Item drop, Block... terrain) { public PottableCropBlock(Item drop, Block... terrain) {
super(drop, terrain); super(drop, terrain);
this.terrain = terrain; this.terrain = List.of(terrain);
}
@Override
public boolean canPlantOn(Block block) {
for (Block ter : terrain) {
if (block == ter) {
return true;
}
}
return false;
} }
@Override @Override
public String getPottedState() { public String getPottedState() {
return "age=3"; return "age=3";
} }
@Override
public List<Block> getSurvivableBlocks() {
return terrain;
}
@Override
public boolean canPlantOn(Block block) {
return isSurvivable(block.defaultBlockState());
}
} }

View file

@ -2,12 +2,14 @@ package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.behaviours.interfaces.BehaviourSapling; import org.betterx.bclib.behaviours.interfaces.BehaviourSapling;
import org.betterx.bclib.blocks.FeatureSaplingBlock; import org.betterx.bclib.blocks.FeatureSaplingBlock;
import org.betterx.bclib.interfaces.SurvivesOn;
import org.betterx.betterend.interfaces.PottablePlant; import org.betterx.betterend.interfaces.PottablePlant;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
public abstract class PottableFeatureSapling<F extends Feature<FC>, FC extends FeatureConfiguration> extends FeatureSaplingBlock<F, FC> implements PottablePlant, BehaviourSapling { public abstract class PottableFeatureSapling<F extends Feature<FC>, FC extends FeatureConfiguration> extends FeatureSaplingBlock<F, FC> implements PottablePlant, BehaviourSapling, SurvivesOn {
public PottableFeatureSapling(FeatureSupplier<F, FC> featureSupplier) { public PottableFeatureSapling(FeatureSupplier<F, FC> featureSupplier) {
super(featureSupplier); super(featureSupplier);
@ -16,4 +18,9 @@ public abstract class PottableFeatureSapling<F extends Feature<FC>, FC extends F
public PottableFeatureSapling(int light, FeatureSupplier<F, FC> featureSupplier) { public PottableFeatureSapling(int light, FeatureSupplier<F, FC> featureSupplier) {
super(light, featureSupplier); super(light, featureSupplier);
} }
@Override
public boolean canPlantOn(Block block) {
return isSurvivable(block.defaultBlockState());
}
} }

View file

@ -1,12 +1,15 @@
package org.betterx.betterend.blocks.basis; package org.betterx.betterend.blocks.basis;
import org.betterx.bclib.blocks.BaseLeavesBlock; import org.betterx.bclib.blocks.BaseLeavesBlock;
import org.betterx.bclib.interfaces.SurvivesOnBlocks;
import org.betterx.betterend.interfaces.PottablePlant; import org.betterx.betterend.interfaces.PottablePlant;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.MapColor;
public class PottableLeavesBlock extends BaseLeavesBlock implements PottablePlant { import java.util.List;
public class PottableLeavesBlock extends BaseLeavesBlock implements PottablePlant, SurvivesOnBlocks {
public PottableLeavesBlock(Block sapling, MapColor color) { public PottableLeavesBlock(Block sapling, MapColor color) {
super(sapling, color); super(sapling, color);
@ -23,4 +26,17 @@ public class PottableLeavesBlock extends BaseLeavesBlock implements PottablePlan
} }
return true; return true;
} }
@Override
public List<Block> getSurvivableBlocks() {
if (sapling instanceof SurvivesOnBlocks pp) {
return pp.getSurvivableBlocks();
}
return List.of();
}
@Override
public String prefixComponent() {
return "tooltip.bclib.pottable_on";
}
} }

View file

@ -5,10 +5,14 @@ import org.betterx.betterend.blocks.basis.EndWallPlantBlock;
import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndBlocks;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.MapColor;
public class BYGBlocks { public class BYGBlocks {
public static final Block IVIS_MOSS = EndBlocks.registerBlock("ivis_moss", new EndWallPlantBlock()); public static final Block IVIS_MOSS = EndBlocks.registerBlock("ivis_moss", new EndWallPlantBlock(MapColor.PLANT));
public static final Block NIGHTSHADE_MOSS = EndBlocks.registerBlock("nightshade_moss", new EndWallPlantBlock()); public static final Block NIGHTSHADE_MOSS = EndBlocks.registerBlock(
"nightshade_moss",
new EndWallPlantBlock(MapColor.PLANT)
);
public static final Block IVIS_VINE = EndBlocks.registerBlock("ivis_vine", new BaseVineBlock()); public static final Block IVIS_VINE = EndBlocks.registerBlock("ivis_vine", new BaseVineBlock());

View file

@ -54,7 +54,7 @@ public class EndBlocks {
); );
public static final Block CRYSTAL_MOSS = registerBlock( public static final Block CRYSTAL_MOSS = registerBlock(
"crystal_moss", "crystal_moss",
new EndTerrainBlock(MapColor.COLOR_PINK), new EndTerrainBlock(MapColor.COLOR_CYAN),
BCLBlockTags.BONEMEAL_SOURCE_END_STONE, BCLBlockTags.BONEMEAL_SOURCE_END_STONE,
BlockTags.NYLIUM BlockTags.NYLIUM
); );
@ -238,6 +238,7 @@ public class EndBlocks {
public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock( public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock(
"mossy_glowshroom_fur", "mossy_glowshroom_fur",
new FurBlock( new FurBlock(
MapColor.COLOR_LIGHT_BLUE,
MOSSY_GLOWSHROOM_SAPLING, MOSSY_GLOWSHROOM_SAPLING,
15, 15,
16, 16,
@ -316,7 +317,7 @@ public class EndBlocks {
public static final Block TENANEA_FLOWERS = registerBlock("tenanea_flowers", new TenaneaFlowersBlock()); public static final Block TENANEA_FLOWERS = registerBlock("tenanea_flowers", new TenaneaFlowersBlock());
public static final Block TENANEA_OUTER_LEAVES = registerBlock( public static final Block TENANEA_OUTER_LEAVES = registerBlock(
"tenanea_outer_leaves", "tenanea_outer_leaves",
new FurBlock(TENANEA_SAPLING, 32) new FurBlock(MapColor.COLOR_PINK, TENANEA_SAPLING, 32)
); );
public static final EndWoodenComplexMaterial TENANEA = new EndWoodenComplexMaterial( public static final EndWoodenComplexMaterial TENANEA = new EndWoodenComplexMaterial(
"tenanea", "tenanea",
@ -381,7 +382,7 @@ public class EndBlocks {
); );
public static final Block LUCERNIA_OUTER_LEAVES = registerBlock( public static final Block LUCERNIA_OUTER_LEAVES = registerBlock(
"lucernia_outer_leaves", "lucernia_outer_leaves",
new FurBlock(LUCERNIA_SAPLING, 32) new FurBlock(MapColor.COLOR_RED, LUCERNIA_SAPLING, 32)
); );
public static final EndWoodenComplexMaterial LUCERNIA = new EndWoodenComplexMaterial( public static final EndWoodenComplexMaterial LUCERNIA = new EndWoodenComplexMaterial(
"lucernia", "lucernia",
@ -396,11 +397,26 @@ public class EndBlocks {
public static final Block UMBRELLA_MOSS_TALL = registerBlock("umbrella_moss_tall", new UmbrellaMossTallBlock()); public static final Block UMBRELLA_MOSS_TALL = registerBlock("umbrella_moss_tall", new UmbrellaMossTallBlock());
public static final Block CREEPING_MOSS = registerBlock("creeping_moss", new GlowingMossBlock(11)); public static final Block CREEPING_MOSS = registerBlock("creeping_moss", new GlowingMossBlock(11));
public static final Block CHORUS_GRASS = registerBlock("chorus_grass", new ChorusGrassBlock()); public static final Block CHORUS_GRASS = registerBlock("chorus_grass", new ChorusGrassBlock());
public static final Block CAVE_GRASS = registerBlock("cave_grass", new TerrainPlantBlock(CAVE_MOSS)); public static final Block CAVE_GRASS = registerBlock(
public static final Block CRYSTAL_GRASS = registerBlock("crystal_grass", new TerrainPlantBlock(CRYSTAL_MOSS)); "cave_grass",
public static final Block SHADOW_PLANT = registerBlock("shadow_plant", new TerrainPlantBlock(SHADOW_GRASS)); new TerrainPlantBlock(CAVE_MOSS)
public static final Block BUSHY_GRASS = registerBlock("bushy_grass", new TerrainPlantBlock(PINK_MOSS)); );
public static final Block AMBER_GRASS = registerBlock("amber_grass", new TerrainPlantBlock(AMBER_MOSS)); public static final Block CRYSTAL_GRASS = registerBlock(
"crystal_grass",
new TerrainPlantBlock(CRYSTAL_MOSS)
);
public static final Block SHADOW_PLANT = registerBlock(
"shadow_plant",
new TerrainPlantBlock(SHADOW_GRASS)
);
public static final Block BUSHY_GRASS = registerBlock(
"bushy_grass",
new TerrainPlantBlock(PINK_MOSS)
);
public static final Block AMBER_GRASS = registerBlock(
"amber_grass",
new TerrainPlantBlock(AMBER_MOSS)
);
public static final Block TWISTED_UMBRELLA_MOSS = registerBlock( public static final Block TWISTED_UMBRELLA_MOSS = registerBlock(
"twisted_umbrella_moss", "twisted_umbrella_moss",
new TwistedUmbrellaMossBlock() new TwistedUmbrellaMossBlock()
@ -409,8 +425,14 @@ public class EndBlocks {
"twisted_umbrella_moss_tall", "twisted_umbrella_moss_tall",
new TwistedUmbrellaMossTallBlock() new TwistedUmbrellaMossTallBlock()
); );
public static final Block JUNGLE_GRASS = registerBlock("jungle_grass", new TerrainPlantBlock(JUNGLE_MOSS)); public static final Block JUNGLE_GRASS = registerBlock(
public static final Block BLOOMING_COOKSONIA = registerBlock("blooming_cooksonia", new TerrainPlantBlock(END_MOSS)); "jungle_grass",
new TerrainPlantBlock(JUNGLE_MOSS)
);
public static final Block BLOOMING_COOKSONIA = registerBlock(
"blooming_cooksonia",
new TerrainPlantBlock(END_MOSS)
);
public static final Block SALTEAGO = registerBlock("salteago", new TerrainPlantBlock(END_MOSS)); public static final Block SALTEAGO = registerBlock("salteago", new TerrainPlantBlock(END_MOSS));
public static final Block VAIOLUSH_FERN = registerBlock("vaiolush_fern", new TerrainPlantBlock(END_MOSS)); public static final Block VAIOLUSH_FERN = registerBlock("vaiolush_fern", new TerrainPlantBlock(END_MOSS));
public static final Block FRACTURN = registerBlock("fracturn", new TerrainPlantBlock(END_MOSS)); public static final Block FRACTURN = registerBlock("fracturn", new TerrainPlantBlock(END_MOSS));
@ -456,7 +478,7 @@ public class EndBlocks {
public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlueVineLanternBlock()); public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlueVineLanternBlock());
public static final Block BLUE_VINE_FUR = registerBlock( public static final Block BLUE_VINE_FUR = registerBlock(
"blue_vine_fur", "blue_vine_fur",
new FurBlock(BLUE_VINE_SEED, 15, 3, false) new FurBlock(MapColor.COLOR_BLUE, BLUE_VINE_SEED, 15, 3, false)
); );
public static final Block LANCELEAF_SEED = registerBlock("lanceleaf_seed", new LanceleafSeedBlock()); public static final Block LANCELEAF_SEED = registerBlock("lanceleaf_seed", new LanceleafSeedBlock());
@ -473,7 +495,7 @@ public class EndBlocks {
); );
public static final Block GLOWING_PILLAR_LEAVES = registerBlock( public static final Block GLOWING_PILLAR_LEAVES = registerBlock(
"glowing_pillar_leaves", "glowing_pillar_leaves",
new FurBlock(GLOWING_PILLAR_SEED, 15, 3, false) new FurBlock(MapColor.COLOR_ORANGE, GLOWING_PILLAR_SEED, 15, 3, false)
); );
public static final Block SMALL_JELLYSHROOM = registerBlock("small_jellyshroom", new SmallJellyshroomBlock()); public static final Block SMALL_JELLYSHROOM = registerBlock("small_jellyshroom", new SmallJellyshroomBlock());
@ -499,7 +521,7 @@ public class EndBlocks {
public static final Block AMARANITA_LANTERN = registerBlock("amaranita_lantern", new GlowingHymenophoreBlock()); public static final Block AMARANITA_LANTERN = registerBlock("amaranita_lantern", new GlowingHymenophoreBlock());
public static final Block AMARANITA_FUR = registerBlock( public static final Block AMARANITA_FUR = registerBlock(
"amaranita_fur", "amaranita_fur",
new FurBlock(SMALL_AMARANITA_MUSHROOM, 15, 4, true) new FurBlock(MapColor.COLOR_CYAN, SMALL_AMARANITA_MUSHROOM, 15, 4, true)
); );
public static final Block AMARANITA_CAP = registerBlock("amaranita_cap", new AmaranitaCapBlock()); public static final Block AMARANITA_CAP = registerBlock("amaranita_cap", new AmaranitaCapBlock());
@ -573,13 +595,22 @@ public class EndBlocks {
// Wall Plants // // Wall Plants //
public static final Block PURPLE_POLYPORE = registerBlock("purple_polypore", new EndWallMushroom(13)); public static final Block PURPLE_POLYPORE = registerBlock("purple_polypore", new EndWallMushroom(13));
public static final Block AURANT_POLYPORE = registerBlock("aurant_polypore", new EndWallMushroom(13)); public static final Block AURANT_POLYPORE = registerBlock("aurant_polypore", new EndWallMushroom(13));
public static final Block TAIL_MOSS = registerBlock("tail_moss", new EndWallPlantBlock()); public static final Block TAIL_MOSS = registerBlock("tail_moss", new EndWallPlantBlock(MapColor.COLOR_BLACK));
public static final Block CYAN_MOSS = registerBlock("cyan_moss", new EndWallPlantBlock()); public static final Block CYAN_MOSS = registerBlock("cyan_moss", new EndWallPlantBlock(MapColor.COLOR_CYAN));
public static final Block TWISTED_MOSS = registerBlock("twisted_moss", new EndWallPlantBlock()); public static final Block TWISTED_MOSS = registerBlock(
public static final Block TUBE_WORM = registerBlock("tube_worm", new EndUnderwaterWallPlantBlock()); "twisted_moss",
public static final Block BULB_MOSS = registerBlock("bulb_moss", new EndWallPlantBlock(12)); new EndWallPlantBlock(MapColor.COLOR_LIGHT_BLUE)
public static final Block JUNGLE_FERN = registerBlock("jungle_fern", new EndWallPlantBlock()); );
public static final Block RUSCUS = registerBlock("ruscus", new EndWallPlantBlock()); public static final Block TUBE_WORM = registerBlock(
"tube_worm",
new EndUnderwaterWallPlantBlock(MapColor.TERRACOTTA_BROWN)
);
public static final Block BULB_MOSS = registerBlock(
"bulb_moss",
new EndWallPlantBlock(MapColor.TERRACOTTA_ORANGE, 12)
);
public static final Block JUNGLE_FERN = registerBlock("jungle_fern", new EndWallPlantBlock(MapColor.COLOR_GREEN));
public static final Block RUSCUS = registerBlock("ruscus", new EndWallPlantBlock(MapColor.COLOR_RED));
// Vines // // Vines //
public static final Block DENSE_VINE = registerBlock("dense_vine", new BaseVineBlock(15, true)); public static final Block DENSE_VINE = registerBlock("dense_vine", new BaseVineBlock(15, true));