-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* complex controller start * Added methods to get input fluids and items * Added logic to complex parallel mute * Added ACR and fixed many, many, many, many bugs * Added void protection setting to checkRecipe * do not init nbt, if mteID and mteRegistry are the same * Improved GUI design * Force structure check when pressing power switch * ACR Textures * Added T1 structure * Added perfect OC * Added WAILA * fix mutes resetting their nbt * Fix ACR GUI * fix npe * Added void protection for MuTEs * Fixed ACR starting recipe while another one is ongoing * nbt saving * maybe fix structure breaking * Fix complex machine disabling on startup * correctly update input tanks * move casings over * Changed logic of casings to change mode and facing in one go by sneaking * Fixed the casing target not resetting * Added side only annotations * don't leave it empty * Added power logic and tiered blocks to ACR * Change facing to wrench side if casing mode is currently none * lasers anyone? * Added ACR item chaining * Remove unncessary item lists * Use HashSet for process whitelists * Optimize list capacities * Fix potential recipe voiding bug * Rename methods for consistancy * Fix NPE * Duct tape fix structure check * allow MuTEs to connect to cables * Added separate tank inventories for input separation (#1887) * Fixed unregistering tank function * Fixed input busses not being automatable * Added fluid chaining * Fixed saving of input tanks * Forbid inventory registering with empty name * Display all input tanks in controller GUI * Fixed fluid hatch GUI height * Reset casing lists when checking the structure * Make inventory GUI size consistant * Make use of the tooltip cache * rename thing clean up * Forgot to put tooltip into map * Added tooltip to ACR * Reset whitelists when one whitelist window was opened * Refined scanner string * Fixed progress times * Fixed MuTE not consuming fluids * Properly register controller inventories * switch to ForgeDirection * switch to new Renderer * Added missing contains check on registerInventory * Fixed output tanks not registering * Fixed upgrade tank loading * fix machines not having active/inactive textures * fix overlays not loading correctly * Don't register controller directly * Remove magic strings all * fix active not setting to inactive * allow glow * item renderer * fix glow * MuTE improved hatch GUI and fluid output locking (#1889) * Allow output hatches to be fluid locked * Reworked hatch GUI * Check target before trying to open GUI * Make ACR GUI easier to look at * fix covers not rendering on mutes * fix covers not displaying above the item/fluid in/out * new folder texture structure * Reduce network traffic caused by covers * Fixed WAILA fluid locking display * Don't save everything to the itemstack NBT * Added possibility to save NBT of MuTE to its itemstack * fix textures, but make sacrifices * mah textures * Removed the need for all textures to be present * Added glow texture for active coke oven * Removed unncesssary upgrade casing textures * shorten nbt tags --------- Co-authored-by: BlueWeabo <76872108+BlueWeabo@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
de86423
commit fdde96a
Showing
82 changed files
with
3,817 additions
and
861 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
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
183 changes: 183 additions & 0 deletions
183
src/main/java/gregtech/api/logic/ComplexParallelProcessingLogic.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,183 @@ | ||
package gregtech.api.logic; | ||
|
||
import java.util.stream.LongStream; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraftforge.fluids.FluidStack; | ||
|
||
import gregtech.api.multitileentity.multiblock.base.Controller; | ||
import gregtech.api.util.GT_OverclockCalculator; | ||
import gregtech.api.util.GT_ParallelHelper; | ||
import gregtech.api.util.GT_Recipe; | ||
|
||
public class ComplexParallelProcessingLogic { | ||
|
||
protected Controller<?> tileEntity; | ||
protected GT_Recipe.GT_Recipe_Map recipeMap; | ||
protected boolean hasPerfectOverclock; | ||
protected final int maxComplexParallels; | ||
protected final ItemStack[][] outputItems; | ||
protected final ItemStack[][] inputItems; | ||
protected final FluidStack[][] inputFluids; | ||
protected final FluidStack[][] outputFluids; | ||
protected final long[] availableEut; | ||
protected final long[] eut; | ||
protected final long[] durations; | ||
protected boolean[] isVoidProtected; | ||
|
||
public ComplexParallelProcessingLogic(int maxComplexParallels) { | ||
this(null, maxComplexParallels); | ||
} | ||
|
||
public ComplexParallelProcessingLogic(GT_Recipe.GT_Recipe_Map recipeMap, int maxComplexParallels) { | ||
this.maxComplexParallels = maxComplexParallels; | ||
this.recipeMap = recipeMap; | ||
inputItems = new ItemStack[maxComplexParallels][]; | ||
outputItems = new ItemStack[maxComplexParallels][]; | ||
inputFluids = new FluidStack[maxComplexParallels][]; | ||
outputFluids = new FluidStack[maxComplexParallels][]; | ||
eut = new long[maxComplexParallels]; | ||
availableEut = new long[maxComplexParallels]; | ||
durations = new long[maxComplexParallels]; | ||
isVoidProtected = new boolean[maxComplexParallels]; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setRecipeMap(GT_Recipe.GT_Recipe_Map recipeMap) { | ||
this.recipeMap = recipeMap; | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setInputItems(int index, ItemStack... itemInputs) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
inputItems[index] = itemInputs; | ||
} | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setInputFluids(int index, FluidStack... inputFluids) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
this.inputFluids[index] = inputFluids; | ||
} | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setTileEntity(Controller<?> tileEntity) { | ||
this.tileEntity = tileEntity; | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setEut(int index, long eut) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
availableEut[index] = eut; | ||
} | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setVoidProtection(int index, boolean shouldVoidProtect) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
isVoidProtected[index] = shouldVoidProtect; | ||
} | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic setPerfectOverclock(boolean shouldOverclockPerfectly) { | ||
this.hasPerfectOverclock = shouldOverclockPerfectly; | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic clear() { | ||
for (int i = 0; i < maxComplexParallels; i++) { | ||
outputItems[i] = null; | ||
outputFluids[i] = null; | ||
durations[i] = 0; | ||
eut[i] = 0; | ||
} | ||
return this; | ||
} | ||
|
||
public ComplexParallelProcessingLogic clear(int index) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
inputItems[index] = null; | ||
inputFluids[index] = null; | ||
outputItems[index] = null; | ||
outputFluids[index] = null; | ||
durations[index] = 0; | ||
availableEut[index] = 0; | ||
eut[index] = 0; | ||
} | ||
return this; | ||
} | ||
|
||
public boolean process(int index) { | ||
if (recipeMap == null) { | ||
return false; | ||
} | ||
GT_Recipe recipe = recipeMap | ||
.findRecipe(tileEntity, false, false, availableEut[index], inputFluids[index], inputItems[index]); | ||
if (recipe == null) { | ||
return false; | ||
} | ||
|
||
GT_ParallelHelper helper = new GT_ParallelHelper().setRecipe(recipe) | ||
.setItemInputs(inputItems[index]) | ||
.setFluidInputs(inputFluids[index]) | ||
.setAvailableEUt(availableEut[index]) | ||
.enableConsumption() | ||
.enableOutputCalculation(); | ||
|
||
if (isVoidProtected[index]) { | ||
helper.enableVoidProtection(tileEntity); | ||
} | ||
|
||
helper.build(); | ||
|
||
if (helper.getCurrentParallel() <= 0) { | ||
return false; | ||
} | ||
|
||
GT_OverclockCalculator calculator = new GT_OverclockCalculator().setRecipeEUt(recipe.mEUt) | ||
.setDuration(recipe.mDuration) | ||
.setEUt(availableEut[index]); | ||
|
||
if (hasPerfectOverclock) { | ||
calculator.enablePerfectOC(); | ||
} | ||
|
||
if (calculator.getConsumption() == Long.MAX_VALUE - 1 || calculator.getDuration() == Integer.MAX_VALUE - 1) { | ||
return false; | ||
} | ||
|
||
durations[index] = calculator.getDuration(); | ||
eut[index] = calculator.getConsumption(); | ||
outputItems[index] = helper.getItemOutputs(); | ||
outputFluids[index] = helper.getFluidOutputs(); | ||
|
||
return true; | ||
} | ||
|
||
public long getDuration(int index) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
return durations[index]; | ||
} | ||
return 0; | ||
} | ||
|
||
public long getTotalEU() { | ||
return LongStream.of(eut) | ||
.sum(); | ||
} | ||
|
||
public ItemStack[] getOutputItems(int index) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
return outputItems[index]; | ||
} | ||
return null; | ||
} | ||
|
||
public FluidStack[] getOutputFluids(int index) { | ||
if (index >= 0 && index < maxComplexParallels) { | ||
return outputFluids[index]; | ||
} | ||
return null; | ||
} | ||
} |
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,5 @@ | ||
package gregtech.api.logic; | ||
|
||
public abstract class ModelRenderLogic { | ||
|
||
} |
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
10 changes: 10 additions & 0 deletions
10
src/main/java/gregtech/api/logic/interfaces/ModelRenderLogicHost.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,10 @@ | ||
package gregtech.api.logic.interfaces; | ||
|
||
import gregtech.api.logic.ModelRenderLogic; | ||
|
||
public interface ModelRenderLogicHost { | ||
|
||
ModelRenderLogic getRenderLogic(); | ||
|
||
boolean shouldRenderModel(); | ||
} |
4 changes: 3 additions & 1 deletion
4
src/main/java/gregtech/api/logic/interfaces/PowerLogicHost.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
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
Oops, something went wrong.