diff options
author | â€huajijam <strhuaji@gmail.com> | 2019-02-05 12:26:34 +0800 |
---|---|---|
committer | â€huajijam <strhuaji@gmail.com> | 2019-02-05 12:26:34 +0800 |
commit | 40d7e5da9f5b84213e2c3e4596fdc69b94bd523e (patch) | |
tree | 900ad3e45065d8ab8229d0f01823054d3b99583f /src/Java/gtPlusPlus/xmod | |
parent | 8e8a95f5a047a192a64d1e85fb297debac3decbc (diff) | |
parent | 3187b70de7bd7bb6eee323dd0f7f9e191fd8e7cf (diff) | |
download | GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.tar.gz GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.tar.bz2 GT5-Unofficial-40d7e5da9f5b84213e2c3e4596fdc69b94bd523e.zip |
Automatic synchronization
Diffstat (limited to 'src/Java/gtPlusPlus/xmod')
18 files changed, 863 insertions, 75 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 068f47e0c4..c228364149 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -544,6 +544,9 @@ public enum GregtechItemList implements GregtechItemContainer { //GT RTG RTG, + //Plasma Tank + Plasma_Tank, + //---------------------------------------------------------------------------- diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 621918b370..d5b484e314 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -198,4 +198,42 @@ public interface IGregtech_RecipeAdder { public boolean addBrewingRecipe(int aCircuit, FluidStack aInput, FluidStack aOutput, int aTime, int aEu, boolean aHidden); public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aDust, ItemStack aOutput); + + public void addFluidExtractionRecipe(ItemStack input, Object input2, FluidStack output, int aTime, int aEu, int aSpecial); + + /** + * Adds a Fusion reactor Recipe + * + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, int aFusionDurationInTicks, int aEu, int aSpecial); + /** + * Adds a Fusion reactor Recipe + * + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + public boolean addFusionReactorRecipe(FluidStack aInputStackA, FluidStack aInputStackB, FluidStack plasma, int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial); + /** + * Adds a Fusion reactor Recipe + * + * @param aInput1 = first Input (not null, and respects StackSize) + * @param aInput2 = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index 939cac2779..47e4a7ae53 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -23,7 +23,7 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { public BaseCustomTileEntity() { super(); - Logger.INFO("Created new BaseCustomTileEntity"); + Logger.MACHINE_INFO("Created new BaseCustomTileEntity"); } public void writeToNBT(NBTTagCompound aNBT) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java index 0b8cb10606..a4440114e8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -10,7 +10,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { public BaseCustomPower_MTE() { super(); - Logger.INFO("Created new BaseCustomPower_MTE"); + Logger.MACHINE_INFO("Created new BaseCustomPower_MTE"); } public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java index ba98af25f7..8b7ccc202a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -29,7 +29,7 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { public void doExplosion(long aExplosionPower) { if (MathUtils.randInt(1, 10) > 0) { - Logger.INFO("Machine tried to explode, let's stop that. xo"); + //Logger.INFO("Machine tried to explode, let's stop that. xo"); return; } @@ -70,7 +70,7 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { public void onExplosion() { if (MathUtils.randInt(1, 10) > 0) { - Logger.INFO("Machine tried to explode, let's stop that. xo"); + //Logger.INFO("Machine tried to explode, let's stop that. xo"); return; } // TODO Auto-generated method stub diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java new file mode 100644 index 0000000000..d5180ef4e1 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GTPP_Recipe.java @@ -0,0 +1,38 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; + +public class GT_MetaTileEntity_BasicMachine_GTPP_Recipe extends GT_MetaTileEntity_BasicMachine_GT_Recipe { + + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(int aID, String aName, String aNameRegional, int aTier, + String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, + int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) { + super(aID, aName, aNameRegional, aTier, aDescription, aRecipes, aInputSlots, aOutputSlots, aTankCapacity, + aGUIParameterA, aGUIParameterB, aGUIName, aSound, aSharedTank, aRequiresFluidForFiltering, aSpecialEffect, + aOverlays, aRecipe); + } + + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String aDescription, + GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { + super(aName, aTier, aDescription, aRecipes, aInputSlots, aOutputSlots, aTankCapacity, aAmperage, aGUIParameterA, + aGUIParameterB, aTextures, aGUIName, aNEIName, aSound, aSharedTank, aRequiresFluidForFiltering, aSpecialEffect); + } + + public GT_MetaTileEntity_BasicMachine_GTPP_Recipe(String aName, int aTier, String[] aDescription, + GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, + int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, + String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) { + super(aName, aTier, aDescription, aRecipes, aInputSlots, aOutputSlots, aTankCapacity, aAmperage, aGUIParameterA, + aGUIParameterB, aTextures, aGUIName, aNEIName, aSound, aSharedTank, aRequiresFluidForFiltering, aSpecialEffect); + } + + + + + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java new file mode 100644 index 0000000000..aeae474fb7 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Plasma.java @@ -0,0 +1,220 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import java.lang.reflect.Field; + +import com.google.common.collect.BiMap; + +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GT_MetaTileEntity_Hatch_Plasma extends GT_MetaTileEntity_Hatch_Input { + + public final AutoMap<Fluid> mFluidsToUse = new AutoMap<Fluid>(); + public final int mFluidCapacity; + private int mTotalPlasmaSupported = -1; + + public GT_MetaTileEntity_Hatch_Plasma(final int aID, final String aName, final String aNameRegional) { + super(aID, aName, aNameRegional, 6); + mFluidCapacity = 256000; + initHatch(); + } + + public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String aDescription, + final ITexture[][][] aTextures) { + super(aName, 6, aDescription, aTextures); + mFluidCapacity = 256000; + initHatch(); + } + + public GT_MetaTileEntity_Hatch_Plasma(final String aName, final String[] aDescription, + final ITexture[][][] aTextures) { + super(aName, 6, aDescription[0], aTextures); + mFluidCapacity = 256000; + initHatch(); + } + + private void initHatch() { + + //Get all Plasmas, but the easiest way to do this is to just ask the Fluid Registry what exists and filter through them lazily. + Field fluidNameCache; + try { + fluidNameCache = ReflectionUtils.getField(FluidRegistry.class, "fluidNames"); + } catch (NoSuchFieldException e) { + fluidNameCache = null; + } + AutoMap<String> mValidPlasmaNameCache = new AutoMap<String>(); + if (fluidNameCache != null) { + try { + Object fluidNames = fluidNameCache.get(null); + if (fluidNames != null) { + try { + @SuppressWarnings("unchecked") + BiMap<Integer, String> fluidNamesMap = (BiMap<Integer, String>) fluidNames; + if (fluidNamesMap != null) { + for (String g : fluidNamesMap.values()) { + if (g.toLowerCase().contains("plasma")) { + mValidPlasmaNameCache.put(g); + } + } + } + } catch (ClassCastException e) { + } + } + } catch (IllegalArgumentException | IllegalAccessException e) { + } + } + + AutoMap<Fluid> mPlasmaCache = new AutoMap<Fluid>(); + if (!mValidPlasmaNameCache.isEmpty()) { + for (String y : mValidPlasmaNameCache) { + Fluid t = FluidRegistry.getFluid(y); + if (t != null) { + if (t.getTemperature() > 1000) { + mPlasmaCache.put(t); + } + } + } + } + + if (!mPlasmaCache.isEmpty()) { + for (Fluid w : mPlasmaCache) { + mFluidsToUse.put(w); + } + } + + + + + + } + + public ITexture[] getTexturesActive(final ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture }; + } + + public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture }; + } + + public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, + final ItemStack aStack) { + if (aSide == aBaseMetaTileEntity.getFrontFacing() && aIndex == 0) { + for (Fluid f : mFluidsToUse) { + if (f != null) { + if (GT_Utility.getFluidForFilledItem(aStack, true).getFluid() == f) { + return true; + } + } + } + } + return false; + } + + public boolean isFluidInputAllowed(final FluidStack aFluid) { + for (Fluid f : mFluidsToUse) { + if (f != null) { + if (aFluid.getFluid() == f) { + return true; + } + } + } + return false; + } + + public int getCapacity() { + return this.mFluidCapacity; + } + + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return (MetaTileEntity) new GT_MetaTileEntity_Hatch_Plasma(this.mName, this.mDescription, this.mTextures); + } + + @Override + public String[] getDescription() { + + if (mTotalPlasmaSupported < 0) { + if (mFluidsToUse.isEmpty()) { + mTotalPlasmaSupported = 0; + } + else { + mTotalPlasmaSupported = mFluidsToUse.size(); + } + } + + String aX = EnumChatFormatting.GRAY+""; + String a1 = EnumChatFormatting.GOLD+"Refined containment"+aX; + String a2 = EnumChatFormatting.GOLD+"Capacity: "+EnumChatFormatting.DARK_AQUA+getCapacity()+"L"+aX; + String a3 = EnumChatFormatting.GOLD+"Supports "+EnumChatFormatting.DARK_RED+mTotalPlasmaSupported+EnumChatFormatting.GOLD+" types of plasma"+aX; + + + + String[] s2 = new String[]{ + a1, a2, a3 + }; + return s2; + } + + @Override + public boolean doesFillContainers() { + return true; + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + // TODO Auto-generated method stub + return super.getTextureSet(aTextures); + } + + private Field F1, F2; + + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + byte a1 = 0, a2 = 0; + try { + if (F1 == null) { + F1 = ReflectionUtils.getField(getClass(), "actualTexture"); + } + if (F2 == null) { + F2 = ReflectionUtils.getField(getClass(), "mTexturePage"); + } + + if (F1 != null) { + a1 = F1.getByte(this); + } + if (F2 != null) { + a2 = F2.getByte(this); + } + } + catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException n) {} + + int textureIndex = a1 | a2 << 7; + byte texturePointer = (byte) (a1 & 127); + + + + if (aSide == 1 || aSide == 0) { + ITexture g = textureIndex > 0 ? StaticFields59.getCasingTexturePages(a2, texturePointer) : BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]; + + return new ITexture[] {g}; + } + + return aSide != aFacing ? + (textureIndex > 0 ? new ITexture[] { StaticFields59.getCasingTexturePages(a2, texturePointer) } : new ITexture[] { BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1] }) + : (textureIndex > 0 ? (aActive ? this.getTexturesActive(StaticFields59.getCasingTexturePages(a2, texturePointer)) : this.getTexturesInactive(StaticFields59.getCasingTexturePages(a2, texturePointer))) + : (aActive ? this.getTexturesActive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]) : this.getTexturesInactive(BlockIcons.MACHINE_CASINGS[this.mTier][aColorIndex + 1]))); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 892f8f332a..04c1cf34cc 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -74,8 +74,8 @@ GT_MetaTileEntity_MultiBlockBase { Method a08 = findRecipe08 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class); Method a09 = findRecipe09 = ReflectionUtils.getMethod(GT_Recipe_Map.class, "findRecipe", IHasWorldObjectAndCoords.class, GT_Recipe.class, boolean.class, boolean.class, long.class, FluidStack[].class, ItemStack.class, ItemStack[].class); - Logger.INFO("Found .08 findRecipe method? "+(a08 != null)); - Logger.INFO("Found .09 findRecipe method? "+(a09 != null)); + Logger.MACHINE_INFO("Found .08 findRecipe method? "+(a08 != null)); + Logger.MACHINE_INFO("Found .09 findRecipe method? "+(a09 != null)); //gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...) @@ -709,7 +709,7 @@ GT_MetaTileEntity_MultiBlockBase { public boolean isMachineRunning() { boolean aRunning = this.getBaseMetaTileEntity().isActive(); - Logger.INFO("Queried Multiblock is currently running: "+aRunning); + log("Queried Multiblock is currently running: "+aRunning); return aRunning; } @@ -1552,7 +1552,7 @@ GT_MetaTileEntity_MultiBlockBase { return true; } else { - Logger.INFO("Found meta Tile: "+aMetaTileID); + log("Found meta Tile: "+aMetaTileID); } } } @@ -1561,17 +1561,17 @@ GT_MetaTileEntity_MultiBlockBase { return true; } else if (aFoundBlock != aExpectedBlock) { - Logger.INFO("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta); - Logger.INFO("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); + log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta); + log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); return false; } else if (aFoundMeta != aExpectedMeta) { - Logger.INFO("A2"); + log("A2"); return false; } } - Logger.INFO("A3"); + log("A3"); return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java index bc067a5e53..0178bac4da 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/ChargingHelper.java @@ -406,7 +406,7 @@ public class ChargingHelper { return mEntity.getEUVar(); } - public boolean isItemValid(final ItemStack itemstack) { + public static boolean isItemValid(final ItemStack itemstack) { if (itemstack == null){ return false; } @@ -419,7 +419,7 @@ public class ChargingHelper { return false; } - public boolean accepts(final ItemStack stack) { + public static boolean accepts(final ItemStack stack) { if (stack == null) { return false; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java index c4ef545b09..e721761d82 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialMixer.java @@ -12,6 +12,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; @@ -111,20 +112,7 @@ extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(final ItemStack aStack) { - for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { - ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); - tBus.mRecipeMap = getRecipeMap(); - if (isValidMetaTileEntity(tBus)) { - for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { - if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) - tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - - if (checkRecipeGeneric(tBusItems.toArray(new ItemStack[]{}), new FluidStack[]{}, - (8 * GT_Utility.getTier(this.getMaxInputVoltage())), 100, 250, 10000)) return true; - } - return false; + return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 250); } @Override @@ -152,31 +140,40 @@ extends GregtechMeta_MultiBlockBase { for (int j = -1; j < 2; j++) { for (int h = -1; h < 3; h++) { if ((h != 0) || ((((xDir + i) != 0) || ((zDir + j) != 0)) && ((i != 0) || (j != 0)))) { + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - if ((!this.addToMachineList(tTileEntity, CASING_TEXTURE_ID)) && (!this.addMufflerToMachineList(tTileEntity, CASING_TEXTURE_ID)) && (!this.addInputToMachineList(tTileEntity, CASING_TEXTURE_ID)) && (!this.addOutputToMachineList(tTileEntity, CASING_TEXTURE_ID)) && (!this.addEnergyInputToMachineList(tTileEntity, CASING_TEXTURE_ID))) { - final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (h == 0 || h == 1){ - if (i == 0 && j == 0){ - if (((tBlock != GregTech_API.sBlockCasings4) || (tMeta != 11))) { - return false; - } - tAmount++; + final Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); + final byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + + if (h == 0 || h == 1) { + if (i == 0 && j == 0){ + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, false, tBlock, tMeta, GregTech_API.sBlockCasings4, 11)) { + Logger.INFO("Inner casings missing"); + return false; } else { - if (((tBlock != ModBlocks.blockCasings3Misc) || (tMeta != 2))) { - return false; - } tAmount++; } } else { - if (((tBlock != ModBlocks.blockCasings3Misc) || (tMeta != 2))) { + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, tBlock, tMeta, ModBlocks.blockCasings3Misc, 2)) { + Logger.INFO("Middle layer casings missing"); return false; } - tAmount++; + else { + tAmount++; + } } } + else { + if (!isValidBlockForStructure(tTileEntity, CASING_TEXTURE_ID, true, tBlock, tMeta, ModBlocks.blockCasings3Misc, 2)) { + Logger.INFO("Top Or Bottom casings missing"); + return false; + } + else { + tAmount++; + } + } } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java index 7fdabceebb..e4f984ee18 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_EBF.java @@ -254,15 +254,14 @@ public class GregtechMetaTileEntity_Adv_EBF extends GregtechMeta_MultiBlockBase if (!isValidBlockForStructure(null, CASING_TEXTURE_ID, false, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), StaticFields59.getBlockCasings5(), tUsedMeta)) { Logger.INFO("Heating Coils missing."); return false; - } - - //Top Layer - final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) { - Logger.INFO("Top Layer missing."); - return false; - } - + } + } + + //Top Layer + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, CASING_TEXTURE_ID, true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasings3Misc, 11)) { + Logger.INFO("Top Layer missing."); + return false; } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java new file mode 100644 index 0000000000..6ec95ff16b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_MiniFusionPlant.java @@ -0,0 +1,385 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; + +import java.util.ArrayList; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Plasma; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +public class GregtechMTE_MiniFusionPlant extends GregtechMeta_MultiBlockBase { + + public long currentVoltage = GT_Values.V[7]; + public byte currentTier = 8; + + public void upvolt() { + byte f = currentTier; + if ((f+1) > 10) { + f = 8; + } + else { + f++; + } + this.currentTier = f; + updateVoltage(); + } + + public void downvolt() { + byte f = currentTier; + if ((f-1) < 8) { + f = 10; + } + else { + f--; + } + this.currentTier = f; + updateVoltage(); + } + + private long updateVoltage() { + this.currentVoltage = GT_Values.V[this.currentTier-1]; + return currentVoltage; + } + + public GregtechMTE_MiniFusionPlant(String aName) { + super(aName); + } + + public GregtechMTE_MiniFusionPlant(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMTE_MiniFusionPlant(this.mName); + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + if (aSide == this.getBaseMetaTileEntity().getBackFacing()) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[(int) this.getInputTier()]}; + } + if (aSide == 1) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[(int) this.getOutputTier()]}; + } + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)], + new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[TAE.GTPP_INDEX(28)]}; + } + + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes; + } + + @Override + public boolean hasSlotInGUI() { + return false; + } + + @Override + public String getCustomGUIResourceName() { + return null; + } + + @Override + public String getMachineType() { + return "Fusion Reactor"; + } + + @Override + public String[] getTooltip() { + return new String[] { + "Small scale fusion", + "16x slower than using Multiblock of the same voltage", + //"Input voltage can be changed within the GUI", + "Place Input/Output Hatches on sides and bottom", + "Power can only be inserted into the back", + "Power can only be extracted from the top", + }; + } + + @Override + public int getMaxParallelRecipes() { + // TODO Auto-generated method stub + return 1; + } + + @Override + public int getEuDiscountForParallelism() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int xDir2 = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetX; + int zDir2 = ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing()).offsetZ; + int tAmount = 0; + + ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); + + //Require air in front, I think + if (!aBaseMetaTileEntity.getAirOffset(xDir2, 0, zDir2)) { + Logger.INFO("Did not find air in front"); + return false; + } else { + for (int i = -1; i < 2; ++i) { + for (int j = -1; j < 2; ++j) { + for (int h = -1; h < 2; ++h) { + if (h != 0 || (xDir + i != 0 || zDir + j != 0) && (i != 0 || j != 0)) { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, + h, zDir + j); + if (this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(28))) { + tAmount++; + } + } + } + } + } + } + Logger.INFO("Tanks found: "+tAmount); + return tAmount == 3; + } + + @Override + public boolean checkRecipe(ItemStack arg0) { + + + ArrayList tFluidList = this.getStoredFluids(); + int tFluidList_sS = tFluidList.size(); + + for (int tFluids = 0; tFluids < tFluidList_sS - 1; ++tFluids) { + for (int tRecipe = tFluids + 1; tRecipe < tFluidList_sS; ++tRecipe) { + if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(tFluids), + (FluidStack) tFluidList.get(tRecipe))) { + if (((FluidStack) tFluidList.get(tFluids)).amount < ((FluidStack) tFluidList.get(tRecipe)).amount) { + tFluidList.remove(tFluids--); + tFluidList_sS = tFluidList.size(); + break; + } + + tFluidList.remove(tRecipe--); + tFluidList_sS = tFluidList.size(); + } + } + } + int aStep = 0; + //Logger.INFO("Step "+aStep++); + if (tFluidList.size() > 1) { + //Logger.INFO("Step "+aStep++); + FluidStack[] arg5 = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); + GT_Recipe arg6 = getRecipeMap().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, + false, this.getMaxInputVoltage(), arg5, new ItemStack[0]); + if (arg6 == null && !this.mRunningOnLoad || this.maxEUStore() < (long) arg6.mSpecialValue) { + //Logger.INFO("Bad Step "+aStep++); + //this.turnCasingActive(false); + this.mLastRecipe = null; + return false; + } + //Logger.INFO("Step "+aStep++); + + if (this.mRunningOnLoad || arg6.isRecipeInputEqual(true, arg5, new ItemStack[0])) { + //Logger.INFO("Step "+aStep++); + this.mLastRecipe = arg6; + this.mEUt = this.mLastRecipe.mEUt * 1; + this.mMaxProgresstime = this.mLastRecipe.mDuration / 1; + this.mEfficiencyIncrease = 10000; + this.mOutputFluids = this.mLastRecipe.mFluidOutputs; + //this.turnCasingActive(true); + this.mRunningOnLoad = false; + return true; + } + //Logger.INFO("Step "+aStep++); + } + //Logger.INFO("Step "+aStep++); + + return false; + + + + + //return this.checkRecipeGeneric(this.getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + } + + @Override + public int getMaxEfficiency(ItemStack arg0) { + return 10000; + } + + @Override + public boolean drainEnergyInput(long aEU) { + // Not applicable to this machine + return true; + } + + @Override + public boolean addEnergyOutput(long aEU) { + // Not applicable to this machine + return true; + } + + @Override + public long maxEUStore() { + return this.getMaxInputVoltage() * 256 * 512; + } + + @Override + public long getMinimumStoredEU() { + return 0; + } + + @Override + public String[] getExtraInfoData() { + String mode = EnumChatFormatting.BLUE + "" + currentVoltage + EnumChatFormatting.RESET; + String aOutput = EnumChatFormatting.BLUE + "" + mEUt + EnumChatFormatting.RESET; + String storedEnergyText; + if (this.getEUVar() > maxEUStore()) { + storedEnergyText = EnumChatFormatting.RED + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET; + } else { + storedEnergyText = EnumChatFormatting.GREEN + GT_Utility.formatNumbers(this.getEUVar()) + EnumChatFormatting.RESET; + } + + return new String[]{ + "Stored EU: " + storedEnergyText, + "Capacity: " + EnumChatFormatting.YELLOW + GT_Utility.formatNumbers(this.maxEUStore()) + EnumChatFormatting.RESET, + "Voltage: " + mode, + "Output Voltage: " + aOutput + }; + } + + @Override + public void explodeMultiblock() { + super.explodeMultiblock(); + } + + @Override + public void doExplosion(long aExplosionPower) { + super.doExplosion(aExplosionPower); + } + + @Override + public long getMaxInputVoltage() { + return updateVoltage(); + } + + @Override + public long getInputTier() { + return (long) GT_Utility.getTier(maxEUInput()); + } + + @Override + public boolean isElectric() { + return true; + } + + @Override + public boolean isEnetInput() { + return true; + } + + @Override + public boolean isEnetOutput() { + return true; + } + + @Override + public boolean isInputFacing(byte aSide) { + return (aSide == this.getBaseMetaTileEntity().getBackFacing()); + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == 1; + } + + @Override + public long maxAmperesIn() { + return 32; + } + + @Override + public long maxAmperesOut() { + return 1; + } + + @Override + public long maxEUInput() { + return updateVoltage(); + } + + @Override + public long maxEUOutput() { + return mEUt > 0 ? mEUt : 0; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + this.mWrench = true; + this.mScrewdriver = true; + this.mSoftHammer = true; + this.mHardHammer = true; + this.mSolderingTool = true; + this.mCrowbar = true; + } + + @Override + public boolean causeMaintenanceIssue() { + return true; + } + + @Override + public int getControlCoreTier() { + return this.currentTier; + } + + @Override + public int getPollutionPerTick(ItemStack arg0) { + return 0; + } + + @Override + public GT_MetaTileEntity_Hatch_ControlCore getControlCoreBus() { + GT_MetaTileEntity_Hatch_ControlCore x = new GT_MetaTileEntity_Hatch_ControlCore("", 0, "", null); + return (GT_MetaTileEntity_Hatch_ControlCore) x; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java index c424172241..4e5c95ad73 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_AlloyBlastSmelter.java @@ -246,13 +246,13 @@ extends GregtechMeta_MultiBlockBase { Logger.INFO("Heating Coils missing."); return false; } - - //Top Layer - final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); - if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasingsMisc, 15)) { - Logger.INFO("Top Layer missing."); - return false; - } + } + + //Top Layer + final IGregTechTileEntity tTileEntity2 = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j); + if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(15), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 3, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 3, zDir + j), ModBlocks.blockCasingsMisc, 15)) { + Logger.INFO("Top Layer missing."); + return false; } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 8294773be3..ad9876bcf0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -146,12 +146,12 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @Override public void setItemNBT(NBTTagCompound aNBT) { - if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED && !CORE.GTNH) { if (mFluid != null){ - Logger.INFO("Setting item fluid nbt"); + Logger.WARNING("Setting item fluid nbt"); aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); if (aNBT.hasKey("mFluid")) { - Logger.INFO("Set mFluid to NBT."); + Logger.WARNING("Set mFluid to NBT."); } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 433c07e948..9fe2aeb12e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -214,11 +214,12 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Shape_Mold_Screw, // Shape_Mold_Ring, - ItemList mold_Rod = ItemList.valueOf("Shape_Mold_Rod"); - ItemList mold_Rod_Long = ItemList.valueOf("Shape_Mold_Rod_Long"); - ItemList mold_Bolt = ItemList.valueOf("Shape_Mold_Bolt"); - ItemList mold_Screw = ItemList.valueOf("Shape_Mold_Screw"); - ItemList mold_Ring = ItemList.valueOf("Shape_Mold_Ring"); + + ItemList mold_Rod = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod", null); + ItemList mold_Rod_Long = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Rod_Long", null); + ItemList mold_Bolt = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Bolt", null); + ItemList mold_Screw = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Screw", null); + ItemList mold_Ring = gtPlusPlus.core.util.Utils.getValueOfItemList("Shape_Mold_Ring", null); // Rod if (ItemUtils.checkForInvalidItems(material.getRod(1))) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index 94486d472b..ace4876639 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -17,8 +17,10 @@ import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.data.ArrayUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; @@ -943,6 +945,103 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } } + @Override + public void addFluidExtractionRecipe(ItemStack input, Object input2, FluidStack output, int aTime, int aEu, int aSpecial) { + MaterialGenerator.addFluidExtractionRecipe(input, input2, output, aSpecial, aTime, aEu); + + } + + + + + + /** + * Adds a Fusion reactor Recipe + * + * @param aInputStackA = first Input (not null, and respects StackSize) + * @param aInputStackB = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + @Override + public boolean addFusionReactorRecipe(FluidStack aInputStackA, FluidStack aInputStackB, FluidStack plasma, + int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial) { + if (aInputStackA == null || aInputStackB == null || plasma == null || aFusionDurationInTicks < 1 || aEu < 1 || aSpecial < 1) { + return false; + } + Recipe_GT aFusionCustom = new Recipe_GT( + true, + null, + null, + null, + new int[] {aOutputChance}, + new FluidStack[]{aInputStackA, aInputStackB}, + new FluidStack[]{plasma}, + aFusionDurationInTicks, + aEu, + aSpecial); + GT_Recipe.GT_Recipe_Map.sFusionRecipes.addRecipe(aFusionCustom); + return true; + } + + + + + + + /** + * Adds a Fusion reactor Recipe + * + * @param aInputStackA = first Input (not null, and respects StackSize) + * @param aInputStackB = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + @Override + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, + int aFusionDurationInTicks, int aEu, int aSpecial) { + return addFusionReactorRecipe(aInputStackA, aInputStackB, plasma, 10000, aFusionDurationInTicks, aEu, aSpecial); + } + + + /** + * Adds a Fusion reactor Recipe + * + * @param aInputStackA = first Input (not null, and respects StackSize) + * @param aInputStackB = second Input (not null, and respects StackSize) + * @param plasma = Output of the Fusion (can be null, and respects StackSize) + * @param aOutputChance = chance to output plasma (can be 0) + * @param aFusionDurationInTicks = How many ticks the Fusion lasts (must be > 0) + * @param aEu = The EU generated per Tick (can even be negative!) + * @param aSpecial = EU needed for heating the Reactor up (must be >= 0) + */ + @Override + public boolean addFusionReactorRecipe(ItemStack aInputStackA, ItemStack aInputStackB, FluidStack plasma, + int aOutputChance, int aFusionDurationInTicks, int aEu, int aSpecial) { + if (aInputStackA == null || aInputStackB == null || plasma == null || aFusionDurationInTicks < 1 || aEu < 1 || aSpecial < 1) { + return false; + } + Recipe_GT aFusionCustom = new Recipe_GT( + true, + new ItemStack[]{aInputStackA, aInputStackB}, + null, + null, + new int[] {aOutputChance}, + null, + new FluidStack[]{plasma}, + aFusionDurationInTicks, + aEu, + aSpecial); + GT_Recipe.GT_Recipe_Map.sFusionRecipes.addRecipe(aFusionCustom); + return true; + + } + diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java index ee4f32c8ad..d04f71e235 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java @@ -9,6 +9,7 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTransformerHiAmp; @@ -54,17 +55,17 @@ public class GregtechHiAmpTransformer { ItemStack mItem_2; ItemStack mItem_3; try { - mItem_1 = ItemList.valueOf("Casing_Coil_TungstenSteel").get(1); + mItem_1 = Utils.getValueOfItemList("Casing_Coil_TungstenSteel", ItemList.Circuit_Elite).get(1); } catch (Throwable t){ mItem_1 = ItemList.Circuit_Elite.get(1); } try { - mItem_2 = ItemList.valueOf("Casing_Coil_Naquadah").get(1); + mItem_2 = Utils.getValueOfItemList("Casing_Coil_Naquadah", ItemList.Circuit_Master).get(1); } catch (Throwable t){ mItem_2 = ItemList.Circuit_Master.get(1); } try { - mItem_3 = ItemList.valueOf("Casing_Coil_NaquadahAlloy").get(1); + mItem_3 = Utils.getValueOfItemList("Casing_Coil_NaquadahAlloy", ItemList.Circuit_Ultimate).get(1); } catch (Throwable t){ mItem_3 = ItemList.Circuit_Ultimate.get(1); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java index c9f42e437d..30835b6daa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechMiniRaFusion.java @@ -1,26 +1,33 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; -import gregtech.api.GregTech_API; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_GT_Recipe; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Plasma; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_MiniFusionPlant; public class GregtechMiniRaFusion { public static void run() { // Register the Simple Fusion Entity. - GregtechItemList.Miniature_Fusion.set(new GT_MetaTileEntity_BasicMachine_GT_Recipe(994, "machine.simplefusion.tier.01", "Mimir", 8, "Universal Machine for Knowledge and Wisdom", Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes, 2, 9, 64000, 0, 1, "Dehydrator.png", (String) GregTech_API.sSoundList.get(Integer.valueOf(208)), false, false, 0, "EXTRUDER", new Object[]{"CCE", "XMP", "CCE", 'M', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL, 'X', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.SENSOR, 'E', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.STICK_ELECTROMAGNETIC, 'P', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT, 'C', GT_MetaTileEntity_BasicMachine_GT_Recipe.X.FIELD_GENERATOR}).getStackForm(1L)); - + GregtechItemList.Miniature_Fusion.set(new GregtechMTE_MiniFusionPlant(31015, "gtplusplus.fusion.single", "Helium Prime").getStackForm(1L)); + GregtechItemList.Plasma_Tank.set(new GT_MetaTileEntity_Hatch_Plasma(31016, "gtplusplus.tank.plasma", "Plasma Tank").getStackForm(1L)); + } public static boolean generateSlowFusionrecipes() { for (GT_Recipe x : GT_Recipe.GT_Recipe_Map.sFusionRecipes.mRecipeList){ if (x.mEnabled) { GT_Recipe y = x.copy(); - y.mDuration *= 4; + y.mDuration *= 16; + long z = y.mEUt * 4; + if (z > Integer.MAX_VALUE) { + y.mEnabled = false; + continue; + } + y.mEUt = (int) Math.min(Math.max(0, z), Integer.MAX_VALUE); + y.mCanBeBuffered = true; Recipe_GT.Gregtech_Recipe_Map.sSlowFusionRecipes.add(y); } } |