Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
more work on buffers, added chest buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Sep 5, 2023
1 parent 3ff0775 commit 51ee0a7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 3 additions & 1 deletion common/src/main/java/muramasa/gregtech/data/Machines.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import io.github.gregtechintergalactical.gtutility.GTUtilityData;
import io.github.gregtechintergalactical.gtutility.machine.DrumMachine;
import muramasa.antimatter.AntimatterAPI;
import muramasa.antimatter.cover.ICover;
import muramasa.antimatter.data.AntimatterMaterials;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.machine.types.*;
Expand Down Expand Up @@ -116,7 +117,8 @@ public class Machines {
**/
public static BasicMachine ELECTRIC_ITEM_FILTER = null;
public static BasicMachine ELECTRIC_TYPE_FILTER = null;
public static BasicMachine SUPER_BUFFER =new BasicMachine(GTIRef.ID, "super_buffer").addFlags(GUI, ENERGY, ITEM).setTile(TileEntitySuperBuffer::new).setAllowVerticalFacing(true).allowFrontIO();
public static BasicMachine SUPER_BUFFER =new BasicMachine(GTIRef.ID, "super_buffer").addFlags(GUI, ENERGY, ITEM).setTile(TileEntityBuffer::new).setAllowVerticalFacing(true).allowFrontIO().setOutputCover(ICover.emptyFactory);
public static BasicMachine CHEST_BUFFER =new BasicMachine(GTIRef.ID, "chest_buffer").addFlags(GUI, ENERGY, ITEM).setTile(TileEntityBuffer::new).setAllowVerticalFacing(true).allowFrontIO().setOutputCover(ICover.emptyFactory);
/**
* Drums
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import muramasa.antimatter.tool.AntimatterToolType;
import muramasa.antimatter.util.AntimatterPlatformUtils;
import muramasa.antimatter.util.Utils;
import muramasa.gregtech.data.SlotTypes;
import muramasa.gregtech.data.Machines;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
Expand All @@ -33,18 +33,16 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import tesseract.TesseractCapUtils;
import tesseract.api.item.ExtendedItemContainer;
import tesseract.util.ItemHandlerUtils;

import static muramasa.antimatter.machine.MachineFlag.ENERGY;

public class TileEntitySuperBuffer extends TileEntityMachine<TileEntitySuperBuffer> {
public class TileEntityBuffer extends TileEntityMachine<TileEntityBuffer> {
protected int stackLimit = 64;
boolean emitEnergy = false;

public TileEntitySuperBuffer(Machine<?> type, BlockPos pos, BlockState state) {
public TileEntityBuffer(Machine<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
itemHandler.set(() -> new SuperBufferItemHandler(this));
itemHandler.set(() -> new BufferItemHandler(this));
if (type.has(ENERGY)) {
energyHandler.set(() -> new MachineEnergyHandler<>(this, 0L, this.getMachineTier().getVoltage() * 66L, this.getMachineTier().getVoltage(), this.getMachineTier().getVoltage(), 1, 1){
@Override
Expand Down Expand Up @@ -134,11 +132,12 @@ public void addWidgets(GuiInstance instance, IGuiElement parent) {
instance.addButton(8, 63, 16, 16, ButtonBody.NO_OVERLAY);
}

public static class SuperBufferItemHandler extends MachineItemHandler<TileEntitySuperBuffer> {
public static class BufferItemHandler extends MachineItemHandler<TileEntityBuffer> {

public SuperBufferItemHandler(TileEntitySuperBuffer tile) {
public BufferItemHandler(TileEntityBuffer tile) {
super(tile);
this.inventories.put(SlotType.STORAGE, new TrackedItemHandler<>(tile, 256, true, true, (t, s) -> true, ContentEvent.ITEM_INPUT_CHANGED){
int count = tile.getMachineType() == Machines.SUPER_BUFFER ? 256 : tile.getMachineType().getCount(tile.getMachineTier(), SlotType.STORAGE);
this.inventories.put(SlotType.STORAGE, new TrackedItemHandler<>(tile, count, true, true, (t, s) -> true, ContentEvent.ITEM_INPUT_CHANGED){
@NotNull
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate) {
Expand Down

0 comments on commit 51ee0a7

Please sign in to comment.