Package api

Class BTWAddon

java.lang.Object
api.BTWAddon
Direct Known Subclasses:
BTWMod, EMIPostInit

public abstract class BTWAddon extends Object
  • Field Details

    • parentMod

      protected net.fabricmc.loader.api.ModContainer parentMod
    • addonName

      protected String addonName
    • versionString

      protected String versionString
    • modID

      protected String modID
    • isRequiredClientAndServer

      protected boolean isRequiredClientAndServer
    • shouldVersionCheck

      protected boolean shouldVersionCheck
    • addonCustomPacketChannelVersionCheck

      public String addonCustomPacketChannelVersionCheck
    • addonCustomPacketChannelVersionCheckAck

      public String addonCustomPacketChannelVersionCheckAck
    • addonConfig

      public AddonConfig addonConfig
    • dependants

      public final Set<BTWAddon> dependants
    • hasBeenInitialized

      public boolean hasBeenInitialized
  • Constructor Details

    • BTWAddon

      public BTWAddon()
  • Method Details

    • setup_legacy

      protected final void setup_legacy()
    • addResourcePackDomain

      @Environment(CLIENT) protected static void addResourcePackDomain(String domain)
    • postSetup

      public void postSetup()
      Run immediately after initial setup, before initialization
    • preInitialize

      public void preInitialize()
      Do anything here that needs to be done before any other mods have initialized
    • initialize

      public abstract void initialize()
      The main method to initialize mod data. Mod initialize order cannot be guaranteed, except that Better than Wolves loads first Anything that depends on other mods having loaded should be done in postInitialize()
    • postInitialize

      public void postInitialize()
      Do anything here that needs to be done after all other mods have initialized
    • registerConfigProperties

      public void registerConfigProperties(AddonConfig config)
      Do any initial config registration here. Use register___ to register new properties. To reference the values later, use addonConfig's get_____ methods.
    • handleConfigProperties

      public void handleConfigProperties(AddonConfig config)
      Where the addon should handle the values read from config files This is called after Initialize() is called, and every time the config is reloaded with
      Parameters:
      config - Key-value pair for each property which has been registered
    • serverPlayerConnectionInitialized

      public void serverPlayerConnectionInitialized(NetServerHandler serverHandler, EntityPlayerMP playerMP)
      Called when a player joins the world
    • serverCustomPacketReceived

      @Deprecated public boolean serverCustomPacketReceived(NetServerHandler handler, Packet250CustomPayload packet)
      Deprecated.
      Deprecated - please register custom packet handlers instead
      Returns:
      true if the packet has been processed, false otherwise
    • decorateWorld

      public void decorateWorld(BiomeDecoratorBase decorator, World world, Random rand, int x, int y, BiomeGenBase biome)
      Called when decorating a chunk (adding trees, ores, etc) to allow addons to add their own generators Look in BiomeDecorator for guidance in how to create and use a generator for those things
      Parameters:
      decorator - The decorator instance
      world - The current world
      rand - The random number generator. Always use this generator for deterministic generation.
      x -
      y -
      biome - The biome being decorated. Biomes during decoration are lower resolution, only being caluclated per chunk not per block
    • initializeDifficultyCommon

      public void initializeDifficultyCommon(Difficulty difficulty)
    • initializeDifficultyServer

      public void initializeDifficultyServer(Difficulty difficulty)
    • initializeDifficultyClient

      public void initializeDifficultyClient(Difficulty difficulty)
    • registerPacketHandler

      public void registerPacketHandler(String channel, CustomPacketHandler handler)
      Add a custom handler for packets, assigned to a specific channel
      Parameters:
      channel - Channel must be of the format <addon prefix>|<channel string>
      handler - The handler to be called when a packet is received on the specified channel
    • registerAddonCommand

      public void registerAddonCommand(ICommand command)
      Register a command for both client and server
      Parameters:
      command -
    • getName

      public String getName()
    • getVersionString

      public String getVersionString()
    • getModID

      public String getModID()
    • sendVersionCheckToClient

      public void sendVersionCheckToClient(NetServerHandler serverHandler, EntityPlayerMP playerMP)
      Handles version checking
    • sendDifficultyToClient

      public void sendDifficultyToClient(NetServerHandler serverHandler, EntityPlayerMP playerMP)
    • serverAckPacketReceived

      public boolean serverAckPacketReceived(NetServerHandler serverHandler, Packet250CustomPayload packet)
      Called when client ack packet is received by the NetServerHandler If overriding, make sure to make a call to the super method if you want to maintain version checking
      Returns:
      true if packet was handled, false otherwise
    • getAwaitingLoginAck

      public boolean getAwaitingLoginAck()
      Returns:
      whether the server is awaiting the client's response to the version check
    • incrementTicksSinceAckRequested

      public void incrementTicksSinceAckRequested()
    • handleAckCheck

      public boolean handleAckCheck()
    • clientCustomPacketReceived

      @Environment(CLIENT) @Deprecated public boolean clientCustomPacketReceived(Minecraft mcInstance, Packet250CustomPayload packet)
      Deprecated.
      Deprecated - please register custom packet handlers instead
      Returns:
      true if the packet has been processed, false otherwise
    • interceptCustomClientPacket

      @Environment(CLIENT) public boolean interceptCustomClientPacket(Minecraft mc, Packet250CustomPayload packet)
      Used to modify existing client side packet250 behavior (For modifying BTW behavior)
      Returns:
      true if packet was handled, false otherwise
    • clientPlayCustomAuxFX

      @Environment(CLIENT) @Deprecated public boolean clientPlayCustomAuxFX(Minecraft mcInstance, World world, EntityPlayer player, int iFXID, int i, int j, int k, int iFXSpecificData)
      Deprecated.
      Deprecated - please register custom effects using EffectHandler instead
      Returns:
      true if the packet has been processed, false otherwise
    • spawnCustomParticle

      @Environment(CLIENT) public EntityFX spawnCustomParticle(World world, String particleType, double x, double y, double z, double velX, double velY, double velZ)
      Spawns a custom particle based on a string specifying the type
      Returns:
      the spawned particle, or null if type is not handled
    • registerAddonCommandClientOnly

      public void registerAddonCommandClientOnly(ICommand command)
      Register a client only command
      Parameters:
      command -
    • versionCheckPacketReceived

      @Environment(CLIENT) public boolean versionCheckPacketReceived(Minecraft mc, Packet250CustomPayload packet)
      Called when the version check packet is received by the NetClientHandler If overriding, make sure to make a call to the super method
      Returns:
      true if packet was handled, false otherwise
    • registerAddonCommandServerOnly

      @Environment(SERVER) public void registerAddonCommandServerOnly(ICommand command)
      Register a server only command
      Parameters:
      command -