Update 5.08.18

RF Support and finished Processing array
This commit is contained in:
Blood-Asp 2015-05-28 00:29:03 +02:00
parent adb4a5eef6
commit 7e0b4194ac
9 changed files with 181 additions and 44 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.db

View file

@ -310,6 +310,13 @@ import net.minecraftforge.common.ForgeVersion;
gregtechproxy.mDisableIC2Cables = tMainConfig.get("general", "DisableIC2Cables", false).getBoolean(false);
gregtechproxy.mAchievements = tMainConfig.get("general", "EnableAchievements", true).getBoolean(true);
GregTech_API.mOutputRF =GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", false);
GregTech_API.mInputRF =GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false);
GregTech_API.mEUtoRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "100EUtoRF", 360);
GregTech_API.mRFtoEU = GregTech_API.sOPStuff.get(ConfigCategories.general, "100RFtoEU", 20);
GregTech_API.mRFExplosions = GregTech_API.sOPStuff.get(ConfigCategories.general, "RFExplosions", true);
/* 310:211 */ if (tMainConfig.get("general", "hardermobspawners", true).getBoolean(true)) {
/* 311:211 */ Blocks.mob_spawner.setHardness(500.0F).setResistance(6000000.0F);
/* 312: */ }

View file

@ -116,6 +116,11 @@ public class GregTech_API {
/** Getting assigned by the Config */
public static boolean sTimber = F, sDrinksAlwaysDrinkable = F, sMultiThreadedSounds = F, sDoShowAllItemsInCreative = F, sColoredGUI = T, sConstantEnergy = T, sMachineExplosions = T, sMachineFlammable = T, sMachineNonWrenchExplosions = T, sMachineRainExplosions = T, sMachineThunderExplosions = T, sMachineFireExplosions = T, sMachineWireFire = true;
public static boolean mOutputRF =false;
public static boolean mInputRF =false;
public static int mEUtoRF = 360;
public static int mRFtoEU = 20;
public static boolean mRFExplosions = true;
/** Getting assigned by the Mod loading */
public static boolean sUnificationEntriesRegistered = F, sPreloadStarted = F, sPreloadFinished = F, sLoadStarted = F, sLoadFinished = F, sPostloadStarted = F, sPostloadFinished = F;

View file

@ -1,8 +1,13 @@
package gregtech.api.interfaces.tileentity;
import static gregtech.api.enums.GT_Values.V;
import cofh.api.energy.IEnergyReceiver;
import gregtech.api.GregTech_API;
import gregtech.api.util.GT_Utility;
import ic2.api.energy.tile.IEnergySink;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
/**
@ -60,7 +65,23 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd
if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aEmitter, ForgeDirection.getOrientation(j))) {
while (aAmperage > rUsedAmperes && ((IEnergySink)tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink)tTileEntity).injectEnergy(ForgeDirection.getOrientation(j), aVoltage, aVoltage) < aVoltage) rUsedAmperes++;
}
}
} else if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver){
ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100);
if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){
((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++;
}
if(GregTech_API.mRFExplosions && GregTech_API.sMachineExplosions && ((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600){
if(rfOut > 32 * GregTech_API.mEUtoRF / 100) {
int aExplosionPower = rfOut;
float tStrength = aExplosionPower<V[0]?1.0F:aExplosionPower<V[1]?2.0F:aExplosionPower<V[2]?3.0F:aExplosionPower<V[3]?4.0F:aExplosionPower<V[4]?5.0F:aExplosionPower<V[4]*2?6.0F:aExplosionPower<V[5]?7.0F:aExplosionPower<V[6]?8.0F:aExplosionPower<V[7]?9.0F:10.0F;
int tX=tTileEntity.xCoord, tY=tTileEntity.yCoord, tZ=tTileEntity.zCoord;
World tWorld = tTileEntity.getWorldObj();
GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);
tWorld.setBlock(tX, tY, tZ, Blocks.air);
if (GregTech_API.sMachineExplosions) tWorld.createExplosion(null, tX+0.5, tY+0.5, tZ+0.5, tStrength, true);}
}
}
}
return rUsedAmperes;
}

View file

@ -1,6 +1,7 @@
package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.VN;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Dyes;
import gregtech.api.enums.Materials;
import gregtech.api.enums.TextureSet;
@ -20,6 +21,7 @@ import ic2.api.energy.tile.IEnergySink;
import java.util.ArrayList;
import java.util.Arrays;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@ -136,6 +138,15 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)getBaseMetaTileEntity(), tDirection)) {
if (((IEnergySink)tTileEntity).getDemandedEnergy() > 0 && ((IEnergySink)tTileEntity).injectEnergy(tDirection, aVoltage, aVoltage) < aVoltage) rUsedAmperes++;
}
} else if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver){
ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100);
if(((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, true)==rfOut){
((IEnergyReceiver)tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++;
}
if(GregTech_API.mRFExplosions && ((IEnergyReceiver)tTileEntity).getMaxEnergyStored(tDirection) < rfOut * 600){
if(rfOut > 32 * GregTech_API.mEUtoRF / 100) this.doExplosion(rfOut);
}
}
}
}
@ -181,7 +192,12 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (tTileEntity instanceof IEnergySink && ((IEnergySink)tTileEntity).acceptsEnergyFrom((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
mConnections |= (1<<i);
continue;
}/*
}
if(GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver){
mConnections |= (1<<i);
continue;
}
/*
if (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter)tTileEntity).emitsEnergyTo((TileEntity)aBaseMetaTileEntity, ForgeDirection.getOrientation(j))) {
mConnections |= (1<<i);
continue;

View file

@ -1,6 +1,8 @@
package gregtech.api.metatileentity.implementations;
import static gregtech.api.enums.GT_Values.V;
import cofh.api.energy.IEnergyProvider;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@ -84,6 +86,10 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
long tEU = Math.min(maxEUInput(), (long)((IEnergySource)tTileEntity).getOfferedEnergy());
((IEnergySource)tTileEntity).drawEnergy(tEU);
aBaseMetaTileEntity.injectEnergyUnits((byte)6, tEU, 1);
}else if (GregTech_API.mInputRF && tTileEntity instanceof IEnergyProvider&& ((IEnergyProvider)tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)),1,true)==1) {
long tEU = Math.min(maxEUInput(), (long)((IEnergyProvider)tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)),(int) maxEUInput()* 100 / GregTech_API.mRFtoEU ,false));
tEU = tEU * GregTech_API.mRFtoEU / 100;
aBaseMetaTileEntity.injectEnergyUnits((byte)6, tEU, 1);
}
}
}

View file

@ -1,6 +1,7 @@
package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
import java.util.Arrays;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@ -55,13 +56,43 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
/* 54: */
/* 55: */ public GT_Recipe.GT_Recipe_Map getRecipeMap()
/* 56: */ {
if(mInventory[1]==null)return null;
String tmp = mInventory[1].getUnlocalizedName().replaceAll("gt.blockmachines.basicmachine.", "");
if(tmp.startsWith("centrifuge")){
return GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes;
}else if(tmp.equals("")){
}else if(tmp.equals("electrolyzer")){
return GT_Recipe.GT_Recipe_Map.sElectrolyzerRecipes;
}else if(tmp.equals("alloysmelter")){
return GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes;
}else if(tmp.equals("assembler")){
return GT_Recipe.GT_Recipe_Map.sAssemblerRecipes;
}else if(tmp.equals("compressor")){
return GT_Recipe.GT_Recipe_Map.sCompressorRecipes;
}else if(tmp.equals("extractor")){
return GT_Recipe.GT_Recipe_Map.sExtractorRecipes;
}else if(tmp.equals("macerator")){
return GT_Recipe.GT_Recipe_Map.sMaceratorRecipes;
}else if(tmp.equals("recycler")){
return GT_Recipe.GT_Recipe_Map.sRecyclerRecipes;
}else if(tmp.equals("thermalcentrifuge")){
return GT_Recipe.GT_Recipe_Map.sThermalCentrifugeRecipes;
}else if(tmp.equals("orewasher")){
return GT_Recipe.GT_Recipe_Map.sOreWasherRecipes;
}else if(tmp.equals("chemicalreactor")){
return GT_Recipe.GT_Recipe_Map.sChemicalRecipes;
}else if(tmp.equals("chemicalbath")){
return GT_Recipe.GT_Recipe_Map.sChemicalBathRecipes;
}else if(tmp.equals("electromagneticseparator")){
return GT_Recipe.GT_Recipe_Map.sElectroMagneticSeparatorRecipes;
}else if(tmp.equals("autoclave")){
return GT_Recipe.GT_Recipe_Map.sAutoclaveRecipes;
}else if(tmp.equals("mixer")){
return GT_Recipe.GT_Recipe_Map.sMixerRecipes;
}else if(tmp.equals("hammer")){
return GT_Recipe.GT_Recipe_Map.sHammerRecipes;
}else if(tmp.equals("sifter")){
return GT_Recipe.GT_Recipe_Map.sSifterRecipes;
}
/* 57: 54 */ return null;
/* 58: */ }
/* 59: */
@ -83,53 +114,102 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
GT_Recipe.GT_Recipe_Map map = getRecipeMap();
if(map==null){return false;}
/* 72: 66 */ ArrayList<ItemStack> tInputList = getStoredInputs();
/* 75: 69 */ long tVoltage = getMaxInputVoltage();
/* 76: 70 */ int tTier = 0;
if(mInventory[1].getUnlocalizedName().endsWith("1")){tTier=1;}
if(mInventory[1].getUnlocalizedName().endsWith("2")){tTier=2;}
if(mInventory[1].getUnlocalizedName().endsWith("3")){tTier=3;}
if(mInventory[1].getUnlocalizedName().endsWith("4")){tTier=4;}
if(mInventory[1].getUnlocalizedName().endsWith("5")){tTier=5;}
FluidStack fluidIn = null;
if(mInputHatches !=null&&mInputHatches.size()>0){
fluidIn = mInputHatches.get(0).mFluid;
}
ItemStack tInput =null;
if(tInputList.size()>0){
tInput = tInputList.get(0); }
/* 78: 72 */ GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{fluidIn}, new ItemStack[] { tInput });
/* 77: 71 */ for (int i = 0; i < tInputList.size() - 1; i++) {
/* 78: 71 */ for (int j = i + 1; j < tInputList.size(); j++) {
/* 79: 72 */ if (GT_Utility.areStacksEqual((ItemStack)tInputList.get(i), (ItemStack)tInputList.get(j))) {
/* 80: 73 */ if (((ItemStack)tInputList.get(i)).stackSize >= ((ItemStack)tInputList.get(j)).stackSize)
/* 81: */ {
/* 82: 73 */ tInputList.remove(j--);
/* 83: */ }
/* 84: */ else
/* 85: */ {
/* 86: 73 */ tInputList.remove(i--); break;
/* 87: */ }
/* 88: */ }
/* 89: */ }
/* 90: */ }
/* 91: 76 */ ItemStack[] tInputs = (ItemStack[])Arrays.copyOfRange(tInputList.toArray(new ItemStack[tInputList.size()]), 0, 2);
/* 92: */
/* 93: 78 */ ArrayList<FluidStack> tFluidList = getStoredFluids();
/* 94: 79 */ for (int i = 0; i < tFluidList.size() - 1; i++) {
/* 95: 79 */ for (int j = i + 1; j < tFluidList.size(); j++) {
/* 96: 80 */ if (GT_Utility.areFluidsEqual((FluidStack)tFluidList.get(i), (FluidStack)tFluidList.get(j))) {
/* 97: 81 */ if (((FluidStack)tFluidList.get(i)).amount >= ((FluidStack)tFluidList.get(j)).amount)
/* 98: */ {
tFluidList.remove(j--);
}
else
{
tFluidList.remove(i--); break;
}
}
}
}
FluidStack[] tFluids = (FluidStack[])Arrays.copyOfRange(tFluidList.toArray(new FluidStack[tInputList.size()]), 0, 1);
if(tInputList.size() > 0 || tFluids.length>0){
/* 78: 72 */ GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs);
/* 79: 73 */ if (tRecipe != null) {
mLastRecipe = tRecipe;
int machines = Math.max(16,mInventory[1].stackSize);
/* 81: */ if(tRecipe.mFluidOutputs.length>0&&tRecipe.mFluidInputs.length>0&&((mInputHatches.get(0).mFluid.amount)>(tRecipe.mFluidInputs[0].amount*machines))){
mInputHatches.get(0).mFluid.amount -= tRecipe.mFluidInputs[0].amount*machines;
/* 82: 74 */ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
/* 83: 75 */ this.mEfficiencyIncrease = 10000;
/* 84: 77 */ if (tRecipe.mEUt <= 16)
/* 85: */ {
/* 86: 78 */ this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1))*machines;
/* 87: 79 */ this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
/* 88: */ }
/* 89: */ else
/* 90: */ {
/* 91: 81 */ this.mEUt = tRecipe.mEUt*machines;
/* 92: 82 */ this.mMaxProgresstime = tRecipe.mDuration;
/* 93: 83 */ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)])
/* 94: */ {
/* 95: 84 */ this.mEUt *= 4;
/* 96: 85 */ this.mMaxProgresstime /= 2;
/* 97: */ }
/* 98: */ }
/* 99: 89 */ if (this.mEUt > 0) {
/* 100: 89 */ this.mEUt = (-this.mEUt);
/* 101: */ }
/* 102: 90 */ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
/* 103: 91 */ this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) };
this.mOutputFluids[0].amount *=machines;
/* 104: 92 */ updateSlots();}
this.mEUt = 0;
this.mOutputItems = null;
this.mOutputFluids = null;
this.mMaxProgresstime = tRecipe.mDuration;
int machines = Math.max(16,mInventory[1].stackSize);
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
int i = 0;
for(;i<machines;i++){
if(!tRecipe.isRecipeInputEqual(true, tFluids, tInputs))break;
}
if (tRecipe.mEUt <= 16)
{
this.mEUt = (tRecipe.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
this.mMaxProgresstime = (tRecipe.mDuration / (1 << tTier - 1));
}
else
{
this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = tRecipe.mDuration;
while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)])
{
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
}
this.mEUt*=i;
if (this.mEUt > 0) {
this.mEUt = (-this.mEUt);
}
ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length];
for(int h = 0;h<tRecipe.mOutputs.length;h++){
tOut[h] = tRecipe.getOutput(h).copy();
tOut[h].stackSize =0;
}FluidStack tFOut=null;
if(tRecipe.getFluidOutput(0)!=null) tFOut = tRecipe.getFluidOutput(0).copy();
for(int f =0; f < tOut.length ; f++){
if(tRecipe.mOutputs[f]!=null&&tOut[f]!=null){
for(int g =0;g<i;g++){
if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) tOut[f].stackSize += tRecipe.mOutputs[f].stackSize;
}
}
}
if(tFOut!=null){
int tSize = tFOut.amount;
tFOut.amount = tSize * i;
}
this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
this.mOutputItems = tOut;
this.mOutputFluids = new FluidStack[]{tFOut};
updateSlots();
/* 105: 93 */ return true;
/* 106: */
/* 107: */ }
}
/* 109: 96 */ return false;
/* 110: */ }
/* 111: */

View file

@ -28,7 +28,7 @@ import gregtech.api.enums.Textures;
/* 27: */
/* 28: */ public int getToolDamagePerContainerCraft()
/* 29: */ {
/* 30:27 */ return 400;
/* 30:27 */ return 100;
/* 31: */ }
/* 32: */
/* 33: */ public int getToolDamagePerEntityAttack()

View file

@ -678,7 +678,8 @@ public class GT_MachineRecipeLoader
GT_Values.RA.addBlastRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.MeteoricIron, 1L), GT_Values.NI, Materials.Oxygen.getGas(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.MeteoricSteel, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, Materials.DarkAsh, 1L), 500, 120, 1200);
GT_Values.RA.addBlastRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Copper, 1L), GT_Values.NI, Materials.Oxygen.getGas(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.AnnealedCopper, 1L), GT_Values.NI, 500, 120, 1200);
GT_Values.RA.addBlastRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.Copper, 1L), GT_Values.NI, Materials.Oxygen.getGas(1000L), GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.AnnealedCopper, 1L), GT_Values.NI, 500, 120, 1200);
GT_Values.RA.addBlastRecipe(GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.ElectricalSteel, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Obsidian, 1L), GT_Values.NF, GT_Values.NF, GT_OreDictUnificator.get(OrePrefixes.ingot, Materials.DarkSteel, 1L), GT_Values.NI, 4000, 360, 2000);
GT_Values.RA.addFusionReactorRecipe(Materials.Lithium.getMolten(9), Materials.Tungsten.getMolten(9), Materials.Iridium.getMolten(9), 32, 32768, 150000000);
GT_Values.RA.addFusionReactorRecipe(Materials.Deuterium.getGas(125), Materials.Tritium.getGas(125), Materials.Helium.getPlasma(125), 16, 4096, 40000000); //Mark 1 Cheap //
GT_Values.RA.addFusionReactorRecipe(Materials.Deuterium.getGas(125), Materials.Helium_3.getGas(125), Materials.Helium.getPlasma(125), 16, 2048, 60000000); //Mark 1 Expensive //