Blocks API
The RUBlocks interface contains all block registrations, organized by category and including specialized block sets for wood and natural variants.
Block registration pattern
Blocks are registered using the Supplier<Block> pattern with factory functions:
Example block registration
// From RUBlocks.java:51-52
Supplier < Block > PRISMOSS = register (
"prismoss" ,
p -> new PrismossBlock (p
. mapColor ( MapColor . COLOR_LIGHT_GREEN )
. sound ( SoundType . STONE )
. randomTicks ()
. strength ( 1.5f , 6f )
. requiresCorrectToolForDrops ()
)
);
Registration helper methods
The RUBlockUtils class provides factory methods for common block types:
Wood blocks
Stairs and slabs
Doors and fences
// Create a log block
Block log = RUBlockUtils . log (
properties,
RotatedPillarBlock ::new ,
MapColor . WOOD , // plank color
MapColor . WOOD , // bark color
SoundType . WOOD ,
false // fireproof
);
// Create planks
Block planks = RUBlockUtils . planks (
properties,
MapColor . WOOD ,
SoundType . WOOD ,
false
);
Block categories
Cave blocks
Supplier < Block > PRISMOSS = register ( "prismoss" , ...);
Supplier < Block > DEEPSLATE_PRISMOSS = register ( "deepslate_prismoss" , ...);
Supplier < Block > HANGING_PRISMARITE = register ( "hanging_prismarite" , ...);
Supplier < Block > LARGE_PRISMARITE_CLUSTER = register ( "large_prismarite_cluster" , ...);
Supplier < Block > PRISMAGLASS = register ( "prismaglass" , ...);
Supplier < Block > PRISMARITE_CLUSTER = register ( "prismarite_cluster" , ...);
Supplier < Block > POINTED_REDSTONE = register ( "pointed_redstone" , ...);
Supplier < Block > RAW_REDSTONE_BLOCK = register ( "raw_redstone_block" , ...);
Supplier < Block > REDSTONE_BUD = register ( "redstone_bud" , ...);
Supplier < Block > REDSTONE_BULB = register ( "redstone_bulb" , ...);
Plants
Supplier < Block > ALPHA_DANDELION = register ( "alpha_dandelion" ,
p -> new RuFlowerBlock ( MobEffects . JUMP , 5 , p), Blocks . DANDELION );
Supplier < Block > BLEEDING_HEART = register ( "bleeding_heart" ,
p -> new RuSnowFlowerBlock ( MobEffects . POISON , 9 , p), Blocks . DANDELION );
Supplier < Block > BLUE_LUPINE = register ( "blue_lupine" ,
p -> new RuFlowerBlock ( MobEffects . SATURATION , 4 , p), Blocks . DANDELION );
Supplier < Block > MEDIUM_GRASS = register ( "medium_grass" , RuPlantBlock ::new , Blocks . SHORT_GRASS );
Supplier < Block > SANDY_GRASS = register ( "sandy_grass" , RuSandyPlantBlock ::new , Blocks . SHORT_GRASS );
Supplier < Block > STEPPE_GRASS = register ( "steppe_grass" , p -> new RuPlantBlock (p
. pushReaction ( PushReaction . DESTROY )
. ignitedByLava ()
. replaceable ()
. noCollission ()
. instabreak ()
. sound ( SoundType . GRASS )
. offsetType ( BlockBehaviour . OffsetType . XZ )));
Dirt variants
Supplier < Block > PEAT_GRASS_BLOCK = register ( "peat_grass_block" , PeatGrassBlock ::new , Blocks . GRASS_BLOCK );
Supplier < Block > PEAT_DIRT = register ( "peat_dirt" , TillableDirtBlock ::new , Blocks . DIRT );
Supplier < Block > PEAT_DIRT_PATH = register ( "peat_dirt_path" , ...);
Supplier < Block > PEAT_COARSE_DIRT = register ( "peat_coarse_dirt" , TillableDirtBlock ::new , Blocks . COARSE_DIRT );
Supplier < Block > PEAT_FARMLAND = register ( "peat_farmland" , ...);
Supplier < Block > SILT_GRASS_BLOCK = register ( "silt_grass_block" , SiltGrassBlock ::new , Blocks . GRASS_BLOCK );
Supplier < Block > SILT_DIRT = register ( "silt_dirt" , TillableDirtBlock ::new , Blocks . DIRT );
Supplier < Block > SILT_FARMLAND = register ( "silt_farmland" , ...);
Wood sets
The WoodSet class creates complete sets of wood-related blocks:
Creating a wood set
public static WoodSet simple (
String name,
WoodType woodType,
SoundType sound,
MapColor plankColour,
MapColor logColour,
boolean fireproof
) {
WoodSet set = new WoodSet (name, fireproof);
set . addLogs (name, "log" , "wood" , sound, plankColour, logColour, fireproof, logFactory, true );
set . addCommonWoodBlocks (name, woodType, plankColour, sound, fireproof);
if (boat) set . addBoats (name);
return set;
}
Wood set contents
Each wood set can include:
Bark-covered wood (all sides bark texture)
Chest boat item (if enabled)
Example wood sets
Wood set examples from RUBlocks.java
WoodSet BAOBAB_WOOD_SET = WoodSet . simple (
"baobab" ,
RuWoodTypes . BAOBAB ,
RUSoundEvents . BAOBAB_SET . baseType (),
MapColor . WOOD ,
MapColor . TERRACOTTA_LIGHT_GRAY ,
false
);
WoodSet CYPRESS_WOOD_SET = WoodSet . simple (
"cypress" ,
RuWoodTypes . CYPRESS ,
SoundType . BAMBOO_WOOD ,
MapColor . WOOD ,
MapColor . WOOD ,
false
);
WoodSet BRIMWOOD_WOOD_SET = BrimwoodWoodSet . brimwood (
"brimwood" ,
RuWoodTypes . BRIMWOOD ,
SoundType . NETHER_WOOD ,
MapColor . COLOR_BROWN ,
MapColor . COLOR_ORANGE ,
true // fireproof
);
Natural sets
The NaturalSet class creates sets of natural blocks (leaves, saplings, branches):
Creating a natural set
NaturalSet MAPLE_NATURAL_SET = NaturalSet . create ( "maple" )
. withBranch ()
. withShrub ()
. withLeaves ( small ( TintGetter . defaultDarken ( 0.6f )))
. withSapling ( RuTreeGrowers . MAPLE );
NaturalSet BAOBAB_NATURAL_SET = NaturalSet . create ( "baobab" )
. withBranch ()
. withShrub ()
. withLeaves ()
. withSapling (p -> new RuUltraFromMegaSaplingBlock ( RuTreeGrowers . BAOBAB , p));
Natural set components
Decorative branch block that can be placed on tree sides
Small decorative shrub variant
Tree leaves with optional custom tinting
Sapling that grows into the tree
Flower pot variant of the sapling
Natural set builder methods
Adds a branch block to the set
Adds a shrub block to the set
Adds leaves with optional color and factory
withLeaves() - Default green leaves
withLeaves(MapColor color) - Custom map color
withLeaves(BlockFactory factory) - Custom block factory
withLeaves(MapColor color, BlockFactory factory) - Both custom
Adds sapling and potted sapling
withSapling(TreeGrower grower) - Standard sapling
withSapling(BlockFactory factory) - Custom sapling implementation
Items API
The RUItems interface registers items, primarily food items:
Food items
Supplier < Item > SALMONBERRY = RUItemUtils . register (
"salmonberry" ,
p -> new BlockItem ( RUBlocks . SALMONBERRY_BUSH . get (),
p . food ( food ( 3 , 0.3f , t -> t)))
);
Supplier < Item > DUSKMELON_SLICE = RUItemUtils . register (
"duskmelon_slice" ,
p -> new BlockItem ( RUBlocks . DUSKMELON . get (),
p . food ( food ( 5 , 1.1f ,
t -> t . effect ( new MobEffectInstance ( MobEffects . BLINDNESS , 240 ), 1 ))))
);
Supplier < Item > HANGING_EARLIGHT_FRUIT = RUItemUtils . register (
"hanging_earlight_fruit" ,
p -> new BlockItem ( RUBlocks . HANGING_EARLIGHT . get (),
p . food ( food ( 6 , 0.4f ,
t -> t . effect ( new MobEffectInstance ( MobEffects . GLOWING , 200 ), 0.1F ))))
);
Food properties helper
public static FoodProperties food (
int nutrition,
float saturation,
UnaryOperator < FoodProperties . Builder > operator
) {
return operator . apply (
new FoodProperties. Builder ()
. nutrition (nutrition)
. saturationModifier (saturation)
). build ();
}
Food points restored (half drumsticks)
Saturation modifier (hidden hunger value)
operator
UnaryOperator<FoodProperties.Builder>
required
Builder function to add effects or properties
Item registration
public static Supplier < Item > register ( String name, ItemFactory factory) {
return Registrar . register (
BuiltInRegistries . ITEM ,
name,
() -> factory . apply ( new Item. Properties ())
);
}
public static Supplier < Item > registerBlock ( String name, Supplier < Block > block) {
return register (name, p -> new BlockItem ( block . get (), p));
}
Usage examples
Accessing blocks
Iterating sets
Custom registration
// Get a block instance
Block prismoss = RUBlocks . PRISMOSS . get ();
// Get from a wood set
Block mapleLog = RUBlocks . MAPLE_WOOD_SET . getLog ();
Block maplePlanks = RUBlocks . MAPLE_WOOD_SET . getPlanks ();
// Get from a natural set
Block mapleLeaves = RUBlocks . MAPLE_NATURAL_SET . getLeaves ();
Block mapleSapling = RUBlocks . MAPLE_NATURAL_SET . getSapling ();