mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-15 17:44:46 +00:00
cells, remove ExtraCells integration
This commit is contained in:
1 parent
ebd42852ff
commit
4afacb98f0
24 files changed
+25
-2257
No files matched your search
@@ -3,7 +3,6 @@ package com.glodblock.github;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
|
||||
import com.glodblock.github.crossmod.waila.WailaInit;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
@@ -20,7 +19,6 @@ import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
@@ -93,13 +91,6 @@ public class FluidCraft {
|
||||
proxy.onLoadComplete(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void missingMappings(FMLMissingMappingsEvent event) {
|
||||
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||
EC2Replacer.replaceExtraCells(event);
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceLocation resource(String path) {
|
||||
return new ResourceLocation(MODID, path);
|
||||
}
|
||||
|
||||
@@ -1,40 +1,20 @@
|
||||
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.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
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.ICellInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseCell;
|
||||
import appeng.me.storage.FluidCellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
import appeng.items.storage.ItemVoidStorageCell;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ItemFluidVoidStorageCell extends AEBaseCell<IAEFluidStack> implements IRegister<ItemFluidVoidStorageCell> {
|
||||
public class ItemFluidVoidStorageCell extends ItemVoidStorageCell implements IRegister<ItemFluidVoidStorageCell> {
|
||||
|
||||
public ItemFluidVoidStorageCell() {
|
||||
super(com.google.common.base.Optional.absent());
|
||||
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
|
||||
@@ -44,67 +24,6 @@ public class ItemFluidVoidStorageCell extends AEBaseCell<IAEFluidStack> implemen
|
||||
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 FluidCellInventoryHandler 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 ICellInventory<IAEFluidStack> inv = handler.getCellInv();
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
lines.add(GuiText.Filter.getLocal() + ": ");
|
||||
for (int i = 0; i < inv.getConfigInventory().getSizeInventory(); ++i) {
|
||||
IAEStack<?> s = inv.getConfigInventory().getAEStackInSlot(i);
|
||||
if (s != null) lines.add(s.getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBytesLong(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(IAEFluidStack requestedAddition) {
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain(ItemStack is) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@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 StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.glodblock.github.util.RenderUtil;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.items.AEBasePortableCell;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.items.contents.PortableCellViewer;
|
||||
@@ -26,8 +27,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPortableFluidCell extends AEBasePortableCell<IAEFluidStack>
|
||||
implements IRegister<ItemPortableFluidCell> {
|
||||
public class ItemPortableFluidCell extends AEBasePortableCell implements IRegister<ItemPortableFluidCell> {
|
||||
|
||||
public ItemPortableFluidCell() {
|
||||
super();
|
||||
@@ -60,9 +60,10 @@ public class ItemPortableFluidCell extends AEBasePortableCell<IAEFluidStack>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(IAEFluidStack requestedAddition) {
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
public boolean isBlackListed(IAEStack<?> requestedAddition) {
|
||||
|
||||
return requestedAddition instanceof IAEFluidStack ifs && (ifs.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(ifs.getFluid().getClass()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import static appeng.helpers.DualityInterface.NUMBER_OF_STORAGE_SLOTS;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -31,248 +22,28 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import appeng.parts.p2p.PartP2PInterface;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.parts.p2p.PartP2PTunnelStatic;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorIInventory;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.WrapperInvSlot;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInterface>
|
||||
implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory,
|
||||
IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost, IInterfaceHost {
|
||||
public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost {
|
||||
|
||||
boolean needUpdateOnNetworkBooted = false;
|
||||
boolean lastPowerStart = false;
|
||||
|
||||
public PartFluidP2PInterface(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
private final DualityInterface duality = new DualityInterface(this.getProxy(), this) {
|
||||
|
||||
@Override
|
||||
public void updateCraftingList() {
|
||||
if (!isOutput()) {
|
||||
CraftingGridCache.pauseRebuilds();
|
||||
|
||||
super.updateCraftingList();
|
||||
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) {
|
||||
p2p.duality.updateCraftingList();
|
||||
}
|
||||
} catch (GridAccessException e) {
|
||||
// ?
|
||||
}
|
||||
|
||||
CraftingGridCache.unpauseRebuilds();
|
||||
} else {
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
if (p2p != null) {
|
||||
this.craftingList = p2p.duality.craftingList;
|
||||
try {
|
||||
this.gridProxy.getGrid()
|
||||
.postEvent(new MENetworkCraftingPatternChange(this, this.gridProxy.getNode()));
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
final boolean powerState = proxy.isActive();
|
||||
if (needUpdateOnNetworkBooted || lastPowerStart != powerState) {
|
||||
needUpdateOnNetworkBooted = false;
|
||||
lastPowerStart = powerState;
|
||||
updateSharingInventory();
|
||||
}
|
||||
return super.tickingRequest(node, ticksSinceLastCall);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasWorkToDo() {
|
||||
if (isOutput()) {
|
||||
return hasItemsToSend() || hasConfig() || !getStorage().isEmpty();
|
||||
} else return super.hasWorkToDo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readConfig() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
boolean alertDevice = false;
|
||||
|
||||
if (p2p != null) {
|
||||
this.setHasConfig(p2p.duality.hasConfig());
|
||||
|
||||
alertDevice = hasWorkToDo();
|
||||
|
||||
} else {
|
||||
this.setHasConfig(false);
|
||||
}
|
||||
|
||||
if (alertDevice) {
|
||||
try {
|
||||
this.gridProxy.getTick().alertDevice(this.gridProxy.getNode());
|
||||
} catch (final GridAccessException ignored) {}
|
||||
} else {
|
||||
try {
|
||||
this.gridProxy.getTick().sleepDevice(this.gridProxy.getNode());
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
this.notifyNeighbors();
|
||||
} else {
|
||||
super.readConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDrops(final List<ItemStack> drops) {
|
||||
if (!isOutput()) {
|
||||
super.addDrops(drops);
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) p2p.duality.addDrops(drops);
|
||||
} catch (GridAccessException ignored) {}
|
||||
} else {
|
||||
List<IAEStack<?>> waitingList = this.getWaitingToSend();
|
||||
if (waitingList != null) {
|
||||
for (final IAEStack<?> as : waitingList) {
|
||||
if (as instanceof IAEItemStack ais) {
|
||||
drops.add(ais.getItemStack());
|
||||
} else if (as instanceof IAEFluidStack afs) {
|
||||
drops.add(ItemFluidPacket.newStack(afs));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (final ItemStack is : this.getUpgrades()) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
for (final ItemStack is : this.getPatterns()) {
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u) {
|
||||
if (isOutput() && u == Upgrades.PATTERN_CAPACITY) return -1;
|
||||
return super.getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConfigSize() {
|
||||
if (isOutput()) return -1;
|
||||
return super.getConfigSize();
|
||||
}
|
||||
};
|
||||
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
|
||||
private void updateSharingInventory() {
|
||||
duality.readConfig();
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface p2p = getInput();
|
||||
if (proxy.isActive() && p2p != null) {
|
||||
if (!duality.sharedInventory && !duality.getStorage().isEmpty()) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
AppEngInternalInventory storageAppEng = this.duality.getStorage();
|
||||
AdaptorIInventory p2pInv = new AdaptorIInventory(p2p.duality.getStorage());
|
||||
for (ItemStack itemStack : storageAppEng) {
|
||||
if (itemStack == null) continue;
|
||||
ItemStack drop = p2pInv.addItems(itemStack);
|
||||
if (drop != null && drop.stackSize > 0) {
|
||||
drops.add(drop);
|
||||
}
|
||||
}
|
||||
TileEntity te = getTileEntity();
|
||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||
}
|
||||
duality.setStorage(p2p.duality.getStorage());
|
||||
duality.sharedInventory = true;
|
||||
} else {
|
||||
if (duality.sharedInventory) {
|
||||
duality.setStorage(new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS));
|
||||
duality.setSlotInv(new WrapperInvSlot(duality.getStorage()));
|
||||
duality.sharedInventory = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (duality.sharedInventory) {
|
||||
duality.setStorage(new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS));
|
||||
duality.setSlotInv(new WrapperInvSlot(duality.getStorage()));
|
||||
duality.sharedInventory = false;
|
||||
}
|
||||
try {
|
||||
for (PartFluidP2PInterface p2p : getOutputs()) {
|
||||
p2p.duality.readConfig();
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkChannelsChanged c) {
|
||||
this.duality.notifyNeighbors();
|
||||
updateSharingInventory();
|
||||
needUpdateOnNetworkBooted = true;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkPowerStatusChange c) {
|
||||
this.duality.notifyNeighbors();
|
||||
updateSharingInventory();
|
||||
needUpdateOnNetworkBooted = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return this.duality.getInstalledUpgrades(u);
|
||||
public PartFluidP2PInterface(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -281,31 +52,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
return ItemAndBlockHolder.INTERFACE.getBlockTextureFromSide(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
super.gridChanged();
|
||||
dualityFluid.gridChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
this.duality.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
this.duality.writeToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getMemoryCardData() {
|
||||
final NBTTagCompound output = super.getMemoryCardData();
|
||||
this.duality.getConfigManager().writeToNBT(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartP2PTunnel<?> applyMemoryCard(EntityPlayer player, IMemoryCard memoryCard, ItemStack is) {
|
||||
PartP2PTunnel<?> newTunnel = super.applyMemoryCard(player, memoryCard, is);
|
||||
@@ -316,37 +62,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
return newTunnel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToWorld() {
|
||||
super.addToWorld();
|
||||
this.duality.initialize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
this.duality.addDrops(drops);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int cableConnectionRenderTo() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
return this.duality.getConfigManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
return this.duality.getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
this.duality.updateRedstoneState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer p, final Vec3 pos) {
|
||||
if (super.onPartActivate(p, pos)) {
|
||||
@@ -369,53 +84,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
return true;
|
||||
}
|
||||
|
||||
private void dropPatterns(final PartFluidP2PInterface p2p) {
|
||||
final AppEngInternalInventory patterns = p2p.duality.getPatterns();
|
||||
final List<ItemStack> drops = new ArrayList<>();
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
if (patterns.getStackInSlot(i) == null) continue;
|
||||
drops.add(patterns.getStackInSlot(i));
|
||||
}
|
||||
if (!drops.isEmpty()) {
|
||||
final TileEntity te = p2p.getTileEntity();
|
||||
Platform.spawnDrops(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord, drops);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyContents(final PartP2PTunnel<?> from) {
|
||||
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||
DualityInterface newDuality = this.duality;
|
||||
// Copy interface storage, upgrades, and settings over
|
||||
UpgradeInventory upgrades = (UpgradeInventory) fromInterface.duality.getInventoryByName("upgrades");
|
||||
UpgradeInventory newUpgrade = (UpgradeInventory) newDuality.getInventoryByName("upgrades");
|
||||
for (int i = 0; i < upgrades.getSizeInventory(); ++i) {
|
||||
newUpgrade.setInventorySlotContents(i, upgrades.getStackInSlot(i));
|
||||
}
|
||||
|
||||
if (!fromInterface.duality.sharedInventory) {
|
||||
IInventory storage = fromInterface.duality.getStorage();
|
||||
IInventory newStorage = newDuality.getStorage();
|
||||
for (int i = 0; i < storage.getSizeInventory(); ++i) {
|
||||
newStorage.setInventorySlotContents(i, storage.getStackInSlot(i));
|
||||
}
|
||||
}
|
||||
|
||||
AppEngInternalInventory patterns = fromInterface.duality.getPatterns();
|
||||
boolean drop = true;
|
||||
if (!from.isOutput() && !this.isOutput()) { // input to input
|
||||
for (int i = 0; i < patterns.getSizeInventory(); i++) {
|
||||
newDuality.getPatterns().setInventorySlotContents(i, patterns.getStackInSlot(i));
|
||||
}
|
||||
drop = false;
|
||||
}
|
||||
|
||||
if (drop) {
|
||||
this.dropPatterns(fromInterface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copySettings(final PartP2PTunnel<?> from) {
|
||||
if (from instanceof PartFluidP2PInterface fromInterface) {
|
||||
@@ -427,26 +95,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getBreakingTexture() {
|
||||
return this.getItemStack().getIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsert(final ItemStack stack) {
|
||||
return this.duality.canInsert(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||
return this.duality.getItemInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
return this.duality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
TickingRequest item = duality.getTickingRequest(node);
|
||||
@@ -469,216 +117,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.duality.getStorage().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(final int i) {
|
||||
return this.duality.getStorage().getStackInSlot(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(final int i, final int j) {
|
||||
return this.duality.getStorage().decrStackSize(i, j);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(final int i) {
|
||||
return this.duality.getStorage().getStackInSlotOnClosing(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(final int i, final ItemStack itemstack) {
|
||||
this.duality.getStorage().setInventorySlotContents(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.duality.getStorage().getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.duality.getStorage().hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return this.duality.getStorage().getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
this.duality.getStorage().markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
|
||||
return this.duality.getStorage().isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
this.duality.getStorage().openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
this.duality.getStorage().closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(final int i, final ItemStack itemstack) {
|
||||
return this.duality.getStorage().isItemValidForSlot(i, itemstack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(final int s) {
|
||||
return this.duality.getAccessibleSlotsFromSide(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(final int i, final ItemStack itemstack, final int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(final int i, final ItemStack itemstack, final int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
this.duality.onChangeInventory(inv, slot, mc, removedStack, newStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DualityInterface getInterfaceDuality() {
|
||||
return this.duality;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<ForgeDirection> getTargets() {
|
||||
return EnumSet.of(this.getSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return super.getHost().getTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageMonitorable getMonitorable(final ForgeDirection side, final BaseActionSource src) {
|
||||
return this.duality.getMonitorable(side, src, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pushPattern(final ICraftingPatternDetails patternDetails, final InventoryCrafting table) {
|
||||
return this.duality.pushPattern(patternDetails, table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBusy() {
|
||||
return this.duality.isBusy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideCrafting(final ICraftingProviderHelper craftingTracker) {
|
||||
this.duality.provideCrafting(craftingTracker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return this.duality.getRequestedJobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(final ICraftingLink link, final IAEItemStack items, final Actionable mode) {
|
||||
return this.duality.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
this.duality.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return this.duality.getPriority();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(final int newValue) {
|
||||
this.duality.setPriority(newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange() {
|
||||
this.duality.updateCraftingList();
|
||||
updateSharingInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelConfigChange() {
|
||||
updateSharingInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getPatterns() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.getPatterns();
|
||||
}
|
||||
return IInterfaceHost.super.getPatterns();
|
||||
}
|
||||
return IInterfaceHost.super.getPatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rows() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.rows();
|
||||
}
|
||||
return IInterfaceHost.super.rows();
|
||||
}
|
||||
return IInterfaceHost.super.rows();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rowSize() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.rowSize();
|
||||
}
|
||||
return IInterfaceHost.super.rowSize();
|
||||
}
|
||||
return IInterfaceHost.super.rowSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.getName();
|
||||
}
|
||||
return IInterfaceHost.super.getName();
|
||||
}
|
||||
return IInterfaceHost.super.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSelfRep() {
|
||||
return this.getItemStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return dualityFluid.fill(from, resource, doFill);
|
||||
@@ -748,10 +186,4 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
dualityFluid.getInternalFluid().setFluidInSlot(id, fluid);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplay() {
|
||||
return IInterfaceHost.super.shouldDisplay();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,6 +51,7 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridAccessException;
|
||||
@@ -200,26 +201,22 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
IAEItemStack craftItem = requests[i].itemStack.copy();
|
||||
craftItem.setStackSize(batchSize);
|
||||
|
||||
IAEStack<?> aeItem = craftItem.getItem() instanceof ItemFluidDrop
|
||||
? invFluid.findPrecise(ItemFluidDrop.getAeFluidStack(craftItem))
|
||||
: invItems.findPrecise(craftItem);
|
||||
|
||||
if (ModAndClassUtil.ThE) {
|
||||
if (ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) {
|
||||
craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
|
||||
aeItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
|
||||
}
|
||||
}
|
||||
|
||||
IAEItemStack aeItem = invItems.findPrecise(craftItem);
|
||||
|
||||
long stackSize;
|
||||
|
||||
if (craftItem.getItem() instanceof ItemFluidDrop) {
|
||||
IAEFluidStack ifs = invFluid.findPrecise(ItemFluidDrop.getAeFluidStack(craftItem));
|
||||
stackSize = ifs == null ? 0 : ifs.getStackSize();
|
||||
} else {
|
||||
stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
}
|
||||
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
|
||||
if (ModAndClassUtil.ThE) {
|
||||
if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) {
|
||||
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid);
|
||||
if (aeItem instanceof IAEItemStack ais
|
||||
&& ThaumicEnergisticsCrafting.isAspectStack(ais.getItemStack())) {
|
||||
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(ais, grid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,11 +240,11 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.canEmitFor(craftItem)) {
|
||||
if (craftingGrid.canEmitFor(aeItem)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.isRequesting(craftItem)) {
|
||||
if (craftingGrid.isRequesting(aeItem)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class EC2Replacer {
|
||||
|
||||
/**
|
||||
* Should be called if and only if replaceEC2 config is true and EC2 not present. Registers proxy items for the
|
||||
* entire EC2 mod. After running this once, you should set replaceEC2 back to false.
|
||||
*/
|
||||
public static void initReplacer() {
|
||||
System.out.println("Extra Cells not detected, and configuration set. Replacing extra cells.");
|
||||
ItemReplacements.postinit();
|
||||
}
|
||||
|
||||
public static void replaceExtraCells(FMLMissingMappingsEvent event) {
|
||||
List<FMLMissingMappingsEvent.MissingMapping> mappings = event.getAll();
|
||||
for (FMLMissingMappingsEvent.MissingMapping m : mappings) {
|
||||
if (m.type == GameRegistry.Type.ITEM && ItemReplacements.registry.containsKey(m.name)) {
|
||||
Item toRemap = ItemReplacements.registry.get(m.name);
|
||||
m.remap(toRemap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.common.item.ItemMultiFluidStorageCell;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyFluidBusIO;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyFluidInterface;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyFluidStorage;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyLevelEmitter;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyOreDictExportBus;
|
||||
import com.glodblock.github.crossmod.extracells.parts.ProxyStorageMonitor;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyExtremeStorageCell;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidStorageCell;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyItemCellHandler;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyItemStorageCell;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyVoidCellHandler;
|
||||
import com.glodblock.github.crossmod.extracells.storage.ProxyVoidStorageCell;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import li.cil.oc.api.Items;
|
||||
import li.cil.oc.api.detail.ItemInfo;
|
||||
|
||||
/**
|
||||
* A shell class to organize proxy replacements and hide the ugliness
|
||||
*/
|
||||
public class ItemReplacements {
|
||||
|
||||
protected static Map<String, Item> registry;
|
||||
|
||||
static void postinit() {
|
||||
registry = new HashMap<>(23);
|
||||
ProxyFluidBusIO.init();
|
||||
ItemReplacements.proxyItems();
|
||||
ItemReplacements.proxyPartItems();
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
deprecateOC();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register proxy items (non-parts)
|
||||
*/
|
||||
static void proxyItems() {
|
||||
deprecateFluidStorage("storage.fluid", 0, ItemAndBlockHolder.CELL1KM, 1, 8, 0.5);
|
||||
deprecateFluidStorage("storage.fluid", 1, ItemAndBlockHolder.CELL4KM, 4, 32, 1.0);
|
||||
deprecateFluidStorage("storage.fluid", 2, ItemAndBlockHolder.CELL16KM, 16, 128, 1.5);
|
||||
deprecateFluidStorage("storage.fluid", 3, ItemAndBlockHolder.CELL64KM, 64, 512, 2.0);
|
||||
deprecateFluidStorage("storage.fluid", 4, ItemAndBlockHolder.CELL256KM, 256, 2048, 2.5);
|
||||
deprecateFluidStorage("storage.fluid", 5, ItemAndBlockHolder.CELL1024KM, 1024, 8192, 3.0);
|
||||
deprecateFluidStorage("storage.fluid", 6, ItemAndBlockHolder.CELL4096KM, 4096, 32768, 3.5);
|
||||
deprecateFluidStorage("storage.fluid", 7, ItemAndBlockHolder.CELL16384KM, 16384, 131072, 4.0);
|
||||
// Thanks, AEApi.
|
||||
AEApi.instance().registries().cell().addCellHandler(new ProxyItemCellHandler());
|
||||
AEApi.instance().registries().cell().addCellHandler(new ProxyVoidCellHandler());
|
||||
deprecateItemStorage(0, AEApi.instance().definitions().items().cell256k(), 256, 2048, 2.5);
|
||||
deprecateItemStorage(1, AEApi.instance().definitions().items().cell1024k(), 1024, 8192, 3.0);
|
||||
deprecateItemStorage(2, AEApi.instance().definitions().items().cell4096k(), 4096, 32768, 3.5);
|
||||
deprecateItemStorage(3, AEApi.instance().definitions().items().cell16384k(), 16384, 131072, 4.0);
|
||||
deprecateItemStorage(4, AEApi.instance().definitions().items().cellContainer(), 65536, 8, 2.0, 1);
|
||||
deprecateExtremeStorage(
|
||||
"storage.physical.advanced.quantum",
|
||||
0,
|
||||
AEApi.instance().definitions().items().cellQuantum(),
|
||||
Integer.MAX_VALUE / 16,
|
||||
4096,
|
||||
1000.0);
|
||||
deprecateExtremeStorage(
|
||||
"storage.physical.advanced.singularity",
|
||||
0,
|
||||
AEApi.instance().definitions().items().cellSingularity(),
|
||||
Long.MAX_VALUE / 16,
|
||||
4096,
|
||||
15000.0);
|
||||
// Deprecate void cell manually
|
||||
ProxyVoidStorageCell voidCell = new ProxyVoidStorageCell();
|
||||
GameRegistry.registerItem(voidCell, "ec2placeholder.storage.physical.void");
|
||||
registry.put("extracells:storage.physical.void", voidCell);
|
||||
deprecateItem("pattern.fluid", ItemAndBlockHolder.PATTERN);
|
||||
|
||||
/* Storage casings */
|
||||
deprecateItem("storage.casing", 0, AEApi.instance().definitions().materials().emptyAdvancedStorageCell());
|
||||
deprecateItem("storage.casing", 1, ItemAndBlockHolder.CELL_HOUSING, 2);
|
||||
|
||||
/* Storage components (1k component, etc.) */
|
||||
deprecateItem("storage.component", 0, AEApi.instance().definitions().materials().cell256kPart());
|
||||
deprecateItem("storage.component", 1, AEApi.instance().definitions().materials().cell1024kPart());
|
||||
deprecateItem("storage.component", 2, AEApi.instance().definitions().materials().cell4096kPart());
|
||||
deprecateItem("storage.component", 3, AEApi.instance().definitions().materials().cell16384kPart());
|
||||
deprecateItem("storage.component", 4, ItemAndBlockHolder.CELL_PART, 0);
|
||||
deprecateItem("storage.component", 5, ItemAndBlockHolder.CELL_PART, 1);
|
||||
deprecateItem("storage.component", 6, ItemAndBlockHolder.CELL_PART, 2);
|
||||
deprecateItem("storage.component", 7, ItemAndBlockHolder.CELL_PART, 3);
|
||||
deprecateItem("storage.component", 8, ItemAndBlockHolder.CELL_PART, 4);
|
||||
deprecateItem("storage.component", 9, ItemAndBlockHolder.CELL_PART, 5);
|
||||
deprecateItem("storage.component", 10, ItemAndBlockHolder.CELL_PART, 6);
|
||||
deprecateWireless("terminal.universal.wireless", ItemAndBlockHolder.WIRELESS_ULTRA_TERM);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecate OC upgrades. Wrapper so we don't need a hard dependency
|
||||
*/
|
||||
@Optional.Method(modid = "OpenComputers")
|
||||
static void deprecateOC() {
|
||||
ItemInfo info = Items.get("me_upgrade1");
|
||||
if (info != null) {
|
||||
// Note EC tier 1, 2, 3 corresponds to the correct meta equivalent in OC, so we can be lazy
|
||||
deprecateItem("oc.upgrade", 0, info.item(), 0);
|
||||
deprecateItem("oc.upgrade", 1, info.item(), 1);
|
||||
deprecateItem("oc.upgrade", 2, info.item(), 2);
|
||||
} else {
|
||||
System.out.println("OpenComputers detected, but could not replace items: me_upgrade1");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register proxy part items.
|
||||
*/
|
||||
static void proxyPartItems() {
|
||||
deprecateItemPart(0, ItemAndBlockHolder.FLUID_EXPORT_BUS, ProxyFluidBusIO::new);
|
||||
deprecateItemPart(1, ItemAndBlockHolder.FLUID_IMPORT_BUS, ProxyFluidBusIO::new);
|
||||
deprecateItemPart(2, ItemAndBlockHolder.FLUID_STORAGE_BUS, ProxyFluidStorage::new);
|
||||
deprecateItemPart(3, ItemAndBlockHolder.FLUID_TERM, ProxyPart::new);
|
||||
deprecateItemPart(4, ItemAndBlockHolder.FLUID_LEVEL_EMITTER, ProxyLevelEmitter::new);
|
||||
deprecateItemPart(9, ItemAndBlockHolder.FLUID_INTERFACE, ProxyFluidInterface::new);
|
||||
deprecateItemPart(10, ItemAndBlockHolder.FLUID_STORAGE_MONITOR, ProxyStorageMonitor::new);
|
||||
deprecateItemPart(11, ItemAndBlockHolder.FLUID_CONVERSION_MONITOR, ProxyStorageMonitor::new);
|
||||
deprecateItemPart(12, AEApi.instance().definitions().parts().exportBus(), ProxyOreDictExportBus::new);
|
||||
}
|
||||
|
||||
private static ProxyItem getOrBuildItem(String srcName) {
|
||||
final String fullName = "extracells:" + srcName;
|
||||
ProxyItem proxy = (ProxyItem) registry.get(fullName);
|
||||
if (proxy == null) {
|
||||
proxy = new ProxyItem(srcName);
|
||||
registry.put(fullName, proxy);
|
||||
proxy.register();
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
private static ProxyFluidStorageCell getOrBuildFluidStorage(String srcName) {
|
||||
final String fullName = "extracells:" + srcName;
|
||||
ProxyFluidStorageCell proxy = (ProxyFluidStorageCell) registry.get(fullName);
|
||||
if (proxy == null) {
|
||||
proxy = new ProxyFluidStorageCell(srcName);
|
||||
registry.put(fullName, proxy);
|
||||
proxy.register();
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
private static ProxyItemStorageCell getOrBuildItemStorage() {
|
||||
final String fullName = "extracells:storage.physical";
|
||||
ProxyItemStorageCell proxy = (ProxyItemStorageCell) registry.get(fullName);
|
||||
if (proxy == null) {
|
||||
proxy = new ProxyItemStorageCell("storage.physical");
|
||||
registry.put(fullName, proxy);
|
||||
proxy.register();
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
private static ProxyExtremeStorageCell getOrBuildItemStorage(String srcName) {
|
||||
final String fullName = "extracells:" + srcName;
|
||||
ProxyExtremeStorageCell proxy = (ProxyExtremeStorageCell) registry.get(fullName);
|
||||
if (proxy == null) {
|
||||
proxy = new ProxyExtremeStorageCell(srcName);
|
||||
registry.put(fullName, proxy);
|
||||
proxy.register();
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecate a simple item.
|
||||
*
|
||||
* @param srcName name of the to-be-replaced item without the mod id prefix
|
||||
* @param srcMeta meta of the to-be-replaced item
|
||||
* @param replacement item that will replace src
|
||||
* @param targetMeta meta of the item that will replace src
|
||||
*/
|
||||
private static void deprecateItem(String srcName, int srcMeta, Item replacement, int targetMeta) {
|
||||
getOrBuildItem(srcName).addMetaReplacement(srcMeta, replacement, targetMeta);
|
||||
}
|
||||
|
||||
private static void deprecateItem(String srcName, Item replacement) {
|
||||
deprecateItem(srcName, 0, replacement, 0);
|
||||
}
|
||||
|
||||
private static void deprecateItem(String srcName, int srcMeta, IItemDefinition replacement) {
|
||||
if (replacement.isEnabled()) {
|
||||
deprecateItem(
|
||||
srcName,
|
||||
srcMeta,
|
||||
replacement.maybeItem().get(),
|
||||
replacement.maybeStack(1).get().getItemDamage());
|
||||
}
|
||||
}
|
||||
|
||||
private static void deprecateWireless(String srcName, ItemBaseWirelessTerminal replacement) {
|
||||
getOrBuildItem(srcName).addMetaReplacement(0, new ProxyItem.ProxyItemEntry(replacement, 0) {
|
||||
|
||||
@Override
|
||||
NBTTagCompound replaceNBT(NBTTagCompound compound) {
|
||||
double power = compound.getDouble("power");
|
||||
compound.removeTag("power");
|
||||
compound.setDouble("internalCurrentPower", power);
|
||||
String key = compound.getString("key");
|
||||
compound.removeTag("key");
|
||||
compound.setString("encryptionKey", key);
|
||||
return compound;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void deprecateItemPart(int srcMeta, Item replacement,
|
||||
Function<ProxyPartItem, ProxyPart> partBuilder) {
|
||||
final String fullName = "extracells:part.base";
|
||||
ProxyPartItem proxyItem = (ProxyPartItem) registry.get(fullName);
|
||||
if (proxyItem == null) {
|
||||
proxyItem = new ProxyPartItem("part.base");
|
||||
registry.put(fullName, proxyItem);
|
||||
proxyItem.register();
|
||||
}
|
||||
proxyItem.addItemPart(srcMeta, replacement, partBuilder);
|
||||
}
|
||||
|
||||
private static void deprecateItemPart(int srcMeta, IItemDefinition definition,
|
||||
Function<ProxyPartItem, ProxyPart> partBuilder) {
|
||||
if (definition.isEnabled()) {
|
||||
final String fullName = "extracells:part.base";
|
||||
ProxyPartItem proxyItem = (ProxyPartItem) registry.get(fullName);
|
||||
if (proxyItem == null) {
|
||||
proxyItem = new ProxyPartItem("part.base");
|
||||
registry.put(fullName, proxyItem);
|
||||
proxyItem.register();
|
||||
}
|
||||
proxyItem.addItemPart(srcMeta, definition, partBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecate a fluid storage item. Note that we can't access the properties directly, so we need to do this
|
||||
*/
|
||||
private static void deprecateFluidStorage(String srcName, int srcMeta, ItemMultiFluidStorageCell replacement,
|
||||
long kilobytes, int bytesPerType, double idleDrain) {
|
||||
ProxyFluidStorageCell proxyItem = getOrBuildFluidStorage(srcName);
|
||||
ProxyItem.ProxyStorageEntry entry = new ProxyItem.ProxyStorageEntry(
|
||||
replacement,
|
||||
0,
|
||||
kilobytes,
|
||||
bytesPerType,
|
||||
idleDrain);
|
||||
proxyItem.addMetaReplacement(srcMeta, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecate a storage item. This goes through AEAPI, as AE2FC doesn't have any item cells. If the item is disabled
|
||||
* in AEAPI, the replacement will not be registered!
|
||||
*/
|
||||
private static void deprecateItemStorage(int srcMeta, IItemDefinition replacement, long kilobytes, int bytesPerType,
|
||||
double idleDrain) {
|
||||
if (replacement.isEnabled()) {
|
||||
ProxyItemStorageCell item = getOrBuildItemStorage();
|
||||
int meta = replacement.maybeStack(1).get().getItemDamage();
|
||||
ProxyItem.ProxyItemEntry storage = new ProxyItem.ProxyStorageEntry(
|
||||
replacement.maybeItem().get(),
|
||||
meta,
|
||||
kilobytes,
|
||||
bytesPerType,
|
||||
idleDrain);
|
||||
item.addMetaReplacement(srcMeta, storage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecate a storage item. This goes through AEAPI, as AE2FC doesn't have any item cells. If the item is disabled
|
||||
* in AEAPI, the replacement will not be registered!
|
||||
*/
|
||||
private static void deprecateItemStorage(int srcMeta, IItemDefinition replacement, long kilobytes, int bytesPerType,
|
||||
double idleDrain, int types) {
|
||||
if (replacement.isEnabled()) {
|
||||
ProxyItemStorageCell item = getOrBuildItemStorage();
|
||||
ProxyItem.ProxyItemEntry storage = new ProxyItem.ProxyStorageEntry(
|
||||
replacement.maybeItem().get(),
|
||||
kilobytes,
|
||||
bytesPerType,
|
||||
idleDrain,
|
||||
types);
|
||||
item.addMetaReplacement(srcMeta, storage);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deprecateExtremeStorage(String srcName, int srcMeta, IItemDefinition replacement, long bytes,
|
||||
int bytesPerType, double idleDrain) {
|
||||
if (replacement.isEnabled()) {
|
||||
ProxyExtremeStorageCell item = getOrBuildItemStorage(srcName);
|
||||
int meta = replacement.maybeStack(1).get().getItemDamage();
|
||||
ProxyItem.ProxyItemEntry storage = new ProxyItem.ProxyStorageEntry(
|
||||
replacement.maybeItem().get(),
|
||||
meta,
|
||||
bytes / 1024,
|
||||
bytesPerType,
|
||||
idleDrain);
|
||||
item.addMetaReplacement(srcMeta, storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.FCBaseItem;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
/**
|
||||
* EC2ProxyItem - Item that "holds" the data of a missing item.
|
||||
*/
|
||||
public class ProxyItem extends FCBaseItem {
|
||||
|
||||
protected final String name;
|
||||
|
||||
/**
|
||||
* Maps a metadata value to a replacement.
|
||||
*/
|
||||
protected final Map<Integer, ProxyItemEntry> replacements;
|
||||
|
||||
public ProxyItem(String ec2itemName) {
|
||||
this.name = ec2itemName;
|
||||
this.replacements = new HashMap<>();
|
||||
setUnlocalizedName("ec2placeholder." + name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCBaseItem register() {
|
||||
GameRegistry.registerItem(this, "ec2placeholder." + name, FluidCraft.MODID);
|
||||
if (!ModAndClassUtil.EC2) {
|
||||
API.hideItem("ec2placeholder." + name);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
protected void addMetaReplacement(int srcMeta, Item replacement, int targetMeta) {
|
||||
this.replacements.put(srcMeta, new ProxyItemEntry(replacement, targetMeta));
|
||||
}
|
||||
|
||||
protected void addMetaReplacement(int srcMeta, ProxyItemEntry replacement) {
|
||||
this.replacements.put(srcMeta, replacement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasSubtypes() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean p_77624_4_) {
|
||||
int meta = stack.getItemDamage();
|
||||
ProxyItemEntry itemRepl = replacements.get(meta);
|
||||
if (itemRepl != null) {
|
||||
info.add(EnumChatFormatting.RED + "Extra Cells Placeholder for:");
|
||||
info.add(EnumChatFormatting.AQUA + itemRepl.replacement.getUnlocalizedName());
|
||||
info.add(EnumChatFormatting.GOLD + "Put in your inventory to get a replacement.");
|
||||
info.add(EnumChatFormatting.GOLD + "It will disappear if no replacement was found.");
|
||||
info.add(EnumChatFormatting.RED + "Report missing conversions on the GitHub.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack s = player.inventory.getStackInSlot(i);
|
||||
if (s == stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
ProxyItemEntry r = replacements.get(meta);
|
||||
if (r == null) {
|
||||
player.inventory.setInventorySlotContents(i, null);
|
||||
} else {
|
||||
ItemStack replaceStack = new ItemStack(r.replacement, stack.stackSize, r.replacementMeta);
|
||||
if (stack.hasTagCompound()) {
|
||||
replaceStack.setTagCompound(r.replaceNBT(stack.getTagCompound()));
|
||||
}
|
||||
player.inventory.setInventorySlotContents(i, replaceStack);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base class for a mapping from source (Item, meta) -> replacement (Item, meta). Optionally, override the
|
||||
* {@link ProxyItemEntry#replaceNBT(NBTTagCompound)} method for custom NBT migration.
|
||||
*/
|
||||
protected static class ProxyItemEntry {
|
||||
|
||||
protected final Item replacement;
|
||||
protected final int replacementMeta;
|
||||
|
||||
/**
|
||||
* Creates a Proxy Replacement.
|
||||
*
|
||||
* @param replacement Item that will replace the other.
|
||||
* @param replacementMeta Metadata/damage value of the replacement
|
||||
*/
|
||||
protected ProxyItemEntry(Item replacement, int replacementMeta) {
|
||||
this.replacement = replacement;
|
||||
this.replacementMeta = replacementMeta;
|
||||
}
|
||||
|
||||
NBTTagCompound replaceNBT(NBTTagCompound compound) {
|
||||
System.out.println(compound);
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ProxyStorageEntry extends ProxyItemEntry {
|
||||
|
||||
public final long maxBytes;
|
||||
public final int bytesPerType;
|
||||
public final double idleDrain;
|
||||
public final int types;
|
||||
|
||||
protected ProxyStorageEntry(Item replacement, int meta, long kilobytes, int bytesPerType, double idleDrain) {
|
||||
super(replacement, meta);
|
||||
this.maxBytes = kilobytes * 1024;
|
||||
this.bytesPerType = bytesPerType;
|
||||
this.idleDrain = idleDrain;
|
||||
this.types = 63;
|
||||
}
|
||||
|
||||
protected ProxyStorageEntry(Item replacement, long kilobytes, int bytesPerType, double idleDrain, int types) {
|
||||
super(replacement, 0);
|
||||
this.maxBytes = kilobytes * 1024;
|
||||
this.bytesPerType = bytesPerType;
|
||||
this.idleDrain = idleDrain;
|
||||
this.types = types;
|
||||
}
|
||||
|
||||
@Override
|
||||
NBTTagCompound replaceNBT(NBTTagCompound compound) {
|
||||
if (compound != null && compound.hasKey("ecc")) {
|
||||
compound.removeTag("ecc");
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.BusSupport;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartDeprecated;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* ProxyPart is expected to be immediately replaced with the replacement part on load.
|
||||
*/
|
||||
public class ProxyPart implements IPart, IPartDeprecated {
|
||||
|
||||
/**
|
||||
* Prevent memory leaks by having one of the instances be a weak ref.
|
||||
*/
|
||||
private final WeakReference<ProxyPartItem> item;
|
||||
|
||||
/**
|
||||
* Name for debug
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
public ProxyPart(ProxyPartItem item) {
|
||||
this.item = new WeakReference<>(item);
|
||||
this.name = item.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack(PartItemStack type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public void renderDynamic(double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer) {}
|
||||
|
||||
@Override
|
||||
public IIcon getBreakingTexture() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requireDynamicRender() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolid() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {}
|
||||
|
||||
@Override
|
||||
public int getLightLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLadder(EntityLivingBase entity) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {}
|
||||
|
||||
@Override
|
||||
public int isProvidingStrongPower() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToStream(ByteBuf data) {}
|
||||
|
||||
@Override
|
||||
public boolean readFromStream(ByteBuf data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(Entity entity) {}
|
||||
|
||||
@Override
|
||||
public void removeFromWorld() {}
|
||||
|
||||
@Override
|
||||
public void addToWorld() {}
|
||||
|
||||
@Override
|
||||
public IGridNode getExternalFacingNode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartHostInfo(ForgeDirection side, IPartHost host, TileEntity tile) {}
|
||||
|
||||
@Override
|
||||
public boolean onActivate(EntityPlayer player, Vec3 pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onShiftActivate(EntityPlayer player, Vec3 pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(List<ItemStack> drops, boolean wrenched) {}
|
||||
|
||||
@Override
|
||||
public int cableConnectionRenderTo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacement(EntityPlayer player, ItemStack held, ForgeDirection side) {}
|
||||
|
||||
@Override
|
||||
public boolean canBePlacedOn(BusSupport what) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBoxes(IPartCollisionHelper boxes) {}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound transformPart(NBTTagCompound def) {
|
||||
int meta = def.getShort("Damage");
|
||||
if (item.get() == null) {
|
||||
throw new NullPointerException("Umm, this wasn't supposed to happen. The ref item " + name + " was GC'd.");
|
||||
}
|
||||
ProxyItem.ProxyItemEntry r = item.get().replacements.get(meta);
|
||||
def.setInteger("id", Item.getIdFromItem(r.replacement));
|
||||
def.setShort("Damage", (short) r.replacementMeta);
|
||||
return def;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
return extra;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new fluid display NBT tag from the fluid name
|
||||
*/
|
||||
public static NBTTagCompound createFluidDisplayTag(String fluidName) {
|
||||
NBTTagCompound fluidDisplay = new NBTTagCompound();
|
||||
Fluid fluid = FluidRegistry.getFluid(fluidName);
|
||||
if (fluid != null) {
|
||||
ItemStack fluidPacket = new ItemStack(GameRegistry.findItem("ae2fc", "fluid_packet"), 1, 0);
|
||||
NBTTagCompound fluidPacketTag = new NBTTagCompound();
|
||||
// FluidStack
|
||||
FluidStack fluidStack = new FluidStack(fluid, 1000);
|
||||
NBTTagCompound fluidStackNbt = new NBTTagCompound();
|
||||
fluidStack.writeToNBT(fluidStackNbt);
|
||||
fluidPacketTag.setTag("FluidStack", fluidStackNbt);
|
||||
// FluidPacket
|
||||
fluidPacketTag.setBoolean("DisplayOnly", true);
|
||||
fluidPacket.setTagCompound(fluidPacketTag);
|
||||
// Final Item
|
||||
IAEItemStack aeStack = AEItemStack.create(fluidPacket);
|
||||
aeStack.writeToNBT(fluidDisplay);
|
||||
}
|
||||
return fluidDisplay;
|
||||
}
|
||||
|
||||
public static NBTTagCompound createFluidNBT(String fluidName, long amount) {
|
||||
NBTTagCompound fluid = new NBTTagCompound();
|
||||
fluid.setString("FluidName", fluidName);
|
||||
fluid.setBoolean("Craft", false);
|
||||
fluid.setLong("Req", 0);
|
||||
fluid.setLong("Cnt", amount);
|
||||
return fluid;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
|
||||
public class ProxyPartItem extends ProxyItem implements IPartItem {
|
||||
|
||||
/**
|
||||
* Creates a ProxyPartItem associated with the ProxyPart instance. This instance is reused on each call to
|
||||
* {@link #createPartFromItemStack(ItemStack)}.
|
||||
*
|
||||
* @param ec2itemName extra cells internal name
|
||||
*/
|
||||
public ProxyPartItem(String ec2itemName) {
|
||||
super(ec2itemName);
|
||||
}
|
||||
|
||||
protected void addItemPart(int srcMeta, Item replacement, Function<ProxyPartItem, ProxyPart> part) {
|
||||
this.replacements.put(srcMeta, new PartReplacement(replacement, part));
|
||||
}
|
||||
|
||||
protected void addItemPart(int srcMeta, IItemDefinition replacement, Function<ProxyPartItem, ProxyPart> part) {
|
||||
ItemStack stack = replacement.maybeStack(1).get();
|
||||
this.replacements.put(srcMeta, new PartReplacement(stack.getItem(), stack.getItemDamage(), part));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack(ItemStack is) {
|
||||
final int meta = is.getItemDamage();
|
||||
if (this.replacements.get(meta) instanceof PartReplacement part) {
|
||||
return part.proxyPart.apply(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Item replacement entry for ItemParts. All targets replace into 0.
|
||||
*/
|
||||
class PartReplacement extends ProxyItem.ProxyItemEntry {
|
||||
|
||||
Function<ProxyPartItem, ProxyPart> proxyPart;
|
||||
|
||||
PartReplacement(Item replacement, Function<ProxyPartItem, ProxyPart> proxyPart) {
|
||||
this(replacement, 0, proxyPart);
|
||||
}
|
||||
|
||||
PartReplacement(Item replacement, int meta, Function<ProxyPartItem, ProxyPart> proxyPart) {
|
||||
super(replacement, meta);
|
||||
this.proxyPart = proxyPart;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
|
||||
public class ProxyFluidBusIO extends ProxyPart {
|
||||
|
||||
/**
|
||||
* Map for converting slots from bus EC2 -> AE2FC
|
||||
*/
|
||||
private static int[] FILTER_MAP = null;
|
||||
|
||||
public static void init() {
|
||||
FILTER_MAP = new int[] { 5, 3, 6, 1, 0, 2, 7, 4, 8 };
|
||||
}
|
||||
|
||||
public ProxyFluidBusIO(ProxyPartItem partItem) {
|
||||
super(partItem);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// Transform NBT in place
|
||||
// Fluid Filter
|
||||
NBTTagCompound fluidFilterNew = new NBTTagCompound();
|
||||
for (int slot = 0; slot < 9; ++slot) {
|
||||
String oldFilterName = "FilterFluid#" + slot;
|
||||
fluidFilterNew
|
||||
.setTag("#" + FILTER_MAP[slot], ProxyPart.createFluidDisplayTag(extra.getString(oldFilterName)));
|
||||
extra.removeTag(oldFilterName);
|
||||
}
|
||||
extra.setTag("config", fluidFilterNew);
|
||||
// Upgrades
|
||||
NBTTagList upgrades = extra.getTagList("upgradeInventory", TAG_COMPOUND);
|
||||
NBTTagCompound upgradesNew = new NBTTagCompound();
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
NBTTagCompound upgrade = upgrades.getCompoundTagAt(i);
|
||||
upgrade.removeTag("Slot");
|
||||
upgradesNew.setTag("#" + i, upgrade);
|
||||
}
|
||||
extra.removeTag("upgradeInventory");
|
||||
extra.setTag("upgrades", upgradesNew);
|
||||
// Redstone mode
|
||||
RedstoneMode redstoneMode = RedstoneMode.values()[extra.getInteger("redstoneMode")];
|
||||
switch (redstoneMode) {
|
||||
case LOW_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "LOW_SIGNAL");
|
||||
case HIGH_SIGNAL -> extra.setString("REDSTONE_CONTROLLED", "HIGH_SIGNAL");
|
||||
case SIGNAL_PULSE -> extra.setString("REDSTONE_CONTROLLED", "SIGNAL_PULSE");
|
||||
default -> extra.setString("REDSTONE_CONTROLLED", "IGNORE");
|
||||
}
|
||||
extra.removeTag("redstoneMode");
|
||||
// Part data
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
// Extra tags
|
||||
extra.setString("CRAFT_ONLY", "NO");
|
||||
extra.setString("FUZZY_MODE", "IGNORE_ALL");
|
||||
extra.setString("SCHEDULING_MODE", "DEFAULT");
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
public class ProxyFluidInterface extends ProxyPart {
|
||||
|
||||
public ProxyFluidInterface(ProxyPartItem item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// Internal fluids - ConfigInv and FluidInv
|
||||
NBTTagCompound tank = extra.getCompoundTag("tank");
|
||||
NBTTagCompound configTank = new NBTTagCompound();
|
||||
configTank.setTag("#0", ProxyPart.createFluidDisplayTag(tank.getString("FluidName")));
|
||||
extra.setTag("ConfigInv", configTank);
|
||||
NBTTagCompound fluidTank = new NBTTagCompound();
|
||||
NBTTagCompound fluid = ProxyPart.createFluidNBT(tank.getString("FluidName"), tank.getLong("Amount"));
|
||||
fluidTank.setTag("#0", fluid);
|
||||
extra.setTag("FluidInv", fluidTank);
|
||||
extra.removeTag("tank");
|
||||
// Patterns
|
||||
NBTTagList patterns = extra.getCompoundTag("inventory").getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
|
||||
NBTTagCompound newPatterns = new NBTTagCompound();
|
||||
for (int i = 0; i < patterns.tagCount(); ++i) {
|
||||
NBTTagCompound p = patterns.getCompoundTagAt(i);
|
||||
p.removeTag("Slot");
|
||||
newPatterns.setTag("#" + i, p);
|
||||
}
|
||||
extra.removeTag("inventory");
|
||||
extra.setTag("patterns", newPatterns);
|
||||
// Part
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
return extra;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
public class ProxyFluidStorage extends ProxyPart {
|
||||
|
||||
private static int[] FILTER_MAP = null;
|
||||
|
||||
protected static void init() {
|
||||
// spotless:off
|
||||
FILTER_MAP = new int[] {
|
||||
0, 9, 18, 27, 36, 45,
|
||||
1, 10, 19, 28, 37, 46,
|
||||
2, 11, 20, 29, 38, 47,
|
||||
3, 12, 21, 30, 39, 48,
|
||||
4, 13, 22, 31, 40, 49,
|
||||
5, 14, 23, 32, 41, 50,
|
||||
6, 15, 24, 33, 42, 51,
|
||||
7, 16, 25, 34, 43, 52,
|
||||
8, 17, 26, 35, 44, 53 };
|
||||
//spotless:on
|
||||
}
|
||||
|
||||
public ProxyFluidStorage(ProxyPartItem item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// Transform in place, less messy IMO
|
||||
// Fluid filter slots
|
||||
NBTTagCompound fluidFilterNew = new NBTTagCompound();
|
||||
for (int slot = 0; slot < 54; ++slot) {
|
||||
String oldFilterName = "FilterFluid#" + slot;
|
||||
fluidFilterNew
|
||||
.setTag("#" + FILTER_MAP[slot], ProxyPart.createFluidDisplayTag(extra.getString(oldFilterName)));
|
||||
extra.removeTag(oldFilterName);
|
||||
}
|
||||
extra.setTag("config", fluidFilterNew);
|
||||
|
||||
// Part data
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
|
||||
// Access
|
||||
extra.setString("ACCESS", extra.getString("access"));
|
||||
extra.removeTag("access");
|
||||
|
||||
// Upgrades
|
||||
NBTTagList upgrades = extra.getTagList("upgradeInventory", TAG_COMPOUND);
|
||||
NBTTagCompound upgradeNew = new NBTTagCompound();
|
||||
upgradeNew.setTag("#0", upgrades.getCompoundTagAt(0));
|
||||
upgradeNew.setTag("#1", new NBTTagCompound());
|
||||
upgradeNew.setTag("#2", new NBTTagCompound());
|
||||
upgradeNew.setTag("#3", new NBTTagCompound());
|
||||
upgradeNew.setTag("#4", new NBTTagCompound());
|
||||
extra.setTag("upgrades", upgradeNew);
|
||||
extra.removeTag("upgradeInventory");
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
|
||||
public class ProxyLevelEmitter extends ProxyPart {
|
||||
|
||||
public ProxyLevelEmitter(ProxyPartItem item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// Fluid
|
||||
NBTTagCompound fluidSlots = new NBTTagCompound();
|
||||
fluidSlots.setTag("#0", ProxyPart.createFluidDisplayTag(extra.getString("fluid")));
|
||||
extra.setTag("config", fluidSlots);
|
||||
extra.removeTag("fluid");
|
||||
// Redstone
|
||||
RedstoneMode redstoneMode = RedstoneMode.values()[extra.getInteger("mode")];
|
||||
if (redstoneMode == RedstoneMode.LOW_SIGNAL) {
|
||||
extra.setString("REDSTONE_EMITTER", "LOW_SIGNAL");
|
||||
} else {
|
||||
extra.setString("REDSTONE_EMITTER", "HIGH_SIGNAL");
|
||||
}
|
||||
extra.removeTag("mode");
|
||||
// Level
|
||||
long wanted = extra.getLong("wantedAmount");
|
||||
extra.setLong("reportingValue", wanted);
|
||||
extra.setLong("lastReportingValue", wanted);
|
||||
extra.removeTag("wantedAmount");
|
||||
// Part
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
|
||||
public class ProxyOreDictExportBus extends ProxyPart {
|
||||
|
||||
public ProxyOreDictExportBus(ProxyPartItem item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// TODO: Node tag... should use OOP here.
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
// Ore dict card
|
||||
NBTTagCompound upgrades = new NBTTagCompound();
|
||||
NBTTagCompound oreDictCard = new NBTTagCompound();
|
||||
AEApi.instance().definitions().materials().cardOreFilter().maybeStack(1).get().writeToNBT(oreDictCard);
|
||||
upgrades.setTag("#0", oreDictCard);
|
||||
extra.setTag("upgrades", upgrades);
|
||||
return super.transformNBT(extra);
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.parts;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPart;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyPartItem;
|
||||
|
||||
public class ProxyStorageMonitor extends ProxyPart {
|
||||
|
||||
public ProxyStorageMonitor(ProxyPartItem item) {
|
||||
super(item);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound transformNBT(NBTTagCompound extra) {
|
||||
// Fluid
|
||||
int fluid = extra.getInteger("fluid");
|
||||
Fluid f = FluidRegistry.getFluid(fluid);
|
||||
NBTTagCompound itemDisplay = ProxyPart.createFluidNBT(f.getName(), 0L);
|
||||
extra.setTag("configuredItem", itemDisplay);
|
||||
extra.removeTag("amount");
|
||||
extra.removeTag("fluid");
|
||||
// Locked and other props
|
||||
extra.setBoolean("isLocked", extra.getBoolean("locked"));
|
||||
extra.removeTag("locked");
|
||||
extra.setByte("spin", (byte) 0);
|
||||
extra.setFloat("opacity", 255.0f);
|
||||
// Part
|
||||
extra.setTag("part", extra.getCompoundTag("node").getCompoundTag("node0"));
|
||||
extra.removeTag("node");
|
||||
return extra;
|
||||
}
|
||||
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ProxyExtremeStorageCell extends ProxyItemStorageCell {
|
||||
|
||||
public ProxyExtremeStorageCell(String ec2itemName) {
|
||||
super(ec2itemName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.storage.FluidCellInventory;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class ProxyFluidCellInventory extends FluidCellInventory {
|
||||
|
||||
private static final String EC_CONVERTED = "ecc";
|
||||
|
||||
public ProxyFluidCellInventory(ItemStack o, ISaveProvider container) throws AppEngException {
|
||||
super(o, container);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadCellFluids() {
|
||||
// If we've already converted the tag to AE2FC, just go to super.
|
||||
// Else, proceed with conversion
|
||||
if (!this.tagCompound.hasKey(EC_CONVERTED)) {
|
||||
if (this.cellFluids == null) {
|
||||
this.cellFluids = AEApi.instance().storage().createFluidList();
|
||||
}
|
||||
this.cellFluids.resetStatus(); // clears totals and stuff.
|
||||
// Load using Extra Cell's NBT format
|
||||
for (int i = 0; i < this.cellType.getTotalTypes(this.cellItem); i++) {
|
||||
FluidStack fs = FluidStack.loadFluidStackFromNBT(tagCompound.getCompoundTag("Fluid#" + i));
|
||||
tagCompound.removeTag("Fluid#" + i);
|
||||
final AEFluidStack aet = AEFluidStack.create(fs);
|
||||
if (aet != null) {
|
||||
if (aet.getStackSize() > 0) {
|
||||
this.cellFluids.add(aet);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tagCompound.setBoolean(EC_CONVERTED, true);
|
||||
// Convert to the new format
|
||||
long fluidCount = 0;
|
||||
int x = 0;
|
||||
|
||||
for (final IAEFluidStack v : this.cellFluids) {
|
||||
fluidCount += v.getStackSize();
|
||||
final NBTBase c = this.tagCompound.getTag(fluidSlots[x]);
|
||||
if (c instanceof NBTTagCompound) {
|
||||
v.writeToNBT((NBTTagCompound) c);
|
||||
} else {
|
||||
final NBTTagCompound g = new NBTTagCompound();
|
||||
v.writeToNBT(g);
|
||||
this.tagCompound.setTag(fluidSlots[x], g);
|
||||
}
|
||||
this.tagCompound.setLong(fluidSlotCount[x], v.getStackSize());
|
||||
x++;
|
||||
}
|
||||
this.storedFluids = (short) this.cellFluids.size();
|
||||
|
||||
if (!this.cellFluids.isEmpty()) {
|
||||
this.tagCompound.setShort(FLUID_TYPE_TAG, this.storedFluids);
|
||||
}
|
||||
|
||||
this.storedFluidCount = fluidCount;
|
||||
if (fluidCount > 0) {
|
||||
this.tagCompound.setLong(FLUID_COUNT_TAG, fluidCount);
|
||||
}
|
||||
} else {
|
||||
super.loadCellFluids();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-130
@@ -1,130 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyItem;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ProxyFluidStorageCell extends ProxyItem implements IStorageCell<IAEFluidStack> {
|
||||
|
||||
public ProxyFluidStorageCell(String ec2itemName) {
|
||||
super(ec2itemName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack cellItem) {
|
||||
return Math.toIntExact(getBytesLong(cellItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBytesLong(ItemStack cellItem) {
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).maxBytes;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int BytePerType(ItemStack cellItem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType(ItemStack cellItem) {
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).bytesPerType;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(IAEFluidStack requestedAddition) {
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell(ItemStack i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain(ItemStack is) {
|
||||
int meta = is.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).idleDrain;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is) {
|
||||
return new CellUpgrades(is, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackInventory 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) {
|
||||
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.registries.entries.BasicCellHandler;
|
||||
|
||||
public class ProxyItemCellHandler extends BasicCellHandler {
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is) {
|
||||
return is != null && is.getItem() != null && is.getItem() instanceof ProxyItemStorageCell;
|
||||
}
|
||||
}
|
||||
-168
@@ -1,168 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.crossmod.extracells.ProxyItem;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
|
||||
/**
|
||||
* Proxy Item Storage. 256K, 1024K, etc. -> AE2's version. For now its just mirroring AE2's version, will need to
|
||||
* transition to something better.
|
||||
*/
|
||||
public class ProxyItemStorageCell extends ProxyItem implements IStorageCell<IAEItemStack> {
|
||||
|
||||
public ProxyItemStorageCell(String ec2itemName) {
|
||||
super(ec2itemName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytes(ItemStack cellItem) {
|
||||
if (cellItem == null) {
|
||||
return 0;
|
||||
}
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return (int) ((ProxyStorageEntry) entry).maxBytes;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int BytePerType(ItemStack cellItem) {
|
||||
if (cellItem == null) {
|
||||
return 0;
|
||||
}
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).bytesPerType;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType(ItemStack cellItem) {
|
||||
if (cellItem == null) {
|
||||
return 0;
|
||||
}
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).bytesPerType;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBytesLong(ItemStack cellItem) {
|
||||
if (cellItem == null) {
|
||||
return 0;
|
||||
}
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).maxBytes;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(ItemStack cellItem) {
|
||||
return 63;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(IAEItemStack requestedAddition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storableInStorageCell() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageCell(ItemStack i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain(@Nullable ItemStack cellItem) {
|
||||
if (cellItem == null) {
|
||||
return 0.0;
|
||||
}
|
||||
int meta = cellItem.getItemDamage();
|
||||
if (replacements.containsKey(meta)) {
|
||||
ProxyItemEntry entry = replacements.get(meta);
|
||||
if (entry instanceof ProxyStorageEntry) {
|
||||
return ((ProxyStorageEntry) entry).bytesPerType;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.ITEMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEditable(ItemStack is) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackInventory 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());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOreFilter(ItemStack is) {
|
||||
return Platform.openNbtData(is).getString("OreFilter");
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.registries.entries.VoidCellHandler;
|
||||
|
||||
public class ProxyVoidCellHandler extends VoidCellHandler {
|
||||
|
||||
@Override
|
||||
public boolean isCell(ItemStack is) {
|
||||
return is != null && is.getItem() != null && is.getItem() instanceof ProxyVoidStorageCell;
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package com.glodblock.github.crossmod.extracells.storage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.items.storage.ItemVoidStorageCell;
|
||||
|
||||
public class ProxyVoidStorageCell extends ItemVoidStorageCell {
|
||||
|
||||
private final String name = AEApi.instance().definitions().items().cellVoid().maybeStack(1).get()
|
||||
.getUnlocalizedName();
|
||||
|
||||
public ProxyVoidStorageCell() {
|
||||
this.setUnlocalizedName("ec2placeholder.storage.physical.void");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> info,
|
||||
boolean displayMoreInfo) {
|
||||
info.add(EnumChatFormatting.RED + "Extra Cells Placeholder for:");
|
||||
info.add(EnumChatFormatting.AQUA + name);
|
||||
info.add(EnumChatFormatting.GOLD + "Put in your inventory to get a replacement.");
|
||||
info.add(EnumChatFormatting.GOLD + "It will disappear if no replacement was found.");
|
||||
info.add(EnumChatFormatting.RED + "Report missing conversions on the GitHub.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int p_77663_4_, boolean p_77663_5_) {
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayer player) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); ++i) {
|
||||
ItemStack s = player.inventory.getStackInSlot(i);
|
||||
if (s == stack) {
|
||||
ItemStack replaceStack = AEApi.instance().definitions().items().cellVoid().maybeStack(1).get();
|
||||
player.inventory.setInventorySlotContents(i, replaceStack);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidP2PInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
|
||||
@@ -96,9 +95,6 @@ public class CommonProxy {
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||
EC2Replacer.initReplacer();
|
||||
}
|
||||
if (ModAndClassUtil.ThE) {
|
||||
ThaumicEnergisticsCrafting.postInit();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user