2015-07-02 20:23:01 +01:00
|
|
|
package techreborn.compat.minetweaker;
|
|
|
|
|
|
|
|
import minetweaker.MineTweakerAPI;
|
2015-08-27 08:55:34 +01:00
|
|
|
import minetweaker.api.item.IIngredient;
|
|
|
|
import minetweaker.api.item.IItemStack;
|
|
|
|
import minetweaker.api.item.IngredientStack;
|
2015-08-27 10:22:17 +01:00
|
|
|
import minetweaker.api.liquid.ILiquidStack;
|
2015-08-27 08:55:34 +01:00
|
|
|
import minetweaker.api.oredict.IOreDictEntry;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2015-08-27 10:22:17 +01:00
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2016-02-24 08:18:21 +00: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 20:23:01 +01:00
|
|
|
import techreborn.compat.ICompatModule;
|
|
|
|
|
2016-03-13 15:37:55 +00:00
|
|
|
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
|
|
|
import static minetweaker.api.minecraft.MineTweakerMC.getLiquidStack;
|
|
|
|
|
2015-07-02 20:23:01 +01:00
|
|
|
|
2015-08-27 08:55:34 +01:00
|
|
|
public class MinetweakerCompat implements ICompatModule {
|
2015-11-08 12:15:45 +00:00
|
|
|
@Override
|
|
|
|
public void preInit(FMLPreInitializationEvent event) {
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
}
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
@Override
|
|
|
|
public void init(FMLInitializationEvent event) {
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
}
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00: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 00:57:57 +00:00
|
|
|
MineTweakerAPI.registerClass(MTIndustrialGrinder.class);
|
2015-11-08 12:15:45 +00:00
|
|
|
MineTweakerAPI.registerClass(MTImplosionCompressor.class);
|
|
|
|
MineTweakerAPI.registerClass(MTIndustrialElectrolyzer.class);
|
|
|
|
MineTweakerAPI.registerClass(MTIndustrialSawmill.class);
|
|
|
|
MineTweakerAPI.registerClass(MTPlateCuttingMachine.class);
|
2015-11-17 08:24:41 +00:00
|
|
|
MineTweakerAPI.registerClass(MTFusionReactor.class);
|
2015-11-17 21:48:06 +00:00
|
|
|
MineTweakerAPI.registerClass(MTVacuumFreezer.class);
|
2016-02-20 20:07:05 +00:00
|
|
|
MineTweakerAPI.registerClass(MTGenerator.class);
|
2016-03-02 13:52:17 +00:00
|
|
|
MineTweakerAPI.registerClass(MTRollingMachine.class);
|
2015-11-08 12:15:45 +00:00
|
|
|
}
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
@Override
|
|
|
|
public void serverStarting(FMLServerStartingEvent event) {
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
}
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00:00
|
|
|
public static ItemStack toStack(IItemStack iStack) {
|
|
|
|
return getItemStack(iStack);
|
|
|
|
}
|
2015-08-27 08:55:34 +01:00
|
|
|
|
2015-11-08 12:15:45 +00: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 20:23:01 +01:00
|
|
|
|
|
|
|
}
|