-
Notifications
You must be signed in to change notification settings - Fork 0
Misc Features
one of the few misc features added by SilliestLib is the compat Blocks and Items, classes exist for all the existing vanilla classes i thought would be useful, mostly wood type blocks, tool items and other classes, using these is quite simple and an example is shown here.
Item COMPAT_ITEM = regItem(TestItemIds.TEST_ITEM, properties -> new CompatItem("mod_id", properties));"mod_id", found in the above example, is then replaced with the id of the mod that should be loaded in order for the Block/Item to be enabled, the rest works like you would register a normal Block or Item, for CompatBlocks, BlockItems must be registered seperately and use CompatBlockItems
adding your own comapt Blocks/Items isn't that hard, an example of the base CompatBlock and CompatItem is shown here.
public class CompatBlock extends Block {
public final List<String> MODIDS;
public CompatBlock(String modId, BlockBehaviour.Properties properties) {
super(properties);
this.MODIDS = List.of(modId);
}
@Override
public boolean isEnabled(FeatureFlagSet enabledFeatures) {
return MODIDS.stream().allMatch(SilliestLib::isModLoaded);
}
}public class CompatItem extends Item {
public final List<String> MODIDS;
public CompatItem(String modId, Item.Properties properties) {
super(properties);
this.MODIDS = List.of(modId);
}
@Override
public boolean isEnabled(FeatureFlagSet enabledFeatures) {
return MODIDS.stream().allMatch(SilliestLib::isModLoaded);
}
}Simply make the class extend the Item/Block class you wish to add a compat version for, and make sure to update the super so that it works
the only thing that's actually registered by SilliestLib is the Double handed component, that when added to an item makes the players armPose to visually appear like you are holding the item with both hands when held
some template models included in SilliestLib are the custom wall models, these function similar to the vanilla wall models, with the addition of a separate top texture