Comments (10)
I'd really like to expose the enchantments so other mods can use them, and not just my own locks. I know I could have an API function for the items, like getLevelSecurity, but if someone wanted to make their own locks and make then enchantable I'm not sure how they'd do it.
Maybe you know a good way to do it?
from betterstorage.
I guess I'll just use a class with a bunch of public static Enchantment xyz;
fields, and set them when the mod starts. It's simple and everything, so it should be good.
from betterstorage.
Just sat down to start looking at the code. I'm thinking it would be pretty nice if the enchantment didn't matter to the chest. Like the lock knows what effect it has on the chest and when the lock is attached it applies the effect to the chest. I'm hoping that's possible but it'll take some digging.
from betterstorage.
What about making your base enchantment class part of the API and then adding a method to that class that takes a container as a parameter and it allows the enchantment to apply some effect to the chest? The lock would need to get the list of enchantments it has and call this new method when the lock is added to a chest. A corresponding action would need to be done when the lock is removed as well. This way the lock has to know how to handle the enchantments, not the chest, AND the exact enchantment doesn't matter so much. This also means that someone else can implement their own enchantment that affects locks.
from betterstorage.
I might try and create a fork that has what I'm talking about a bit later.
from betterstorage.
Yeah, I have an now idea how I'd do it, thanks to your input.
I won't be getting at the API until I've fixed some of the more serious problems.
About the fork, I do have to say I'm very picky about other people's contributions.
from betterstorage.
Yeah fixing core functionality is a bit more important.
I totally get it. I'm trying to stick to the style of your code and trying not to change anything. It's your mod and I don't want to change/add stuff that makes it less your mod.
from betterstorage.
Added what I thought would be alright for the enchantment API.
Tell me if you'd like to suggest any changes or if it's fine, so I can close up the issue.
from betterstorage.
I think that should be sufficient. Only thing I can think to change is make the names more generic. So instead of shock make it just damage. That way someone could say add an enchantment that does burn damage or something. Then maybe also have the map of names to enchantments be a name to multiple enchantments and all the damage enchantments would be called.
from betterstorage.
That wouldn't really make sense, as the locks are what decide what happens when the chest is being opened. You could have a lock which does something else to the player for the shock enchantment, but the enchantments themselves are just "there" and can't control anything.
I'll mark the issue as closed now, but I'm (obviously) still open for suggestions and the like.
from betterstorage.
Related Issues (20)
- Can't pull from crafting station HOT 2
- April Fools gone wrong HOT 1
- Crafting Station containerItem Damage Issue with IC2 / Others? HOT 1
- [Feature Request]IGW (In-Game Wiki) support HOT 1
- Add support for Wood Stuff HOT 4
- Odd placement of the buttons of InvTweaks HOT 3
- Reinforced Chests not detecting upper block HOT 1
- Reinforced chests blow up HOT 2
- Incompatibility between Storage crates and ForgeEssentials' Multiworld (and potentially any mod implementing their own SaveHandler) HOT 10
- [CRASH] BCA and Better Storage caused a crash at SSP HOT 2
- PneumaticCraft helm crashes client when searching a Crate HOT 2
- Crash Breaking Present HOT 1
- Crates and Recurrent Complex mod HOT 1
- NullPointerException when standing on top of an Autonomous Activator HOT 1
- Backpack drops as item not as block HOT 1
- Crafting Station dupe bug with TFC HOT 10
- Crash (NullPointerException) when loading with Thaumcraft HOT 2
- test issue
- Crash when storage crate is moved by CarryOn HOT 2
- Publicly readable feature list? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from betterstorage.