Additional survival details
This commit is contained in:
parent
300a262ac4
commit
14be7ecf01
4 changed files with 48 additions and 12 deletions
|
@ -2,16 +2,19 @@ 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.behaviours.interfaces.BehaviourWaterPlant;
|
||||||
import org.betterx.bclib.interfaces.SurvivesOnWater;
|
import org.betterx.bclib.interfaces.SurvivesOnSpecialGround;
|
||||||
import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
import org.betterx.betterend.blocks.basis.EndUnderwaterPlantBlock;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.material.Fluids;
|
|
||||||
|
|
||||||
public class CharniaBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant, SurvivesOnWater {
|
import java.util.List;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class CharniaBlock extends EndUnderwaterPlantBlock implements BehaviourWaterPlant {
|
||||||
public CharniaBlock() {
|
public CharniaBlock() {
|
||||||
super(
|
super(
|
||||||
BehaviourBuilders.createWaterPlant()
|
BehaviourBuilders.createWaterPlant()
|
||||||
|
@ -19,12 +22,18 @@ public class CharniaBlock extends EndUnderwaterPlantBlock implements BehaviourWa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
public void appendHoverText(
|
||||||
return canSupportCenter(world, pos.below(), Direction.UP) && world.getFluidState(pos).getType() == Fluids.WATER;
|
ItemStack itemStack,
|
||||||
|
@Nullable BlockGetter blockGetter,
|
||||||
|
List<Component> list,
|
||||||
|
TooltipFlag tooltipFlag
|
||||||
|
) {
|
||||||
|
super.appendHoverText(itemStack, blockGetter, list, tooltipFlag);
|
||||||
|
SurvivesOnSpecialGround.appendHoverTextUnderwater(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isTerrain(BlockState state) {
|
protected boolean isTerrain(BlockState state) {
|
||||||
return SurvivesOnWater.super.isTerrain(state);
|
return state.isSolid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,4 +59,10 @@ public class FlamaeaBlock extends EndPlantBlock implements CustomItemProvider, B
|
||||||
public boolean isTerrain(BlockState state) {
|
public boolean isTerrain(BlockState state) {
|
||||||
return SurvivesOnWater.super.isTerrain(state);
|
return SurvivesOnWater.super.isTerrain(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
|
||||||
|
// return SurvivesOnWater.super.canSurvive(state, level, pos);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.betterx.betterend.blocks;
|
||||||
|
|
||||||
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSapling;
|
import org.betterx.bclib.behaviours.interfaces.BehaviourWaterPlantSapling;
|
||||||
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
import org.betterx.bclib.blocks.UnderwaterPlantWithAgeBlock;
|
||||||
|
import org.betterx.bclib.interfaces.SurvivesOnSpecialGround;
|
||||||
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.interfaces.survives.SurvivesOnSulphuricRock;
|
import org.betterx.betterend.interfaces.survives.SurvivesOnSulphuricRock;
|
||||||
|
@ -9,11 +10,18 @@ import org.betterx.betterend.registry.EndBlocks;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.TooltipFlag;
|
||||||
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling, SurvivesOnSulphuricRock {
|
public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements BehaviourWaterPlantSapling, SurvivesOnSulphuricRock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,7 +83,15 @@ public class HydraluxSaplingBlock extends UnderwaterPlantWithAgeBlock implements
|
||||||
return SurvivesOnSulphuricRock.super.isTerrain(state);
|
return SurvivesOnSulphuricRock.super.isTerrain(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String prefixComponent() {
|
|
||||||
return "tooltip.bclib.place_underwater_on";
|
@Override
|
||||||
|
public void appendHoverText(
|
||||||
|
ItemStack itemStack,
|
||||||
|
@Nullable BlockGetter blockGetter,
|
||||||
|
List<Component> list,
|
||||||
|
TooltipFlag tooltipFlag
|
||||||
|
) {
|
||||||
|
super.appendHoverText(itemStack, blockGetter, list, tooltipFlag);
|
||||||
|
SurvivesOnSpecialGround.appendHoverTextUnderwaterInDepth(list, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,4 +14,9 @@ public interface SurvivesOnSulphuricRock extends SurvivesOnBlocks {
|
||||||
default List<Block> getSurvivableBlocks() {
|
default List<Block> getSurvivableBlocks() {
|
||||||
return BLOCKS;
|
return BLOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default String prefixComponent() {
|
||||||
|
return "tooltip.bclib.place_underwater_on";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue