Skip to content

Commit

Permalink
fix: made pre-filled oxygen tanks in the creative tab have the correc…
Browse files Browse the repository at this point in the history
…t capacity (#369)
  • Loading branch information
DuckyProgrammer authored Nov 15, 2024
1 parent 8a01925 commit cd68e90
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,44 @@ public class GCCreativeModeTabs {

output.accept(SMALL_OXYGEN_TANK);//todo: set directly
itemStorage.setItem(SMALL_OXYGEN_TANK);
context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), Long.MAX_VALUE, t);
OxygenTankItem smallTankItem = (OxygenTankItem) SMALL_OXYGEN_TANK.asItem();
long smallCapacity = smallTankItem.capacity;
long insertedSmall;

do {
insertedSmall = context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), smallCapacity, t);
} while (insertedSmall > 0 && smallCapacity > 0);

output.accept(itemStorage.variant.toStack());

output.accept(MEDIUM_OXYGEN_TANK);
itemStorage.setItem(MEDIUM_OXYGEN_TANK);
context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), Long.MAX_VALUE, t);
OxygenTankItem mediumTankItem = (OxygenTankItem) MEDIUM_OXYGEN_TANK.asItem();
long mediumCapacity = mediumTankItem.capacity;
long insertedMedium;

do {
insertedMedium = context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), mediumCapacity, t);
mediumCapacity -= insertedMedium;
} while (insertedMedium > 0 && mediumCapacity > 0);

output.accept(itemStorage.variant.toStack());

output.accept(LARGE_OXYGEN_TANK);
itemStorage.setItem(LARGE_OXYGEN_TANK);
context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), Long.MAX_VALUE, t);
OxygenTankItem largeTankItem = (OxygenTankItem) LARGE_OXYGEN_TANK.asItem();
long largeCapacity = largeTankItem.capacity;
long insertedLarge;

do {
insertedLarge = context.find(FluidStorage.ITEM).insert(FluidVariant.of(Gases.OXYGEN), largeCapacity, t);
largeCapacity -= insertedLarge;
} while (insertedLarge > 0 && largeCapacity > 0);

output.accept(itemStorage.variant.toStack());
}


output.accept(INFINITE_OXYGEN_TANK);
output.accept(SENSOR_GLASSES);
output.accept(FREQUENCY_MODULE);
Expand Down

0 comments on commit cd68e90

Please sign in to comment.