Compare commits

...
Author SHA1 Message Date
Martin Robertz d60b8505ee Merge remote-tracking branch 'asdflj/bookmark' into dev 2023-01-28 15:47:14 +01:00
GlodBlock fc9893ac32 fix npe from two storage bus facing each other 2023-01-28 15:48:14 +08:00
Martin Robertz 4d236cb898 Merge pull request #69 from asdflj/bookmark
add fluid storage monitor
2023-01-25 10:36:13 +01:00
GlodBlock e424230f96 add missing super event handler 2023-01-25 14:56:36 +08:00
GlodBlock ea4014fc1e fix fluid storage bus trigger 2023-01-24 15:48:10 +08:00
Yang Xizhi 96ba5e2997 Merge pull request #70 from GTNewHorizons/removeasm
remove io port asm and add 16384k fluid cell
2023-01-24 00:10:13 +08:00
GlodBlock 0a5a38341f remove io port asm 2023-01-23 20:55:31 +08:00
GlodBlock 4440ea5a1c colorful tooltips and 16384k cell 2023-01-23 20:52:19 +08:00
16 changed files with 149 additions and 84 deletions

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
@@ -122,11 +122,13 @@ public class PartFluidInterface extends PartInterface implements IDualHost {
@MENetworkEventSubscribe
public void stateChange(final MENetworkChannelsChanged c) {
fluidDuality.onChannelStateChange(c);
super.stateChange(c);
}
@MENetworkEventSubscribe
public void stateChange(final MENetworkPowerStatusChange c) {
fluidDuality.onPowerStateChange(c);
super.stateChange(c);
}
@Override
@@ -56,6 +56,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.IFluidHandler;
public class PartFluidStorageBus extends PartUpgradeable
implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEFluidStack>, IPriorityHost {
@@ -289,6 +290,9 @@ public class PartFluidStorageBus extends PartUpgradeable
this.resetCache(true);
this.resetCache();
}
} else if (te instanceof IFluidHandler) {
this.resetCache(true);
this.resetCache();
} else {
this.resetCache(false);
}
@@ -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);
@@ -25,9 +25,11 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
@SuppressWarnings("rawtypes")
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
if (channel == StorageChannel.FLUIDS) {
if (te instanceof ITileStorageMonitorable) {
if (te instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable) {
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
ITileStorageMonitorable part = (ITileStorageMonitorable) Util.getPart(te, d.getOpposite());
return part.getMonitorable(d, src).getFluidInventory();
}
@@ -43,6 +43,8 @@ public class ItemAndBlockHolder {
new ItemBasicFluidStorageCell(CellType.Cell1024kPart, 1024).register();
public static ItemBasicFluidStorageCell CELL4096K =
new ItemBasicFluidStorageCell(CellType.Cell4096kPart, 4096).register();
public static ItemBasicFluidStorageCell CELL16384K =
new ItemBasicFluidStorageCell(CellType.Cell16384kPart, 16384).register();
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
public static void loadSetting() {
@@ -54,5 +56,6 @@ public class ItemAndBlockHolder {
CellType.Cell256kPart.setItemInstance(CELL_PART);
CellType.Cell1024kPart.setItemInstance(CELL_PART);
CellType.Cell4096kPart.setItemInstance(CELL_PART);
CellType.Cell16384kPart.setItemInstance(CELL_PART);
}
}
@@ -198,7 +198,7 @@ public class RecipeLoader implements Runnable {
"CEC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
"anyCertusCrystal",
'E',
@@ -209,7 +209,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell1kPart.stack(1),
'P',
@@ -222,7 +222,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell4kPart.stack(1),
'P',
@@ -235,7 +235,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell16kPart.stack(1),
'P',
@@ -248,7 +248,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell64kPart.stack(1),
'P',
@@ -261,7 +261,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell256kPart.stack(1),
'P',
@@ -274,16 +274,30 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell1024kPart.stack(1),
'P',
AE2_PROCESS_CAL,
'G',
AE2_LAMP_GLASS));
GameRegistry.addRecipe(new ShapedOreRecipe(
CellType.Cell16384kPart.stack(1),
"DPD",
"CGC",
"DCD",
'D',
"dyeRed",
'C',
CellType.Cell4096kPart.stack(1),
'P',
AE2_PROCESS_ENG,
'G',
AE2_LAMP_GLASS));
ItemBasicFluidStorageCell[] cells =
new ItemBasicFluidStorageCell[] {CELL1K, CELL4K, CELL16K, CELL64K, CELL256K, CELL1024K, CELL4096K};
ItemBasicFluidStorageCell[] cells = new ItemBasicFluidStorageCell[] {
CELL1K, CELL4K, CELL16K, CELL64K, CELL256K, CELL1024K, CELL4096K, CELL16384K
};
for (ItemBasicFluidStorageCell cell : cells) {
GameRegistry.addRecipe(new ShapedOreRecipe(
+16 -14
View File
@@ -11,20 +11,22 @@ item.part_fluid_level_emitter.name=ME Fluid Level Emitter
item.part_fluid_storage_monitor.name=ME Fluid Storage Monitor
item.part_fluid_conversion_monitor.name=ME Fluid Conversion Monitor
item.fluid_packet.name=Fluid Packet
item.fluid_storage.1.name=1k ME Fluid Storage Cell
item.fluid_storage.4.name=4k ME Fluid Storage Cell
item.fluid_storage.16.name=16k ME Fluid Storage Cell
item.fluid_storage.64.name=64k ME Fluid Storage Cell
item.fluid_storage.256.name=256k ME Fluid Storage Cell
item.fluid_storage.1024.name=1024k ME Fluid Storage Cell
item.fluid_storage.4096.name=4096k ME Fluid Storage Cell
item.fluid_part.0.name=1k ME Fluid Storage Component
item.fluid_part.1.name=4k ME Fluid Storage Component
item.fluid_part.2.name=16k ME Fluid Storage Component
item.fluid_part.3.name=64k ME Fluid Storage Component
item.fluid_part.4.name=256k ME Fluid Storage Component
item.fluid_part.5.name=1024k ME Fluid Storage Component
item.fluid_part.6.name=4096k ME Fluid Storage Component
item.fluid_storage.1.name=%s1k%s ME Fluid Storage Cell
item.fluid_storage.4.name=%s4k%s ME Fluid Storage Cell
item.fluid_storage.16.name=%s16k%s ME Fluid Storage Cell
item.fluid_storage.64.name=%s64k%s ME Fluid Storage Cell
item.fluid_storage.256.name=%s256k%s ME Fluid Storage Cell
item.fluid_storage.1024.name=%s1024k%s ME Fluid Storage Cell
item.fluid_storage.4096.name=%s4096k%s ME Fluid Storage Cell
item.fluid_storage.16384.name=%s16384k%s ME Fluid Storage Cell
item.fluid_part.0.name=%s1k%s ME Fluid Storage Component
item.fluid_part.1.name=%s4k%s ME Fluid Storage Component
item.fluid_part.2.name=%s16k%s ME Fluid Storage Component
item.fluid_part.3.name=%s64k%s ME Fluid Storage Component
item.fluid_part.4.name=%s256k%s ME Fluid Storage Component
item.fluid_part.5.name=%s1024k%s ME Fluid Storage Component
item.fluid_part.6.name=%s4096k%s ME Fluid Storage Component
item.fluid_part.7.name=%s16384k%s ME Fluid Storage Component
tile.fluid_discretizer.name=Fluid Discretizer
tile.fluid_pattern_encoder.name=Fluid Pattern Encoder
+14 -14
View File
@@ -6,20 +6,20 @@ item.part_fluid_interface.name=Жидкостный интерфейс
item.part_fluid_import.name=МЭ жидкостная шина импорта
item.part_fluid_export.name=МЭ жидкостная шина экспорта
item.fluid_packet.name=Жидкостный пакет
item.fluid_storage.1.name=1К МЭ жидкостная ячейка хранения
item.fluid_storage.4.name=4К МЭ жидкостная ячейка хранения
item.fluid_storage.16.name=16К МЭ жидкостная ячейка хранения
item.fluid_storage.64.name=64К МЭ жидкостная ячейка хранения
item.fluid_storage.256.name=256К МЭ жидкостная ячейка хранения
item.fluid_storage.1024.name=1024К МЭ жидкостная ячейка хранения
item.fluid_storage.4096.name=4096К МЭ жидкостная ячейка хранения
item.fluid_part.0.name=1К МЭ жидкостный компонент хранения
item.fluid_part.1.name=4К МЭ жидкостный компонент хранения
item.fluid_part.2.name=16К МЭ жидкостный компонент хранения
item.fluid_part.3.name=64К МЭ жидкостный компонент хранения
item.fluid_part.4.name=256К МЭ жидкостный компонент хранения
item.fluid_part.5.name=1024К МЭ жидкостный компонент хранения
item.fluid_part.6.name=4096К МЭ жидкостный компонент хранения
item.fluid_storage.1.name=%s1К%s МЭ жидкостная ячейка хранения
item.fluid_storage.4.name=%s4К%s МЭ жидкостная ячейка хранения
item.fluid_storage.16.name=%s16К%s МЭ жидкостная ячейка хранения
item.fluid_storage.64.name=%s64К%s МЭ жидкостная ячейка хранения
item.fluid_storage.256.name=%s256К%s МЭ жидкостная ячейка хранения
item.fluid_storage.1024.name=%s1024К%s МЭ жидкостная ячейка хранения
item.fluid_storage.4096.name=%s4096К%s МЭ жидкостная ячейка хранения
item.fluid_part.0.name=%s1К%s МЭ жидкостный компонент хранения
item.fluid_part.1.name=%s4К%s МЭ жидкостный компонент хранения
item.fluid_part.2.name=%s16К%s МЭ жидкостный компонент хранения
item.fluid_part.3.name=%s64К%s МЭ жидкостный компонент хранения
item.fluid_part.4.name=%s256К%s МЭ жидкостный компонент хранения
item.fluid_part.5.name=%s1024К%s МЭ жидкостный компонент хранения
item.fluid_part.6.name=%s4096К%s МЭ жидкостный компонент хранения
tile.fluid_discretizer.name=Дискретизатор жидкости
tile.fluid_pattern_encoder.name=Кодировщик жидкостных шаблонов
+14 -14
View File
@@ -11,20 +11,20 @@ item.part_fluid_level_emitter.name=ME流体发信器
item.part_fluid_storage_monitor.name=ME流体存储监控器
item.part_fluid_conversion_monitor.name=ME流体交换监控器
item.fluid_packet.name=流体封包
item.fluid_storage.1.name=1k-ME流体存储元件
item.fluid_storage.4.name=4k-ME流体存储元件
item.fluid_storage.16.name=16k-ME流体存储元件
item.fluid_storage.64.name=64k-ME流体存储元件
item.fluid_storage.256.name=256k-ME流体存储元件
item.fluid_storage.1024.name=1024k-ME流体存储元件
item.fluid_storage.4096.name=4096k-ME流体存储元件
item.fluid_part.0.name=1k-ME流体存储组件
item.fluid_part.1.name=4k-ME流体存储组件
item.fluid_part.2.name=16k-ME流体存储组件
item.fluid_part.3.name=64k-ME流体存储组件
item.fluid_part.4.name=256k-ME流体存储组件
item.fluid_part.5.name=1024k-ME流体存储组件
item.fluid_part.6.name=4096k-ME流体存储组件
item.fluid_storage.1.name=%s1k%s-ME流体存储元件
item.fluid_storage.4.name=%s4k%s-ME流体存储元件
item.fluid_storage.16.name=%s16k%s-ME流体存储元件
item.fluid_storage.64.name=%s64k%s-ME流体存储元件
item.fluid_storage.256.name=%s256k%s-ME流体存储元件
item.fluid_storage.1024.name=%s1024k%s-ME流体存储元件
item.fluid_storage.4096.name=%s4096k%s-ME流体存储元件
item.fluid_part.0.name=%s1k%s-ME流体存储组件
item.fluid_part.1.name=%s4k%s-ME流体存储组件
item.fluid_part.2.name=%s16k%s-ME流体存储组件
item.fluid_part.3.name=%s64k%s-ME流体存储组件
item.fluid_part.4.name=%s256k%s-ME流体存储组件
item.fluid_part.5.name=%s1024k%s-ME流体存储组件
item.fluid_part.6.name=%s4096k%s-ME流体存储组件
tile.fluid_discretizer.name=ME流体离散器
tile.fluid_pattern_encoder.name=流体适配型样板编码台
Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 B

After

Width:  |  Height:  |  Size: 359 B