Skip to content

Block Entities for Redstone? #6

@StockiesLad

Description

@StockiesLad

Current Limits

The current system from Minecraft is not designed to be extended the likes of which you did. Single-handedly adding that much more performance-cost for one mod is not practical.

Envisioned Solution

It is far more sensible to use BlockEntities, and a BlockEntityRenderer to actually handle redstone. Unfortunately, this means you have to rewrite basically everything (including nuking the current redstone system, which is subject to parity breaks).

  • Store power levels as a field in an enum: "PowerType" with 4 fields.
  • In the Block Entity data, you store a byte array of length 4. The ordinal of the PowerLevel then corresponds to the index of the array, where it's respective power-level is stored.
  • Example: powerLevels[powerType.ordinal()] = powerLevel;
  • Use mixin to redirect all redstone calls to channel through this system. If done correctly, only redstone (and torches it seems) need an actual custom system. Things like repeaters and such will just read the highest power level (you can extend this system to make different color powerstone components later on). Try to avoid actually changing anything else.

Because it's stored as Nbt data, you save 99% of the RAM and only have to worry about a couple block entities and renderers, not thousands of block states (you'd be effectively optimising the whole system anyways...).

For such a system, you'd need to put this kind of rewrite in a separate library that people can PR into. Otherwise PowerStones would just be a ridiculously intrusive mod.

(If you are interested and would like a bit of help there, I'm here).

Aside from that, good job thus far. Most others have not actually even implemented a working system of alternate red stone to begin with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions