Page 1 of 1

BTW Extended Addon API v1.1.4

Posted: Sat Mar 06, 2021 7:07 pm
by dawnraider
This is an API designed to increase compatibility between BTW addons and to help make the process a little easier.

Any addon author is free to use it or make hook requests (or to submit code through a pull request)

Download here
Source code here

This API makes changes to your worlds which means it is unsafe to uninstall!
Due to how villagers had to be handled, they are broken into multiple classes now which means MC will not know how to load them if you load a world without the API.

Further documentation is present in the code itself
Hooks:
General
  • Version checking and display on login
  • Client packet intercepting (e.g. for replacing behavior)
  • Custom particle spawning
Block
  • Replace references to a block with another block class, with checks for addon conflict.
  • Set map color for blocks per metadata.
EntityList
  • Replace an entity with another entity class in a safe manner, avoiding potential crashes which can arise from FC's hooks which do not expect references to old classes to still exist in the code. (Unfortunately this is currently bugged to not work on mob spawning, but will work on all other entities, including mobs loaded from the save file).
  • Changed entity mapping with spawn egg to public.
FCEntityVillager
  • Changed to an abstract class. Extend the class to add professions.
Item
  • Replace references to an item with another item class, with checks for addon conflict.
  • Set custom entity to use for the item in world.
ServerCommandManager
  • Register new commands, including client or server only.
Templates:
AddonBlockDirectional
  • Template for orientable block (e.g. logs).
  • Handles all metadata rotation and texture rendering.
  • Can have up to 4 sub-types.
License
This API is provided under the Creative Commons 4.0 Attribution license, which you can view here. You may do anything you please with this API as long as you give credit.

Re: BTW Extended Addon API v1.0

Posted: Sun Mar 07, 2021 3:15 am
by jorgebonafe
Will this version have conflicts with the changes I copied to my addon in order to register commands? Do I have to change anything?

Re: BTW Extended Addon API v1.0

Posted: Sun Mar 07, 2021 1:45 pm
by dawnraider
Yeah this will conflict. You can remove any of the base class mods you made and replace it with a call like this:

Code: Select all

ServerCommandManager.registerAddonCommand(new BTACommandBiome());
There are similar calls to register a command only with the client or server.

Re: BTW Extended Addon API v1.0

Posted: Sun Mar 07, 2021 7:46 pm
by jorgebonafe
Cool. I'll update when I can, thanks

Re: BTW Extended Addon API v1.0

Posted: Wed Mar 24, 2021 5:20 pm
by dawnraider
Added missing license

License
This API is provided under the Creative Commons 4.0 Attribution license, which you can view here. You may do anything you please with this API as long as you give credit.

Re: BTW Extended Addon API v1.1.0

Posted: Sat Apr 03, 2021 11:51 pm
by dawnraider
Version 1.1.0 has been released!
Download here
Note that this release is incompatible with BTA 1.3.3 and Deco 2.13.3. Minor releases for those addons will be coming soon to update to this version of the API.

Edit: BTA 1.3.4 and Deco 2.13.4 have been released with compatibility for this API version.

The villager changes in this version required me to split villager professions into their own entities. Backwards compatibility has been added for villagers in the old format, though it is still a good idea to back up your worlds.
However, support cannot be added for going the other way. Worlds which update to this version of the API cannot be downgraded safely. If you do load a world that you have loaded with this version later with a version of the API before 1.1.0, or without the API, your villagers will disappear.
Unfortunately this was the only way to be able to break professions into their own classes because of how MC handles entities internally.
Back up your worlds just in case!

Version 1.1.0 changes:
  • Removed spaces from filename to assist users on linux.
  • Added some hooks for my upcoming automation addon.
  • Added hooks to spawn custom item entities per item.
  • Added hooks to allow more specific customization of map colors, including per metadata.
  • Refactored how villagers work to allow for addons to add new professions. Further work here will be done to allow for modifying existing professions without modifying base classes.
  • Changed item replacement slightly to fix conflict warnings.
  • Changed item and block replacement to have more detailed error messages.

    Re: BTW Extended Addon API v1.1.0

    Posted: Sun Apr 04, 2021 1:58 am
    by dawnraider
    I forgot to mention in the changelog that I added an AddonBlockDirectional template class which can be used to create directional blocks like logs.

    Re: BTW Extended Addon API v1.1.1

    Posted: Tue May 11, 2021 10:58 pm
    by dawnraider
    Version 1.1.1 has been released!
    Download here

    Version 1.1.1 changes:
    • Fixed an issue where opening a world from before API 1.1.0 would delete villagers.
    • Fixed an issue where curing or attacking villagers would cause the game to crash.
    • Fixed an issue where villager spawn eggs did not have names.
    • Fixed an issue where maps would cause severe performance issues.
    • Fixed an issue where spawning an item entity would log errors to the console. These errors never caused real issues and were simply a result of running code on both the client and server when it should've only been run on the server.

    Re: BTW Extended Addon API v1.1.1

    Posted: Wed May 12, 2021 5:48 pm
    by dawnraider
    Download updated to fix out of date version string in server version. Client version unaffected.

    Re: BTW Extended Addon API v1.1.2

    Posted: Fri May 14, 2021 9:08 pm
    by dawnraider
    version 1.1.2 has been released!
    Download here

    Version 1.1.2 changes:
    • Fixed an issue where the client would crash when an entity spawned on a server with an id above 255. Notably, this fixes an issue in multiplayer where clients would be kicked and unable to rejoin when curing villagers.

    Re: BTW Extended Addon API v1.1.3

    Posted: Sat May 15, 2021 12:13 am
    by dawnraider
    Version 1.1.3 has been released!
    Download here

    Version 1.1.3 changes:
    • Fixed a BTW issue which could cause a crash when trying to remove crucible or cauldron recipes with different numbers of input ingredients vs output ingredients.

    Re: BTW Extended Addon API v1.1.4

    Posted: Sun May 16, 2021 5:52 pm
    by dawnraider
    Version 1.1.4 has been released!
    Download here

    Version 1.1.4 changes:
    • Fixed an issue where curing zombie villagers always produced peasants.