[Feature] New Block Behaviour Interfaces

This commit is contained in:
Frank 2023-05-21 15:12:48 +02:00
parent 7d0df8c4dd
commit 3b2a2d4294
13 changed files with 118 additions and 42 deletions

View file

@ -0,0 +1,10 @@
package org.betterx.bclib.interfaces.behaviours;
/**
* Interface for blocks that can be climbed.
* <p>
* {@link org.betterx.bclib.api.v2.PostInitAPI} will add the {@link net.minecraft.tags.BlockTags#CLIMBABLE} tag to all blocks that
* implement this interface.
*/
public interface BehaviourClimable {
}

View file

@ -0,0 +1,9 @@
package org.betterx.bclib.interfaces.behaviours;
/**
* Interface for blocks that can be climbed and are vines.
* <p>
* This will combine the {@link BehaviourClimable} behaviours with all {@link BehaviourVine} behaviours.
*/
public interface BehaviourClimableVine extends BehaviourClimable, BehaviourVine {
}

View file

@ -0,0 +1,22 @@
package org.betterx.bclib.interfaces.behaviours;
/**
* Interface for blocks that can be composted.
* <p>
* {@link org.betterx.bclib.api.v2.PostInitAPI} will add the
* {@link org.betterx.worlds.together.tag.v3.CommonItemTags#COMPOSTABLE} tag to the items of all blocks that
* implement this interface. It will also register the Block with the {@link org.betterx.bclib.api.v2.ComposterAPI}
*/
public interface BehaviourCompostable {
/**
* The chance that this block will be composted.
* <p>
* The default value is 0.1f.
*
* @return The chance that this block will be composted.
*/
default float compostingChance() {
return 0.1f;
}
}

View file

@ -0,0 +1,16 @@
package org.betterx.bclib.interfaces.behaviours;
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
import org.betterx.bclib.interfaces.tools.AddMineableShears;
/**
* Interface for leaves blocks.
* <p>
* Adds composting chance, mineable with shears and hoe.
*/
public interface BehaviourLeaves extends AddMineableShears, AddMineableHoe, BehaviourCompostable {
@Override
default float compostingChance() {
return 0.3f;
}
}

View file

@ -0,0 +1,12 @@
package org.betterx.bclib.interfaces.behaviours;
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
import org.betterx.bclib.interfaces.tools.AddMineableShears;
/**
* Interface for blocks that are vines.
* <p>
* This will add the {@link AddMineableShears}, {@link AddMineableHoe} and {@link BehaviourCompostable} behaviours.
*/
public interface BehaviourVine extends AddMineableShears, AddMineableHoe, BehaviourCompostable {
}