TechReborn/toaddback/minetweaker/MinetweakerCompat.java

81 lines
2.9 KiB
Java
Raw Normal View History

2015-07-02 21:23:01 +02:00
package techreborn.compat.minetweaker;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.item.IngredientStack;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.oredict.IOreDictEntry;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
2016-02-24 09:18:21 +01:00
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
2015-07-02 21:23:01 +02:00
import techreborn.compat.ICompatModule;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getLiquidStack;
2015-07-02 21:23:01 +02:00
public class MinetweakerCompat implements ICompatModule {
2015-11-08 13:15:45 +01:00
@Override
public void preInit(FMLPreInitializationEvent event) {
2015-11-08 13:15:45 +01:00
}
2015-11-08 13:15:45 +01:00
@Override
public void init(FMLInitializationEvent event) {
2015-11-08 13:15:45 +01:00
}
2015-11-08 13:15:45 +01:00
@Override
public void postInit(FMLPostInitializationEvent event) {
MineTweakerAPI.registerClass(MTAlloySmelter.class);
MineTweakerAPI.registerClass(MTAssemblingMachine.class);
MineTweakerAPI.registerClass(MTBlastFurnace.class);
MineTweakerAPI.registerClass(MTCentrifuge.class);
MineTweakerAPI.registerClass(MTChemicalReactor.class);
2016-02-20 01:57:57 +01:00
MineTweakerAPI.registerClass(MTIndustrialGrinder.class);
2015-11-08 13:15:45 +01:00
MineTweakerAPI.registerClass(MTImplosionCompressor.class);
MineTweakerAPI.registerClass(MTIndustrialElectrolyzer.class);
MineTweakerAPI.registerClass(MTIndustrialSawmill.class);
MineTweakerAPI.registerClass(MTPlateCuttingMachine.class);
MineTweakerAPI.registerClass(MTFusionReactor.class);
MineTweakerAPI.registerClass(MTVacuumFreezer.class);
2016-02-20 21:07:05 +01:00
MineTweakerAPI.registerClass(MTGenerator.class);
2016-03-02 14:52:17 +01:00
MineTweakerAPI.registerClass(MTRollingMachine.class);
2015-11-08 13:15:45 +01:00
}
2015-11-08 13:15:45 +01:00
@Override
public void serverStarting(FMLServerStartingEvent event) {
2015-11-08 13:15:45 +01:00
}
2015-11-08 13:15:45 +01:00
public static ItemStack toStack(IItemStack iStack) {
return getItemStack(iStack);
}
2015-11-08 13:15:45 +01:00
public static Object toObject(IIngredient iStack) {
if (iStack == null)
return null;
else {
if (iStack instanceof IOreDictEntry)
return ((IOreDictEntry) iStack).getName();
else if (iStack instanceof IItemStack)
return getItemStack((IItemStack) iStack);
else if (iStack instanceof IngredientStack) {
IIngredient ingr = ReflectionHelper.getPrivateValue(IngredientStack.class, (IngredientStack) iStack, "ingredient");
return toObject(ingr);
} else
return null;
}
}
public static FluidStack toFluidStack(ILiquidStack iStack) {
return getLiquidStack(iStack);
}
2015-07-02 21:23:01 +02:00
}