[Request] API
InfinityRaider opened this issue ยท 7 comments
Hello, I'm the creator of AgriCraft and I'd like to have compatibility for my crops in your farms. I've looked at the code, and at this time it'll take a lot of effort and hacks to make it happen.
So what are your thoughts on creating an API so any mod could in the future register its crops to it?
If you don't want to make it yourself, I could write what I need and create a Pull Request, however I'm not going to put effort into it if I don't know if there's any chance that it'll be accepted?
AncientWarfare farms are supporting the Minecraft/Forge API on plants:
here
and here
You shouldn't have to make any more than using the Minecraft/Forge API yourself.
If it doesn't work, i'll consider a bug and investigate properly.
You are welcome to suggest something different, but i wonder why you would do that.
I know, I looked at it, but my crops are TileEntities. They basicly wrap about any existing crop to allow them to be farmed akin to IC2 crops (on crop sticks, mutating and increasing their stats)
I'm sorry I'm not explaining well, this is not a bug, your farms are working well, a bit too well in fact.
If I insert my seeds, they get planted, they grow and get harvested, no issues there.
But the main mechanic of Agricraft is that you put crop sticks in the soil, then plant the seed on the crop sticks. When the plant is mature you right click to harvest and the growth stage gets reset. You can also crossbreed two mature plants to increase the stats of your seeds (faster growth, more fruit drops, higher resistance to weeds).
Now when your farm sees cropsticks without a plant on them, they just break them, when there is a plant planted on crop sticks, it waits until it's matured and then breaks the crops and the cropsticks and plants the seed. This is where it clashes, when a seed is planted on cropsticks, it gets an NBT tag assigned to it, I also have an event handler that denies any planting of seeds with such an NBT tag. So when they get planted by your farms, the NBT tag is lost.
So what I would do is have an interface like 'IAncientWarfareFarmable' that is implemented in the block class. This would have one method returning a List with all the drops where the harvesting logic is also done. So on your side it would first check if a block is instance of that interface, if so, forward the harvesting operations to the block. If not, continue like before.
I hope I'm making sense to you, and if I'm not, I'll try even harder to explain myself.
Placing should be working as expected though.
I understand that breaking the block is not desired in your setup.
You are welcome to make a pull request for it.