Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public enum TransferType {
INPUT(0x009001, true, false, true), // external: insertion only, players: insertion and extraction allowed
OUTPUT(0xa7071e, false, true, false), // external: extraction only, players: extraction only
STORAGE(0x008d90, true, true, true), // external: insertion and extraction allowed, players: insertion and extraction allowed
TRANSFER(0x908400, false, false, true); // external: immutable, players: insertion and extraction allowed - e.g. battery slots
TRANSFER(0x908400, false, false, true), // external: immutable, players: insertion and extraction allowed - e.g. battery slots
PROCESSING(0x908400, true, true, true); // external: insertion and extraction allowed, players: insertion and extraction allowed - e.g. bucket slots

private final int color;
private final boolean externalInsert;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ protected void drawConfigurationPanels(@NotNull GuiGraphics graphics, int mouseX
* @see #titleLabelY
*/
protected void drawTitle(@NotNull GuiGraphics graphics) {
graphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 0xFFFFFFFF, false);
graphics.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, 0xFF404040, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import dev.galacticraft.machinelib.api.compat.transfer.ExposedSlot;
import dev.galacticraft.machinelib.api.storage.slot.ResourceSlot;
import dev.galacticraft.machinelib.api.transfer.ResourceFlow;
import dev.galacticraft.machinelib.api.transfer.TransferType;
import net.fabricmc.fabric.api.transfer.v1.storage.StorageView;
import net.fabricmc.fabric.api.transfer.v1.storage.TransferVariant;
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
Expand Down Expand Up @@ -57,7 +58,15 @@ public long insert(Variant variant, long maxAmount, TransactionContext transacti

@Override
public long extract(Variant variant, long maxAmount, TransactionContext transaction) {
return this.supportsExtraction() ? this.slot.extract(variant.getObject(), variant.getComponents(), maxAmount, transaction) : 0;
if (this.supportsExtraction()) {
if (this.slot.transferMode() == TransferType.PROCESSING) {
if (this.slot.getFilter().test(variant.getObject(), variant.getComponents())) {
return 0;
}
}
return this.slot.extract(variant.getObject(), variant.getComponents(), maxAmount, transaction);
}
return 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class GeneratorBlockEntity extends MachineBlockEntity {

public static final StorageSpec STORAGE_SPEC = StorageSpec.of(
MachineItemStorage.spec(
ItemResourceSlot.builder(TransferType.TRANSFER)
ItemResourceSlot.builder(TransferType.PROCESSING)
.pos(8, 62)
.filter(ResourceFilters.CAN_INSERT_ENERGY)
.capacity(32),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class MelterBlockEntity extends MachineBlockEntity {
ItemResourceSlot.builder(TransferType.INPUT)
.pos(59, 42)
.filter(ResourceFilters.ofResource(Items.COBBLESTONE)),
ItemResourceSlot.builder(TransferType.TRANSFER)
ItemResourceSlot.builder(TransferType.PROCESSING)
.pos(152, 62)
.filter(ResourceFilters.canInsertFluid(Fluids.LAVA))
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ public class MixerBlockEntity extends MachineBlockEntity {
.pos(8, 8)
.filter(ResourceFilters.CAN_EXTRACT_ENERGY)
.capacity(32),
ItemResourceSlot.builder(TransferType.TRANSFER)
ItemResourceSlot.builder(TransferType.PROCESSING)
.pos(48, 8)
.filter(ResourceFilters.canExtractFluid(Fluids.WATER)),
ItemResourceSlot.builder(TransferType.TRANSFER)
ItemResourceSlot.builder(TransferType.PROCESSING)
.pos(70, 8)
.filter(ResourceFilters.canExtractFluid(Fluids.LAVA)),
ItemResourceSlot.builder(TransferType.OUTPUT)
Expand Down