Feature Request - Added support for other grass seeds
Mictali opened this issue ยท 1 comments
I was looking to be able to get seeds from some mods when I broke grass (either long grass or grass blocks with the hoe) and only one mod seemed to have a single seed registered with the seedList so I made a minor change to the current code locally that I thought I'd share.
First I subclassed GameObject with one called WeightedGameObject simply to add an additional weight parameter to provide varying random values for newly registered seeds.
public class WeightedGameObject extends GameObject {
public int weight = 10;
}
In HOJsonData I added a new array:
public List<WeightedGameObject> grassSeedsList;
which now lets me add to a custom json file an entry like:
"grassSeedsList": [
{ "name":"etfuturum:beetroot_seeds", "meta": 3, "weight":5}
]
Then inside the JsonModule's init() method in the loop processing the HOJsonData, I added an additional code block:
if (h.grassSeedsList != null)
{
for (WeightedGameObject gameObj : h.grassSeedsList)
{
ItemStack seeds = gameObj.toItemStack();
if(seeds != null ) {
MinecraftForge.addGrassSeed(seeds, gameObj.weight);
}
}
}
Now these seeds will be available when breaking long grass or right clicking the grass block.