Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial/set of examples/wiki #47

Open
Azim opened this issue Nov 12, 2017 · 6 comments
Open

Tutorial/set of examples/wiki #47

Azim opened this issue Nov 12, 2017 · 6 comments
Labels
A. question Issue is asking a question C. needs more info Issue needs more information to identify the cause

Comments

@Azim
Copy link

Azim commented Nov 12, 2017

i'd hope to see at least 2 of those

@bergerkiller
Copy link
Member

There's an awful lot of API to cover here, which part of it are you most interested in? For sure there should be examples and a tutorial for entity controllers, network controllers and map displays.

@bbayu123 bbayu123 added A. question Issue is asking a question C. needs more info Issue needs more information to identify the cause labels Oct 28, 2018
@Andre601
Copy link
Contributor

Andre601 commented Jan 3, 2019

I would happily take my time to make a wiki here, since it looks like everyone can make a wiki...
Just need to know what the different API options and functions are, what they do, accept, etc.

Just to give a perspective on what I did in the past:
I made 99% of the current PlaceholderAPI wiki and also are the maintainer of it.

@bergerkiller
Copy link
Member

Essential parts I think that should be covered:

  • Maven repository and dependency entries to use in your pom.xml to use BKCommonLib
  • Map Display API needs code samples:
    • Creating a custom map display class, creating an item from it, putting the item in an item frame/giving to a player and how it automatically tiles it.
    • Some basic drawing examples of shapes, font and textures.
    • Loading MapTexture from .png files included in the plugin's jar file, plus perhaps the pom.xml changes needed to include .png files into the plugin's jar.
    • Widgets, what they do and how to add them to a map display, and how to handle events coming from them
  • Packet API:
    • Spawning a named entity/other kind of entity. Involves getting your own entity id, sending the packet to the players
    • Sending a move/teleport packet for an entity spawned this way.
    • First time delving into the *Handle classes that represent the net.minecraft.server counterparts
    • Changing entity metadata using the DataWatcher - making an entity invisible and changing armorstand pose
  • Block Data
    • Provides more properties and information than the Bukkit Material does
    • Retrieved using WorldUtil.getBlockData, and is a singleton type closely mimicking MaterialData
  • Configuration
    • Using the FileConfiguration class to read and generate yaml files easily
    • How defaults are handled (VERY different from how Bukkit does it)
    • How comments are handled
    • Documenting get("name", defaultTypedValue) and how it automatically reinterprets the value to the correct data type
  • Entity Controller
    • Creating a custom entity
    • Use of the EntityAdd event to replace entities that are loaded in with a custom type at runtime
    • Overriding onTick() and doing additional logic in there
    • Most basic example: custom Pig entity controller that drops cocoa beans at random

Theres more, but these are the most important off the top of my head. Some things are just too complex for most people to comprehend just starting out, like entity controllers. I think covering the most common use case, spawning armor stands for custom models, is best to cover.

@bergerkiller
Copy link
Member

I know it's a bit much, and certainly don't expect all of that to be written. Downside to having everything in one big library. After all, it mostly just contains all the duct-tape and glue code I need for other plugins to function on as many versions of Minecraft as possible.

@Andre601
Copy link
Contributor

Andre601 commented Jan 3, 2019

Do you have some practical examples later? 😅

Or like links to classes or so, that show code examples?

@bergerkiller
Copy link
Member

Not really, which is why the documentation is so poor. In the past I just wrote quick demos or copy-pasted code from my plugins to people that asked that worked mostly as intended. There was some sort of documentation for things over at dev.bukkit though, but its very much outdated.

https://dev.bukkit.org/projects/bkcommonlib/pages/datastorage/configuration-api

The menu is broken, but the sub-pages work fine and will show contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A. question Issue is asking a question C. needs more info Issue needs more information to identify the cause
Projects
None yet
Development

No branches or pull requests

4 participants