Added Feature: #0715 - Mekanism recipes
Added Feature: #0702 - Mekanism Power for Energy Acceptor
This commit is contained in:
parent
82d1f8f506
commit
9223f724bf
11 changed files with 269 additions and 44 deletions
|
@ -112,7 +112,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
|||
registerApp( 16 * 10 + 0, Settings.POWER_UNITS, PowerUnits.AE, ButtonToolTips.PowerUnits, PowerUnits.AE.unlocalizedName );
|
||||
registerApp( 16 * 10 + 1, Settings.POWER_UNITS, PowerUnits.EU, ButtonToolTips.PowerUnits, PowerUnits.EU.unlocalizedName );
|
||||
registerApp( 16 * 10 + 2, Settings.POWER_UNITS, PowerUnits.MJ, ButtonToolTips.PowerUnits, PowerUnits.MJ.unlocalizedName );
|
||||
registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.KJ, ButtonToolTips.PowerUnits, PowerUnits.KJ.unlocalizedName );
|
||||
registerApp( 16 * 10 + 3, Settings.POWER_UNITS, PowerUnits.MK, ButtonToolTips.PowerUnits, PowerUnits.MK.unlocalizedName );
|
||||
registerApp( 16 * 10 + 4, Settings.POWER_UNITS, PowerUnits.WA, ButtonToolTips.PowerUnits, PowerUnits.WA.unlocalizedName );
|
||||
registerApp( 16 * 10 + 5, Settings.POWER_UNITS, PowerUnits.RF, ButtonToolTips.PowerUnits, PowerUnits.RF.unlocalizedName );
|
||||
|
||||
|
|
|
@ -107,11 +107,10 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||
final double DEFAULT_IC2_EXCHANGE = 2.0;
|
||||
final double DEFAULT_RTC_EXCHANGE = 1.0 / 11256.0;
|
||||
final double DEFAULT_RF_EXCHANGE = 0.5;
|
||||
final double DEFAULT_MEKANISM_EXCHANGE = 0.2;
|
||||
|
||||
PowerUnits.MJ.conversionRatio = get( "PowerRatios", "BuildCraft", DEFAULT_BC_EXCHANGE ).getDouble( DEFAULT_BC_EXCHANGE );
|
||||
// PowerUnits.KJ.conversionRatio = get( "PowerRatios",
|
||||
// "UniversalElectricity", DEFAULT_UE_EXCHANGE ).getDouble(
|
||||
// DEFAULT_UE_EXCHANGE );
|
||||
PowerUnits.MK.conversionRatio = get( "PowerRatios", "Mekanism", DEFAULT_MEKANISM_EXCHANGE ).getDouble( DEFAULT_MEKANISM_EXCHANGE );
|
||||
PowerUnits.EU.conversionRatio = get( "PowerRatios", "IC2", DEFAULT_IC2_EXCHANGE ).getDouble( DEFAULT_IC2_EXCHANGE );
|
||||
PowerUnits.WA.conversionRatio = get( "PowerRatios", "RotaryCraft", DEFAULT_RTC_EXCHANGE ).getDouble( DEFAULT_RTC_EXCHANGE );
|
||||
PowerUnits.RF.conversionRatio = get( "PowerRatios", "ThermalExpansion", DEFAULT_RF_EXCHANGE ).getDouble( DEFAULT_RF_EXCHANGE );
|
||||
|
|
|
@ -147,6 +147,8 @@ import appeng.recipes.handlers.Grind;
|
|||
import appeng.recipes.handlers.GrindFZ;
|
||||
import appeng.recipes.handlers.Inscribe;
|
||||
import appeng.recipes.handlers.Macerator;
|
||||
import appeng.recipes.handlers.MekCrusher;
|
||||
import appeng.recipes.handlers.MekEnrichment;
|
||||
import appeng.recipes.handlers.Press;
|
||||
import appeng.recipes.handlers.Pulverizer;
|
||||
import appeng.recipes.handlers.Shaped;
|
||||
|
@ -191,6 +193,8 @@ public class Registration
|
|||
IRecipeHandlerRegistry recipeRegistery = AEApi.instance().registries().recipes();
|
||||
recipeRegistery.addNewSubItemResolver( new AEItemResolver() );
|
||||
|
||||
recipeRegistery.addNewCraftHandler( "mekcrusher", MekCrusher.class );
|
||||
recipeRegistery.addNewCraftHandler( "mekechamber", MekEnrichment.class );
|
||||
recipeRegistery.addNewCraftHandler( "grind", Grind.class );
|
||||
recipeRegistery.addNewCraftHandler( "crusher", Crusher.class );
|
||||
recipeRegistery.addNewCraftHandler( "grindfz", GrindFZ.class );
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
package appeng.integration;
|
||||
|
||||
|
||||
public enum IntegrationType
|
||||
{
|
||||
IC2(IntegrationSide.BOTH, "Industrial Craft 2", "IC2"),
|
||||
|
||||
|
||||
RotaryCraft(IntegrationSide.BOTH, "Rotary Craft", "RotaryCraft"),
|
||||
|
||||
|
||||
RC(IntegrationSide.BOTH, "Railcraft", "Railcraft"),
|
||||
|
||||
BC(IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon"),
|
||||
|
||||
MJ6(IntegrationSide.BOTH, "BuildCraft6 Power", null),
|
||||
|
||||
MJ5( IntegrationSide.BOTH, "BuildCraft5 Power", null ),
|
||||
|
||||
RF(IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", null),
|
||||
|
||||
RFItem( IntegrationSide.BOTH, "RedstoneFlux Power - Items", null ),
|
||||
|
||||
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
|
||||
|
||||
DSU( IntegrationSide.BOTH, "Deep Storage Unit", null ),
|
||||
|
||||
FZ( IntegrationSide.BOTH, "Factorization", "factorization" ),
|
||||
|
||||
FMP( IntegrationSide.BOTH, "Forge MultiPart", "McMultipart" ),
|
||||
|
||||
RB( IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks" ),
|
||||
|
||||
CLApi( IntegrationSide.BOTH, "Colored Lights Core", "coloredlightscore" ),
|
||||
|
||||
Waila( IntegrationSide.CLIENT, "Waila", "Waila" ),
|
||||
|
||||
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
|
||||
|
||||
NEI( IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems" ),
|
||||
|
||||
CraftGuide( IntegrationSide.CLIENT, "Craft Guide", "craftguide" );
|
||||
|
||||
MJ6(IntegrationSide.BOTH, "BuildCraft6 Power", null),
|
||||
|
||||
MJ5(IntegrationSide.BOTH, "BuildCraft5 Power", null),
|
||||
|
||||
RF(IntegrationSide.BOTH, "RedstoneFlux Power - Tiles", null),
|
||||
|
||||
RFItem(IntegrationSide.BOTH, "RedstoneFlux Power - Items", null),
|
||||
|
||||
MFR(IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded"),
|
||||
|
||||
DSU(IntegrationSide.BOTH, "Deep Storage Unit", null),
|
||||
|
||||
FZ(IntegrationSide.BOTH, "Factorization", "factorization"),
|
||||
|
||||
FMP(IntegrationSide.BOTH, "Forge MultiPart", "McMultipart"),
|
||||
|
||||
RB(IntegrationSide.BOTH, "Rotatable Blocks", "RotatableBlocks"),
|
||||
|
||||
CLApi(IntegrationSide.BOTH, "Colored Lights Core", "coloredlightscore"),
|
||||
|
||||
Waila(IntegrationSide.CLIENT, "Waila", "Waila"),
|
||||
|
||||
InvTweaks(IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks"),
|
||||
|
||||
NEI(IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems"),
|
||||
|
||||
CraftGuide(IntegrationSide.CLIENT, "Craft Guide", "craftguide"),
|
||||
|
||||
Mekanism(IntegrationSide.BOTH, "Mekanism", "Mekanism");
|
||||
|
||||
public final IntegrationSide side;
|
||||
public final String dspName;
|
||||
public final String modID;
|
||||
|
||||
private IntegrationType( IntegrationSide side, String Name, String modid ) {
|
||||
|
||||
private IntegrationType(IntegrationSide side, String Name, String modid) {
|
||||
this.side = side;
|
||||
this.dspName = Name;
|
||||
this.modID = modid;
|
||||
|
|
|
@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack;
|
|||
public interface IMekanism
|
||||
{
|
||||
|
||||
void addMaceratorRecipe(ItemStack in, ItemStack out);
|
||||
void addCrusherRecipe(ItemStack in, ItemStack out);
|
||||
|
||||
void addEnrichmentChamberRecipe(ItemStack in, ItemStack out);
|
||||
|
||||
}
|
||||
|
|
37
integration/modules/Mekanism.java
Normal file
37
integration/modules/Mekanism.java
Normal file
|
@ -0,0 +1,37 @@
|
|||
package appeng.integration.modules;
|
||||
|
||||
import mekanism.api.RecipeHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
|
||||
public class Mekanism extends BaseModule implements IMekanism
|
||||
{
|
||||
|
||||
public static Mekanism instance;
|
||||
|
||||
@Override
|
||||
public void Init() throws Throwable
|
||||
{
|
||||
TestClass( mekanism.api.energy.IStrictEnergyAcceptor.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit() throws Throwable
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCrusherRecipe(ItemStack in, ItemStack out)
|
||||
{
|
||||
RecipeHelper.addCrusherRecipe( in, out );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addEnrichmentChamberRecipe(ItemStack in, ItemStack out)
|
||||
{
|
||||
RecipeHelper.addEnrichmentChamberRecipe( in, out );
|
||||
}
|
||||
|
||||
}
|
72
recipes/handlers/MekCrusher.java
Normal file
72
recipes/handlers/MekCrusher.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package appeng.recipes.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class MekCrusher implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient pro_input;
|
||||
IIngredient pro_output[];
|
||||
|
||||
@Override
|
||||
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
|
||||
{
|
||||
if ( input.size() == 1 && output.size() == 1 )
|
||||
{
|
||||
int outs = output.get( 0 ).size();
|
||||
if ( input.get( 0 ).size() == 1 && outs == 1 )
|
||||
{
|
||||
pro_input = input.get( 0 ).get( 0 );
|
||||
pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
new RecipeError( "MekCrusher must have a single input, and single output." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
|
||||
{
|
||||
IMekanism rc = (IMekanism) AppEng.instance.getIntegration( IntegrationType.Mekanism );
|
||||
for (ItemStack is : pro_input.getItemStackSet())
|
||||
{
|
||||
try
|
||||
{
|
||||
rc.addCrusherRecipe( is, pro_output[0].getItemStack() );
|
||||
}
|
||||
catch (java.lang.RuntimeException err)
|
||||
{
|
||||
AELog.info( "Mekanism not happy - " + err.getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern(RecipeHandler h)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
72
recipes/handlers/MekEnrichment.java
Normal file
72
recipes/handlers/MekEnrichment.java
Normal file
|
@ -0,0 +1,72 @@
|
|||
package appeng.recipes.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IMekanism;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class MekEnrichment implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
IIngredient pro_input;
|
||||
IIngredient pro_output[];
|
||||
|
||||
@Override
|
||||
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
|
||||
{
|
||||
if ( input.size() == 1 && output.size() == 1 )
|
||||
{
|
||||
int outs = output.get( 0 ).size();
|
||||
if ( input.get( 0 ).size() == 1 && outs == 1 )
|
||||
{
|
||||
pro_input = input.get( 0 ).get( 0 );
|
||||
pro_output = output.get( 0 ).toArray( new IIngredient[outs] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
new RecipeError( "MekCrusher must have a single input, and single output." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.Mekanism ) )
|
||||
{
|
||||
IMekanism rc = (IMekanism) AppEng.instance.getIntegration( IntegrationType.Mekanism );
|
||||
for (ItemStack is : pro_input.getItemStackSet())
|
||||
{
|
||||
try
|
||||
{
|
||||
rc.addEnrichmentChamberRecipe( is, pro_output[0].getItemStack() );
|
||||
}
|
||||
catch (java.lang.RuntimeException err)
|
||||
{
|
||||
AELog.info( "Mekanism not happy - " + err.getMessage() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack output) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( pro_output[0].getItemStack(), output );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern(RecipeHandler h)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package appeng.tile.powersink;
|
||||
|
||||
public abstract class AEBasePoweredTile extends RedstoneFlux
|
||||
public abstract class AEBasePoweredTile extends MekJoules
|
||||
{
|
||||
|
||||
}
|
||||
|
|
43
tile/powersink/MekJoules.java
Normal file
43
tile/powersink/MekJoules.java
Normal file
|
@ -0,0 +1,43 @@
|
|||
package appeng.tile.powersink;
|
||||
|
||||
import mekanism.api.energy.IStrictEnergyAcceptor;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
|
||||
@Interface(iname = "Mekanism", iface = "mekanism.api.energy.IStrictEnergyAcceptor")
|
||||
public abstract class MekJoules extends RedstoneFlux implements IStrictEnergyAcceptor {
|
||||
|
||||
@Override
|
||||
public double getEnergy() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergy(double energy) {
|
||||
double extra = injectExternalPower( PowerUnits.MK, energy );
|
||||
internalCurrentPower += PowerUnits.MK.convertTo(PowerUnits.AE, extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxEnergy() {
|
||||
return this.getExternalPowerDemand( PowerUnits.MK, 100000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double transferEnergyToAcceptor(ForgeDirection side, double amount)
|
||||
{
|
||||
double demand = getExternalPowerDemand( PowerUnits.MK, Double.MAX_VALUE );
|
||||
if ( amount > demand )
|
||||
amount = demand;
|
||||
|
||||
double overflow = injectExternalPower( PowerUnits.MK, amount );
|
||||
return amount - overflow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveEnergy(ForgeDirection side) {
|
||||
return getPowerSides().contains(side);
|
||||
}
|
||||
|
||||
}
|
|
@ -152,12 +152,8 @@ public class Platform
|
|||
if ( displayUnits == PowerUnits.WA )
|
||||
unitName = "J";
|
||||
|
||||
if ( displayUnits == PowerUnits.KJ )
|
||||
{
|
||||
Lvl = preFixes[offset];
|
||||
if ( displayUnits == PowerUnits.MK )
|
||||
unitName = "J";
|
||||
offset++;
|
||||
}
|
||||
|
||||
while (p > 1000 && offset < preFixes.length)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue