mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 10:34:40 +00:00
colorful tooltips and 16384k cell
This commit is contained in:
1 parent
8d072f0c89
commit
4440ea5a1c
13 files changed
+139
-82
No files matched your search
@@ -41,6 +41,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -94,6 +95,10 @@ public class ItemBasicFluidStorageCell extends AEBaseItem
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
@@ -106,7 +111,10 @@ public class ItemBasicFluidStorageCell extends AEBaseItem
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return StatCollector.translateToLocalFormatted("item.fluid_storage." + this.totalBytes / 1024 + ".name");
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
"item.fluid_storage." + this.totalBytes / 1024 + ".name",
|
||||
CellType.getTypeColor(this.component),
|
||||
EnumChatFormatting.RESET);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,11 +144,14 @@ public class ItemBasicFluidStorageCell extends AEBaseItem
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if (cellInventory != null) {
|
||||
lines.add(cellInventory.getUsedBytes() + " " + GuiText.Of.getLocal() + ' '
|
||||
+ cellInventory.getTotalBytes() + ' ' + GuiText.BytesUsed.getLocal());
|
||||
|
||||
lines.add(cellInventory.getStoredFluidTypes() + " " + GuiText.Of.getLocal() + ' '
|
||||
+ cellInventory.getTotalFluidTypes() + ' ' + GuiText.Types.getLocal());
|
||||
lines.add(EnumChatFormatting.WHITE + String.valueOf(cellInventory.getUsedBytes())
|
||||
+ EnumChatFormatting.GRAY + " " + GuiText.Of.getLocal() + " "
|
||||
+ EnumChatFormatting.DARK_GREEN + cellInventory.getTotalBytes() + " "
|
||||
+ EnumChatFormatting.GRAY + GuiText.BytesUsed.getLocal());
|
||||
lines.add(EnumChatFormatting.WHITE + String.valueOf(cellInventory.getStoredFluidTypes())
|
||||
+ EnumChatFormatting.GRAY + " " + GuiText.Of.getLocal() + " "
|
||||
+ EnumChatFormatting.DARK_GREEN + cellInventory.getTotalFluidTypes() + " "
|
||||
+ EnumChatFormatting.GRAY + GuiText.Types.getLocal());
|
||||
|
||||
if (GuiScreen.isCtrlKeyDown()) {
|
||||
if (cellInventory.getStoredFluidTypes() > 0) {
|
||||
@@ -148,7 +159,7 @@ public class ItemBasicFluidStorageCell extends AEBaseItem
|
||||
for (IAEFluidStack fluid : cellInventory.getContents()) {
|
||||
if (fluid != null) {
|
||||
lines.add(String.format(
|
||||
" %s x%smB",
|
||||
" %s x%s mB",
|
||||
fluid.getFluidStack().getLocalizedName(),
|
||||
format.toWideReadableForm(fluid.getStackSize())));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.common.item;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -13,12 +14,13 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemBasicFluidStoragePart extends FCBaseItem {
|
||||
|
||||
public static final int types = 7;
|
||||
public static final int types = 8;
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
|
||||
public ItemBasicFluidStoragePart() {
|
||||
@@ -39,7 +41,8 @@ public class ItemBasicFluidStoragePart extends FCBaseItem {
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return StatCollector.translateToLocalFormatted("item.fluid_part." + meta + ".name");
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
"item.fluid_part." + meta + ".name", CellType.getTypeColor(meta), EnumChatFormatting.RESET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import appeng.core.features.AEFeature;
|
||||
import java.util.EnumSet;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public enum CellType {
|
||||
Cell1kPart(0, AEFeature.StorageCells),
|
||||
@@ -12,7 +13,8 @@ public enum CellType {
|
||||
Cell64kPart(3, AEFeature.StorageCells),
|
||||
Cell256kPart(4, AEFeature.StorageCells),
|
||||
Cell1024kPart(5, AEFeature.StorageCells),
|
||||
Cell4096kPart(6, AEFeature.StorageCells);
|
||||
Cell4096kPart(6, AEFeature.StorageCells),
|
||||
Cell16384kPart(7, AEFeature.StorageCells);
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private int damageValue;
|
||||
@@ -46,4 +48,30 @@ public enum CellType {
|
||||
public void setItemInstance(final Item itemInstance) {
|
||||
this.itemInstance = itemInstance;
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(int type) {
|
||||
return getTypeColor(CellType.values()[type % CellType.values().length]);
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(CellType type) {
|
||||
switch (type) {
|
||||
case Cell1kPart:
|
||||
return EnumChatFormatting.GOLD;
|
||||
case Cell4kPart:
|
||||
return EnumChatFormatting.YELLOW;
|
||||
case Cell16kPart:
|
||||
return EnumChatFormatting.GREEN;
|
||||
case Cell64kPart:
|
||||
return EnumChatFormatting.AQUA;
|
||||
case Cell256kPart:
|
||||
return EnumChatFormatting.BLUE;
|
||||
case Cell1024kPart:
|
||||
return EnumChatFormatting.LIGHT_PURPLE;
|
||||
case Cell4096kPart:
|
||||
return EnumChatFormatting.RED;
|
||||
case Cell16384kPart:
|
||||
return EnumChatFormatting.DARK_PURPLE;
|
||||
}
|
||||
return EnumChatFormatting.WHITE;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ public class FluidCellHandler implements ICellHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public IMEInventoryHandler getCellInventory(
|
||||
final ItemStack is, final ISaveProvider container, final StorageChannel channel) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
|
||||
@@ -39,6 +39,22 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
public static final int singleByteAmount = 256 * 8;
|
||||
|
||||
public FluidCellInventory(final ItemStack o, final ISaveProvider container) throws AppEngException {
|
||||
if (o == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
this.cellType = null;
|
||||
this.cellItem = o;
|
||||
final Item type = this.cellItem.getItem();
|
||||
if (type instanceof IStorageFluidCell) {
|
||||
this.cellType = (IStorageFluidCell) this.cellItem.getItem();
|
||||
}
|
||||
if (this.cellType == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
if (!this.cellType.isStorageCell(this.cellItem)) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
if (fluidSlots == null) {
|
||||
fluidSlots = new String[MAX_TYPE];
|
||||
fluidSlotCount = new String[MAX_TYPE];
|
||||
@@ -49,27 +65,6 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
}
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
this.cellType = null;
|
||||
this.cellItem = o;
|
||||
|
||||
final Item type = this.cellItem.getItem();
|
||||
|
||||
if (type instanceof IStorageFluidCell) {
|
||||
this.cellType = (IStorageFluidCell) this.cellItem.getItem();
|
||||
}
|
||||
|
||||
if (this.cellType == null) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
if (!this.cellType.isStorageCell(this.cellItem)) {
|
||||
throw new AppEngException("ItemStack was used as a cell, but was not a cell!");
|
||||
}
|
||||
|
||||
this.container = container;
|
||||
this.tagCompound = Platform.openNbtData(o);
|
||||
this.storedFluids = this.tagCompound.getShort(FLUID_TYPE_TAG);
|
||||
|
||||
Reference in new issue
Block a user