mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-20 04:19:44 +00:00
1f8b36f823
* [bs] spotless apply for jenkins * [bs] spotless apply for jenkins * spotlessApply (#6) Co-authored-by: GitHub GTNH Actions <> * Update dependencies.gradle --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Martin Robertz <[email protected]>
53 lines
1.8 KiB
Java
53 lines
1.8 KiB
Java
package modtweaker2.mods.mariculture;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraftforge.fluids.FluidStack;
|
|
import net.minecraftforge.oredict.OreDictionary;
|
|
|
|
import mariculture.api.core.FuelInfo;
|
|
import mariculture.api.core.MaricultureHandlers;
|
|
import mariculture.api.fishery.Fishing;
|
|
import mariculture.api.fishery.Loot;
|
|
import mariculture.api.fishery.Loot.Rarity;
|
|
import modtweaker2.helpers.ReflectionHelper;
|
|
|
|
public class MaricultureHelper {
|
|
|
|
public static Map<Object, FuelInfo> fuels = null;
|
|
public static HashMap<Rarity, ArrayList<Loot>> loot = null;
|
|
|
|
static {
|
|
try {
|
|
fuels = ReflectionHelper.getFinalObject(MaricultureHandlers.crucible, "fuels");
|
|
loot = ReflectionHelper.getFinalObject(Fishing.fishing, "fishing_loot");
|
|
} catch (Exception e) {}
|
|
}
|
|
|
|
private MaricultureHelper() {}
|
|
|
|
// Helper for getting the key that is used when adding/removing fuels
|
|
public static String getKey(Object o) {
|
|
if (o instanceof String) return (String) o;
|
|
else if (o instanceof ItemStack) {
|
|
String name = "";
|
|
ItemStack stack = (ItemStack) o;
|
|
if (OreDictionary.getOreIDs(stack).length > 0) {
|
|
name = OreDictionary.getOreName(OreDictionary.getOreIDs(stack)[0]);
|
|
} else if (stack.isItemStackDamageable()) {
|
|
name = Item.itemRegistry.getNameForObject(stack.getItem()) + "|ignore";
|
|
} else {
|
|
name = Item.itemRegistry.getNameForObject(stack.getItem()) + "|" + stack.getItemDamage();
|
|
}
|
|
|
|
return name;
|
|
} else if (o instanceof FluidStack) {
|
|
return ((FluidStack) o).getFluid().getName();
|
|
} else return null;
|
|
}
|
|
}
|