mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
Universal GUI (#340)
Co-authored-by: Kogepan229 <[email protected]> Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
213 files changed
+1859
-19432
No files matched your search
@@ -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,321 +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);
|
||||
deprecateWireless("terminal.fluid.wireless", ItemAndBlockHolder.WIRELESS_FLUID_TERM);
|
||||
|
||||
/* 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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-108
@@ -1,108 +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.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyItem;
|
||||
import com.glodblock.github.inventory.FluidCellConfig;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ProxyFluidStorageCell extends ProxyItem implements IStorageFluidCell {
|
||||
|
||||
public ProxyFluidStorageCell(String ec2itemName) {
|
||||
super(ec2itemName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBytes(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 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(ItemStack cellItem, 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 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 IInventory getConfigInventory(ItemStack is) {
|
||||
return new FluidCellConfig(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;
|
||||
}
|
||||
}
|
||||
-161
@@ -1,161 +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.data.IAEItemStack;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
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 {
|
||||
|
||||
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(ItemStack cellItem, 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 boolean isEditable(ItemStack is) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is) {
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+11
-7
@@ -3,7 +3,6 @@ package com.glodblock.github.crossmod.opencomputers;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -13,6 +12,10 @@ import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
@@ -44,7 +47,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
super(tileEntity, NameConst.BLOCK_LEVEL_MAINTAINER);
|
||||
}
|
||||
|
||||
private int getSlot(Arguments args, IInventory inv, int index, int def) {
|
||||
private int getSlot(Arguments args, IAEStackInventory inv, int index, int def) {
|
||||
if (index >= 0 && index < args.count()) {
|
||||
int slot = args.checkInteger(index) - 1;
|
||||
if (slot < 0 || slot >= inv.getSizeInventory()) {
|
||||
@@ -93,10 +96,11 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
|
||||
@Callback(doc = "function([slot:number]):table -- Get the slot status.")
|
||||
public Object[] getSlot(Context context, Arguments args) {
|
||||
IInventory config = tileEntity.getInventory();
|
||||
int slot = getSlot(args, config, 0, 0);
|
||||
ItemStack stack = config.getStackInSlot(slot);
|
||||
if (stack != null) {
|
||||
IAEStackInventory inventory = tileEntity.getAEStackInventory();
|
||||
int slot = getSlot(args, inventory, 0, 0);
|
||||
IAEStack<?> aeStack = inventory.getAEStackInSlot(slot);
|
||||
if (aeStack != null) {
|
||||
ItemStack stack = Platform.stackConvert(aeStack).getItemStack();
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("damage", stack.getItemDamage());
|
||||
result.put("hasTag", stack.hasTagCompound());
|
||||
@@ -122,7 +126,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
if (dbStack == null) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
tileEntity.updateStack(slot, dbStack);
|
||||
tileEntity.updateStack(slot, AEItemStack.create(dbStack));
|
||||
} else {
|
||||
throw new IllegalArgumentException("Not a database");
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import appeng.parts.automation.PartSharedItemBus;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final IPart part, final TileEntity te,
|
||||
final NBTTagCompound tag, final World world, final int x, final int y, final int z) {
|
||||
if (part instanceof FCSharedFluidBus bus) {
|
||||
if (part instanceof PartSharedItemBus<?>bus) {
|
||||
tag.setInteger("BusSpeed", bus.calculateAmountToSend() / 5);
|
||||
}
|
||||
return tag;
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public class LevelMaintainerWailaDataProvider extends BaseWailaDataProvider {
|
||||
tileLevelMaintainer);
|
||||
currentToolTip.add(
|
||||
Tooltip.tileLevelMaintainerFormat(
|
||||
request.getAEItemStack().getItemStack().getDisplayName(),
|
||||
request.getAEStack().getDisplayName(),
|
||||
request.getQuantity(),
|
||||
request.getBatchSize(),
|
||||
request.isEnable()));
|
||||
|
||||
Reference in new issue
Block a user