forked from GregTechCEu/GregTech
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Primitive Multi Rewrite (GregTechCEu#85)
* new PBF working * implement primitive recipes * finish PBF * refactor Coke Oven * update changelog * fix tech memeing on me
- Loading branch information
1 parent
61a52db
commit 0cb6427
Showing
22 changed files
with
282 additions
and
1,151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/gregtech/api/capability/impl/PrimitiveRecipeLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package gregtech.api.capability.impl; | ||
|
||
import gregtech.api.GTValues; | ||
import gregtech.api.metatileentity.multiblock.RecipeMapPrimitiveMultiblockController; | ||
import gregtech.api.recipes.RecipeMap; | ||
|
||
/** | ||
* Recipe Logic for a Multiblock that does not require power. | ||
*/ | ||
public class PrimitiveRecipeLogic extends AbstractRecipeLogic { | ||
|
||
public PrimitiveRecipeLogic(RecipeMapPrimitiveMultiblockController tileEntity, RecipeMap<?> recipeMap) { | ||
super(tileEntity, recipeMap); | ||
} | ||
|
||
@Override | ||
protected long getEnergyStored() { | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
@Override | ||
protected long getEnergyCapacity() { | ||
return Integer.MAX_VALUE; | ||
} | ||
|
||
@Override | ||
protected boolean drawEnergy(int recipeEUt) { | ||
return true; // spoof energy being drawn | ||
} | ||
|
||
@Override | ||
protected long getMaxVoltage() { | ||
return GTValues.LV; | ||
} | ||
|
||
@Override | ||
protected int[] calculateOverclock(int EUt, long voltage, int duration) { | ||
return new int[]{1, duration}; | ||
} | ||
|
||
@Override | ||
protected int getOverclockingTier(long voltage) { | ||
return GTValues.LV; // just return something reasonable | ||
} | ||
|
||
/** | ||
* Used to reset cached values in the Recipe Logic on structure deform | ||
*/ | ||
public void invalidate() { | ||
lastItemInputs = null; | ||
lastFluidInputs = null; | ||
previousRecipe = null; | ||
progressTime = 0; | ||
maxProgressTime = 0; | ||
recipeEUt = 0; | ||
fluidOutputs = null; | ||
itemOutputs = null; | ||
setActive(false); // this marks dirty for us | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...n/java/gregtech/api/metatileentity/multiblock/RecipeMapPrimitiveMultiblockController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package gregtech.api.metatileentity.multiblock; | ||
|
||
import gregtech.api.capability.impl.*; | ||
import gregtech.api.recipes.RecipeMap; | ||
import net.minecraft.util.ResourceLocation; | ||
import net.minecraftforge.fluids.FluidTank; | ||
import net.minecraftforge.items.ItemStackHandler; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public abstract class RecipeMapPrimitiveMultiblockController extends MultiblockWithDisplayBase { | ||
|
||
protected PrimitiveRecipeLogic recipeMapWorkable; | ||
|
||
public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?> recipeMap) { | ||
super(metaTileEntityId); | ||
this.recipeMapWorkable = new PrimitiveRecipeLogic(this, recipeMap); | ||
initializeAbilities(); | ||
} | ||
|
||
// just initialize inventories based on RecipeMap values by default | ||
protected void initializeAbilities() { | ||
this.importItems = new ItemStackHandler(recipeMapWorkable.recipeMap.getMaxInputs()); | ||
this.importFluids = new FluidTankList(true, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidInputs())); | ||
this.exportItems = new ItemStackHandler(recipeMapWorkable.recipeMap.getMaxOutputs()); | ||
this.exportFluids = new FluidTankList(false, makeFluidTanks(recipeMapWorkable.recipeMap.getMaxFluidOutputs())); | ||
|
||
this.itemInventory = new ItemHandlerProxy(this.importItems, this.exportItems); | ||
this.fluidInventory = new FluidHandlerProxy(this.importFluids, this.exportFluids); | ||
} | ||
|
||
private List<FluidTank> makeFluidTanks(int length) { | ||
List<FluidTank> fluidTankList = new ArrayList<>(length); | ||
for (int i = 0; i < length; i++) { | ||
fluidTankList.add(new FluidTank(32000)); | ||
} | ||
return fluidTankList; | ||
} | ||
|
||
@Override | ||
protected void updateFormedValid() { | ||
recipeMapWorkable.update(); | ||
} | ||
|
||
@Override | ||
public void invalidateStructure() { | ||
super.invalidateStructure(); | ||
recipeMapWorkable.invalidate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
src/main/java/gregtech/api/recipes/builders/CokeOvenRecipeBuilder.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.