Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ org.gradle.caching=true
cyclopscore_version=1.26.2-808
integrateddynamics_version=1.32.0-1630
integratedterminalscompat_version=1.0.0-167
integratedcrafting_version=1.4.1-442
integratedcrafting_version=1.5.0-689
integratedtunnels_version=1.8.44-484
commoncapabilities_version=2.9.12-263
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public interface ITerminalCraftingOption<T> extends Comparable<ITerminalCrafting
*/
public <T, M> Collection<T> getOutputs(IngredientComponent<T, M> ingredientComponent);

/**
* An estimation of how long a single crafting operation of this option takes,
* based on how long the crafting interfaces of the network needed for it before.
*
* @return The estimated tick duration of one crafting operation. -1 indicates an unknown duration.
*/
public long getEstimatedTickDuration();

/**
* @return All input components.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ public interface ITerminalCraftingPlan<I> {
*/
public long getCraftingQuantity();

/**
* @return The number of instances that will be crafted in total by this job,
* including the ones that were crafted already.
* For jobs that have not started crafting yet,
* this is equal to {@link #getCraftingQuantity()}.
*/
public long getCraftingQuantityTotal();

/**
* @return The ingredients within the storage buffer.
*/
Expand All @@ -64,6 +72,19 @@ public interface ITerminalCraftingPlan<I> {
*/
public long getTickDuration();

/**
* Contrary to {@link #getTickDuration()}, which indicates how long this job has been running already,
* this is an estimation of how long this job takes from start to finish.
*
* @return The estimated total tick duration for this job. -1 indicates an unknown duration.
*/
public long getEstimatedTickDurationTotal();

/**
* @return The estimated tick duration until this job is finished. -1 indicates an unknown duration.
*/
public long getEstimatedTickDurationRemaining();

/**
* @return The channel id, or -1 for non-applicable.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ public interface ITerminalCraftingPlanFlat<I> {
*/
public long getTickDuration();

/**
* @return The number of crafting operations in this plan, including the ones that finished already.
* 0 indicates an unknown quantity.
*/
public long getCraftingQuantityTotal();

/**
* @return The number of crafting operations in this plan that still have to be performed.
* 0 indicates an unknown quantity, or a plan without remaining operations.
*/
public long getCraftingQuantityRemaining();

/**
* Contrary to {@link #getTickDuration()}, which indicates how long this job has been running already,
* this is an estimation of how long this job takes from start to finish.
*
* @return The estimated total tick duration for this job. -1 indicates an unknown duration.
*/
public long getEstimatedTickDurationTotal();

/**
* @return The estimated tick duration until this job is finished. -1 indicates an unknown duration.
*/
public long getEstimatedTickDurationRemaining();

/**
* @return The channel id, or -1 for non-applicable.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ public class TerminalCraftingPlanFlatStatic<I> implements ITerminalCraftingPlanF
@Nullable
private String unlocalizedLabelOverride;
private final long tickDuration;
private final long craftingQuantityTotal;
private final long craftingQuantityRemaining;
private final long estimatedTickDurationTotal;
private final long estimatedTickDurationRemaining;
private final int channel;
@Nullable
private final String initiatorName;
Expand All @@ -36,13 +40,32 @@ public TerminalCraftingPlanFlatStatic(I id,
long tickDuration,
int channel,
@Nullable String initiatorName) {
this(id, entries, outputs, status, label, tickDuration, 0, 0, -1, -1, channel, initiatorName);
}

public TerminalCraftingPlanFlatStatic(I id,
List<TerminalCraftingPlanFlatStatic.Entry> entries,
List<IPrototypedIngredient<?, ?>> outputs,
TerminalCraftingJobStatus status,
TerminalCraftingPlanStatic.Label label,
long tickDuration,
long craftingQuantityTotal,
long craftingQuantityRemaining,
long estimatedTickDurationTotal,
long estimatedTickDurationRemaining,
int channel,
@Nullable String initiatorName) {
this.id = id;
this.entries = entries;
this.outputs = outputs;
this.status = status;
this.label = label;
this.unlocalizedLabelOverride = null;
this.tickDuration = tickDuration;
this.craftingQuantityTotal = craftingQuantityTotal;
this.craftingQuantityRemaining = craftingQuantityRemaining;
this.estimatedTickDurationTotal = estimatedTickDurationTotal;
this.estimatedTickDurationRemaining = estimatedTickDurationRemaining;
this.channel = channel;
this.initiatorName = initiatorName;
}
Expand Down Expand Up @@ -93,6 +116,26 @@ public long getTickDuration() {
return tickDuration;
}

@Override
public long getCraftingQuantityTotal() {
return craftingQuantityTotal;
}

@Override
public long getCraftingQuantityRemaining() {
return craftingQuantityRemaining;
}

@Override
public long getEstimatedTickDurationTotal() {
return estimatedTickDurationTotal;
}

@Override
public long getEstimatedTickDurationRemaining() {
return estimatedTickDurationRemaining;
}

@Override
public int getChannel() {
return channel;
Expand Down Expand Up @@ -137,6 +180,12 @@ public static <I> CompoundTag serialize(HolderLookup.Provider lookupProvider, Te

tag.putLong("tickDuration", plan.getTickDuration());

tag.putLong("craftingQuantityTotal", plan.getCraftingQuantityTotal());
tag.putLong("craftingQuantityRemaining", plan.getCraftingQuantityRemaining());

tag.putLong("estimatedTickDurationTotal", plan.getEstimatedTickDurationTotal());
tag.putLong("estimatedTickDurationRemaining", plan.getEstimatedTickDurationRemaining());

tag.putInt("channel", plan.getChannel());

if (plan.getInitiatorName() != null) {
Expand Down Expand Up @@ -195,14 +244,24 @@ public static <I> TerminalCraftingPlanFlatStatic<I> deserialize(HolderLookup.Pro

long tickDuration = tag.getLong("tickDuration");

long craftingQuantityTotal = tag.getLong("craftingQuantityTotal");
long craftingQuantityRemaining = tag.getLong("craftingQuantityRemaining");

long estimatedTickDurationTotal = tag.contains("estimatedTickDurationTotal", Tag.TAG_LONG)
? tag.getLong("estimatedTickDurationTotal") : -1;
long estimatedTickDurationRemaining = tag.contains("estimatedTickDurationRemaining", Tag.TAG_LONG)
? tag.getLong("estimatedTickDurationRemaining") : -1;

int channel = tag.getInt("channel");

String initiatorName = null;
if (tag.contains("initiatorName", Tag.TAG_STRING)) {
initiatorName = tag.getString("initiatorName");
}

TerminalCraftingPlanFlatStatic<I> plan = new TerminalCraftingPlanFlatStatic<>(id, entries, outputs, status, label, tickDuration, channel, initiatorName);
TerminalCraftingPlanFlatStatic<I> plan = new TerminalCraftingPlanFlatStatic<>(id, entries, outputs, status, label,
tickDuration, craftingQuantityTotal, craftingQuantityRemaining,
estimatedTickDurationTotal, estimatedTickDurationRemaining, channel, initiatorName);
if (unlocalizedLabelOverride != null) {
plan.unlocalizedLabelOverride = unlocalizedLabelOverride;
}
Expand Down
Loading
Loading