Skip to content

Commit 8c1b0dd

Browse files
authored
Add fallback fluid capacity method and overloaded methods for not specifying fluid capacity (#139)
1 parent 2f87fee commit 8c1b0dd

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

src/main/java/net/swedz/tesseract/neoforge/compat/mi/machine/builder/slots/MachineSlotConfiguration.java

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ public static final class Builder
188188
{
189189
private final List<MachineSlotDefinition> slots = Lists.newArrayList();
190190

191+
private int fallbackFluidCapacity = 16;
192+
193+
public Builder fluidCapacity(int fallbackFluidCapacity)
194+
{
195+
this.fallbackFluidCapacity = fallbackFluidCapacity;
196+
return this;
197+
}
198+
191199
public Builder append(Builder other)
192200
{
193201
slots.addAll(other.slots);
@@ -296,31 +304,61 @@ public Builder fluidInput(int x, int y, Supplier<Fluid> lock, int capacityBucket
296304
return this.fluid(x, y, true, true, true, false, lock, capacityBuckets);
297305
}
298306

307+
public Builder fluidInput(int x, int y, Supplier<Fluid> lock)
308+
{
309+
return this.fluidInput(x, y, lock, fallbackFluidCapacity);
310+
}
311+
299312
public Builder fluidInput(int x, int y, int capacityBuckets)
300313
{
301314
return this.fluidInput(x, y, null, capacityBuckets);
302315
}
303316

317+
public Builder fluidInput(int x, int y)
318+
{
319+
return this.fluidInput(x, y, fallbackFluidCapacity);
320+
}
321+
304322
public Builder fluidOutput(int x, int y, Supplier<Fluid> lock, int capacityBuckets)
305323
{
306324
return this.fluid(x, y, false, false, true, true, lock, capacityBuckets);
307325
}
308326

327+
public Builder fluidOutput(int x, int y, Supplier<Fluid> lock)
328+
{
329+
return this.fluidOutput(x, y, lock, fallbackFluidCapacity);
330+
}
331+
309332
public Builder fluidOutput(int x, int y, int capacityBuckets)
310333
{
311334
return this.fluidOutput(x, y, null, capacityBuckets);
312335
}
313336

337+
public Builder fluidOutput(int x, int y)
338+
{
339+
return this.fluidOutput(x, y, fallbackFluidCapacity);
340+
}
341+
314342
public Builder fluidIO(int x, int y, Supplier<Fluid> lock, int capacityBuckets)
315343
{
316344
return this.fluid(x, y, true, true, true, true, lock, capacityBuckets);
317345
}
318346

347+
public Builder fluidIO(int x, int y, Supplier<Fluid> lock)
348+
{
349+
return this.fluidIO(x, y, lock, fallbackFluidCapacity);
350+
}
351+
319352
public Builder fluidIO(int x, int y, int capacityBuckets)
320353
{
321354
return this.fluidIO(x, y, null, capacityBuckets);
322355
}
323356

357+
public Builder fluidIO(int x, int y)
358+
{
359+
return this.fluidIO(x, y, fallbackFluidCapacity);
360+
}
361+
324362
private Builder fluids(int x, int y, int columns, int rows,
325363
boolean playerInsert, boolean pipesInsert,
326364
boolean playerExtract, boolean pipesExtract,
@@ -341,31 +379,61 @@ public Builder fluidInputs(int x, int y, int columns, int rows, Supplier<Fluid>
341379
return this.fluids(x, y, columns, rows, true, true, true, false, lock, capacityBuckets);
342380
}
343381

382+
public Builder fluidInputs(int x, int y, int columns, int rows, Supplier<Fluid> lock)
383+
{
384+
return this.fluidInputs(x, y, columns, rows, lock, fallbackFluidCapacity);
385+
}
386+
344387
public Builder fluidInputs(int x, int y, int columns, int rows, int capacityBuckets)
345388
{
346389
return this.fluidInputs(x, y, columns, rows, null, capacityBuckets);
347390
}
348391

392+
public Builder fluidInputs(int x, int y, int columns, int rows)
393+
{
394+
return this.fluidInputs(x, y, columns, rows, fallbackFluidCapacity);
395+
}
396+
349397
public Builder fluidOutputs(int x, int y, int columns, int rows, Supplier<Fluid> lock, int capacityBuckets)
350398
{
351399
return this.fluids(x, y, columns, rows, false, false, true, true, lock, capacityBuckets);
352400
}
353401

402+
public Builder fluidOutputs(int x, int y, int columns, int rows, Supplier<Fluid> lock)
403+
{
404+
return this.fluidOutputs(x, y, columns, rows, lock, fallbackFluidCapacity);
405+
}
406+
354407
public Builder fluidOutputs(int x, int y, int columns, int rows, int capacityBuckets)
355408
{
356409
return this.fluidOutputs(x, y, columns, rows, null, capacityBuckets);
357410
}
358411

412+
public Builder fluidOutputs(int x, int y, int columns, int rows)
413+
{
414+
return this.fluidOutputs(x, y, columns, rows, fallbackFluidCapacity);
415+
}
416+
359417
public Builder fluidIOs(int x, int y, int columns, int rows, Supplier<Fluid> lock, int capacityBuckets)
360418
{
361419
return this.fluids(x, y, columns, rows, true, true, true, true, lock, capacityBuckets);
362420
}
363421

422+
public Builder fluidIOs(int x, int y, int columns, int rows, Supplier<Fluid> lock)
423+
{
424+
return this.fluidIOs(x, y, columns, rows, lock, fallbackFluidCapacity);
425+
}
426+
364427
public Builder fluidIOs(int x, int y, int columns, int rows, int capacityBuckets)
365428
{
366429
return this.fluidIOs(x, y, columns, rows, null, capacityBuckets);
367430
}
368431

432+
public Builder fluidIOs(int x, int y, int columns, int rows)
433+
{
434+
return this.fluidIOs(x, y, columns, rows, fallbackFluidCapacity);
435+
}
436+
369437
public MachineSlotConfiguration build()
370438
{
371439
return new MachineSlotConfiguration(slots.toArray(MachineSlotDefinition[]::new));

0 commit comments

Comments
 (0)