Package api
Class BTWAddon
java.lang.Object
api.BTWAddon
- Direct Known Subclasses:
BTWMod,EMIPostInit
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddResourcePackDomain(String domain) booleanclientCustomPacketReceived(Minecraft mcInstance, Packet250CustomPayload packet) Deprecated.booleanclientPlayCustomAuxFX(Minecraft mcInstance, World world, EntityPlayer player, int iFXID, int i, int j, int k, int iFXSpecificData) Deprecated.voiddecorateWorld(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 thingsbooleangetModID()getName()booleanvoidhandleConfigProperties(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 withvoidabstract voidThe main method to initialize mod data.voidinitializeDifficultyClient(Difficulty difficulty) voidinitializeDifficultyCommon(Difficulty difficulty) voidinitializeDifficultyServer(Difficulty difficulty) booleanUsed to modify existing client side packet250 behavior (For modifying BTW behavior)voidDo anything here that needs to be done after all other mods have initializedvoidRun immediately after initial setup, before initializationvoidDo anything here that needs to be done before any other mods have initializedvoidregisterAddonCommand(ICommand command) Register a command for both client and servervoidregisterAddonCommandClientOnly(ICommand command) Register a client only commandvoidregisterAddonCommandServerOnly(ICommand command) Register a server only commandvoidregisterConfigProperties(AddonConfig config) Do any initial config registration here.voidregisterPacketHandler(String channel, CustomPacketHandler handler) Add a custom handler for packets, assigned to a specific channelvoidsendDifficultyToClient(NetServerHandler serverHandler, EntityPlayerMP playerMP) voidsendVersionCheckToClient(NetServerHandler serverHandler, EntityPlayerMP playerMP) Handles version checkingbooleanserverAckPacketReceived(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 checkingbooleanserverCustomPacketReceived(NetServerHandler handler, Packet250CustomPayload packet) Deprecated.voidserverPlayerConnectionInitialized(NetServerHandler serverHandler, EntityPlayerMP playerMP) Called when a player joins the worldprotected final voidspawnCustomParticle(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 typebooleanCalled when the version check packet is received by the NetClientHandler If overriding, make sure to make a call to the super method
-
Field Details
-
parentMod
protected net.fabricmc.loader.api.ModContainer parentMod -
addonName
-
versionString
-
modID
-
isRequiredClientAndServer
protected boolean isRequiredClientAndServer -
shouldVersionCheck
protected boolean shouldVersionCheck -
addonCustomPacketChannelVersionCheck
-
addonCustomPacketChannelVersionCheckAck
-
addonConfig
-
dependants
-
hasBeenInitialized
public boolean hasBeenInitialized
-
-
Constructor Details
-
BTWAddon
public BTWAddon()
-
-
Method Details
-
setup_legacy
protected final void setup_legacy() -
addResourcePackDomain
-
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
Do any initial config registration here. Use register___ to register new properties. To reference the values later, useaddonConfig's get_____ methods. -
handleConfigProperties
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 instanceworld- The current worldrand- 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
-
initializeDifficultyServer
-
initializeDifficultyClient
-
registerPacketHandler
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
Register a command for both client and server- Parameters:
command-
-
getName
-
getVersionString
-
getModID
-
sendVersionCheckToClient
Handles version checking -
sendDifficultyToClient
-
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
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
Register a server only command- Parameters:
command-
-