Merge pull request #70 from GTNewHorizons/removeasm

remove io port asm and add 16384k fluid cell
This commit is contained in:
Yang Xizhi authored and GitHub committed 2023-01-24 00:10:13 +08:00
commit 96ba5e2997
15 files changed
+139 -142

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);
@@ -32,9 +32,6 @@ public class FCClassTransformer implements IClassTransformer {
case "appeng.integration.modules.NEI":
tform = NEITransfermer.INSTANCE;
break;
case "appeng.tile.storage.TileIOPort":
tform = TitleIOPortTransformer.INSTANCE;
break;
case "appeng.core.features.registries.ExternalStorageRegistry":
tform = ExternalStorageRegistryTransformer.INSTANCE;
break;
@@ -1,57 +0,0 @@
package com.glodblock.github.coremod.transform;
import com.glodblock.github.coremod.FCClassTransformer;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class TitleIOPortTransformer extends FCClassTransformer.ClassMapper {
public static final TitleIOPortTransformer INSTANCE = new TitleIOPortTransformer();
private TitleIOPortTransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new TitleIOPortTransformer.TransformTitleIOPort(Opcodes.ASM5, downstream);
}
private static class TransformTitleIOPort extends ClassVisitor {
TransformTitleIOPort(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (name.equals("transferContents")) {
return new TitleIOPortTransformer.TransformTransferContents(
api, super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class TransformTransferContents extends MethodVisitor {
TransformTransferContents(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
if (opcode == Opcodes.INVOKESTATIC && owner.equals("java/lang/Math") && name.equals("min")) {
super.visitVarInsn(Opcodes.ALOAD, 6);
super.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"IOPortMinSpeed",
"(JJLappeng/api/storage/StorageChannel;)J",
false);
} else {
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
}
}
}
@@ -40,6 +40,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() {
@@ -51,5 +53,6 @@ public class ItemAndBlockHolder {
CellType.Cell256kPart.setItemInstance(CELL_PART);
CellType.Cell1024kPart.setItemInstance(CELL_PART);
CellType.Cell4096kPart.setItemInstance(CELL_PART);
CellType.Cell16384kPart.setItemInstance(CELL_PART);
}
}
@@ -177,7 +177,7 @@ public class RecipeLoader implements Runnable {
"CEC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
"anyCertusCrystal",
'E',
@@ -188,7 +188,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell1kPart.stack(1),
'P',
@@ -201,7 +201,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell4kPart.stack(1),
'P',
@@ -214,7 +214,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell16kPart.stack(1),
'P',
@@ -227,7 +227,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell64kPart.stack(1),
'P',
@@ -240,7 +240,7 @@ public class RecipeLoader implements Runnable {
"CGC",
"DCD",
'D',
"dyeBlue",
"dyeRed",
'C',
CellType.Cell256kPart.stack(1),
'P',
@@ -253,16 +253,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
@@ -9,20 +9,22 @@ item.part_fluid_export.name=ME Fluid Export Bus
item.part_fluid_storage_bus.name=ME Fluid Storage Bus
item.part_fluid_level_emitter.name=ME Fluid Level Emitter
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
@@ -8,20 +8,20 @@ item.part_fluid_import.name=ME流体输入总线
item.part_fluid_export.name=ME流体输出总线
item.part_fluid_level_emitter.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