aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java
diff options
context:
space:
mode:
authorElisis <gtandemmodding@gmail.com>2024-11-24 10:14:22 +1100
committerGitHub <noreply@github.com>2024-11-23 23:14:22 +0000
commit9ce867e5aa95d2f8a8a809e33b3a0fb874e3b36b (patch)
tree96333d48657f7c07e03b2ce8d7367a0a2ccc7523 /src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java
parent2449dbf9168456d49f0cf29097ff780f6cd63deb (diff)
downloadGT5-Unofficial-9ce867e5aa95d2f8a8a809e33b3a0fb874e3b36b.tar.gz
GT5-Unofficial-9ce867e5aa95d2f8a8a809e33b3a0fb874e3b36b.tar.bz2
GT5-Unofficial-9ce867e5aa95d2f8a8a809e33b3a0fb874e3b36b.zip
Beamline fixes 4 (#3504)
Co-authored-by: BlueHero233 <jeleiacraft@gmail.com> Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ethryan <3237986+Ethryan@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java')
-rw-r--r--src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java80
1 files changed, 63 insertions, 17 deletions
diff --git a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java
index ffc16fddf0..988bf1fd5c 100644
--- a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java
+++ b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java
@@ -272,15 +272,7 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
})
.find();
- if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItemsWithFocusItemArray))
- return false;
-
- if (tRecipe.focusItem != null) {
- if (tRecipe.focusItem.getItem() != tFocusItem.getItem()) return false;
- }
-
- this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
- this.mEfficiencyIncrease = 10000;
+ if (tRecipe == null) return false;
BeamInformation inputInfo = this.getInputInformation();
@@ -297,23 +289,72 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
if (inputParticle != tRecipe.particleId) return false;
- this.mMaxProgresstime = Math.max(Math.round((tRecipe.amount / inputRate * 5 * TickTime.SECOND)), 1); // 5
- // seconds
- // per
+ if (tRecipe.focusItem != null) {
+ if (tRecipe.focusItem.getItem() != tFocusItem.getItem()) return false;
+ }
+
+ int focusDurabilityDepletion = 1;
+
+ float progressTime = tRecipe.amount / inputRate * 5 * TickTime.SECOND;
+
+ int batchAmount = 1;
+
+ if (progressTime < 1) { // Subticking
+
+ batchAmount = (int) Math.round(1.0 / progressTime);
+
+ if (tRecipe.focusItem != null) {
+ int maskLimit = tFocusItem.getMaxDamage() - tFocusItem.getItemDamage() + 1;
+
+ if (batchAmount > maskLimit) batchAmount = maskLimit; // Limited by mask durability first, if it's
+ // present in recipe. Assume mask is present in
+ // machine from above condition
+ }
+
+ progressTime = 1;
+ }
+
+ this.mMaxProgresstime = (int) progressTime; // 5
+ // seconds
+ // per
// integer multiple
// over the rate. E.g., 100a, 10r
// would equal 50 seconds
+
if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false;
+ double maxParallel = tRecipe
+ .maxParallelCalculatedByInputs(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray);
+
+ if (maxParallel < 1) // Insufficient items
+ return false;
+
+ if (batchAmount > maxParallel) batchAmount = (int) maxParallel;
+
+ tRecipe.consumeInput(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray);
+
+ focusDurabilityDepletion = batchAmount;
+
+ ItemStack[] itemOutputArray = GTUtility.copyItemArray(tRecipe.mOutputs);
+
+ for (ItemStack stack : itemOutputArray) {
+
+ stack.stackSize *= batchAmount;
+
+ }
+
+ this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
mEUt = (int) -tVoltage;
if (this.mEUt > 0) this.mEUt = (-this.mEUt);
- this.mOutputItems = tRecipe.mOutputs;
+ this.mOutputItems = itemOutputArray;
if (tRecipe.focusItem != null) // Recipe actually uses the mask, can also assume machine mask item is nonnull
// due to above conditions
mInputFocus.get(0)
- .depleteFocusDurability(1);
+ .depleteFocusDurability(focusDurabilityDepletion);
this.updateSlots();
@@ -325,9 +366,6 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
for (MTEHatchInputBeamline in : this.mInputBeamline) {
if (in.q == null) return new BeamInformation(0, 0, 0, 0);
- // if (in.q == null) return new BeamInformation(10, 10, Particle.PHOTON.ordinal(), 90); // temporary
- // for
- // testing purposes
return in.q.getContent();
}
@@ -337,6 +375,10 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
private ItemStack getFocusItemStack() {
for (MTEBusInputFocus hatch : this.mInputFocus) {
+
+ if (hatch.getContentUsageSlots()
+ .isEmpty()) return null;
+
return hatch.getContentUsageSlots()
.get(0);
}
@@ -400,6 +442,10 @@ public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber
BeamInformation information = this.getInputInformation();
+ if (information == null) {
+ information = new BeamInformation(0, 0, 0, 0);
+ }
+
return new String[] {
/* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": "
+ EnumChatFormatting.GREEN