aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/CodeChickenLib.cfg2
-rw-r--r--config/IC2.ini336
-rw-r--r--config/splash.properties2
-rw-r--r--mods/CodeChickenCore-1.7.10-1.0.7.47-universal.jarbin0 -> 145782 bytes
-rw-r--r--src/main/java/blocks/Block_ItemDistributionNode.java15
-rw-r--r--src/main/java/container/Container_ItemDistributionNode.java68
-rw-r--r--src/main/java/container/Gui_ItemDistributionNode.java49
-rw-r--r--src/main/java/kekztech/GTRecipe.java104
-rw-r--r--src/main/java/kekztech/GuiHandler.java35
-rw-r--r--src/main/java/kekztech/ItemDistributionNetworkController.java45
-rw-r--r--src/main/java/kekztech/KekzCore.java11
-rw-r--r--src/main/java/kekztech/TFFTFluidHandler.java7
-rw-r--r--src/main/java/tileentities/GTMTE_FluidMultiStorage.java2
-rw-r--r--src/main/java/tileentities/GTMTE_ModularNuclearReactor.java2
-rw-r--r--src/main/java/tileentities/GTMTE_SOFuelCellMK1.java2
-rw-r--r--src/main/java/tileentities/GTMTE_SOFuelCellMK2.java2
-rw-r--r--src/main/java/tileentities/TE_ItemDistributionCable.java20
-rw-r--r--src/main/java/tileentities/TE_ItemDistributionNode.java48
-rw-r--r--src/main/java/util/MultiBlockTooltipBuilder.java (renamed from src/main/java/kekztech/MultiBlockTooltipBuilder.java)2
-rw-r--r--src/main/resources/assets/kekztech/textures/gui/ItemDistributorNode.pngbin0 -> 3659 bytes
20 files changed, 451 insertions, 301 deletions
diff --git a/config/CodeChickenLib.cfg b/config/CodeChickenLib.cfg
index 947513c59e..94d4c170a5 100644
--- a/config/CodeChickenLib.cfg
+++ b/config/CodeChickenLib.cfg
@@ -3,6 +3,6 @@
dump_asm=true
#Path to directory holding packaged.srg, fields.csv and methods.csv for mcp remapping
-mappingDir=/home/kekzdealer/.gradle/caches/minecraft/net/minecraftforge/forge/1.7.10-10.13.4.1614-1.7.10/unpacked/conf
+mappingDir=C:\Users\Kekzdealer\.gradle\caches\minecraft\net\minecraftforge\forge\1.7.10-10.13.4.1614-1.7.10\unpacked\conf
textify=true
diff --git a/config/IC2.ini b/config/IC2.ini
index bfd80df245..f1f5ebb5e1 100644
--- a/config/IC2.ini
+++ b/config/IC2.ini
@@ -1,168 +1,168 @@
-; ic2 general config
-; created Oct 22, 2019 11:53:16 PM
-;---
-
-[worldgen]
-; Enable generation of rubber trees in the world.
-rubberTree = true
-; Enable generation of copper in the world.
-copperOre = true
-; Enable generation of tin in the world.
-tinOre = true
-; Enable generation of uranium in the world.
-uraniumOre = true
-; Enable generation of Lead in the world.
-leadOre = true
-; Factor scaling the IC2 ore generation quantity.
-oreDensityFactor = 1.0
-
-[protection]
-; Enable logging of players when they remove a machine using a wrench.
-wrenchLogging = true
-; Maximum Explosion power of a nuke, where TNT is 4.
-nukeExplosionPowerLimit = 60
-; Maximum explosion power of a nuclear reactor, where TNT is 4.
-reactorExplosionPowerLimit = 45
-; Enable the nuke
-enableNuke = true
-
-[balance]
-; Maximum battery tier usable by the miner.
-; 1 = batteries, 2 = lead batteries, 3 = energy crystals, 4 = lapotron crystals
-minerDischargeTier = 1
-; Increase the energy use by the player's inventory weight when going through a teleporter.
-teleporterUseInventoryWeight = true
-; Ratio of energy retained inside energy storage block Items when wrenched.
-; 0 (nothing) ... 1 (100%), default 0.8 (80 %)
-energyRetainedInStorageBlockDrops = 0.8
-; Factor to scale the UU-Matter production energy requirement.
-uuEnergyFactor = 1.0
-; Disable the vanilla ender chest, removing existing ones from the world as well.
-disableEnderChest = false
-; Comma separated list of blocks and items which should not be turned into scrap by the recycler.
-; Format: <name>[@metadata], metadata * matches any.
-; Ore dictionary entries can be specified with OreDict:<ore dict name> as the name.
-recyclerBlacklist = minecraft:glass_pane, minecraft:stick, minecraft:snowball, minecraft:snow_layer, minecraft:snow, IC2:blockScaffold
-; Whitelist for blocks/items allowed to be recycled.
-; The whitelist will be used instead of the blacklist approach if it's non-empty, disallowing everything else.
-; The format is the same as the blacklist.
-recyclerWhitelist =
-; Allow to pick blocks up using just a pickaxe instead of needing a wrench.
-ignoreWrenchRequirement = false
-
-; Base energy generation factors - increase for higher energy yield.
-[balance / energy / generator]
-generator = 1.0
-geothermal = 1.0
-; Deprecated, because of Kinetic Watermill
-water = 1.0
-solar = 1.0
-; Deprecated, because of Kinetic Windmill
-wind = 1.0
-nuclear = 1.0
-semiFluidOil = 1.0
-semiFluidFuel = 1.0
-semiFluidBiomass = 1.0
-semiFluidBioethanol = 1.0
-semiFluidBiogas = 1.0
-Stirling = 1.0
-Kinetic = 1.0
-radioisotope = 1.0
-
-; Base heat generation factors - increase for higher heat yield.
-[balance / energy / heatgenerator]
-semiFluidOil = 1.0
-semiFluidFuel = 1.0
-semiFluidBiomass = 1.0
-semiFluidBioethanol = 1.0
-semiFluidBiogas = 1.0
-solid = 1.0
-radioisotope = 1.0
-electric = 1.0
-
-; Base kinetic generation factors - increase for higher kinetic energy yield.
-[balance / energy / kineticgenerator]
-water = 1.0
-wind = 1.0
-manual = 1.0
-steam = 1.0
-electric = 1.0
-
-; Basically the amount of hU the conversion of one mB of Liquid takes/gives
-[balance / energy / fluidconversion]
-; Lava -> PahoehoeLava
-heatExchangerLava = 1.0
-; Hot Coolant <-> Cold Coolant
-heatExchangerHotCoolant = 1.0
-; Hot Water <- Water
-heatExchangerWater = 1.0
-
-; Base Coolant conversion rate for FluidReactors.
-[balance / energy / FluidReactor]
-outputModifier = 1.0
-
-; Balace Value for Turbine Livetime in sec. Default 86400sec = 24h
-[balance / SteamKineticGenerator]
-rotorlivetime = 86400
-
-; Balace Values for calcification default 100.000mB Water -> to failure
-[balance / steamgenerator / calcification]
-maxcalcification = 100000
-
-; Balance Values for Fermenter
-[balance / fermenter]
-need_amount_biomass_per_run = 10
-output_amount_biogas_per_run = 200
-hU_per_run = 8000
-biomass_per_fertilizier = 500
-
-; Additional initial uu values, a value of 1 equals cobblestone.
-; Recipes may cause the final value be lower than the one specified here.
-; Format: <name>[@metadata] = <value>
-[balance / uu-values / predefined]
-IC2:itemOreIridium = 12000
-
-[recipes]
-; To modify recipes or add custom recipes, copy the corresponding .ini file to
-; "minecraft/config/ic2" and modify it.
-;
-; Disable IC2 crafting recipes with the specified output, comma separated list.
-; Recipes in the additional section below aren't affected.
-; Format: <name>[@metadata], e.g. minecraft:bucket to disable IC2's bucket recipe from tin.
-disable =
-; Purge crafting recipes with the specified output, including vanilla and mod ones, comma separated list.
-; Recipes in the additional section below aren't affected.
-; Format: <name>[@metadata], e.g. minecraft:tnt to disable crafting tnt.
-purge =
-; Enable crafting of IC2 coins, otherwise they have to be spawned in and are thus limited.
-allowCoinCrafting = true
-; Allow only IC2 circuits to be used in IC2's recipes.
-requireIc2Circuits = false
-; Adjust smelting recipes to always output IC2 items if available.
-smeltToIc2Items = false
-; Ignore invalid recipes.
-ignoreInvalidRecipes = false
-
-[misc]
-; Enable IC2's custom sound system.
-enableIc2Audio = true
-; Maximum number of active audio sources, only change it if you know what you're doing.
-maxAudioSourceCount = 32
-; Enable hiding of secret recipes in CraftGuide/NEI.
-hideSecretRecipes = true
-; Enable activation of the quantum leggings' speed boost when sprinting instead of holding the boost key.
-quantumSpeedOnSprint = true
-; Enable burning of scrap in a generator.
-allowBurningScrap = true
-; Comma separated list with ores the miner should harvest.
-; Format: <name>[@metadata], e.g. minecraft:torch, minecraft:chest
-; The metadata * will match any, e.g. minecraft:log@*.
-; Ore dictionary entries can be specified with OreDict:<ore dict name> as the name.
-additionalValuableOres =
-; Use the new highly experimental current + voltage energy net model with energy loss.
-; Only set this to true if you know what you are doing.
-useLinearTransferModel = false
-; Potion ID of radiation potion.
-; Do not change this after you created a world...
-radiationPotionID = 24
-
+; ic2 general config
+; created Nov 9, 2019 6:10:47 PM
+;---
+
+[worldgen]
+; Enable generation of rubber trees in the world.
+rubberTree = true
+; Enable generation of copper in the world.
+copperOre = true
+; Enable generation of tin in the world.
+tinOre = true
+; Enable generation of uranium in the world.
+uraniumOre = true
+; Enable generation of Lead in the world.
+leadOre = true
+; Factor scaling the IC2 ore generation quantity.
+oreDensityFactor = 1.0
+
+[protection]
+; Enable logging of players when they remove a machine using a wrench.
+wrenchLogging = true
+; Maximum Explosion power of a nuke, where TNT is 4.
+nukeExplosionPowerLimit = 60
+; Maximum explosion power of a nuclear reactor, where TNT is 4.
+reactorExplosionPowerLimit = 45
+; Enable the nuke
+enableNuke = true
+
+[balance]
+; Maximum battery tier usable by the miner.
+; 1 = batteries, 2 = lead batteries, 3 = energy crystals, 4 = lapotron crystals
+minerDischargeTier = 1
+; Increase the energy use by the player's inventory weight when going through a teleporter.
+teleporterUseInventoryWeight = true
+; Ratio of energy retained inside energy storage block Items when wrenched.
+; 0 (nothing) ... 1 (100%), default 0.8 (80 %)
+energyRetainedInStorageBlockDrops = 0.8
+; Factor to scale the UU-Matter production energy requirement.
+uuEnergyFactor = 1.0
+; Disable the vanilla ender chest, removing existing ones from the world as well.
+disableEnderChest = false
+; Comma separated list of blocks and items which should not be turned into scrap by the recycler.
+; Format: <name>[@metadata], metadata * matches any.
+; Ore dictionary entries can be specified with OreDict:<ore dict name> as the name.
+recyclerBlacklist = minecraft:glass_pane, minecraft:stick, minecraft:snowball, minecraft:snow_layer, minecraft:snow, IC2:blockScaffold
+; Whitelist for blocks/items allowed to be recycled.
+; The whitelist will be used instead of the blacklist approach if it's non-empty, disallowing everything else.
+; The format is the same as the blacklist.
+recyclerWhitelist =
+; Allow to pick blocks up using just a pickaxe instead of needing a wrench.
+ignoreWrenchRequirement = false
+
+; Base energy generation factors - increase for higher energy yield.
+[balance / energy / generator]
+generator = 1.0
+geothermal = 1.0
+; Deprecated, because of Kinetic Watermill
+water = 1.0
+solar = 1.0
+; Deprecated, because of Kinetic Windmill
+wind = 1.0
+nuclear = 1.0
+semiFluidOil = 1.0
+semiFluidFuel = 1.0
+semiFluidBiomass = 1.0
+semiFluidBioethanol = 1.0
+semiFluidBiogas = 1.0
+Stirling = 1.0
+Kinetic = 1.0
+radioisotope = 1.0
+
+; Base heat generation factors - increase for higher heat yield.
+[balance / energy / heatgenerator]
+semiFluidOil = 1.0
+semiFluidFuel = 1.0
+semiFluidBiomass = 1.0
+semiFluidBioethanol = 1.0
+semiFluidBiogas = 1.0
+solid = 1.0
+radioisotope = 1.0
+electric = 1.0
+
+; Base kinetic generation factors - increase for higher kinetic energy yield.
+[balance / energy / kineticgenerator]
+water = 1.0
+wind = 1.0
+manual = 1.0
+steam = 1.0
+electric = 1.0
+
+; Basically the amount of hU the conversion of one mB of Liquid takes/gives
+[balance / energy / fluidconversion]
+; Lava -> PahoehoeLava
+heatExchangerLava = 1.0
+; Hot Coolant <-> Cold Coolant
+heatExchangerHotCoolant = 1.0
+; Hot Water <- Water
+heatExchangerWater = 1.0
+
+; Base Coolant conversion rate for FluidReactors.
+[balance / energy / FluidReactor]
+outputModifier = 1.0
+
+; Balace Value for Turbine Livetime in sec. Default 86400sec = 24h
+[balance / SteamKineticGenerator]
+rotorlivetime = 86400
+
+; Balace Values for calcification default 100.000mB Water -> to failure
+[balance / steamgenerator / calcification]
+maxcalcification = 100000
+
+; Balance Values for Fermenter
+[balance / fermenter]
+need_amount_biomass_per_run = 10
+output_amount_biogas_per_run = 200
+hU_per_run = 8000
+biomass_per_fertilizier = 500
+
+; Additional initial uu values, a value of 1 equals cobblestone.
+; Recipes may cause the final value be lower than the one specified here.
+; Format: <name>[@metadata] = <value>
+[balance / uu-values / predefined]
+IC2:itemOreIridium = 12000
+
+[recipes]
+; To modify recipes or add custom recipes, copy the corresponding .ini file to
+; "minecraft/config/ic2" and modify it.
+;
+; Disable IC2 crafting recipes with the specified output, comma separated list.
+; Recipes in the additional section below aren't affected.
+; Format: <name>[@metadata], e.g. minecraft:bucket to disable IC2's bucket recipe from tin.
+disable =
+; Purge crafting recipes with the specified output, including vanilla and mod ones, comma separated list.
+; Recipes in the additional section below aren't affected.
+; Format: <name>[@metadata], e.g. minecraft:tnt to disable crafting tnt.
+purge =
+; Enable crafting of IC2 coins, otherwise they have to be spawned in and are thus limited.
+allowCoinCrafting = true
+; Allow only IC2 circuits to be used in IC2's recipes.
+requireIc2Circuits = false
+; Adjust smelting recipes to always output IC2 items if available.
+smeltToIc2Items = false
+; Ignore invalid recipes.
+ignoreInvalidRecipes = false
+
+[misc]
+; Enable IC2's custom sound system.
+enableIc2Audio = true
+; Maximum number of active audio sources, only change it if you know what you're doing.
+maxAudioSourceCount = 32
+; Enable hiding of secret recipes in CraftGuide/NEI.
+hideSecretRecipes = true
+; Enable activation of the quantum leggings' speed boost when sprinting instead of holding the boost key.
+quantumSpeedOnSprint = true
+; Enable burning of scrap in a generator.
+allowBurningScrap = true
+; Comma separated list with ores the miner should harvest.
+; Format: <name>[@metadata], e.g. minecraft:torch, minecraft:chest
+; The metadata * will match any, e.g. minecraft:log@*.
+; Ore dictionary entries can be specified with OreDict:<ore dict name> as the name.
+additionalValuableOres =
+; Use the new highly experimental current + voltage energy net model with energy loss.
+; Only set this to true if you know what you are doing.
+useLinearTransferModel = false
+; Potion ID of radiation potion.
+; Do not change this after you created a world...
+radiationPotionID = 24
+
diff --git a/config/splash.properties b/config/splash.properties
index 655e362f26..708e73fd10 100644
--- a/config/splash.properties
+++ b/config/splash.properties
@@ -1,5 +1,5 @@
#Splash screen properties
-#Tue Oct 22 23:53:07 CEST 2019
+#Sat Nov 09 18:10:34 CET 2019
logoTexture=textures/gui/title/mojang.png
background=0xFFFFFF
font=0x0
diff --git a/mods/CodeChickenCore-1.7.10-1.0.7.47-universal.jar b/mods/CodeChickenCore-1.7.10-1.0.7.47-universal.jar
new file mode 100644
index 0000000000..93c29f42c8
--- /dev/null
+++ b/mods/CodeChickenCore-1.7.10-1.0.7.47-universal.jar
Binary files differ
diff --git a/src/main/java/blocks/Block_ItemDistributionNode.java b/src/main/java/blocks/Block_ItemDistributionNode.java
index 11d9e22b39..07fd988445 100644
--- a/src/main/java/blocks/Block_ItemDistributionNode.java
+++ b/src/main/java/blocks/Block_ItemDistributionNode.java
@@ -6,6 +6,7 @@ import kekztech.KekzCore;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tileentities.TE_ItemDistributionNode;
@@ -33,6 +34,20 @@ public class Block_ItemDistributionNode extends BlockContainer {
}
@Override
+ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) {
+ if(world.isRemote) {
+ return true;
+ }
+
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if(te != null && te instanceof TE_ItemDistributionNode) {
+ player.openGui(KekzCore.instance, 0, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
return new TE_ItemDistributionNode();
}
diff --git a/src/main/java/container/Container_ItemDistributionNode.java b/src/main/java/container/Container_ItemDistributionNode.java
new file mode 100644
index 0000000000..08096bc80f
--- /dev/null
+++ b/src/main/java/container/Container_ItemDistributionNode.java
@@ -0,0 +1,68 @@
+package container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import tileentities.TE_ItemDistributionNode;
+
+public class Container_ItemDistributionNode extends Container {
+
+ private final TE_ItemDistributionNode te;
+
+ private int slotID = 0;
+
+ public Container_ItemDistributionNode(TE_ItemDistributionNode te, EntityPlayer player) {
+ this.te = te;
+
+ // Networked Storage
+ for(int i = 0; i < 4; i++) {
+ for(int j = 0; j < 4; j++) {
+ super.addSlotToContainer(new Slot(te, slotID++, 18 * j + 20, 19 * i + 20));
+ }
+ }
+
+ //Inventory
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 9; j++) {
+ addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+ // Hotbar
+ for (int i = 0; i < 9; i++) {
+ addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142));
+ }
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) {
+ ItemStack stack = null;
+ final Slot slot = (Slot) inventorySlots.get(slotRaw);
+
+ if (slot != null && slot.getHasStack()) {
+ final ItemStack stackInSlot = slot.getStack();
+ stack = stackInSlot.copy();
+
+ if (slotRaw < 3 * 9) {
+ if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) {
+ return null;
+ }
+ } else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) {
+ return null;
+ }
+
+ if (stackInSlot.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player) {
+ return te.isUseableByPlayer(player);
+ }
+
+}
diff --git a/src/main/java/container/Gui_ItemDistributionNode.java b/src/main/java/container/Gui_ItemDistributionNode.java
new file mode 100644
index 0000000000..08f530fce8
--- /dev/null
+++ b/src/main/java/container/Gui_ItemDistributionNode.java
@@ -0,0 +1,49 @@
+package container;
+
+import org.lwjgl.opengl.GL11;
+
+import kekztech.KekzCore;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+import tileentities.TE_ItemDistributionNode;
+
+public class Gui_ItemDistributionNode extends GuiContainer {
+
+ private final ResourceLocation texture = new ResourceLocation(KekzCore.MODID, "textures/gui/ItemDistributionNode.png");
+
+ private final InventoryPlayer inventory;
+ private final TE_ItemDistributionNode te;
+
+ public Gui_ItemDistributionNode(TE_ItemDistributionNode te, EntityPlayer player) {
+ super(new Container_ItemDistributionNode(te, player));
+ inventory = player.inventory;
+ this.te = te;
+
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
+
+ Minecraft.getMinecraft().renderEngine.bindTexture(texture);
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+
+ final int x = (super.width - super.xSize) / 2;
+ final int y = (super.height - super.ySize) / 2;
+
+ super.drawTexturedModalRect(x, y, 0, 0, super.xSize, super.ySize);
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int p1, int p2) {
+ super.fontRendererObj.drawString(
+ I18n.format(te.getInventoryName()),
+ (super.xSize / 2) - (fontRendererObj.getStringWidth(I18n.format(te.getInventoryName())) / 2),
+ 6, 4210752, false);
+ super.fontRendererObj.drawString(
+ I18n.format(inventory.getInventoryName()), 8, super.ySize - 96 + 2, 4210752);
+ }
+}
diff --git a/src/main/java/kekztech/GTRecipe.java b/src/main/java/kekztech/GTRecipe.java
deleted file mode 100644
index 1939afc8ff..0000000000
--- a/src/main/java/kekztech/GTRecipe.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package kekztech;
-
-import java.util.ArrayList;
-
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.FluidStack;
-import util.Util;
-
-public class GTRecipe {
-
- private int euPerTick = 0;
- private int duration = 0;
-
- private ArrayList<ItemStack> inputItems;
- private ArrayList<FluidStack> inputFluids;
- private ArrayList<ItemStack> outputItems;
- private ArrayList<FluidStack> outputFluids;
-
- public int getEuPerTick() {
- return euPerTick;
- }
- public int getDuration() {
- return duration;
- }
- public ItemStack[] getInputItems() {
- return Util.toItemStackArray(inputItems);
- }
- public FluidStack[] getInputFluids() {
- return Util.toFluidStackArray(inputFluids);
- }
- public ItemStack[] getOutputItems() {
- return Util.toItemStackArray(outputItems);
- }
- public FluidStack[] getOutputFluids() {
- return Util.toFluidStackArray(outputFluids);
- }
- public ItemStack getInputItem() {
- final ItemStack[] s = Util.toItemStackArray(inputItems);
- return s[0];
- }
- public FluidStack getInputFluid() {
- final FluidStack[] s = Util.toFluidStackArray(inputFluids);
- return s[0];
- }
- public ItemStack getOutputItem() {
- final ItemStack[] s = Util.toItemStackArray(outputItems);
- return s[0];
- }
- public FluidStack getOutputFluid() {
- final FluidStack[] s = Util.toFluidStackArray(outputFluids);
- return s[0];
- }
-
- public GTRecipe addInputItem(ItemStack inputItem) {
- if(inputItems == null) {
- inputItems = new ArrayList<ItemStack>();
- inputItems.add(inputItem);
- } else {
- inputItems.add(inputItem);
- }
- return this;
- }
-
- public GTRecipe addOutputItem(ItemStack outputItem) {
- if(outputItems == null) {
- outputItems = new ArrayList<ItemStack>();
- outputItems.add(outputItem);
- } else {
- outputItems.add(outputItem);
- }
- return this;
- }
-
- public GTRecipe addInputFluid(FluidStack inputFluid) {
- if(inputFluids == null) {
- inputFluids = new ArrayList<FluidStack>();
- inputFluids.add(inputFluid);
- } else {
- inputFluids.add(inputFluid);
- }
- return this;
- }
-
- public GTRecipe addOutputFluid(FluidStack outputFluid) {
- if(outputFluids == null) {
- outputFluids = new ArrayList<FluidStack>();
- outputFluids.add(outputFluid);
- } else {
- outputFluids.add(outputFluid);
- }
- return this;
- }
-
- public GTRecipe setEUPerTick(int euPerTick) {
- this.euPerTick = euPerTick;
- return this;
- }
-
- public GTRecipe setDuration(int duration) {
- this.duration = duration;
- return this;
- }
-
-}
diff --git a/src/main/java/kekztech/GuiHandler.java b/src/main/java/kekztech/GuiHandler.java
new file mode 100644
index 0000000000..21ad5c95ae
--- /dev/null
+++ b/src/main/java/kekztech/GuiHandler.java
@@ -0,0 +1,35 @@
+package kekztech;
+
+import container.Container_ItemDistributionNode;
+import container.Gui_ItemDistributionNode;
+import cpw.mods.fml.common.network.IGuiHandler;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import tileentities.TE_ItemDistributionNode;
+
+public class GuiHandler implements IGuiHandler {
+
+ @Override
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if(te != null) {
+ if(ID == 0) {
+ return new Container_ItemDistributionNode((TE_ItemDistributionNode) te, player);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if(te != null) {
+ if(ID == 0) {
+ return new Gui_ItemDistributionNode((TE_ItemDistributionNode) te, player);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/src/main/java/kekztech/ItemDistributionNetworkController.java b/src/main/java/kekztech/ItemDistributionNetworkController.java
index e188cb0d26..bf976898e5 100644
--- a/src/main/java/kekztech/ItemDistributionNetworkController.java
+++ b/src/main/java/kekztech/ItemDistributionNetworkController.java
@@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.UUID;
+import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@@ -15,7 +16,9 @@ public class ItemDistributionNetworkController implements Comparable<ItemDistrib
private final UUID uuid = UUID.randomUUID();
private final LinkedList<IConduit> conduits = new LinkedList<>();
- private final HashMap<String, IConduit> sources = new HashMap<>(); // k = resource name, v = source conduit
+ private final boolean[] slotDirections = new boolean[15];
+ private final ItemStack[] networkedItemStacks = new ItemStack[15];
+ //private final HashMap<String, IConduit> sources = new HashMap<>(); // k = resource name, v = source conduit
public ItemDistributionNetworkController() {
@@ -126,6 +129,46 @@ public class ItemDistributionNetworkController implements Comparable<ItemDistrib
}
/**
+ * Find out if this slot is designated as input and can accept an item into the network.
+ *
+ * Slots are numbered left to right, then top to bottom and start at zero.
+ * For example, the second slot in the second row, would have a slot number of five.
+ *
+ * @param slot:
+ * Slot number.
+ * @return whether this slot can accept input or not.
+ */
+ public boolean isInputSlot(int slot) {
+ if(slot >= slotDirections.length) {
+ return false;
+ }
+ return slotDirections[slot];
+ }
+
+ /**
+ * Return the ItemStack that is contained in the given slot number.
+ *
+ * Slots are numbered left to right, then top to bottom and start at zero.
+ * For example, the second slot in the second row, would have a slot number of five.
+ *
+ * @param slot:
+ * Slot number.
+ * @return ItemStack at given slot number.
+ */
+ public ItemStack getStackInSlot(int slot) {
+ if(slot >= networkedItemStacks.length) {
+ return null;
+ }
+ return networkedItemStacks[slot];
+ }
+
+ public void setStackInSlot(int slot, ItemStack itemStack) {
+ if(slot < networkedItemStacks.length && isInputSlot(slot)) {
+ networkedItemStacks[slot] = itemStack;
+ }
+ }
+
+ /**
* Register a new conduit to this network.
*
* @param conduit
diff --git a/src/main/java/kekztech/KekzCore.java b/src/main/java/kekztech/KekzCore.java
index 3b88a9074d..f93b5a9802 100644
--- a/src/main/java/kekztech/KekzCore.java
+++ b/src/main/java/kekztech/KekzCore.java
@@ -2,6 +2,8 @@ package kekztech;
import blocks.Block_ControlRod;
import blocks.Block_GDCUnit;
+import blocks.Block_ItemDistributionCable;
+import blocks.Block_ItemDistributionNode;
import blocks.Block_ReactorChamber_OFF;
import blocks.Block_ReactorChamber_ON;
import blocks.Block_TFFTCasing;
@@ -16,6 +18,7 @@ import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
@@ -33,6 +36,8 @@ import tileentities.GTMTE_FluidMultiStorage;
import tileentities.GTMTE_ModularNuclearReactor;
import tileentities.GTMTE_SOFuelCellMK1;
import tileentities.GTMTE_SOFuelCellMK2;
+import tileentities.TE_ItemDistributionCable;
+import tileentities.TE_ItemDistributionNode;
import tileentities.TE_TFFTMultiHatch;
import util.Util;
@@ -82,8 +87,14 @@ public class KekzCore {
Block_ReactorChamber_OFF.getInstance().registerBlock();
Block_ReactorChamber_ON.getInstance().registerBlock();
Block_ControlRod.getInstance().registerBlock();
+ Block_ItemDistributionCable.getInstance().registerBlock();
+ Block_ItemDistributionNode.getInstance().registerBlock();
// Register TileEntities
GameRegistry.registerTileEntity(TE_TFFTMultiHatch.class, "kekztech_tfftmultihatch_tile");
+ GameRegistry.registerTileEntity(TE_ItemDistributionCable.class, "kekztech_itemdistributioncable_tile");
+ GameRegistry.registerTileEntity(TE_ItemDistributionNode.class, "kekztech_itemdistributionnode_tile");
+ // Register a GUI?
+ NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
}
@Mod.EventHandler
diff --git a/src/main/java/kekztech/TFFTFluidHandler.java b/src/main/java/kekztech/TFFTFluidHandler.java
deleted file mode 100644
index 2ed5eac798..0000000000
--- a/src/main/java/kekztech/TFFTFluidHandler.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package kekztech;
-
-public class TFFTFluidHandler {
-
-
-
-}
diff --git a/src/main/java/tileentities/GTMTE_FluidMultiStorage.java b/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
index e4ab4e574e..61b8e558f5 100644
--- a/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
+++ b/src/main/java/tileentities/GTMTE_FluidMultiStorage.java
@@ -21,7 +21,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
-import kekztech.MultiBlockTooltipBuilder;
import kekztech.MultiFluidHandler;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -32,6 +31,7 @@ import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
+import util.MultiBlockTooltipBuilder;
import util.Vector3i;
import util.Vector3ic;
diff --git a/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
index a6b91a60ca..14941e489d 100644
--- a/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
+++ b/src/main/java/tileentities/GTMTE_ModularNuclearReactor.java
@@ -15,11 +15,11 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
-import kekztech.MultiBlockTooltipBuilder;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
+import util.MultiBlockTooltipBuilder;
public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase {
diff --git a/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java b/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
index 549bc19f72..9aa0a5c01d 100644
--- a/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
+++ b/src/main/java/tileentities/GTMTE_SOFuelCellMK1.java
@@ -19,13 +19,13 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import kekztech.MultiBlockTooltipBuilder;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
+import util.MultiBlockTooltipBuilder;
import util.Vector3i;
import util.Vector3ic;
diff --git a/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java b/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
index 8d1f996cb8..3ecba204ce 100644
--- a/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
+++ b/src/main/java/tileentities/GTMTE_SOFuelCellMK2.java
@@ -19,13 +19,13 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import kekztech.MultiBlockTooltipBuilder;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
+import util.MultiBlockTooltipBuilder;
import util.Vector3i;
import util.Vector3ic;
diff --git a/src/main/java/tileentities/TE_ItemDistributionCable.java b/src/main/java/tileentities/TE_ItemDistributionCable.java
index 153ed139b5..325d04c211 100644
--- a/src/main/java/tileentities/TE_ItemDistributionCable.java
+++ b/src/main/java/tileentities/TE_ItemDistributionCable.java
@@ -1,7 +1,25 @@
package tileentities;
+import kekztech.IConduit;
+import kekztech.ItemDistributionNetworkController;
import net.minecraft.tileentity.TileEntity;
-public class TE_ItemDistributionCable extends TileEntity {
+public class TE_ItemDistributionCable extends TileEntity implements IConduit {
+
+ private ItemDistributionNetworkController network;
+
+ public TE_ItemDistributionCable() {
+ ItemDistributionNetworkController.placeConduit(this);
+ }
+
+ @Override
+ public void setNetwork(ItemDistributionNetworkController network) {
+ this.network = network;
+ }
+
+ @Override
+ public ItemDistributionNetworkController getNetwork() {
+ return network;
+ }
}
diff --git a/src/main/java/tileentities/TE_ItemDistributionNode.java b/src/main/java/tileentities/TE_ItemDistributionNode.java
index 4da94ea5f5..25d7b64680 100644
--- a/src/main/java/tileentities/TE_ItemDistributionNode.java
+++ b/src/main/java/tileentities/TE_ItemDistributionNode.java
@@ -5,7 +5,10 @@ import kekztech.ItemDistributionNetworkController;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.common.util.Constants;
public class TE_ItemDistributionNode extends TileEntity implements IConduit, IInventory {
@@ -31,38 +34,58 @@ private ItemDistributionNetworkController network;
@Override
public ItemStack getStackInSlot(int slot) {
- // TODO Auto-generated method stub
- return null;
+ return network.getStackInSlot(slot);
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
- // TODO Auto-generated method stub
+
+ if(network.getStackInSlot(slot) != null) {
+ if(network.getStackInSlot(slot).stackSize == amount) {
+ final ItemStack itemStack = network.getStackInSlot(slot);
+ network.setStackInSlot(slot, null);
+ super.markDirty();
+ return itemStack;
+ } else {
+ final ItemStack itemStack = network.getStackInSlot(slot).splitStack(amount);
+ if(network.getStackInSlot(slot).stackSize == 0) {
+ network.setStackInSlot(slot, null);
+ }
+ super.markDirty();
+ return itemStack;
+ }
+ }
+
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
- // TODO Auto-generated method stub
+ if(network.getStackInSlot(slot) != null) {
+ final ItemStack itemStack = network.getStackInSlot(slot);
+ network.setStackInSlot(slot, null);
+ return itemStack;
+ }
return null;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemStack) {
- // TODO Auto-generated method stub
-
+ if(itemStack.stackSize > getInventoryStackLimit()) {
+ itemStack.stackSize = getInventoryStackLimit();
+ }
+ network.setStackInSlot(slot, itemStack);
+ super.markDirty();
}
@Override
public String getInventoryName() {
- // TODO Auto-generated method stub
- return null;
+ return network.getUUID().toString();
}
@Override
public boolean hasCustomInventoryName() {
- // TODO Auto-generated method stub
- return false;
+ return true;
}
@Override
@@ -88,9 +111,8 @@ private ItemDistributionNetworkController network;
}
@Override
- public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
- // TODO Auto-generated method stub
- return false;
+ public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
+ return network.isInputSlot(slot) && network.getStackInSlot(slot).isItemEqual(itemStack);
}
}
diff --git a/src/main/java/kekztech/MultiBlockTooltipBuilder.java b/src/main/java/util/MultiBlockTooltipBuilder.java
index 6e2e7669a8..329220272a 100644
--- a/src/main/java/kekztech/MultiBlockTooltipBuilder.java
+++ b/src/main/java/util/MultiBlockTooltipBuilder.java
@@ -1,4 +1,4 @@
-package kekztech;
+package util;
import java.util.LinkedList;
import java.util.List;
diff --git a/src/main/resources/assets/kekztech/textures/gui/ItemDistributorNode.png b/src/main/resources/assets/kekztech/textures/gui/ItemDistributorNode.png
new file mode 100644
index 0000000000..b01d9b444f
--- /dev/null
+++ b/src/main/resources/assets/kekztech/textures/gui/ItemDistributorNode.png
Binary files differ