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