mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-11 07:47:55 +00:00
add fluid cell housing
This commit is contained in:
1 parent
7910578318
commit
96c7032523
10 files changed
+163
-29
No files matched your search
@@ -52,6 +52,10 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
return component.stack(1);
|
||||
}
|
||||
|
||||
public ItemStack getHousing() {
|
||||
return component.getHousing(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
return StatCollector.translateToLocalFormatted(
|
||||
@@ -114,12 +118,9 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
final ItemStack extraA = ia.addItems(this.component.getHousing(1));
|
||||
if (extraA != null) {
|
||||
player.dropPlayerItemWithRandomChoice(this.component.getHousing(1), false);
|
||||
}
|
||||
if (player.inventoryContainer != null) {
|
||||
player.inventoryContainer.detectAndSendChanges();
|
||||
@@ -140,9 +141,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));
|
||||
|
||||
@@ -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 = 2;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
public enum CellType {
|
||||
|
||||
Cell1kPart(0, AEFeature.StorageCells),
|
||||
@@ -22,6 +24,7 @@ public enum CellType {
|
||||
private final EnumSet<AEFeature> features;
|
||||
private int damageValue;
|
||||
private Item itemInstance;
|
||||
private int housingValue;
|
||||
|
||||
CellType(final int metaValue, final AEFeature part) {
|
||||
this.setDamageValue(metaValue);
|
||||
@@ -36,6 +39,14 @@ public enum CellType {
|
||||
this.damageValue = damageValue;
|
||||
}
|
||||
|
||||
public int getHousingValue() {
|
||||
return this.housingValue;
|
||||
}
|
||||
|
||||
public void setHousingValue(final int housingValue) {
|
||||
this.housingValue = housingValue;
|
||||
}
|
||||
|
||||
EnumSet<AEFeature> getFeature() {
|
||||
return this.features;
|
||||
}
|
||||
@@ -44,6 +55,10 @@ public enum CellType {
|
||||
return new ItemStack(this.getItemInstance(), size, this.getDamageValue());
|
||||
}
|
||||
|
||||
public ItemStack getHousing(final int size) {
|
||||
return new ItemStack(ItemAndBlockHolder.CELL_HOUSING, size, this.getHousingValue());
|
||||
}
|
||||
|
||||
public Item getItemInstance() {
|
||||
return this.itemInstance;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class ItemAndBlockHolder {
|
||||
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;
|
||||
@@ -78,5 +79,13 @@ public class ItemAndBlockHolder {
|
||||
CellType.Cell1024kPart.setItemInstance(CELL_PART);
|
||||
CellType.Cell4096kPart.setItemInstance(CELL_PART);
|
||||
CellType.Cell16384kPart.setItemInstance(CELL_PART);
|
||||
CellType.Cell1kPart.setHousingValue(0);
|
||||
CellType.Cell4kPart.setHousingValue(0);
|
||||
CellType.Cell16kPart.setHousingValue(0);
|
||||
CellType.Cell64kPart.setHousingValue(0);
|
||||
CellType.Cell256kPart.setHousingValue(1);
|
||||
CellType.Cell1024kPart.setHousingValue(1);
|
||||
CellType.Cell4096kPart.setHousingValue(1);
|
||||
CellType.Cell16384kPart.setHousingValue(1);
|
||||
}
|
||||
}
|
||||
@@ -66,10 +66,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,
|
||||
@@ -422,22 +418,63 @@ public class RecipeLoader implements Runnable {
|
||||
'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()));
|
||||
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_QUARTZ_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_QUARTZ_GLASS,
|
||||
'I',
|
||||
"gemDiamond"));
|
||||
}
|
||||
|
||||
if (Config.fluidIOBus) {
|
||||
|
||||
@@ -44,6 +44,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";
|
||||
|
||||
Reference in new issue
Block a user