Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fluid Void Cell "ME Defective Fluid Digital Singularity Storage Cell" #234

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package com.glodblock.github.common.item;

import java.util.EnumSet;
import java.util.List;

import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;

import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;

public class ItemDefectiveSingularityFluidStorageCell extends AEBaseItem
implements IStorageFluidCell, IRegister<ItemDefectiveSingularityFluidStorageCell> {

public ItemDefectiveSingularityFluidStorageCell() {
super();
setUnlocalizedName(NameConst.ITEM_DEFECTIVE_SINGULARITY_FLUID_STORAGE);
setTextureName(FluidCraft.resource(NameConst.ITEM_DEFECTIVE_SINGULARITY_FLUID_STORAGE).toString());
this.setFeature(EnumSet.of(AEFeature.StorageCells));
this.setMaxStackSize(1);
}

@Override
public ItemDefectiveSingularityFluidStorageCell register() {
GameRegistry.registerItem(this, NameConst.ITEM_DEFECTIVE_SINGULARITY_FLUID_STORAGE, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}

@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
lines.add(NameConst.i18n(NameConst.TT_DEFECTIVE_SINGULARITY_CELL));
lines.add(GuiText.VoidCellTooltip.getLocal());
lines.add(0 + " " + GuiText.Of.getLocal() + " \u00A7k9999\u00A77 " + GuiText.BytesUsed.getLocal());
final IFluidCellInventory inv = handler.getCellInv();
if (GuiScreen.isShiftKeyDown()) {
lines.add(GuiText.Filter.getLocal() + ": ");
for (int i = 0; i < inv.getConfigInventory().getSizeInventory(); ++i) {
ItemStack s = inv.getConfigInventory().getStackInSlot(i);
if (s != null) lines.add(s.getDisplayName());
}
}
}
}

@Override
public long getBytes(ItemStack cellItem) {
return 0;
}

@Override
public int getBytesPerType(ItemStack cellItem) {
return 0;
}

@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
}

@Override
public boolean storableInStorageCell() {
return true;
}

@Override
public boolean isStorageCell(ItemStack i) {
return true;
}

@Override
public double getIdleDrain(ItemStack is) {
return 0;
}

@Override
public int getTotalTypes(ItemStack cellItem) {
return 0;
}

@Override
public boolean isEditable(ItemStack is) {
return true;
}

@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 0);
}

@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
}

@Override
public FuzzyMode getFuzzyMode(ItemStack is) {
final String fz = Platform.openNbtData(is).getString("FuzzyMode");
try {
return FuzzyMode.valueOf(fz);
} catch (final Throwable t) {
return FuzzyMode.IGNORE_ALL;
}
}

@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {
Platform.openNbtData(is).setString("FuzzyMode", fzMode.name());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package com.glodblock.github.common.storage;

import java.util.List;

import javax.annotation.Nonnull;

import net.minecraft.item.ItemStack;

import appeng.api.config.Actionable;
import appeng.api.exceptions.AppEngException;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;

public class DefectiveSingularityCellInventory extends FluidCellInventory {

public DefectiveSingularityCellInventory(ItemStack o, ISaveProvider container) throws AppEngException {
super(o, container);
}

@Override
public boolean canHoldNewFluid() {
return true;
}

@Override
public long getTotalBytes() {
return 0;
}

@Override
public long getFreeBytes() {
return 0;
}

@Override
public long getUsedBytes() {
return 0;
}

@Override
public long getTotalFluidTypes() {
return 63;
}

@Override
public long getStoredFluidCount() {
return 0;
}

@Override
public long getStoredFluidTypes() {
return 0;
}

@Override
public long getRemainingFluidTypes() {
return 63;
}

@Override
public long getRemainingFluidCount() {
return Long.MAX_VALUE;
}

@Override
public int getUnusedFluidCount() {
return Integer.MAX_VALUE;
}

@Override
public int getStatusForCell() {
return 1;
}

@Override
protected void loadCellFluids() {}

@Override
protected IItemList<IAEFluidStack> getCellFluids() {
return null;
}

@Override
public IAEFluidStack injectItems(IAEFluidStack input, Actionable mode, BaseActionSource src) {
if (input == null || input.getStackSize() == 0) {
return null;
}
if (this.cellType.isBlackListed(this.cellItem, input)) {
return input;
}
return null;
}

@Override
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
return null;
}

@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
return out;
}

@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return null;
}

@Override
public List<IAEFluidStack> getContents() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraftforge.fluids.FluidStack;

import com.glodblock.github.common.item.ItemBaseInfinityStorageCell;
import com.glodblock.github.common.item.ItemDefectiveSingularityFluidStorageCell;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidCellInventory;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidStorageCell;

Expand Down Expand Up @@ -86,6 +87,8 @@ public static IMEInventoryHandler<IAEFluidStack> getCell(final ItemStack o, fina
return new FluidCellInventoryHandler(new CreativeFluidCellInventory(o, container2));
} else if (o.getItem() instanceof ProxyFluidStorageCell) {
return new FluidCellInventoryHandler(new ProxyFluidCellInventory(o, container2));
} else if (o.getItem() instanceof ItemDefectiveSingularityFluidStorageCell) {
return new FluidCellInventoryHandler(new DefectiveSingularityCellInventory(o, container2));
} else {
return new FluidCellInventoryHandler(new FluidCellInventory(o, container2));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
import com.glodblock.github.common.item.ItemBasicFluidStoragePart;
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
import com.glodblock.github.common.item.ItemDefectiveSingularityFluidStorageCell;
import com.glodblock.github.common.item.ItemEnergyCard;
import com.glodblock.github.common.item.ItemFluidConversionMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
Expand Down Expand Up @@ -140,6 +141,8 @@ public static void init() {}
16384,
5,
600000D).register();
public static ItemDefectiveSingularityFluidStorageCell DEFECTIVE_SINGULARITY_CELL = new ItemDefectiveSingularityFluidStorageCell()
.register();
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().register();
public static ItemInfinityWaterStorageCell INFINITY_WATER_CELL = new ItemInfinityWaterStorageCell().register();
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/glodblock/github/loader/RecipeLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL_HOUSING;
import static com.glodblock.github.loader.ItemAndBlockHolder.CERTUS_QUARTZ_TANK;
import static com.glodblock.github.loader.ItemAndBlockHolder.DECODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.DEFECTIVE_SINGULARITY_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.DISCRETIZER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENCODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
Expand Down Expand Up @@ -505,6 +506,20 @@ public void run() {
QUANTUM_CELL,
'M',
AE2_MATTER_CONDENSER));
GameRegistry.addRecipe(
new ShapedOreRecipe(
DEFECTIVE_SINGULARITY_CELL,
"ABA",
"BDB",
"CCC",
'A',
AE2_QUARTZ_GLASS,
'B',
"dustGlowstone",
'C',
"gemDiamond",
'D',
AE2_SINGULARITY));
for (FCBaseItemCell cell : cells) {
if (cell.getHousing().getItemDamage() == 0) {
GameRegistry.addRecipe(
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/glodblock/github/util/NameConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class NameConst {
public static final String ITEM_MULTI_FLUID_STORAGE = "multi_fluid_storage";
public static final String ITEM_QUANTUM_FLUID_STORAGE = ITEM_FLUID_STORAGE + ".quantum";
public static final String ITEM_SINGULARITY_FLUID_STORAGE = ITEM_FLUID_STORAGE + ".singularity";
public static final String ITEM_DEFECTIVE_SINGULARITY_FLUID_STORAGE = ITEM_SINGULARITY_FLUID_STORAGE + ".defective";
public static final String ITEM_ARTIFICIAL_UNIVERSE_STORAGE = ITEM_FLUID_STORAGE + ".Universe";
public static final String ITEM_INFINITY_FLUID_STORAGE = ITEM_FLUID_STORAGE + ".infinity";
public static final String ITEM_INFINITY_WATER_FLUID_STORAGE = ITEM_INFINITY_FLUID_STORAGE + ".water";
Expand Down Expand Up @@ -103,6 +104,7 @@ public class NameConst {
public static final String TT_ENERGY_CARD_DESC = TT_ENERGY_CARD + ".desc";
public static final String TT_QUANTUM_BRIDGE_CARD = TT_KEY + "quantum_bridge_card";
public static final String TT_QUANTUM_BRIDGE_CARD_DESC = TT_QUANTUM_BRIDGE_CARD + ".desc";
public static final String TT_DEFECTIVE_SINGULARITY_CELL = TT_KEY + ITEM_DEFECTIVE_SINGULARITY_FLUID_STORAGE;

public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/ae2fc/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ item.multi_fluid_storage.4096.name=%s4096k%s ME Multi-Fluid Storage Cell
item.multi_fluid_storage.16384.name=%s16384k%s ME Multi-Fluid Storage Cell
item.fluid_storage.quantum.name=ME Fluid Quantum Storage Cell
item.fluid_storage.singularity.name=ME Fluid Digital Singularity Storage Cell
item.fluid_storage.singularity.defective.name=ME Defective Fluid Digital Singularity Storage Cell
item.fluid_storage.Universe.name=ME Fluid Artificial Universe Storage Cell
item.fluid_storage.infinity.water.name=ME Fluid Infinity Water Storage Cell
item.fluid_part.0.name=%s1k%s ME Fluid Storage Component
Expand Down Expand Up @@ -114,6 +115,7 @@ ae2fc.tooltip.ultra_terminal=Right click + sneaking to switch mode.
ae2fc.tooltip.ultra_terminal.tips=ToolTips:
ae2fc.tooltip.ultra_terminal.tips.desc=1.You can put it to baubles slot and use hotkey to open.\n2.Interface mode hold §3Shift§7 toggle interface renamer button.\n3.When you are in the crafting plan screen.\nHold §3Shift§7 click cancel button will automatically add missing items to NEI bookmark.
ae2fc.tooltip.infinity_fluid=§aInfinity§r
ae2fc.tooltip.fluid_storage.singularity.defective=Absolute §kVOID§r

ae2fc.tooltip.quantum_bridge_card.desc=Allows wireless terminals to connect to a quantum bridge, allowing for unlimited range
ae2fc.tooltip.energy_card.desc=Infinity Energy for the Wireless Terminal
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.