Skip to content

Commit

Permalink
add contents display on cells and fix pattern terminal encode overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
GlodBlock committed Dec 3, 2022
1 parent a805df0 commit c087930
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ private NBTBase createItemTag(final ItemStack i )
if( i != null )
{
i.writeToNBT( c );
c.setInteger( "Count", i.stackSize );
}

return c;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ private NBTBase createItemTag(final ItemStack i )
if( i != null )
{
i.writeToNBT( c );
c.setInteger( "Count", i.stackSize );
}

return c;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import appeng.items.contents.CellUpgrades;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.CellType;
Expand Down Expand Up @@ -52,8 +53,10 @@ public class ItemBasicFluidStorageCell extends AEBaseItem implements IStorageFlu
private final int totalBytes;
private final int perType;
private final double idleDrain;
private final ReadableNumberConverter format = ReadableNumberConverter.INSTANCE;
private final static HashMap<Integer, IIcon> icon = new HashMap<>();

@SuppressWarnings("Guava")
public ItemBasicFluidStorageCell( final CellType whichCell, final int kilobytes )
{
super( Optional.of( kilobytes + "k" ) );
Expand Down Expand Up @@ -137,6 +140,17 @@ public void addCheckedInformation(final ItemStack stack, final EntityPlayer play

lines.add( cellInventory.getStoredFluidTypes() + " " + GuiText.Of.getLocal() + ' ' + cellInventory.getTotalFluidTypes() + ' ' + GuiText.Types.getLocal() );

if (GuiScreen.isShiftKeyDown()) {
if (cellInventory.getStoredFluidTypes() > 0) {
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_CONTENTS));
for (IAEFluidStack fluid : cellInventory.getContents()) {
if (fluid != null) {
lines.add(String.format(" %s x%smB", fluid.getFluidStack().getLocalizedName(), format.toWideReadableForm(fluid.getStackSize())));
}
}
}
}

if( handler.isPreformatted() )
{
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded).getLocal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;

import java.util.ArrayList;
import java.util.List;

public class FluidCellInventory implements IFluidCellInventory {

private static final String FLUID_TYPE_TAG = "ft";
Expand Down Expand Up @@ -465,10 +468,18 @@ public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out)
{
out.add( i );
}

return out;
}

@Override
public List<IAEFluidStack> getContents() {
List<IAEFluidStack> ret = new ArrayList<>();
for (IAEFluidStack fluid : this.getCellItems()) {
ret.add(fluid);
}
return ret;
}

@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

import java.util.List;

public interface IFluidCellInventory extends IMEInventory<IAEFluidStack>
{

Expand Down Expand Up @@ -71,4 +73,6 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack>
long getStoredFluidTypes();

long getTotalFluidTypes();

List<IAEFluidStack> getContents();
}
1 change: 1 addition & 0 deletions src/main/java/com/glodblock/github/util/NameConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class NameConst {
public static final String TT_DUMP_TANK = TT_KEY + "dump_tank";
public static final String TT_REQUEST_SIZE = TT_KEY + "request_size";
public static final String TT_BATCH_SIZE = TT_KEY + "batch_size";
public static final String TT_CELL_CONTENTS = TT_KEY + "cell_contents";

public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/ae2fc/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ae2fc.waila.disable=Disable

ae2fc.tooltip.request_size=Amount to Maintain
ae2fc.tooltip.batch_size=Crafting Batch Size
ae2fc.tooltip.cell_contents=Contains Fluid:
ae2fc.tooltip.fluid_terminal=uh So we don't need EC2 anymore?
ae2fc.tooltip.invalid_fluid=Invalid fluid!
ae2fc.tooltip.encode_pattern=Encode Patter
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/ae2fc/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ae2fc.waila.disable=禁用

ae2fc.tooltip.request_size=缓存量
ae2fc.tooltip.batch_size=批量制作数量
ae2fc.tooltip.cell_contents=内含流体:
ae2fc.tooltip.fluid_terminal=我们不再需要EC2了吗?
ae2fc.tooltip.invalid_fluid=流体无效!
ae2fc.tooltip.encode_pattern=编写样板
Expand Down

0 comments on commit c087930

Please sign in to comment.