[Change] New generalized plant and shearable plant Behaviour
This commit is contained in:
parent
9d92ec65c8
commit
2a6f62a0b9
10 changed files with 23 additions and 16 deletions
|
@ -188,10 +188,11 @@ public class PostInitAPI {
|
|||
TagManager.BLOCKS.add(block, CommonBlockTags.WATER_PLANT);
|
||||
}
|
||||
|
||||
if (block instanceof BehaviourPlant) {
|
||||
if (block instanceof BehaviourPlant || block instanceof BehaviourShearablePlant) {
|
||||
TagManager.BLOCKS.add(block, CommonBlockTags.PLANT);
|
||||
}
|
||||
|
||||
|
||||
if (block instanceof BehaviourSeed) {
|
||||
TagManager.BLOCKS.add(block, CommonBlockTags.SEEDS);
|
||||
if (item != null && item != Items.AIR) {
|
||||
|
|
|
@ -2,5 +2,5 @@ package org.betterx.bclib.behaviours.interfaces;
|
|||
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||
|
||||
public interface BehaviourPlant extends AddMineableHoe, BehaviourCompostable {
|
||||
public interface BehaviourPlant extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
package org.betterx.bclib.behaviours.interfaces;
|
||||
|
||||
public interface BehaviourPlantLike {
|
||||
}
|
|
@ -2,5 +2,5 @@ package org.betterx.bclib.behaviours.interfaces;
|
|||
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||
|
||||
public interface BehaviourSapling extends AddMineableHoe, BehaviourCompostable {
|
||||
public interface BehaviourSapling extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike {
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ package org.betterx.bclib.behaviours.interfaces;
|
|||
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||
|
||||
public interface BehaviourSeed extends AddMineableHoe, BehaviourCompostable {
|
||||
public interface BehaviourSeed extends AddMineableHoe, BehaviourCompostable, BehaviourPlantLike {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package org.betterx.bclib.behaviours.interfaces;
|
||||
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
||||
|
||||
public interface BehaviourShearablePlant extends AddMineableShears, BehaviourPlantLike, BehaviourCompostable {
|
||||
}
|
|
@ -8,5 +8,5 @@ import org.betterx.bclib.interfaces.tools.AddMineableShears;
|
|||
* <p>
|
||||
* This will add the {@link AddMineableShears}, {@link AddMineableHoe} and {@link BehaviourCompostable} behaviours.
|
||||
*/
|
||||
public interface BehaviourVine extends AddMineableShears, AddMineableHoe, BehaviourCompostable, BehaviourClimable {
|
||||
public interface BehaviourVine extends AddMineableShears, AddMineableHoe, BehaviourPlantLike, BehaviourCompostable, BehaviourClimable {
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ package org.betterx.bclib.behaviours.interfaces;
|
|||
|
||||
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||
|
||||
public interface BehaviourWaterPlant extends AddMineableHoe, BehaviourCompostable {
|
||||
public interface BehaviourWaterPlant extends AddMineableHoe, BehaviourPlantLike, BehaviourCompostable {
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.bclib.creativetab;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.*;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourLeaves;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlantLike;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -17,12 +18,8 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class BCLCreativeTab {
|
||||
public static CreativeTabPredicate NATURE = item -> item instanceof BlockItem bi
|
||||
&& (bi.getBlock() instanceof BehaviourSapling
|
||||
|| bi.getBlock() instanceof BehaviourSeed
|
||||
|| bi.getBlock() instanceof BehaviourLeaves
|
||||
|| bi.getBlock() instanceof BehaviourPlant
|
||||
|| bi.getBlock() instanceof BehaviourWaterPlant
|
||||
|| bi.getBlock() instanceof BehaviourVine);
|
||||
&& (bi.getBlock() instanceof BehaviourPlantLike
|
||||
|| bi.getBlock() instanceof BehaviourLeaves);
|
||||
|
||||
public static CreativeTabPredicate BLOCKS = item -> item instanceof BlockItem;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.betterx.bclib.util;
|
||||
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlant;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourSeed;
|
||||
import org.betterx.bclib.behaviours.interfaces.BehaviourPlantLike;
|
||||
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -353,7 +352,7 @@ public class BlocksHelper {
|
|||
|
||||
public static Boolean replaceableOrPlant(BlockState state) {
|
||||
final Block block = state.getBlock();
|
||||
if (state.is(CommonBlockTags.PLANT) || state.is(CommonBlockTags.WATER_PLANT) || block instanceof BehaviourPlant || block instanceof BehaviourSeed) {
|
||||
if (state.is(CommonBlockTags.PLANT) || state.is(CommonBlockTags.WATER_PLANT) || block instanceof BehaviourPlantLike) {
|
||||
return true;
|
||||
}
|
||||
if (state.getPistonPushReaction() == PushReaction.DESTROY && block.defaultDestroyTime() == 0) return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue