Made plant creation consistent with BehaviourBuilders
This commit is contained in:
parent
c340d575c5
commit
f259496ba0
56 changed files with 363 additions and 396 deletions
|
@ -1,22 +1,24 @@
|
|||
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.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import org.betterx.betterend.blocks.basis.FurBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrMycelium;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
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() {
|
||||
super(BehaviourBuilders.createPlant());
|
||||
super(BehaviourBuilders.createSeed(MapColor.COLOR_BLUE).ignitedByLava());
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
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.registry.EndBlocks;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnRutiscus;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.LevelReader;
|
||||
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.material.MapColor;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -21,17 +22,17 @@ import com.google.common.collect.Lists;
|
|||
|
||||
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);
|
||||
|
||||
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
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
|
|
|
@ -26,12 +26,10 @@ public class BubbleCoralBlock extends EndUnderwaterPlantBlock implements Behavio
|
|||
private static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16);
|
||||
|
||||
public BubbleCoralBlock() {
|
||||
super(baseUnderwaterPlantSettings(
|
||||
BehaviourBuilders.createWaterPlant(),
|
||||
0
|
||||
)
|
||||
.sound(SoundType.CORAL_BLOCK)
|
||||
.offsetType(BlockBehaviour.OffsetType.NONE)
|
||||
super(BehaviourBuilders
|
||||
.createWaterPlant()
|
||||
.sound(SoundType.CORAL_BLOCK)
|
||||
.offsetType(BlockBehaviour.OffsetType.NONE)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +1,29 @@
|
|||
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.TripleShape;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnEndStoneOrTrees;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
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
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
BlockState up = world.getBlockState(pos.above());
|
||||
return up.is(CommonBlockTags.GEN_END_STONES) || up.is(BlockTags.LOGS) || up.is(BlockTags.LEAVES);
|
||||
return canSurviveOnBottom(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
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.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnEndStone;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.block.Block;
|
||||
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.VoxelShape;
|
||||
|
||||
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock {
|
||||
public class CavePumpkinVineBlock extends EndPlantWithAgeBlock implements SurvivesOnEndStone, BehaviourPlant {
|
||||
public CavePumpkinVineBlock() {
|
||||
super(BehaviourBuilders.createPlant());
|
||||
super(BehaviourBuilders.createPlant(MapColor.TERRACOTTA_ORANGE));
|
||||
}
|
||||
|
||||
private static final VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12);
|
||||
|
||||
@Override
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
BlockState down = world.getBlockState(pos.above());
|
||||
return isTerrain(down);
|
||||
return canSurviveOnBottom(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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 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.material.Fluids;
|
||||
|
||||
public class CharniaBlock extends EndUnderwaterPlantBlock {
|
||||
public class CharniaBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant, SurvivesOnWater {
|
||||
public CharniaBlock() {
|
||||
super(
|
||||
BehaviourBuilders.createWaterPlant()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
||||
return canSupportCenter(world, pos.below(), Direction.UP) && world.getFluidState(pos).getType() == Fluids.WATER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return SurvivesOnWater.super.isTerrain(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
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.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() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.getBlock() == EndBlocks.CHORUS_NYLIUM;
|
||||
super(BehaviourBuilders.createGrass(MapColor.COLOR_PURPLE).replaceable());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,9 +29,7 @@ public class CrystalMossCoverBlock extends MultifaceBlock implements Bonemealabl
|
|||
private final MultifaceSpreader spreader = new MultifaceSpreader(this);
|
||||
|
||||
public CrystalMossCoverBlock(MapColor color) {
|
||||
super(BehaviourBuilders.createReplaceablePlant(color)
|
||||
.strength(0.2f)
|
||||
.sound(SoundType.GLOW_LICHEN)
|
||||
super(BehaviourBuilders.createPlantCover(color)
|
||||
.lightLevel(GlowLichenBlock.emission(7)));
|
||||
this.registerDefaultState(this.defaultBlockState().setValue(WATERLOGGED, false));
|
||||
}
|
||||
|
|
|
@ -1,28 +1,20 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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.state.BlockState;
|
||||
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() {
|
||||
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
|
||||
public boolean canPlantOn(Block block) {
|
||||
return block == EndBlocks.SHADOW_GRASS;
|
||||
return isSurvivable(block.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.TripleShape;
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
||||
|
@ -37,17 +38,15 @@ import com.google.common.collect.Lists;
|
|||
import java.util.Collections;
|
||||
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;
|
||||
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);
|
||||
|
||||
public EndLilyBlock() {
|
||||
super(baseUnderwaterPlantSettings(
|
||||
BehaviourBuilders.createWaterPlant(),
|
||||
0
|
||||
)
|
||||
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
|
||||
super(BehaviourBuilders
|
||||
.createWaterPlant()
|
||||
.lightLevel((state) -> state.getValue(SHAPE) == TripleShape.TOP ? 13 : 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSeed;
|
||||
import org.betterx.bclib.blocks.BlockProperties.TripleShape;
|
||||
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||
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.material.Fluids;
|
||||
|
||||
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||
public class EndLilySeedBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSeed {
|
||||
@Override
|
||||
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {
|
||||
if (canGrow(world, pos)) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
public EndLotusFlowerBlock() {
|
||||
super(BehaviourBuilders.createPlant(MapColor.COLOR_PINK, true).lightLevel((bs) -> 15));
|
||||
super(BehaviourBuilders.createPlant(MapColor.COLOR_PINK).lightLevel((bs) -> 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_LOTUS_STEM);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class EndLotusLeafBlock extends BaseBlockNotFull implements RenderLayerPr
|
|||
private static final VoxelShape VSHAPE = Block.box(0, 0, 0, 16, 1, 16);
|
||||
|
||||
public EndLotusLeafBlock() {
|
||||
super(BehaviourBuilders.createPlant(MapColor.PLANT, true).noOcclusion().sound(SoundType.WET_GRASS));
|
||||
super(BehaviourBuilders.createWalkablePlant(MapColor.COLOR_PINK).sound(SoundType.WET_GRASS));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSeed;
|
||||
import org.betterx.bclib.blocks.BlockProperties.TripleShape;
|
||||
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||
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.material.Fluids;
|
||||
|
||||
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock {
|
||||
public class EndLotusSeedBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSeed {
|
||||
@Override
|
||||
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {
|
||||
if (canGrow(world, pos)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
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.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -24,7 +25,7 @@ public class FilaluxWingsBlock extends BaseAttachedBlock implements RenderLayerP
|
|||
|
||||
public FilaluxWingsBlock() {
|
||||
super(BehaviourBuilders
|
||||
.createPlant()
|
||||
.createPlant(MapColor.COLOR_RED)
|
||||
.sound(SoundType.WET_GRASS)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.tools.AddMineableShears;
|
||||
import org.betterx.bclib.interfaces.SurvivesOnWater;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantBlock;
|
||||
|
||||
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.level.BlockGetter;
|
||||
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.state.BlockBehaviour;
|
||||
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.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
@ -26,22 +25,16 @@ import com.google.common.collect.Lists;
|
|||
|
||||
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);
|
||||
|
||||
public FlamaeaBlock() {
|
||||
super(BehaviourBuilders
|
||||
.createPlant()
|
||||
.createPlant(MapColor.COLOR_ORANGE)
|
||||
.sound(SoundType.WET_GRASS)
|
||||
.offsetType(BlockBehaviour.OffsetType.NONE)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(Blocks.WATER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return SHAPE;
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.betterx.bclib.behaviours.BehaviourBuilders;
|
|||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.client.models.ModelsHelper;
|
||||
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.core.BlockPos;
|
||||
|
@ -19,21 +19,13 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
import net.fabricmc.api.EnvType;
|
||||
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);
|
||||
|
||||
public FlammalixBlock() {
|
||||
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
|
||||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return SHAPE;
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
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.registry.EndBlocks;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnMossOrMycelium;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.Environment;
|
||||
|
||||
public class GlowingMossBlock extends EndPlantBlock {
|
||||
public class GlowingMossBlock extends EndPlantBlock implements SurvivesOnMossOrMycelium, BehaviourPlant {
|
||||
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)
|
||||
public boolean hasEmissiveLighting(BlockGetter world, BlockPos pos) {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
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.TripleShape;
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.state.BlockState;
|
||||
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() {
|
||||
super(BehaviourBuilders
|
||||
.createPlant()
|
||||
.createSeed(MapColor.COLOR_ORANGE)
|
||||
.sound(SoundType.GRASS)
|
||||
.lightLevel(state -> state.getValue(AGE) * 3 + 3)
|
||||
.offsetType(OffsetType.XZ)
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,28 +1,21 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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.state.BlockState;
|
||||
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() {
|
||||
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
|
||||
public boolean canPlantOn(Block block) {
|
||||
return block == EndBlocks.AMBER_MOSS;
|
||||
return isSurvivable(block.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
|
||||
import org.betterx.bclib.blocks.UnderwaterPlantBlock;
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
@ -29,15 +30,14 @@ import com.google.common.collect.Lists;
|
|||
import java.util.Collections;
|
||||
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 HydraluxBlock() {
|
||||
super(baseUnderwaterPlantSettings(
|
||||
BehaviourBuilders.createWaterPlant(),
|
||||
0
|
||||
)
|
||||
super(
|
||||
BehaviourBuilders
|
||||
.createWaterPlant()
|
||||
.lightLevel((state) -> state.getValue(SHAPE).hasGlow() ? 15 : 0)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class HydraluxPetalBlock extends BaseBlock.Wood {
|
|||
public HydraluxPetalBlock() {
|
||||
this(
|
||||
BehaviourBuilders
|
||||
.createPlant(MapColor.PODZOL)
|
||||
.createWalkablePlant(MapColor.PODZOL)
|
||||
.strength(1)
|
||||
.sound(SoundType.WART_BLOCK)
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSapling;
|
||||
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
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.state.BlockState;
|
||||
|
||||
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock {
|
||||
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling {
|
||||
|
||||
@Override
|
||||
public void grow(WorldGenLevel world, RandomSource random, BlockPos pos) {
|
||||
|
|
|
@ -1,29 +1,14 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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;
|
||||
|
||||
public class LacugroveSaplingBlock extends PottableFeatureSapling<LacugroveFeature, NoneFeatureConfiguration> {
|
||||
public class LacugroveSaplingBlock extends PottableFeatureSapling<LacugroveFeature, NoneFeatureConfiguration> implements SurvivesOnMossOrDust {
|
||||
public LacugroveSaplingBlock() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
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.PentaShape;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.properties.EnumProperty;
|
||||
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 java.util.Collections;
|
||||
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 IntegerProperty ROTATION = BlockProperties.ROTATION;
|
||||
|
||||
public LanceleafBlock() {
|
||||
super();
|
||||
super(BehaviourBuilders.createPlant(MapColor.TERRACOTTA_BROWN).ignitedByLava().offsetType(OffsetType.XZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,8 +46,7 @@ public class LanceleafBlock extends EndPlantBlock {
|
|||
if (shape == PentaShape.TOP) {
|
||||
return world.getBlockState(pos.below()).is(this);
|
||||
} else if (shape == PentaShape.BOTTOM) {
|
||||
return world.getBlockState(pos.below()).is(EndBlocks.AMBER_MOSS) && world.getBlockState(pos.above())
|
||||
.is(this);
|
||||
return canSurviveOnTop(world, pos) && world.getBlockState(pos.above()).is(this);
|
||||
} else {
|
||||
return world.getBlockState(pos.below()).is(this) && world.getBlockState(pos.above()).is(this);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
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.PentaShape;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantWithAgeBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnAmberMoss;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -14,10 +16,11 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
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() {
|
||||
super(BehaviourBuilders.createPlant().offsetType(OffsetType.NONE));
|
||||
super(BehaviourBuilders.createSeed(MapColor.TERRACOTTA_BROWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,9 +57,4 @@ public class LanceleafSeedBlock extends EndPlantWithAgeBlock {
|
|||
plant.setValue(BlockProperties.PENTA_SHAPE, PentaShape.TOP)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.AMBER_MOSS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
|||
import org.betterx.bclib.blocks.BlockProperties;
|
||||
import org.betterx.bclib.blocks.BlockProperties.TripleShape;
|
||||
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.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.StateDefinition;
|
||||
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.Shapes;
|
||||
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;
|
||||
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);
|
||||
|
||||
public LargeAmaranitaBlock() {
|
||||
super(BehaviourBuilders
|
||||
.createPlant()
|
||||
.createWalkablePlant(MapColor.COLOR_RED)
|
||||
.ignitedByLava()
|
||||
.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;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.SANGNUM) || state.is(EndBlocks.MOSSY_OBSIDIAN) || state.is(EndBlocks.MOSSY_DRAGON_BONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(SHAPE);
|
||||
|
|
|
@ -1,28 +1,14 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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;
|
||||
|
||||
public class LucerniaSaplingBlock extends PottableFeatureSapling<LucerniaFeature, NoneFeatureConfiguration> {
|
||||
public class LucerniaSaplingBlock extends PottableFeatureSapling<LucerniaFeature, NoneFeatureConfiguration> implements SurvivesOnRutiscus {
|
||||
public LucerniaSaplingBlock() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,23 @@ package org.betterx.betterend.blocks;
|
|||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
|
||||
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 net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
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.FeaturePlaceContext;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class LumecornSeedBlock extends EndPlantWithAgeBlock implements BehaviourSeed {
|
||||
public class LumecornSeedBlock extends EndPlantWithAgeBlock implements BehaviourSeed, SurvivesOnEndMoss {
|
||||
|
||||
public LumecornSeedBlock() {
|
||||
super(BehaviourBuilders.createPlant());
|
||||
super(BehaviourBuilders.createSeed(MapColor.COLOR_LIGHT_BLUE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,9 +33,4 @@ public class LumecornSeedBlock extends EndPlantWithAgeBlock implements Behaviour
|
|||
null
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_MOSS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,14 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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;
|
||||
|
||||
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling<MossyGlowshroomFeature, NoneFeatureConfiguration> {
|
||||
public class MossyGlowshroomSaplingBlock extends PottableFeatureSapling<MossyGlowshroomFeature, NoneFeatureConfiguration> implements SurvivesOnMossOrMycelium {
|
||||
public MossyGlowshroomSaplingBlock() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
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.particles.ParticleTypes;
|
||||
|
@ -13,12 +14,19 @@ import net.minecraft.world.entity.LivingEntity;
|
|||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
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
|
||||
@Environment(EnvType.CLIENT)
|
||||
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
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
import org.betterx.bclib.items.tool.BaseShearsItem;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
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.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.Level;
|
||||
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.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
|
@ -23,7 +25,15 @@ import com.google.common.collect.Lists;
|
|||
|
||||
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
|
||||
@SuppressWarnings("deprecation")
|
||||
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
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isPathfindable(BlockState state, BlockGetter world, BlockPos pos, PathComputationType type) {
|
||||
|
|
|
@ -389,6 +389,7 @@ public class NeonCactusPlantBlock extends BaseBlockNotFull implements SimpleWate
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
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));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlant;
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
||||
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.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);
|
||||
|
||||
public PondAnemoneBlock() {
|
||||
super(baseUnderwaterPlantSettings(
|
||||
BehaviourBuilders.createWaterPlant(),
|
||||
13
|
||||
).sound(SoundType.CORAL_BLOCK)
|
||||
.offsetType(OffsetType.NONE)
|
||||
super(
|
||||
BehaviourBuilders
|
||||
.createWaterPlant()
|
||||
.sound(SoundType.CORAL_BLOCK)
|
||||
.offsetType(OffsetType.NONE)
|
||||
.lightLevel(state -> 13)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,14 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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;
|
||||
|
||||
public class PythadendronSaplingBlock extends PottableFeatureSapling<PythadendronTreeFeature, NoneFeatureConfiguration> {
|
||||
public class PythadendronSaplingBlock extends PottableFeatureSapling<PythadendronTreeFeature, NoneFeatureConfiguration> implements SurvivesOnChorusNylium {
|
||||
public PythadendronSaplingBlock() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
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.betterend.blocks.basis.EndPlantBlock;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnEndBone;
|
||||
import org.betterx.betterend.registry.EndFeatures;
|
||||
|
||||
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.state.BlockState;
|
||||
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.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
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);
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.SANGNUM) || state.is(EndBlocks.MOSSY_OBSIDIAN) || state.is(EndBlocks.MOSSY_DRAGON_BONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {
|
||||
|
|
|
@ -25,8 +25,10 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.BonemealableBlock;
|
||||
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.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.parameters.LootContextParams;
|
||||
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);
|
||||
|
||||
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
|
||||
|
|
|
@ -1,28 +1,14 @@
|
|||
package org.betterx.betterend.blocks;
|
||||
|
||||
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.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;
|
||||
|
||||
public class TenaneaSaplingBlock extends PottableFeatureSapling<TenaneaFeature, NoneFeatureConfiguration> {
|
||||
public class TenaneaSaplingBlock extends PottableFeatureSapling<TenaneaFeature, NoneFeatureConfiguration> implements SurvivesOnPinkMoss {
|
||||
public TenaneaSaplingBlock() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +1,28 @@
|
|||
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 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 {
|
||||
private final Block[] ground;
|
||||
import java.util.List;
|
||||
|
||||
public class TerrainPlantBlock extends EndPlantBlock implements SurvivesOnBlocks, BehaviourPlant {
|
||||
private final List<Block> ground;
|
||||
|
||||
public TerrainPlantBlock(Block... ground) {
|
||||
super(true);
|
||||
this.ground = ground;
|
||||
super(BehaviourBuilders.createPlant(ground.length == 0 ? MapColor.PLANT : ground[0].defaultMapColor())
|
||||
.ignitedByLava()
|
||||
.offsetType(OffsetType.XZ)
|
||||
.replaceable());
|
||||
this.ground = List.of(ground);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
for (Block block : ground) {
|
||||
if (state.is(block)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
public List<Block> getSurvivableBlocks() {
|
||||
return ground;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
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.util.BlocksHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class TwistedUmbrellaMossBlock extends EndPlantBlock {
|
||||
public class TwistedUmbrellaMossBlock extends EndPlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
|
||||
public TwistedUmbrellaMossBlock() {
|
||||
super(11);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
|
||||
super(BehaviourBuilders.createPlant(MapColor.COLOR_BLUE).lightLevel((state) -> 12));
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.betterx.betterend.blocks;
|
|||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.blocks.BaseDoublePlantBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.level.block.state.BlockState;
|
||||
|
||||
public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant {
|
||||
public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
|
||||
public TwistedUmbrellaMossTallBlock() {
|
||||
super(12);
|
||||
}
|
||||
|
@ -29,7 +30,7 @@ public class TwistedUmbrellaMossTallBlock extends BaseDoublePlantBlock implement
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return SurvivesOnJungleMossOrMycelium.super.isTerrain(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
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.util.BlocksHelper;
|
||||
import org.betterx.betterend.blocks.basis.EndPlantBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class UmbrellaMossBlock extends EndPlantBlock {
|
||||
public class UmbrellaMossBlock extends EndPlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
|
||||
public UmbrellaMossBlock() {
|
||||
super(11);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
|
||||
super(BehaviourBuilders.createGrass(MapColor.COLOR_ORANGE).ignitedByLava().lightLevel((state) -> 11));
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.betterx.betterend.blocks;
|
|||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.blocks.BaseDoublePlantBlock;
|
||||
import org.betterx.betterend.interfaces.survives.SurvivesOnJungleMossOrMycelium;
|
||||
import org.betterx.betterend.registry.EndBlocks;
|
||||
|
||||
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.level.block.state.BlockState;
|
||||
|
||||
public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant {
|
||||
public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements BehaviourPlant, SurvivesOnJungleMossOrMycelium {
|
||||
public UmbrellaMossTallBlock() {
|
||||
super(12);
|
||||
}
|
||||
|
@ -29,7 +30,7 @@ public class UmbrellaMossTallBlock extends BaseDoublePlantBlock implements Behav
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(EndBlocks.END_MOSS) || state.is(EndBlocks.END_MYCELIUM) || state.is(EndBlocks.JUNGLE_MOSS);
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return SurvivesOnJungleMossOrMycelium.super.isTerrain(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,33 +2,19 @@ package org.betterx.betterend.blocks;
|
|||
|
||||
import org.betterx.bclib.client.render.BCLRenderLayer;
|
||||
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.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;
|
||||
|
||||
public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling<UmbrellaTreeFeature, NoneFeatureConfiguration> {
|
||||
public class UmbrellaTreeSaplingBlock extends PottableFeatureSapling<UmbrellaTreeFeature, NoneFeatureConfiguration> implements SurvivesOnJungleMoss {
|
||||
public UmbrellaTreeSaplingBlock() {
|
||||
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
|
||||
public BCLRenderLayer getRenderLayer() {
|
||||
return BCLRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlantOn(Block block) {
|
||||
return block == EndBlocks.JUNGLE_MOSS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.betterx.betterend.blocks.basis;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.blocks.BasePlantBlock;
|
||||
import org.betterx.betterend.interfaces.PottablePlant;
|
||||
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.state.BlockState;
|
||||
|
||||
public class EndPlantBlock extends BasePlantBlock implements PottablePlant, BehaviourPlant {
|
||||
protected EndPlantBlock() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected EndPlantBlock(boolean replaceable) {
|
||||
super(replaceable);
|
||||
}
|
||||
|
||||
protected EndPlantBlock(int light) {
|
||||
super(light);
|
||||
}
|
||||
|
||||
public abstract class EndPlantBlock extends BasePlantBlock implements PottablePlant {
|
||||
protected EndPlantBlock(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return state.is(CommonBlockTags.END_STONES);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
package org.betterx.betterend.blocks.basis;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.blocks.BasePlantWithAgeBlock;
|
||||
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock implements BehaviourPlant {
|
||||
protected EndPlantWithAgeBlock() {
|
||||
super();
|
||||
}
|
||||
public abstract class EndPlantWithAgeBlock extends BasePlantWithAgeBlock {
|
||||
|
||||
public EndPlantWithAgeBlock(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return state.is(CommonBlockTags.END_STONES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,6 @@ import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class EndUnderwaterPlantBlock extends UnderwaterPlantBlock {
|
||||
|
||||
public EndUnderwaterPlantBlock() {
|
||||
}
|
||||
|
||||
public EndUnderwaterPlantBlock(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
package org.betterx.betterend.blocks.basis;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
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.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
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(CommonBlockTags.END_STONES);
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return SurvivesOnEndStone.super.isTerrain(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
package org.betterx.betterend.blocks.basis;
|
||||
|
||||
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
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.material.MapColor;
|
||||
|
||||
public class EndWallPlantBlock extends BaseWallPlantBlock implements BehaviourPlant {
|
||||
public EndWallPlantBlock() {
|
||||
public class EndWallPlantBlock extends BaseWallPlantBlock implements BehaviourPlant, SurvivesOnEndStone {
|
||||
public EndWallPlantBlock(MapColor color) {
|
||||
super(BehaviourBuilders.createPlant(color));
|
||||
}
|
||||
|
||||
public EndWallPlantBlock(int light) {
|
||||
super(light);
|
||||
public EndWallPlantBlock(MapColor color, int light) {
|
||||
super(BehaviourBuilders.createPlant(color).lightLevel((bs) -> light));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.is(CommonBlockTags.END_STONES);
|
||||
public boolean isTerrain(BlockState state) {
|
||||
return SurvivesOnEndStone.super.isTerrain(state);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,20 +5,24 @@ import org.betterx.bclib.behaviours.interfaces.BehaviourShearablePlant;
|
|||
import org.betterx.bclib.blocks.BaseAttachedBlock;
|
||||
import org.betterx.bclib.client.render.BCLRenderLayer;
|
||||
import org.betterx.bclib.interfaces.RenderLayerProvider;
|
||||
import org.betterx.bclib.interfaces.TagProvider;
|
||||
import org.betterx.bclib.items.tool.BaseShearsItem;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.worlds.together.tag.v3.TagManager;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
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.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
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.state.BlockState;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
|
@ -31,28 +35,26 @@ import com.google.common.collect.Maps;
|
|||
import java.util.EnumMap;
|
||||
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 final ItemLike drop;
|
||||
private final int dropChance;
|
||||
|
||||
public FurBlock(ItemLike drop, int light, int dropChance, boolean wet) {
|
||||
super(BehaviourBuilders.createReplaceablePlant()
|
||||
.lightLevel(bs -> light)
|
||||
.sound(wet ? SoundType.WET_GRASS : SoundType.GRASS)
|
||||
public FurBlock(MapColor color, ItemLike drop, int light, int dropChance, boolean wet) {
|
||||
super(BehaviourBuilders
|
||||
.createPlant(color)
|
||||
.replaceable()
|
||||
.lightLevel(bs -> light)
|
||||
.ignitedByLava()
|
||||
.sound(wet ? SoundType.WET_GRASS : SoundType.GRASS)
|
||||
);
|
||||
|
||||
this.drop = drop;
|
||||
this.dropChance = dropChance;
|
||||
TagManager.BLOCKS.add(BlockTags.LEAVES, this);
|
||||
}
|
||||
|
||||
public FurBlock(ItemLike drop, int dropChance) {
|
||||
super(BehaviourBuilders.createReplaceablePlant()
|
||||
.sound(SoundType.GRASS)
|
||||
);
|
||||
this.drop = drop;
|
||||
this.dropChance = dropChance;
|
||||
TagManager.BLOCKS.add(BlockTags.LEAVES, this);
|
||||
public FurBlock(MapColor color, ItemLike drop, int dropChance) {
|
||||
this(color, drop, 0, dropChance, false);
|
||||
}
|
||||
|
||||
@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.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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,31 +2,34 @@ package org.betterx.betterend.blocks.basis;
|
|||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
|
||||
import org.betterx.bclib.blocks.BaseCropBlock;
|
||||
import org.betterx.bclib.interfaces.SurvivesOnBlocks;
|
||||
import org.betterx.betterend.interfaces.PottablePlant;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public class PottableCropBlock extends BaseCropBlock implements PottablePlant, BehaviourSeed {
|
||||
private final Block[] terrain;
|
||||
import java.util.List;
|
||||
|
||||
public class PottableCropBlock extends BaseCropBlock implements PottablePlant, BehaviourSeed, SurvivesOnBlocks {
|
||||
private final List<Block> terrain;
|
||||
|
||||
public PottableCropBlock(Item drop, Block... terrain) {
|
||||
super(drop, terrain);
|
||||
this.terrain = terrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlantOn(Block block) {
|
||||
for (Block ter : terrain) {
|
||||
if (block == ter) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
this.terrain = List.of(terrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPottedState() {
|
||||
return "age=3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Block> getSurvivableBlocks() {
|
||||
return terrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlantOn(Block block) {
|
||||
return isSurvivable(block.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.betterx.betterend.blocks.basis;
|
|||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourSapling;
|
||||
import org.betterx.bclib.blocks.FeatureSaplingBlock;
|
||||
import org.betterx.bclib.interfaces.SurvivesOn;
|
||||
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.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) {
|
||||
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) {
|
||||
super(light, featureSupplier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlantOn(Block block) {
|
||||
return isSurvivable(block.defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package org.betterx.betterend.blocks.basis;
|
||||
|
||||
import org.betterx.bclib.blocks.BaseLeavesBlock;
|
||||
import org.betterx.bclib.interfaces.SurvivesOnBlocks;
|
||||
import org.betterx.betterend.interfaces.PottablePlant;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
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) {
|
||||
super(sapling, color);
|
||||
|
@ -23,4 +26,17 @@ public class PottableLeavesBlock extends BaseLeavesBlock implements PottablePlan
|
|||
}
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue