Better Animals Plus

Better Animals Plus

22M Downloads

Pam's HarvestCraft integration

Dabombber opened this issue ยท 1 comments

commented

Better Animals Plus and Pam's HarvestCraft could complement each other quite well, one adding the mobs and the other adding potential drops. It's already somewhat possible to get them to work together, but this requires a number of additional mods (CraftTweaker, LootTweaker, HungerTweaker). It'd be nice if Better Animals Plus could support Pam's HarvestCraft natively.

Hopefully there wouldn't be too much work involved, just checking if HarvestCraft is installed and change the loot tables/recipes, perhaps with a config value to enable/disable the switch.

For reference, here's a CraftTweaker zenscript which makes the required changes (minecraft 1.12).

animals.zs

// config/betteranimalsplus.cfg > its_meow > betteranimalsplus > common > entity > entitycoyote/entityfox > S:tameItems
// harvestcraft:turkeyrawitem
// harvestcraft:turkeycookeditem

// Change goat cheese recipe to match pams cheese, transformations not necessary but kept for clarity
recipes.remove(<betteranimalsplus:goatcheese>);
recipes.addShapeless("pamgoatcheese", <betteranimalsplus:goatcheese>, [<harvestcraft:potitem>.reuse(), <betteranimalsplus:goatmilk>.transformReplace(<minecraft:bucket>), <harvestcraft:saltitem>]);

// Change hunger values to match pams cheese
<betteranimalsplus:goatcheese>.foodValues.setHunger(<harvestcraft:cheeseitem>.foodValues.hunger);
<betteranimalsplus:goatcheese>.foodValues.setSaturationModifier(<harvestcraft:cheeseitem>.foodValues.saturationModifier);

// Change loot tables to drop pams items
replaceDrop("crab", "betteranimalsplus:crab_meat_raw", <harvestcraft:crabrawitem>);
replaceDrop("deer", "betteranimalsplus:venisonraw", <harvestcraft:venisonrawitem>);
replaceDrop("reindeer", "betteranimalsplus:venisonraw", <harvestcraft:venisonrawitem>);
replaceDrop("pheasant", "betteranimalsplus:pheasantraw", <harvestcraft:turkeyrawitem>);
replaceDrop("lamprey", "minecraft:fish", <harvestcraft:eelrawitem>);
// snail might be closer than shrimp but eww
replaceDrop("nautilus", "minecraft:fish", <harvestcraft:shrimprawitem>);

// Remove unused food items
mods.jei.JEI.removeAndHide(<betteranimalsplus:crab_meat_raw>);
mods.jei.JEI.removeAndHide(<betteranimalsplus:crab_meat_cooked>);
mods.jei.JEI.removeAndHide(<betteranimalsplus:venisonraw>);
mods.jei.JEI.removeAndHide(<betteranimalsplus:venisoncooked>);
mods.jei.JEI.removeAndHide(<betteranimalsplus:pheasantraw>);
mods.jei.JEI.removeAndHide(<betteranimalsplus:pheasantcooked>);

// Change rave recipe to use pams crab meat
recipes.remove(<betteranimalsplus:record_crab_rave>);
recipes.addHiddenShapeless("pamcrabrave", <betteranimalsplus:record_crab_rave>, [<harvestcraft:crabrawitem>, <minecraft:record_cat>]);

// Add drops for mobs with matching pams items
<entity:betteranimalsplus:jellyfish>.addDrop(<harvestcraft:jellyfishrawitem>, 1, 2);
<entity:betteranimalsplus:squirrel>.addDropFunction(function(entity, dmgSource) {
		// Drop different nuts in biomes based on a quick skim over their respective wikis. Unlikely to be accurate, evenly distributed, or even useful
		val biome = entity.world.getBiome(entity.position);
		var nut = <harvestcraft:peanutitem>;
		if(biome.isSnowyBiome) {
			nut = biome.highHumidity ? <harvestcraft:pistachioitem> : <harvestcraft:chestnutitem>;
		} else if (biome.highHumidity) {
			nut = biome.canRain ? (biome.baseHeight <= 70.00 ? <harvestcraft:walnutitem> : <harvestcraft:almonditem>) : <harvestcraft:pecanitem>;
		} else if(biome.baseHeight <= 70.00) {
			nut = <harvestcraft:cashewitem>;
		}
		return nut * 2;
	});

// Helper function
function replaceDrop(loot_table as string, old_item as string, new_item as crafttweaker.item.IItemStack) {
	val pool = loottweaker.vanilla.loot.LootTables.getTableUnchecked("betteranimalsplus:" + loot_table).getPool(loot_table);
	pool.removeEntry(old_item);
	pool.addItemEntryHelper(new_item, 2, 0, [
			loottweaker.vanilla.loot.Functions.setCount(1, 3),
			loottweaker.vanilla.loot.Functions.lootingEnchantBonus(0, 1, 0),
			loottweaker.vanilla.loot.Functions.parse({"function": "minecraft:furnace_smelt", "conditions": [{"properties": {"minecraft:on_fire": true}, "entity": "this", "condition": "minecraft:entity_properties"}]})
		], []);
}

commented

hm... uhh, well that's a lot of changes to make, especially conditionally. recipes and loot tables I believe have conditions but that is a lot of conditions to implement. As much as I'd like this I don't think it's a sensible amount of work especially if you can already do it with scripts.