Merge pull request #81 from GTNewHorizons/cell-housing
cell housing and multi fluid cell
No files matched your search
@@ -6,22 +6,28 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.CellConfig;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
|
||||
@@ -30,74 +36,43 @@ import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventory;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluidCell {
|
||||
|
||||
protected final CellType component;
|
||||
protected final long totalBytes;
|
||||
protected final int perType;
|
||||
protected final double idleDrain;
|
||||
protected CellType component;
|
||||
protected long totalBytes;
|
||||
protected int perType;
|
||||
protected double idleDrain;
|
||||
protected int maxType = 1;
|
||||
private final ReadableNumberConverter format = ReadableNumberConverter.INSTANCE;
|
||||
|
||||
@SuppressWarnings("Guava")
|
||||
public FCBaseItemCell(long bytes, int perType, double drain) {
|
||||
public FCBaseItemCell(long bytes, int perType, int totalType, double drain) {
|
||||
super(Optional.of(bytes / 1024 + "k"));
|
||||
this.setFeature(EnumSet.of(AEFeature.StorageCells));
|
||||
this.setMaxStackSize(1);
|
||||
this.totalBytes = bytes;
|
||||
this.perType = perType;
|
||||
this.idleDrain = drain;
|
||||
this.maxType = totalType;
|
||||
this.component = null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("Guava")
|
||||
public FCBaseItemCell(final CellType whichCell, final long kilobytes) {
|
||||
super(Optional.of(kilobytes + "k"));
|
||||
this.setFeature(EnumSet.of(AEFeature.StorageCells));
|
||||
this.setMaxStackSize(1);
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
@SuppressWarnings("all")
|
||||
public FCBaseItemCell(final Optional<String> subName) {
|
||||
super(subName);
|
||||
}
|
||||
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4kPart:
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16kPart:
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell64kPart:
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell256kPart:
|
||||
this.idleDrain = 2.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell1024kPart:
|
||||
this.idleDrain = 3.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4096kPart:
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
public ItemStack getHousing() {
|
||||
return ItemAndBlockHolder.CELL_HOUSING.stack();
|
||||
}
|
||||
|
||||
public ItemStack getComponent() {
|
||||
return component.stack(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,7 +181,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
|
||||
@Override
|
||||
public int getTotalTypes(final ItemStack cellItem) {
|
||||
return 1;
|
||||
return this.maxType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,6 +214,52 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
Platform.openNbtData(is).setString("FuzzyMode", fzMode.name());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected boolean disassembleDrive(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (Platform.isClient()) {
|
||||
return false;
|
||||
}
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler<?> inv = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
if (inv != null && playerInventory.getCurrentItem() == stack) {
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
|
||||
if (list.isEmpty() && ia != null) {
|
||||
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
|
||||
|
||||
// drop core
|
||||
final ItemStack extraB = ia.addItems(this.component.stack(1));
|
||||
if (extraB != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraB, false);
|
||||
}
|
||||
|
||||
// drop upgrades
|
||||
final IInventory upgradesInventory = this.getUpgradesInventory(stack);
|
||||
for (int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++) {
|
||||
final ItemStack upgradeStack = upgradesInventory.getStackInSlot(upgradeIndex);
|
||||
final ItemStack leftStack = ia.addItems(upgradeStack);
|
||||
if (leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule) {
|
||||
player.dropPlayerItemWithRandomChoice(upgradeStack, false);
|
||||
}
|
||||
}
|
||||
|
||||
// drop empty storage cell case
|
||||
final ItemStack extraA = ia.addItems(this.getHousing());
|
||||
if (extraA != null) {
|
||||
player.dropPlayerItemWithRandomChoice(this.getHousing(), false);
|
||||
}
|
||||
if (player.inventoryContainer != null) {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
@@ -1,30 +1,20 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
@@ -32,7 +22,9 @@ import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -42,14 +34,60 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
implements IStorageFluidCell, IRegister<ItemBasicFluidStorageCell> {
|
||||
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
private final int housingValue;
|
||||
|
||||
public ItemBasicFluidStorageCell(final CellType whichCell, final long kilobytes) {
|
||||
super(whichCell, kilobytes);
|
||||
@SuppressWarnings("Guava")
|
||||
public ItemBasicFluidStorageCell(final CellType whichCell, final int housingValue, final long kilobytes) {
|
||||
super(Optional.of(kilobytes + "k"));
|
||||
this.setFeature(EnumSet.of(AEFeature.StorageCells));
|
||||
this.setMaxStackSize(1);
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
this.housingValue = housingValue;
|
||||
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
|
||||
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4kPart:
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16kPart:
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell64kPart:
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell256kPart:
|
||||
this.idleDrain = 2.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell1024kPart:
|
||||
this.idleDrain = 3.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4096kPart:
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 8;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getComponent() {
|
||||
return component.stack(1);
|
||||
@Override
|
||||
public ItemStack getHousing() {
|
||||
return ItemAndBlockHolder.CELL_HOUSING.stack(1, this.housingValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,55 +120,6 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
return stack;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean disassembleDrive(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
if (player.isSneaking()) {
|
||||
if (Platform.isClient()) {
|
||||
return false;
|
||||
}
|
||||
final InventoryPlayer playerInventory = player.inventory;
|
||||
final IMEInventoryHandler<?> inv = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
if (inv != null && playerInventory.getCurrentItem() == stack) {
|
||||
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
|
||||
if (list.isEmpty() && ia != null) {
|
||||
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
|
||||
|
||||
// drop core
|
||||
final ItemStack extraB = ia.addItems(this.component.stack(1));
|
||||
if (extraB != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraB, false);
|
||||
}
|
||||
|
||||
// drop upgrades
|
||||
final IInventory upgradesInventory = this.getUpgradesInventory(stack);
|
||||
for (int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++) {
|
||||
final ItemStack upgradeStack = upgradesInventory.getStackInSlot(upgradeIndex);
|
||||
final ItemStack leftStack = ia.addItems(upgradeStack);
|
||||
if (leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule) {
|
||||
player.dropPlayerItemWithRandomChoice(upgradeStack, false);
|
||||
}
|
||||
}
|
||||
|
||||
// drop empty storage cell case
|
||||
for (final ItemStack storageCellStack : AEApi.instance().definitions().materials()
|
||||
.emptyStorageCell().maybeStack(1).asSet()) {
|
||||
final ItemStack extraA = ia.addItems(storageCellStack);
|
||||
if (extraA != null) {
|
||||
player.dropPlayerItemWithRandomChoice(extraA, false);
|
||||
}
|
||||
}
|
||||
if (player.inventoryContainer != null) {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(final ItemStack stack, final EntityPlayer player, final World world, final int x,
|
||||
final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
@@ -140,9 +129,8 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
for (final ItemStack stack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack(1)
|
||||
.asSet()) {
|
||||
return stack;
|
||||
if (this.getHousing() != null) {
|
||||
return this.getHousing();
|
||||
}
|
||||
throw new MissingDefinition("Tried to use empty storage cells while basic storage cells are defined.");
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ItemBasicFluidStoragePart extends FCBaseItem {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < types; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
|
||||
@@ -16,8 +16,8 @@ public class ItemFluidExtremeStorageCell extends FCBaseItemCell
|
||||
|
||||
private final String name;
|
||||
|
||||
public ItemFluidExtremeStorageCell(String name, long bytes, int perType, double drain) {
|
||||
super(bytes, perType, drain);
|
||||
public ItemFluidExtremeStorageCell(String name, long bytes, int perType, int totalTypes, double drain) {
|
||||
super(bytes, perType, totalTypes, drain);
|
||||
setUnlocalizedName(name);
|
||||
this.name = name;
|
||||
setTextureName(FluidCraft.resource(name).toString());
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFluidStorageHousing extends FCBaseItem {
|
||||
|
||||
public static final int types = 4;
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
|
||||
public ItemFluidStorageHousing() {
|
||||
super();
|
||||
setHasSubtypes(true);
|
||||
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE_HOUSING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < types; ++i) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
int meta = stack.getItemDamage();
|
||||
return StatCollector.translateToLocalFormatted("item.fluid_storage_housing." + meta + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
for (int i = 0; i < types; i++) {
|
||||
icon.put(i, iconRegister.registerIcon(NameConst.RES_KEY + NameConst.ITEM_FLUID_STORAGE_HOUSING + "." + i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icon.get(meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidStorageHousing register() {
|
||||
if (!Config.fluidCells) return null;
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_STORAGE_HOUSING, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import appeng.api.exceptions.MissingDefinition;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemMultiFluidStorageCell extends FCBaseItemCell
|
||||
implements IStorageFluidCell, IRegister<ItemMultiFluidStorageCell> {
|
||||
|
||||
private static final HashMap<Integer, IIcon> icon = new HashMap<>();
|
||||
private final int housingValue;
|
||||
|
||||
@SuppressWarnings("Guava")
|
||||
public ItemMultiFluidStorageCell(final CellType whichCell, final int housingValue, final long kilobytes) {
|
||||
super(Optional.of(kilobytes + "k"));
|
||||
this.setFeature(EnumSet.of(AEFeature.StorageCells));
|
||||
this.setMaxStackSize(1);
|
||||
this.totalBytes = kilobytes * 1024;
|
||||
this.component = whichCell;
|
||||
this.housingValue = housingValue;
|
||||
this.maxType = 5;
|
||||
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + kilobytes);
|
||||
|
||||
switch (this.component) {
|
||||
case Cell1kPart:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case Cell4kPart:
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 32;
|
||||
break;
|
||||
case Cell16kPart:
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 128;
|
||||
break;
|
||||
case Cell64kPart:
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 512;
|
||||
break;
|
||||
case Cell256kPart:
|
||||
this.idleDrain = 2.5;
|
||||
this.perType = 2048;
|
||||
break;
|
||||
case Cell1024kPart:
|
||||
this.idleDrain = 3.0;
|
||||
this.perType = 8192;
|
||||
break;
|
||||
case Cell4096kPart:
|
||||
this.idleDrain = 3.5;
|
||||
this.perType = 32768;
|
||||
break;
|
||||
case Cell16384kPart:
|
||||
this.idleDrain = 4.0;
|
||||
this.perType = 131072;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHousing() {
|
||||
return ItemAndBlockHolder.CELL_HOUSING.stack(1, this.housingValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
"item.multi_fluid_storage." + this.totalBytes / 1024 + ".name",
|
||||
CellType.getTypeColor(this.component),
|
||||
EnumChatFormatting.RESET);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
icon.put(
|
||||
(int) (this.totalBytes / 1024),
|
||||
iconRegister.registerIcon(
|
||||
NameConst.RES_KEY + NameConst.ITEM_MULTI_FLUID_STORAGE + "." + this.totalBytes / 1024));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
int id = (int) (this.totalBytes / 1024);
|
||||
return icon.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) {
|
||||
this.disassembleDrive(stack, world, player);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(final ItemStack stack, final EntityPlayer player, final World world, final int x,
|
||||
final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (ForgeEventFactory.onItemUseStart(player, stack, 1) <= 0) return true;
|
||||
return this.disassembleDrive(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem(final ItemStack stack) {
|
||||
return AEConfig.instance.isFeatureEnabled(AEFeature.EnableDisassemblyCrafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
if (this.getHousing() != null) {
|
||||
return this.getHousing();
|
||||
}
|
||||
throw new MissingDefinition("Tried to use empty storage cells while basic storage cells are defined.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemMultiFluidStorageCell register() {
|
||||
if (!Config.fluidCells) return null;
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_MULTI_FLUID_STORAGE + this.totalBytes / 1024, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -41,32 +41,57 @@ public class ItemAndBlockHolder {
|
||||
public static ItemWirelessInterfaceTerminal WIRELESS_INTERFACE_TERM = new ItemWirelessInterfaceTerminal()
|
||||
.register();
|
||||
public static ItemFluidPacket PACKET = new ItemFluidPacket().register();
|
||||
public static ItemBasicFluidStorageCell CELL1K = new ItemBasicFluidStorageCell(CellType.Cell1kPart, 1).register();
|
||||
public static ItemBasicFluidStorageCell CELL4K = new ItemBasicFluidStorageCell(CellType.Cell4kPart, 4).register();
|
||||
public static ItemBasicFluidStorageCell CELL16K = new ItemBasicFluidStorageCell(CellType.Cell16kPart, 16)
|
||||
public static ItemBasicFluidStorageCell CELL1K = new ItemBasicFluidStorageCell(CellType.Cell1kPart, 0, 1)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL64K = new ItemBasicFluidStorageCell(CellType.Cell64kPart, 64)
|
||||
public static ItemBasicFluidStorageCell CELL4K = new ItemBasicFluidStorageCell(CellType.Cell4kPart, 0, 4)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL256K = new ItemBasicFluidStorageCell(CellType.Cell256kPart, 256)
|
||||
public static ItemBasicFluidStorageCell CELL16K = new ItemBasicFluidStorageCell(CellType.Cell16kPart, 0, 16)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL1024K = new ItemBasicFluidStorageCell(CellType.Cell1024kPart, 1024)
|
||||
public static ItemBasicFluidStorageCell CELL64K = new ItemBasicFluidStorageCell(CellType.Cell64kPart, 0, 64)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL4096K = new ItemBasicFluidStorageCell(CellType.Cell4096kPart, 4096)
|
||||
public static ItemBasicFluidStorageCell CELL256K = new ItemBasicFluidStorageCell(CellType.Cell256kPart, 1, 256)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL16384K = new ItemBasicFluidStorageCell(CellType.Cell16384kPart, 16384)
|
||||
public static ItemBasicFluidStorageCell CELL1024K = new ItemBasicFluidStorageCell(CellType.Cell1024kPart, 1, 1024)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL4096K = new ItemBasicFluidStorageCell(CellType.Cell4096kPart, 1, 4096)
|
||||
.register();
|
||||
public static ItemBasicFluidStorageCell CELL16384K = new ItemBasicFluidStorageCell(
|
||||
CellType.Cell16384kPart,
|
||||
1,
|
||||
16384).register();
|
||||
public static ItemMultiFluidStorageCell CELL1KM = new ItemMultiFluidStorageCell(CellType.Cell1kPart, 2, 1)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL4KM = new ItemMultiFluidStorageCell(CellType.Cell4kPart, 2, 4)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL16KM = new ItemMultiFluidStorageCell(CellType.Cell16kPart, 2, 16)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL64KM = new ItemMultiFluidStorageCell(CellType.Cell64kPart, 2, 64)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL256KM = new ItemMultiFluidStorageCell(CellType.Cell256kPart, 3, 256)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL1024KM = new ItemMultiFluidStorageCell(CellType.Cell1024kPart, 3, 1024)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL4096KM = new ItemMultiFluidStorageCell(CellType.Cell4096kPart, 3, 4096)
|
||||
.register();
|
||||
public static ItemMultiFluidStorageCell CELL16384KM = new ItemMultiFluidStorageCell(
|
||||
CellType.Cell16384kPart,
|
||||
3,
|
||||
16384).register();
|
||||
public static ItemFluidExtremeStorageCell QUANTUM_CELL = new ItemFluidExtremeStorageCell(
|
||||
NameConst.ITEM_QUANTUM_FLUID_STORAGE,
|
||||
Integer.MAX_VALUE / 16,
|
||||
8,
|
||||
5,
|
||||
4.5).register();
|
||||
public static ItemFluidExtremeStorageCell SINGULARITY_CELL = new ItemFluidExtremeStorageCell(
|
||||
NameConst.ITEM_SINGULARITY_FLUID_STORAGE,
|
||||
Long.MAX_VALUE / (singleByteAmount * 2),
|
||||
8,
|
||||
1,
|
||||
5).register();
|
||||
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().register();
|
||||
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
|
||||
public static ItemFluidStorageHousing CELL_HOUSING = new ItemFluidStorageHousing().register();
|
||||
|
||||
public static void loadSetting() {
|
||||
if (!Config.fluidCells) return;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.loader;
|
||||
|
||||
import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.*;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL4KM;
|
||||
import static net.minecraft.init.Blocks.redstone_torch;
|
||||
import static net.minecraft.init.Items.fish;
|
||||
|
||||
@@ -16,7 +17,7 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
@@ -66,10 +67,6 @@ public class RecipeLoader implements Runnable {
|
||||
.findItemStack("appliedenergistics2", "tile.BlockQuartzGlass", 1);
|
||||
public static final ItemStack AE2_LAMP_GLASS = GameRegistry
|
||||
.findItemStack("appliedenergistics2", "tile.BlockQuartzLamp", 1);
|
||||
public static final ItemStack AE2_CELL_HOUSING = new ItemStack(
|
||||
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
|
||||
1,
|
||||
39);
|
||||
public static final ItemStack AE2_CELL_1K = new ItemStack(
|
||||
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
|
||||
1,
|
||||
@@ -397,8 +394,9 @@ public class RecipeLoader implements Runnable {
|
||||
'G',
|
||||
AE2_LAMP_GLASS));
|
||||
|
||||
ItemBasicFluidStorageCell[] cells = new ItemBasicFluidStorageCell[] { CELL1K, CELL4K, CELL16K, CELL64K,
|
||||
CELL256K, CELL1024K, CELL4096K, CELL16384K };
|
||||
FCBaseItemCell[] cells = new FCBaseItemCell[] { CELL1K, CELL4K, CELL16K, CELL64K, CELL256K, CELL1024K,
|
||||
CELL4096K, CELL16384K, CELL1KM, CELL4KM, CELL16KM, CELL64KM, CELL256KM, CELL1024KM, CELL4096KM,
|
||||
CELL16384KM };
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
QUANTUM_CELL.stack(),
|
||||
@@ -421,23 +419,118 @@ public class RecipeLoader implements Runnable {
|
||||
QUANTUM_CELL,
|
||||
'M',
|
||||
AE2_MATTER_CONDENSER));
|
||||
for (ItemBasicFluidStorageCell cell : cells) {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
cell,
|
||||
"GDG",
|
||||
"DCD",
|
||||
"III",
|
||||
'D',
|
||||
"dustRedstone",
|
||||
'G',
|
||||
AE2_QUARTZ_GLASS,
|
||||
'C',
|
||||
cell.getComponent(),
|
||||
'I',
|
||||
"ingotIron"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(cell, AE2_CELL_HOUSING, cell.getComponent()));
|
||||
for (FCBaseItemCell cell : cells) {
|
||||
if (cell.getHousing().getItemDamage() == 0) {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
cell,
|
||||
"GDG",
|
||||
"DCD",
|
||||
"III",
|
||||
'D',
|
||||
"dyeRed",
|
||||
'G',
|
||||
AE2_QUARTZ_GLASS,
|
||||
'C',
|
||||
cell.getComponent(),
|
||||
'I',
|
||||
"ingotIron"));
|
||||
} else if (cell.getHousing().getItemDamage() == 1) {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
cell,
|
||||
"GDG",
|
||||
"DCD",
|
||||
"III",
|
||||
'D',
|
||||
"dustRedstone",
|
||||
'G',
|
||||
AE2_LAMP_GLASS,
|
||||
'C',
|
||||
cell.getComponent(),
|
||||
'I',
|
||||
"gemDiamond"));
|
||||
} else if (cell.getHousing().getItemDamage() == 2) {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
cell,
|
||||
"GDG",
|
||||
"DCD",
|
||||
"III",
|
||||
'D',
|
||||
"dyeBlue",
|
||||
'G',
|
||||
AE2_QUARTZ_GLASS,
|
||||
'C',
|
||||
cell.getComponent(),
|
||||
'I',
|
||||
"ingotIron"));
|
||||
} else if (cell.getHousing().getItemDamage() == 3) {
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
cell,
|
||||
"GDG",
|
||||
"DCD",
|
||||
"III",
|
||||
'D',
|
||||
"dustGlowstone",
|
||||
'G',
|
||||
AE2_LAMP_GLASS,
|
||||
'C',
|
||||
cell.getComponent(),
|
||||
'I',
|
||||
"gemDiamond"));
|
||||
}
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(cell, cell.getHousing(), cell.getComponent()));
|
||||
}
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
CELL_HOUSING.stack(1, 0),
|
||||
"GDG",
|
||||
"D D",
|
||||
"III",
|
||||
'D',
|
||||
"dyeRed",
|
||||
'G',
|
||||
AE2_QUARTZ_GLASS,
|
||||
'I',
|
||||
"ingotIron"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
CELL_HOUSING.stack(1, 1),
|
||||
"GDG",
|
||||
"D D",
|
||||
"III",
|
||||
'D',
|
||||
"dustRedstone",
|
||||
'G',
|
||||
AE2_LAMP_GLASS,
|
||||
'I',
|
||||
"gemDiamond"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
CELL_HOUSING.stack(1, 2),
|
||||
"GDG",
|
||||
"D D",
|
||||
"III",
|
||||
'D',
|
||||
"dyeBlue",
|
||||
'G',
|
||||
AE2_QUARTZ_GLASS,
|
||||
'I',
|
||||
"ingotIron"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
CELL_HOUSING.stack(1, 3),
|
||||
"GDG",
|
||||
"D D",
|
||||
"III",
|
||||
'D',
|
||||
"dustGlowstone",
|
||||
'G',
|
||||
AE2_LAMP_GLASS,
|
||||
'I',
|
||||
"gemDiamond"));
|
||||
}
|
||||
|
||||
if (Config.fluidIOBus) {
|
||||
|
||||
@@ -35,6 +35,7 @@ public class NameConst {
|
||||
public static final String ITEM_PART_FLUID_LEVEL_EMITTER = "part_fluid_level_emitter";
|
||||
public static final String ITEM_FLUID_PACKET = "fluid_packet";
|
||||
public static final String ITEM_FLUID_STORAGE = "fluid_storage";
|
||||
public static final String ITEM_MULTI_FLUID_STORAGE = "multi_fluid_storage";
|
||||
public static final String ITEM_QUANTUM_FLUID_STORAGE = ITEM_FLUID_STORAGE + ".quantum";
|
||||
public static final String ITEM_SINGULARITY_FLUID_STORAGE = ITEM_FLUID_STORAGE + ".singularity";
|
||||
public static final String ITEM_CREATIVE_FLUID_STORAGE = "creative_" + ITEM_FLUID_STORAGE;
|
||||
@@ -44,6 +45,7 @@ public class NameConst {
|
||||
public static final String ITEM_WIRELESS_ULTRA_TERMINAL = "wireless_ultra_terminal";
|
||||
public static final String ITEM_WIRELESS_FLUID_PATTERN_TERMINAL = "wireless_fluid_pattern_terminal";
|
||||
public static final String ITEM_FLUID_PART = "fluid_part";
|
||||
public static final String ITEM_FLUID_STORAGE_HOUSING = "fluid_storage_housing";
|
||||
|
||||
public static final String TT_KEY = FluidCraft.MODID + ".tooltip.";
|
||||
public static final String TT_FLUID_TERMINAL = TT_KEY + "fluid_terminal";
|
||||
|
||||
@@ -30,6 +30,14 @@ item.fluid_storage.256.name=%s256k%s ME Fluid Storage Cell
|
||||
item.fluid_storage.1024.name=%s1024k%s ME Fluid Storage Cell
|
||||
item.fluid_storage.4096.name=%s4096k%s ME Fluid Storage Cell
|
||||
item.fluid_storage.16384.name=%s16384k%s ME Fluid Storage Cell
|
||||
item.multi_fluid_storage.1.name=%s1k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.4.name=%s4k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.16.name=%s16k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.64.name=%s64k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.256.name=%s256k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.1024.name=%s1024k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.4096.name=%s4096k%s ME Multi-Fluid Storage Cell
|
||||
item.multi_fluid_storage.16384.name=%s16384k%s ME Multi-Fluid Storage Cell
|
||||
item.fluid_storage.quantum.name=ME Fluid Quantum Storage Cell
|
||||
item.fluid_storage.singularity.name=ME Fluid Digital Singularity Storage Cell
|
||||
item.fluid_part.0.name=%s1k%s ME Fluid Storage Component
|
||||
@@ -40,6 +48,10 @@ item.fluid_part.4.name=%s256k%s ME Fluid Storage Component
|
||||
item.fluid_part.5.name=%s1024k%s ME Fluid Storage Component
|
||||
item.fluid_part.6.name=%s4096k%s ME Fluid Storage Component
|
||||
item.fluid_part.7.name=%s16384k%s ME Fluid Storage Component
|
||||
item.fluid_storage_housing.0.name=ME Fluid Storage Housing
|
||||
item.fluid_storage_housing.1.name=ME Advanced Fluid Storage Housing
|
||||
item.fluid_storage_housing.2.name=ME Multi-Fluid Storage Housing
|
||||
item.fluid_storage_housing.3.name=ME Advanced Multi-Fluid Storage Housing
|
||||
|
||||
tile.fluid_discretizer.name=Fluid Discretizer
|
||||
tile.fluid_pattern_encoder.name=Fluid Pattern Encoder
|
||||
|
||||
|
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 480 B |
|
After Width: | Height: | Size: 337 B |
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 348 B |
|
After Width: | Height: | Size: 344 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 448 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 361 B |
|
After Width: | Height: | Size: 1.2 KiB |