Luminance Block Entities - Fabric

Quick rating

Luminance Block Entities - Fabric

No reviews yet

A Simple API That Allows Block Entities To Emit Light

Tech
Mod Loaders
Fabric
Minecraft

Community voices

Reviews

Versions
Loading versions…
Match includes

Click once to include, again to exclude, again to clear

Rating Any
Any 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0
Min
Max
Play Status
Reviews
Time Played
hrs+
Verified developers only
Has developer response
List view
Grid view
Compact view
Sort by
Date
Rating
Helpful
Unhelpful
Edited
Sort ascending
Delete this review?

This removes your review from the project. You can write a new review after.

Review submitted for moderation

Your review has been sent to moderators, who will check that it meets our guidelines before it appears publicly.

No reviews yet. Be the first to review this project!

Get it on

Available Platforms

About

Project Details

Type
Mod
Latest Version
LuminanceBlockEntities-Fabric-1.0.0
Authors

For authors

Embed Badge

If you're the author of this project, you can embed a live badge anywhere that supports HTML or Markdown. It updates automatically whenever ratings change.

Custom banner text
ModDex rating badge preview

Use HTML for any page that supports it, or Markdown for README files and Markdown-based descriptions.

Identifiers

Platform IDs

CurseForge ID

Resources

External Links

Source Issues Wiki Discord

About

Description

Luminance Block Entities

allows block entities (such as chests, furnaces, dispensers, etc.) to emit light into the world, similarly to how a glowstone block or a redstone lamp would. However, unlike glowstone blocks and redstone lamps, this utility api completely foregoes blockstates. It is therefore perfect for mods that want to add new blocks with many blockstates that also emit light, or for mods that need very fine control over their lighting. ONLY WORKS FOR FABRIC (sorry!)

For Gamers

If another mod needs this mod as a dependency, simply download this mod here, and place it into your mods folder together with all your other mods.

For Developers

Setup

In order to use this api for your mods, simply download the jar here, and place it somewhere in your Fabric development environment. In your build.gradle file, add

flatDir {
	dirs 'directory/where/you/placed/the/jar'
}

to the repositories section. And, add 

modImplementation "com.nonumberstudios.luminance_block_entities:luminance_block_entities:1.0.0"

to the dependencies section. Of course, change out the '1.0.0' bit with whichever version of this api you're using.

How to use

Once set up, you can add new block entities like you normally would using fabric. Instead of extending BlockEntity however, your block entity class should extend the LuminanceBlockEntity class provided by the api. This class will need a new parameter LuminanceBehavior. This is an enum that specifies how you decide whether to use your block entity's lighting or your block state's lighting in the world. Here are your options:

  • IGNORE: only use the lighting from your block entity, ignore block state. This is probably what you want.
  • FALLBACK: use the lighting from your block entity if your block entity has light. If your lighting is zero, use the block state's lighting as a fallback.
  • PRIORITY: use the lighting from your block state if your block state has light. If your lighting is zero, use the block entity's lighting as a fallback.

 Next you will be prompted to implement the getLuminance method. Simply do whatever you want in here. If you want to update the world's lighting according to whatever getLuminance returns, simply call the updateLuminance method defined in LuminanceBlockEntity. Only call this if your lighting has actually changed! It's somewhat expensive.

Lastly in your mod initialization sequence, you can call LuminanceBlockEntitiesMod.initializeExample() to load an example block entity into the game. This is a very crude block (without texture and such) that can be found in the misc tab. If you place it down you'll see it generates a random lighting value between 0 and 15 every tick, and updates the world lighting accordingly (see video below). Theoretically, doing this in the vanilla style of changing block state every tick would be more expensive, but I'm sure you can find better applications for this api (I sure have, stay tuned😉). You can check out the GlowBlockEntity class to see the implementation.

And that's about it. If you need any help, you can ask in the comments or you can contact me at [email protected]Good luck programming!

The example implementation:

Screenshots

Gallery

This project has no gallery images yet.

Versions

Files

Relations

Project Relations

More like this

Similar Mods

Suggestions use data such as tags, dependencies, dependents, descriptions, titles, and more to rank how much they overlap with this mod.

On ModDex

Community snapshot

0
Ratings
0
Followers
0
In stacks

By the numbers

Statistics

<1,000
Downloads
Last Updated
Created
Last synced
When ModDex last fetched this project from CurseForge or Modrinth. Every project is re-checked on a schedule, and any project that ships a new file is synced automatically within hours of the release.
New file updates sync automatically
How syncing works