-
Notifications
You must be signed in to change notification settings - Fork 15
Contributions
SBL is open to pull requests and always looking for contributions of custom behaviours, sensors, and memory types. The more we can build up from the community, the more that will be available to other users.
Breaking change-PRs may not be implemented and may instead be recreated in development branches, if required.
If your PR does not need to be a breaking change, it should be designed as an in-place change instead (such as by using and documenting deprecated annotations)
Note that custom implementations should follow the same style as the existing ones, so take a look at existing similar classes before submitting your PR.
Line-ending curly braces
public static void method() {
}4-space tabs/indents
public static boolean method() {
if (myCheck()) {
if (myOtherCheck())
doThing();
return true;
}
return false;
}Braceless single-line if statements
public static void method() {
if (myCheckHere())
return;
if (myOtherCheck()) {
}
else {
}
}Guard Clauses
public static void healIfOnServer(Level level, LivingEntity entity) {
if (level.isClientSide())
return;
entity.heal(entity.getMaxHealth());
}Use FastUtil collections
List<Entity> entities = new ObjectArrayList();
Int2ObjectOpenHashMap<Entity> entityIdMap = new Int2ObjectOpenHashMap();Avoid streams
List<LivingEntity> livingEntities = new ObjectArrayList();
for (Entity entity : myEntityList()) {
if (entity instanceof LivingEntity livingEntity)
livingEntities.add(livingEntity);
}SBL tries to include as many generic behaviours as possible, so that users need to create as few custom behaviours as possible. To that end, it welcomes contributions of new behaviours, under the following requirements:
- The behaviour should be generic enough that it is viably useful for more than one entity.
- The behaviour should be designed to fill one function only. A behaviour that finds a new position to walk to should not also start walking there, for example.
- The behaviour should, at a minimum, extend ExtendedBehaviour, or one of its sub-classes.
- The behaviour class should be code-documented to explain what it does and any defaults for configurable settings. Configuration methods should be documented to explain what they are configuring. It is not required to document the actual functioning code of the behaviour.
- The behaviour should be placed into one of the sub-packages of the api/core/behaviour/custom package
SBL tries to include as many generic sensors as possible, so that users need to create as few custom sensors as possible. To that end, it welcomes contributions of new sensors, under the following requirements:
- The sensor should be generic enough that it is viably useful for more than one entity.
- The sensor should be designed to fill one function only.
- The sensor should not perform any actions on the entity besides settings/clearing/checking memories.
- The sensor should, at a minimum, extend ExtendedSensor, or one of its sub-classes.
- The sensor class should be code-documented to explain what it does and any defaults for configurable settings. Configuration methods should be documented to explain what they are configuring. It is not required to document the actual functioning code of the sensor.
- The sensor should be placed into the api/core/sensor/custom package
- The sensor should be registered in SBLSensors
- The memory module should be generic enough that it is viably useful for more than one entity.
- The memory module should be plainly named, and avoid using shortcut/contracted words.
- The memory module should not replace an existing suitable memory module present in MemoryModuleTypes or SBLMemoryTypes.
- The memory module should be registered in SBLMemoryTypes