forked from AE2-UEL/AE2FluidCraft-Rework
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-essentia-level-maintaining
- Loading branch information
Showing
9 changed files
with
284 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
src/main/java/com/glodblock/github/common/item/ItemFluidVoidStorageCell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ItemFluidVoidStorageCell extends AEBaseItem | ||
implements IStorageFluidCell, IRegister<ItemFluidVoidStorageCell> { | ||
|
||
public ItemFluidVoidStorageCell() { | ||
super(); | ||
setUnlocalizedName(NameConst.ITEM_FLUID_VOID_CELL); | ||
setTextureName(FluidCraft.resource(NameConst.ITEM_FLUID_VOID_CELL).toString()); | ||
this.setFeature(EnumSet.of(AEFeature.StorageCells)); | ||
this.setMaxStackSize(1); | ||
} | ||
|
||
@Override | ||
public ItemFluidVoidStorageCell register() { | ||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_VOID_CELL, 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_ITEM_FLUID_VOID_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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
src/main/java/com/glodblock/github/common/storage/FluidVoidStorageCellInventory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 FluidVoidStorageCellInventory extends FluidCellInventory { | ||
|
||
public FluidVoidStorageCellInventory(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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+548 Bytes
src/main/resources/assets/ae2fc/textures/items/fluid_storage.void.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.