BananaPuncher714 / NBTEditor

A single class NBT editor for items, skulls, mobs, and tile entities
MIT License
136 stars 30 forks source link

Deep design thoughts. #15

Closed portlek closed 10 months ago

portlek commented 4 years ago

I think the usage design is terrible for newbie developer: We should make it more understandable, for example;

NBTEditor.of(itemStack).getCompound();
NBTEditor.of(itemStack).setCompound(compond);

Just an example. Also this design is more OOP so, we can understand how we can use the library or what the library behavior is. We have to look at the parameter name to understand how the library works, But I think we should add more understandable codes like above.

BananaPuncher714 commented 4 years ago

I'd be fine with something like that as long as it doesn't require constraining the user. Although, do note that no matter what, setting anything on an item would require re-assigning it, so making a wrapper of an ItemStack may turn out more tedious especially if the user is only changing one or two things. If you're able to show more examples on how it would be implemented, I'd be glad to look over them.

portlek commented 4 years ago

I'd be fine with something like that as long as it doesn't require constraining the user. Although, do note that no matter what, setting anything on an item would require re-assigning it, so making a wrapper of an ItemStack may turn out more tedious especially if the user is only changing one or two things. If you're able to show more examples on how it would be implemented, I'd be glad to look over them.

I will make a p.r. about that ASAP.

portlek commented 4 years ago

But first off all, we should add all tests. We can think the design after that.

portlek commented 4 years ago

Anyway I can't use the library because of the design and I can't write well-organized tests, I will change design first.

portlek commented 4 years ago

I'm making my own overhaul-design here; https://github.com/forkstuffs/NBTEditor/blob/improvetests/src/main/java/io/github/bananapuncher714/nbteditor/NBTEditorNew.java

portlek commented 4 years ago

The new reflection design is finished, here; https://github.com/forkstuffs/NBTEditor/blob/improvetests/src/main/java/io/github/bananapuncher714/nbteditor/util/Reflections.java

BananaPuncher714 commented 4 years ago

I see. The reflection design does look a bit cleaner. But please note that one of the goals of NBTEditor was to be contained in a single class, for easy copy and paste purposes.

portlek commented 4 years ago

I see. The reflection design does look a bit cleaner. But please note that one of the goals of NBTEditor was to be contained in a single class, for easy copy and paste purposes.

Yes, I will combine all classes into a single class, I'm making like that because this way is easier than writing in a single class. It's easier to design.