Slimefun4
Slimefun4 copied to clipboard
Multimeter additional info
Description
This isn't directly for Slimefun. Many addons have blocks that display information about their current operational status within a GUI inventory. While this is a good way to do this from the player's perspective, this creates a BlockMenu that is kept in RAM indefinitely which has recently been the cause of some issues. While the block storage rewrite will likely be the best 'fix' for this, for now this is to allow addons to remove information-only GUIs for their machines.
The biggest 'offender' for this is InfinityExpansion which in my most recent example server had 70k~ of these inventories which are, effectively, wasting RAM - and a lot of it. If accepted I will be using this in Infinity, Networks and Tinker and will recommend to any other addons with similar blocks.
This solution will allow addons to display the information they are trying to put forward through the MultiMeter
Proposed changes
Add a new ItemAttribute that addons can implement to add additional messages to the MultiMeter.
This could easily be a new tool instead. While I think it fits well in the MultiMeter, I'm happy to make a new item for this purpose.
Related Issues (if applicable)
Checklist
- [ ] I have fully tested the proposed changes and promise that they will not break everything into chaos.
- [ ] I have also tested the proposed changes in combination with various popular addons and can confirm my changes do not break them.
- [ ] I have made sure that the proposed changes do not break compatibility across the supported Minecraft versions (1.14.* - 1.19.*).
- [x] I followed the existing code standards and didn't mess up the formatting.
- [x] I did my best to add documentation to any public classes or methods I added.
- [x] I have added
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values - [ ] I added sufficient Unit Tests to cover my code.
This feels like unnecessary weight in my opinion. Why not add a default method to
EnergyComponent
likesendMultimeterInfo(Player player, Location location)
, move the stuff for the default message there and override if necessary?Sure, then every item would need to be required to be an energy component for the multimeter to be able to read it. But then again, a multimeter working on something that is not an energy component seems un-intuitive anyway.
I did have two non-energycomponent items in my scope. Would a new item called a Probe be accepted instead? If not ill do as you suggest as near all the weight in the blockstorage reports I've worked on are EnergyComponents and should be enough in the main
marked this as stale no activity in almost 2 months. Will close this after a week, if its still stale.