mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-18 11:39:07 +00:00
Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
This commit is contained in:
1 parent
4fd2551072
commit
ec562b62ea
187 files changed
+977
-991
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package modtweaker2.helpers;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import static modtweaker2.helpers.ReflectionHelper.*;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ForgeHelper {
|
||||
public static Map translate = null;
|
||||
public static List seeds = null;
|
||||
public static HashMap<String, ChestGenHooks> loot = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
seeds = getStaticObject(ForgeHooks.class, "seedList");
|
||||
loot = getStaticObject(ChestGenHooks.class, "chestInfo");
|
||||
translate = getFinalObject(getStaticObject(StatCollector.class, "localizedName", "field_74839_a"), "languageList", "field_74816_c");
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
private ForgeHelper() {}
|
||||
|
||||
public static Object getSeedEntry(ItemStack stack, int weight) {
|
||||
try {
|
||||
Class clazz = Class.forName("net.minecraftforge.common.ForgeHooks$SeedEntry");
|
||||
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, int.class);
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(stack, weight);
|
||||
} catch (Exception e) {
|
||||
throw new NullPointerException("Failed to instantiate SeedEntry");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLangActive(String lang) {
|
||||
return FMLCommonHandler.instance().getSide() == Side.SERVER ? null : FMLClientHandler.instance().getCurrentLanguage().equals(lang);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user