-
Notifications
You must be signed in to change notification settings - Fork 25
Integrating plants with AppleCore
Ryan Liptak edited this page Dec 10, 2017
·
7 revisions
In Minecraft versions 1.10.2 and newer, AppleCore's plant growth events have been deprecated in favor of Forge's net.minecraftforge.event.world.BlockEvent.CropGrowEvent
Note: This is only relevant if your Block class either does not extend BlockCrops or overrides BlockCrops.updateTick without calling super.updateTick. If you use the default BlockCrops.updateTick implementation, your plant growth ticks will fire the relevant AppleCore events automatically.
A general checklist for manual integration:
- For each attempted growth tick of your plant, AppleCore's
PlantGrowthEvent.AllowGrowthTickshould be fired (this can be done by callingAppleCoreAPI.dispatcher.validatePlantGrowth). - The result of the
PlantGrowthEvent.AllowGrowthTickevent should be handled in the following way:
-
Event.Result.ALLOW: always allow the growth tick without condition -
Event.Result.DEFAULT: continue with the conditionals as normal -
Event.Result.DENY: always disallow the growth tick
- After a successful growth tick (and its effects), AppleCore's
PlantGrowthEvent.GrowthTickshould be fired (this can be done by callingAppleCoreAPI.dispatcher.announcePlantGrowth).
An example implementation can be found here: