Farmers unable to farm Mystical World's Aubergine Crop
GentlemanGnu opened this issue ยท 9 comments
Minecraft Version: 1.12.2
(modded) forge-14.23.5.2847
Minecolonies version
minecolonies-1.12.2-0.10.488-RELEASE-universal
also mysticalworld-1.12.2-1.5.0
and mysticallib-1.12.2-1.4.0
Expected behavior
I expected the Minecolonies farmer to collect the aubergines, replanting as appropriate, and delivering the aubergines as if it were a vanilla crop. OR, to completely ignore the aubergines.
Actual behaviour
The farmer can plant and harvest the crop as intended, but the aubergines themselves totally disappear. The farmer is able to collect and accumulate the seeds.
https://clips.twitch.tv/BlightedMoistSalamanderRaccAttack this is a link to a twitch clip of Filthy Coin showing what is happening on his farm. He is playing the 1.0.0 version of Civitas Novelas on his server.
Steps to reproduce the problem
- set up your town and set up a farm area (as per usual gameplay for Minecolonies)
- prime the farmland with some aubergines.
- wait, and observe the farmer farming the aubergines. Check the farmers inventory
- ... Profit?? only if you want more aubergine seeds, not if you want to eat the aubergines. I have not yet checked with any other Mystical World plants.
I am hoping you are able to include compatibility with Aubergines in your mod.
Strangely enough, that is exactly what Noobanidus (mod dev for Mystical World) has said of your mod.
Well, there's no loot table for blocks in 1.12, so I don't think that comes into it. We don't do anything to specifically prevent automation of farming. I'd look into it a bit further but your code is quite large and I'm not entirely sure which AI to be checking for the functionality.
Here's the code for the BlockAubergineCrop from 1.12.2, which simply overrides BlockCrops (via an interface in MysticalLib which does nothing to the actual crop block).
It's not the cleanest piece of code, but this is the Harvest functionality that I uses in Roots (which uses Mystical World as a content provider) to perform basically "right-click" harvesting. I was unable to find reference to "fire block harvesting" in your code so I presume you are determining the item produced differently.
If you're still having trouble finding the source of the problem, I can have a look at it if you can direct me to which classes are responsible for the actual "harvesting" of the blocks.
I would guess that the mod that adds the aubergines only intends players to farm them and does something with the loot table which requires a player. If all crops work but theirs, I believe they did something wrong.
We break crop blocks, like all vanilla crops are harvested. Simply break the block and get the item(s) given for it
There are multiple ways to break blocks, though. Where exactly are you doing it? Unfortunately, I can't really check to see if there are conflicts with my mod until I can see where in your code the breaking is being done. Disregard, I've found where it's fired.
So, without installing Minecolonies, I've somewhat duplicated the system used for drops in a development environment:
In this instance, I can't create a NonNullList<> inside the debugger; however, the default (and deprecated) getDrops
function is:
NonNullList<ItemStack> ret = NonNullList.create();
getDrops(ret, world, pos, state, fortune);
return ret;
which basically replicates the pre-existing code, implying that my test should be replicating standard harvesting.
Most interestingly is the fact that the decision to drop either an aubergine or a seed (the default, base drops) is made in getItemDropped()
:
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return this.isMaxAge(state) ? this.getCrop() : this.getSeed();
}
If it's only ever collecting seeds I would presume that, for some reason, either the state being provided isn't considered "maxAge"
, or it's attempting to harvest when it's not at the maximum age.
Outside of this, I don't really see where else the error could be, as this implementation is basically identical to Vanilla crops & extends the Vanilla crops & uses the standard age property for crops, so everything you're doing should work properly.
if (crop.isMaxAge(state))
{
return true;
}
We do this check before harvesting.
NonNullList<ItemStack> drops = NonNullList.create();
state.getBlock().getDrops(drops, world, pos, state, fortune);
for (final ItemStack item : drops)
{
InventoryUtils.addItemStackToItemHandler(new InvWrapper(worker.getInventoryCitizen()), item);
}
And this when harvesting.
@noobanidus is this working now, did you figure out what the problem was?
I haven't changed anything on our end and there hasn't been a release since. I'm guessing it was some type of version discrepancy and the issue was resolved by updating to the most recent versions of everything?
Failing that, it was some sort of external mod interaction that I'm unaware of.