Skip to main content
Version: GeckoLib5

Copy-Paste Templates

Just looking for some template code to copy-paste?
See below for some existing code you can use to get you started.

Block Class

public class ExampleBlock extends Block implements EntityBlock {
public ExampleBlock(BlockBehaviour.Properties properties) {
super(properties);
}

@Override
public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return BlockEntityRegistry.EXAMPLE_BLOCK_ENTITY.create(pos, state);
}
}

BlockEntity Class

public class ExampleBlockEntity extends BlockEntity {
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);

public ExampleBlockEntity(BlockPos pos, BlockState state) {
super(BlockEntityRegistry.EXAMPLE_BLOCK_ENTITY, pos, state);
}

@Override
public void registerControllers(final AnimatableManager.ControllerRegistrar controllers) {

}

@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.geoCache;
}
}

BlockEntity Renderer

// Registering the renderer
context -> new GeoBlockRenderer<>(context, BlockEntityRegistry.EXAMPLE_BLOCK_ENTITY.get());

Blockstate JSON

{
"variants": {
"": {
"model": "examplemod:block/example_block"
}
}
}

Block Model JSON

{
"textures": {
"particle": "examplemod:block/example_block"
}
}