Added universal barrels, retrofitted coal and nuclear generators

This commit is contained in:
HbmMods 2017-08-05 22:37:44 +02:00
parent 7a7713d6a7
commit bed728641c
23 changed files with 312 additions and 434 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

View File

@ -4,6 +4,7 @@ import java.util.Arrays;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.gui.GuiFluidContainer;
import com.hbm.items.ModItems;
import com.hbm.items.tool.ItemFluidIdentifier;
import com.hbm.lib.RefStrings;
import com.hbm.packet.PacketDispatcher;
@ -70,6 +71,11 @@ public class FluidTank {
if(slots[in] != null) {
inType = FluidContainerRegistry.getFluidType(slots[in]);
if(slots[in].getItem() == ModItems.fluid_barrel_infinite) {
this.fluid = this.maxFluid;
return;
}
if(FluidContainerRegistry.getFluidContent(slots[in], type) <= 0)
return;
} else {
@ -98,6 +104,12 @@ public class FluidTank {
ItemStack full = null;
if(slots[in] != null) {
if(slots[in].getItem() == ModItems.fluid_barrel_infinite) {
this.fluid = 0;
return;
}
full = FluidContainerRegistry.getFullContainer(slots[in], type);
}
if(full == null)

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.TileEntityMachineGenerator;
import net.minecraft.entity.player.EntityPlayer;
@ -13,8 +14,6 @@ public class ContainerGenerator extends Container {
private TileEntityMachineGenerator diFurnace;
private int water;
private int cool;
private int power;
private int heat;
@ -34,6 +33,8 @@ public class ContainerGenerator extends Container {
this.addSlotToContainer(new Slot(tedf, 9, 8, 90));
this.addSlotToContainer(new Slot(tedf, 10, 26, 90));
this.addSlotToContainer(new Slot(tedf, 11, 62, 90));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 12, 8, 90 + 18));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 13, 26, 90 + 18));
for(int i = 0; i < 3; i++)
{
@ -52,10 +53,8 @@ public class ContainerGenerator extends Container {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.water);
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.cool);
crafting.sendProgressBarUpdate(this, 2, this.diFurnace.power);
crafting.sendProgressBarUpdate(this, 3, this.diFurnace.heat);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.power);
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.heat);
}
@Override
@ -106,29 +105,17 @@ public class ContainerGenerator extends Container {
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.water != this.diFurnace.water)
{
par1.sendProgressBarUpdate(this, 0, this.diFurnace.water);
}
if(this.cool != this.diFurnace.cool)
{
par1.sendProgressBarUpdate(this, 1, this.diFurnace.cool);
}
if(this.power != this.diFurnace.power)
{
par1.sendProgressBarUpdate(this, 2, this.diFurnace.power);
par1.sendProgressBarUpdate(this, 0, this.diFurnace.power);
}
if(this.heat != this.diFurnace.heat)
{
par1.sendProgressBarUpdate(this, 3, this.diFurnace.heat);
par1.sendProgressBarUpdate(this, 1, this.diFurnace.heat);
}
}
this.water = this.diFurnace.water;
this.cool = this.diFurnace.cool;
this.power = this.diFurnace.power;
this.heat = this.diFurnace.heat;
}
@ -136,18 +123,10 @@ public class ContainerGenerator extends Container {
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
diFurnace.water = j;
}
if(i == 1)
{
diFurnace.cool = j;
}
if(i == 2)
{
diFurnace.power = j;
}
if(i == 3)
if(i == 1)
{
diFurnace.heat = j;
}

View File

@ -1,5 +1,6 @@
package com.hbm.inventory.container;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.tileentity.TileEntityMachineCoal;
import net.minecraft.entity.player.EntityPlayer;
@ -13,19 +14,18 @@ public class ContainerMachineCoal extends Container {
private TileEntityMachineCoal diFurnace;
private int power;
private int water;
private int burnTime;
public ContainerMachineCoal(InventoryPlayer invPlayer, TileEntityMachineCoal tedf) {
power = 0;
water = 0;
burnTime = 0;
diFurnace = tedf;
this.addSlotToContainer(new Slot(tedf, 0, 44, 53));
this.addSlotToContainer(new Slot(tedf, 0, 44, 53 - 36));
this.addSlotToContainer(new Slot(tedf, 1, 80, 53));
this.addSlotToContainer(new Slot(tedf, 2, 116, 53));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 3, 44, 53));
for(int i = 0; i < 3; i++)
{
@ -44,9 +44,8 @@ public class ContainerMachineCoal extends Container {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.water);
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.power);
crafting.sendProgressBarUpdate(this, 2, this.diFurnace.burnTime);
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.power);
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.burnTime);
}
@Override
@ -60,8 +59,8 @@ public class ContainerMachineCoal extends Container {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 2) {
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
if (par2 <= 3) {
if (!this.mergeItemStack(var5, 4, this.inventorySlots.size(), true))
{
return null;
}
@ -99,23 +98,17 @@ public class ContainerMachineCoal extends Container {
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.water != this.diFurnace.water)
{
par1.sendProgressBarUpdate(this, 0, this.diFurnace.water);
}
if(this.power != this.diFurnace.power)
{
par1.sendProgressBarUpdate(this, 1, this.diFurnace.power);
par1.sendProgressBarUpdate(this, 0, this.diFurnace.power);
}
if(this.power != this.diFurnace.burnTime)
{
par1.sendProgressBarUpdate(this, 2, this.diFurnace.burnTime);
par1.sendProgressBarUpdate(this, 1, this.diFurnace.burnTime);
}
}
this.water = this.diFurnace.water;
this.power = this.diFurnace.power;
this.burnTime = this.diFurnace.burnTime;
}
@ -123,14 +116,10 @@ public class ContainerMachineCoal extends Container {
@Override
public void updateProgressBar(int i, int j) {
if(i == 0)
{
diFurnace.water = j;
}
if(i == 1)
{
diFurnace.power = j;
}
if(i == 2)
if(i == 1)
{
diFurnace.burnTime = j;
}

View File

@ -12,17 +12,13 @@ import net.minecraft.item.ItemStack;
public class ContainerMachineOilWell extends Container {
private TileEntityMachineOilWell testNuke;
private int oil;
private int power;
private int warning;
private int gas;
private int warning2;
public ContainerMachineOilWell(InventoryPlayer invPlayer, TileEntityMachineOilWell tedf) {
oil = 0;
power = 0;
warning = 0;
gas = 0;
warning2 = 0;
testNuke = tedf;
@ -57,11 +53,9 @@ public class ContainerMachineOilWell extends Container {
@Override
public void addCraftingToCrafters(ICrafting crafting) {
super.addCraftingToCrafters(crafting);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.oil);
crafting.sendProgressBarUpdate(this, 1, this.testNuke.power);
crafting.sendProgressBarUpdate(this, 2, this.testNuke.warning);
crafting.sendProgressBarUpdate(this, 3, this.testNuke.gas);
crafting.sendProgressBarUpdate(this, 4, this.testNuke.warning2);
crafting.sendProgressBarUpdate(this, 0, this.testNuke.power);
crafting.sendProgressBarUpdate(this, 1, this.testNuke.warning);
crafting.sendProgressBarUpdate(this, 2, this.testNuke.warning2);
}
@Override
@ -113,33 +107,22 @@ public class ContainerMachineOilWell extends Container {
for(int i = 0; i < this.crafters.size(); i++)
{
ICrafting par1 = (ICrafting)this.crafters.get(i);
if(this.oil != this.testNuke.oil)
{
par1.sendProgressBarUpdate(this, 0, this.testNuke.oil);
}
if(this.power != this.testNuke.power)
{
par1.sendProgressBarUpdate(this, 1, this.testNuke.power);
par1.sendProgressBarUpdate(this, 0, this.testNuke.power);
}
if(this.warning != this.testNuke.warning)
{
par1.sendProgressBarUpdate(this, 2, this.testNuke.warning);
}
if(this.gas != this.testNuke.gas)
{
par1.sendProgressBarUpdate(this, 3, this.testNuke.gas);
par1.sendProgressBarUpdate(this, 1, this.testNuke.warning);
}
if(this.warning2 != this.testNuke.warning2)
{
par1.sendProgressBarUpdate(this, 4, this.testNuke.warning2);
par1.sendProgressBarUpdate(this, 2, this.testNuke.warning2);
}
}
this.oil = this.testNuke.oil;
this.power = this.testNuke.power;
this.warning = this.testNuke.warning;
this.gas = this.testNuke.gas;
this.warning2 = this.testNuke.warning2;
}
@ -147,21 +130,13 @@ public class ContainerMachineOilWell extends Container {
public void updateProgressBar(int i, int j) {
if(i == 0)
{
testNuke.oil = j;
testNuke.power = j;
}
if(i == 1)
{
testNuke.power = j;
}
if(i == 2)
{
testNuke.warning = j;
}
if(i == 3)
{
testNuke.gas = j;
}
if(i == 4)
if(i == 2)
{
testNuke.warning2 = j;
}

View File

@ -8,11 +8,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineCoal;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityMachineCoal;
public class GUIMachineCoal extends GuiContainer {
public class GUIMachineCoal extends GuiFluidContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/GUICoal.png");
private TileEntityMachineCoal diFurnace;
@ -25,6 +26,13 @@ public class GUIMachineCoal extends GuiContainer {
this.ySize = 166;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 69 - 52, 16, 52);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
@ -49,10 +57,8 @@ public class GUIMachineCoal extends GuiContainer {
drawTexturedModalRect(guiLeft + 79, guiTop + 34, 208, 0, 18, 18);
}
if(diFurnace.water > 0)
{
int j = diFurnace.getWaterScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 69 - j, 192, 52 - j, 16, j);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
diFurnace.tank.renderTank(this, guiLeft + 8, guiTop + 69, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -8,11 +8,12 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerGenerator;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityMachineGenerator;
public class GUIMachineGenerator extends GuiContainer {
public class GUIMachineGenerator extends GuiFluidContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_generator.png");
private TileEntityMachineGenerator diFurnace;
@ -25,6 +26,14 @@ public class GUIMachineGenerator extends GuiContainer {
this.ySize = 222;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 88 - 52, 16, 52);
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 88 - 52, 16, 52);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
@ -39,16 +48,6 @@ public class GUIMachineGenerator extends GuiContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(diFurnace.hasWater()) {
int i = diFurnace.getWaterScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 88 - i, 176, 52 - i, 16, i);
}
if(diFurnace.hasCoolant()) {
int i = diFurnace.getCoolantScaled(52);
drawTexturedModalRect(guiLeft + 26, guiTop + 88 - i, 192, 52 - i, 16, i);
}
if(diFurnace.hasPower()) {
int i = diFurnace.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 62, guiTop + 88 - i, 224, 52 - i, 16, i);
@ -58,5 +57,10 @@ public class GUIMachineGenerator extends GuiContainer {
int i = diFurnace.getHeatScaled(52);
drawTexturedModalRect(guiLeft + 98, guiTop + 88 - i, 208, 52 - i, 16, i);
}
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
diFurnace.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineOilWell;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.TileEntityMachineOilWell;
@ -11,7 +12,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUIMachineOilWell extends GuiContainer {
public class GUIMachineOilWell extends GuiFluidContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_well_large.png");
private TileEntityMachineOilWell derrick;
@ -24,6 +25,14 @@ public class GUIMachineOilWell extends GuiContainer {
this.ySize = 222;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
derrick.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 70 - 52, 34, 52);
derrick.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 124 - 52, 34, 52);
}
@Override
protected void drawGuiContainerForegroundLayer( int i, int j) {
String name = this.derrick.hasCustomInventoryName() ? this.derrick.getInventoryName() : I18n.format(this.derrick.getInventoryName());
@ -41,12 +50,6 @@ public class GUIMachineOilWell extends GuiContainer {
int i = derrick.getPowerScaled(52);
drawTexturedModalRect(guiLeft + 8, guiTop + 70 - i, 176, 52 - i, 16, i);
int j = derrick.getOilScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 70 - j, 192, 52 - j, 34, j);
int x = derrick.getGasScaled(52);
drawTexturedModalRect(guiLeft + 80, guiTop + 124 - x, 176, 120 - x, 34, x);
int k = derrick.warning;
if(k == 2)
drawTexturedModalRect(guiLeft + 44, guiTop + 18, 176, 52, 16, 16);
@ -58,5 +61,14 @@ public class GUIMachineOilWell extends GuiContainer {
drawTexturedModalRect(guiLeft + 44, guiTop + 90, 208, 52, 16, 16);
if(l == 2)
drawTexturedModalRect(guiLeft + 44, guiTop + 90, 224, 52, 16, 16);
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
derrick.tanks[0].renderTank(this, guiLeft + 80, guiTop + 70, derrick.tanks[0].getTankType().textureX() * FluidTank.x, derrick.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
derrick.tanks[0].renderTank(this, guiLeft + 96, guiTop + 70, derrick.tanks[0].getTankType().textureX() * FluidTank.x, derrick.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
derrick.tanks[0].renderTank(this, guiLeft + 112, guiTop + 70, derrick.tanks[0].getTankType().textureX() * FluidTank.x, derrick.tanks[0].getTankType().textureY() * FluidTank.y, 2, 52);
derrick.tanks[1].renderTank(this, guiLeft + 80, guiTop + 124, derrick.tanks[1].getTankType().textureX() * FluidTank.x, derrick.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
derrick.tanks[1].renderTank(this, guiLeft + 96, guiTop + 124, derrick.tanks[1].getTankType().textureX() * FluidTank.x, derrick.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
derrick.tanks[1].renderTank(this, guiLeft + 112, guiTop + 124, derrick.tanks[1].getTankType().textureX() * FluidTank.x, derrick.tanks[1].getTankType().textureY() * FluidTank.y, 2, 52);
}
}

View File

@ -367,6 +367,9 @@ public class ModItems {
public static Item fluid_tank_full;
public static Item fluid_tank_empty;
public static Item fluid_barrel_full;
public static Item fluid_barrel_empty;
public static Item fluid_barrel_infinite;
public static Item syringe_empty;
public static Item syringe_antidote;
@ -1687,6 +1690,9 @@ public class ModItems {
fluid_identifier = new ItemFluidIdentifier().setUnlocalizedName("fluid_identifier").setMaxStackSize(1).setCreativeTab(MainRegistry.tabMachine).setTextureName(RefStrings.MODID + ":fluid_identifier");
fluid_tank_full = new ItemFluidTank().setUnlocalizedName("fluid_tank_full").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_tank");
fluid_tank_empty = new Item().setUnlocalizedName("fluid_tank_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_tank");
fluid_barrel_full = new ItemFluidTank().setUnlocalizedName("fluid_barrel_full").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel");
fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel");
fluid_barrel_infinite = new Item().setUnlocalizedName("fluid_barrel_infinite").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite");
euphemium_helmet = new ArmorEuphemium(MainRegistry.enumArmorMaterialEuphemium, 6, 0).setUnlocalizedName("astatine_helmet").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":euphemium_helmet");
euphemium_plate = new ArmorEuphemium(MainRegistry.enumArmorMaterialEuphemium, 6, 1).setUnlocalizedName("astatine_plate").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":euphemium_plate");
@ -2272,6 +2278,9 @@ public class ModItems {
//Universal Tank
GameRegistry.registerItem(fluid_tank_empty, fluid_tank_empty.getUnlocalizedName());
GameRegistry.registerItem(fluid_tank_full, fluid_tank_full.getUnlocalizedName());
GameRegistry.registerItem(fluid_barrel_empty, fluid_barrel_empty.getUnlocalizedName());
GameRegistry.registerItem(fluid_barrel_full, fluid_barrel_full.getUnlocalizedName());
GameRegistry.registerItem(fluid_barrel_infinite, fluid_barrel_infinite.getUnlocalizedName());
//Batteries
GameRegistry.registerItem(battery_generic, battery_generic.getUnlocalizedName());

View File

@ -2,6 +2,8 @@ package com.hbm.items.special;
import java.util.List;
import org.lwjgl.input.Keyboard;
import com.hbm.main.MainRegistry;
import net.minecraft.entity.Entity;
@ -11,6 +13,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import scala.swing.event.Key;
public class ItemPolaroid extends Item {

View File

@ -3,6 +3,7 @@ package com.hbm.items.tool;
import java.util.List;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.MachineRecipes;
import com.hbm.items.ModItems;
import com.hbm.tileentity.TileEntityFluidDuct;
import cpw.mods.fml.relauncher.Side;
@ -32,7 +33,7 @@ public class ItemFluidTank extends Item {
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list)
{
for (int i = 0; i < FluidType.values().length; ++i)
for (int i = 1; i < FluidType.values().length; ++i)
{
list.add(new ItemStack(item, 1, i));
}
@ -64,7 +65,10 @@ public class ItemFluidTank extends Item {
{
super.registerIcons(p_94581_1_);
this.overlayIcon = p_94581_1_.registerIcon("hbm:fluid_tank_overlay");
if(this == ModItems.fluid_tank_full)
this.overlayIcon = p_94581_1_.registerIcon("hbm:fluid_tank_overlay");
if(this == ModItems.fluid_barrel_full)
this.overlayIcon = p_94581_1_.registerIcon("hbm:fluid_barrel_overlay");
}
@Override

View File

@ -3,7 +3,7 @@ package com.hbm.lib;
public class RefStrings {
public static final String MODID = "hbm";
public static final String NAME = "Hbm's Nuclear Tech Mod";
public static final String VERSION = "1.0.25";
public static final String VERSION = "1.0.26 BETA (Selena-Luna-X01)";
//HBM's Beta Naming Convention:
//V T (X-Y-Z)
//V -> next release version

View File

@ -838,6 +838,7 @@ public class MainRegistry
for(int i = 1; i < FluidType.values().length; i++) {
FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_full, 1, i), new ItemStack(ModItems.fluid_tank_empty), FluidType.getEnum(i), 1000));
FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_barrel_full, 1, i), new ItemStack(ModItems.fluid_barrel_empty), FluidType.getEnum(i), 16000));
}
}

View File

@ -37,7 +37,6 @@ import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.oredict.OreDictionary;
//TODO: remove obso1337 cases for accptr/src cases to prevent conflicting tanks when multiple have the same type
public class TileEntityMachineChemplant extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor, IFluidSource {
private ItemStack slots[];
@ -63,13 +62,9 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
slots = new ItemStack[21];
tanks = new FluidTank[4];
tanks[0] = new FluidTank(FluidType.NONE, 16000, 0);
tanks[1] = new FluidTank(FluidType.NONE, 16000, 0);
tanks[2] = new FluidTank(FluidType.NONE, 16000, 0);
tanks[3] = new FluidTank(FluidType.NONE, 16000, 0);
tanks[0].index = 0;
tanks[1].index = 1;
tanks[2].index = 2;
tanks[3].index = 3;
tanks[1] = new FluidTank(FluidType.NONE, 16000, 1);
tanks[2] = new FluidTank(FluidType.NONE, 16000, 2);
tanks[3] = new FluidTank(FluidType.NONE, 16000, 3);
}
@Override
@ -786,10 +781,6 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
/*else if(type.name().equals(tanks[2].getTankType().name()))
tanks[2].setFill(i);
else if(type.name().equals(tanks[3].getTankType().name()))
tanks[3].setFill(i);*/
}
@Override
@ -798,21 +789,13 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else /*if(type.name().equals(tanks[2].getTankType().name()))
return tanks[2].getFill();
else if(type.name().equals(tanks[3].getTankType().name()))
return tanks[3].getFill();*/
return 0;
else
return 0;
}
@Override
public void setSFluidFill(int i, FluidType type) {
/*if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
else */if(type.name().equals(tanks[2].getTankType().name()))
if(type.name().equals(tanks[2].getTankType().name()))
tanks[2].setFill(i);
else if(type.name().equals(tanks[3].getTankType().name()))
tanks[3].setFill(i);
@ -820,11 +803,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
@Override
public int getSFluidFill(FluidType type) {
/*if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else*/ if(type.name().equals(tanks[2].getTankType().name()))
if(type.name().equals(tanks[2].getTankType().name()))
return tanks[2].getFill();
else if(type.name().equals(tanks[3].getTankType().name()))
return tanks[3].getFill();
@ -838,12 +817,8 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
return tanks[0].getMaxFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else /*if(type.name().equals(tanks[2].getTankType().name()))
return tanks[2].getMaxFill();
else if(type.name().equals(tanks[3].getTankType().name()))
return tanks[3].getMaxFill();*/
return 0;
else
return 0;
}
@Override

View File

@ -14,23 +14,26 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.machine.MachineCoal;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.ISource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
public class TileEntityMachineCoal extends TileEntity implements ISidedInventory, ISource {
public class TileEntityMachineCoal extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public int power;
public int water;
public int burnTime;
public static final int maxPower = 100000;
public static final int maxWater = 10000;
public int age = 0;
public List<IConsumer> list = new ArrayList();
public FluidTank tank;
private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {0, 2};
@ -39,7 +42,8 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
private String customName;
public TileEntityMachineCoal() {
slots = new ItemStack[3];
slots = new ItemStack[4];
tank = new FluidTank(FluidType.WATER, 5000, 0);
}
@Override
@ -151,7 +155,7 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
NBTTagList list = nbt.getTagList("items", 10);
this.power = nbt.getInteger("powerTime");
this.water = nbt.getInteger("water");
tank.readFromNBT(nbt, "water");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
@ -169,7 +173,7 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("powerTime", power);
nbt.setInteger("water", water);
tank.writeToNBT(nbt, "water");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
@ -208,10 +212,6 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
return false;
}
public int getWaterScaled(int i) {
return (water * i) / maxWater;
}
public int getPowerScaled(int i) {
return (power * i) / maxPower;
}
@ -227,58 +227,20 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
if(age == 9 || age == 19)
ffgeuaInit();
//Water
if(slots[0] != null && slots[0].getItem() == Items.water_bucket && this.water + 2500 <= maxWater)
{
this.slots[0].stackSize--;
this.water += 2500;
if(this.slots[0].stackSize == 0)
{
this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
if(slots[0] != null && slots[0].getItem() == ModItems.rod_water && this.water + 2500 <= maxWater)
{
this.slots[0].stackSize--;
this.water += 2500;
if(this.slots[0].stackSize == 0)
{
this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
if(slots[0] != null && slots[0].getItem() == ModItems.rod_dual_water && this.water + 5000 <= maxWater)
{
this.slots[0].stackSize--;
this.water += 5000;
if(this.slots[0].stackSize == 0)
{
this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
if(slots[0] != null && slots[0].getItem() == ModItems.rod_quad_water && this.water + 10000 <= maxWater)
{
this.slots[0].stackSize--;
this.water += 10000;
if(this.slots[0].stackSize == 0)
{
this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
}
}
if(slots[0] != null && slots[0].getItem() == ModItems.inf_water)
{
this.water = TileEntityMachineCoal.maxWater;
}
//Battery Item
power = Library.chargeItemsFromTE(slots, 2, power, maxPower);
boolean flag = this.burnTime > 0;
boolean flag1 = false;
if(!worldObj.isRemote)
{
//Water
tank.loadTank(0, 3, slots);
tank.updateTank(xCoord, yCoord, zCoord);
//Battery Item
power = Library.chargeItemsFromTE(slots, 2, power, maxPower);
boolean trigger = true;
if(isItemValid() && this.burnTime == 0)
@ -329,9 +291,9 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
{
burnTime--;
if(water > 0)
if(tank.getFill() > 0)
{
water -= 1;
tank.setFill(tank.getFill() - 1);
if(power + 100 <= maxPower)
{
@ -406,4 +368,30 @@ public class TileEntityMachineCoal extends TileEntity implements ISidedInventory
public void clearList() {
this.list.clear();
}
@Override
public void setAFluidFill(int i, FluidType type) {
if(type.name().equals(tank.getTankType().name()))
tank.setFill(i);
}
@Override
public int getAFluidFill(FluidType type) {
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
}
@Override
public int getMaxAFluidFill(FluidType type) {
return type.name().equals(this.tank.getTankType().name()) ? tank.getMaxFill() : 0;
}
@Override
public void setFillstate(int fill, int index) {
tank.setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
tank.setTankType(type);
}
}

View File

@ -6,8 +6,12 @@ import java.util.Random;
import com.hbm.blocks.machine.MachineGenerator;
import com.hbm.explosion.ExplosionNukeGeneric;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.ISource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.items.special.ItemFuelRod;
@ -22,14 +26,10 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
public class TileEntityMachineGenerator extends TileEntity implements ISidedInventory, ISource {
public class TileEntityMachineGenerator extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public int water;
public final int waterMax = 1000000;
public int cool;
public final int coolMax = 1000000;
public int heat;
public final int heatMax = 100000;
public int power;
@ -37,15 +37,19 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
public boolean isLoaded = false;
public int age = 0;
public List<IConsumer> list = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8};
private static final int[] slots_bottom = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
private static final int[] slots_bottom = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
private static final int[] slots_side = new int[] {9, 10, 11};
private String customName;
public TileEntityMachineGenerator() {
slots = new ItemStack[12];
slots = new ItemStack[14];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.WATER, 32000, 0);
tanks[1] = new FluidTank(FluidType.COOLANT, 16000, 1);
}
@Override
@ -166,11 +170,11 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
water = nbt.getInteger("water");
cool = nbt.getInteger("cool");
power = nbt.getInteger("power");
heat = nbt.getInteger("heat");
slots = new ItemStack[getSizeInventory()];
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "coolant");
for(int i = 0; i < list.tagCount(); i++)
{
@ -186,11 +190,11 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("water", water);
nbt.setInteger("cool", cool);
nbt.setInteger("power", power);
nbt.setInteger("heat", heat);
NBTTagList list = new NBTTagList();
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "coolant");
for(int i = 0; i < slots.length; i++)
{
@ -250,14 +254,6 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
return false;
}
public int getWaterScaled(int i) {
return (water * i) / waterMax;
}
public int getCoolantScaled(int i) {
return (cool * i) / coolMax;
}
public int getPowerScaled(int i) {
return (power * i) / powerMax;
}
@ -266,14 +262,6 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
return (heat * i) / heatMax;
}
public boolean hasWater() {
return water > 0;
}
public boolean hasCoolant() {
return cool > 0;
}
public boolean hasPower() {
return power > 0;
}
@ -294,85 +282,16 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
if(age == 9 || age == 19)
ffgeuaInit();
//if(!worldObj.isRemote)
if(!worldObj.isRemote)
{
if(slots[9] != null && slots[9].getItem() == Items.water_bucket && this.water + 250000 <= waterMax)
{
this.slots[9].stackSize--;
this.water += 250000;
if(this.slots[9].stackSize == 0)
{
this.slots[9] = this.slots[9].getItem().getContainerItem(this.slots[9]);
}
}
if(slots[9] != null && slots[9].getItem() == ModItems.rod_water && this.water + 250000 <= waterMax)
{
this.slots[9].stackSize--;
this.water += 250000;
if(this.slots[9].stackSize == 0)
{
this.slots[9] = this.slots[9].getItem().getContainerItem(this.slots[9]);
}
}
if(slots[9] != null && slots[9].getItem() == ModItems.rod_dual_water && this.water + 500000 <= waterMax)
{
this.slots[9].stackSize--;
this.water += 500000;
if(this.slots[9].stackSize == 0)
{
this.slots[9] = this.slots[9].getItem().getContainerItem(this.slots[9]);
}
}
if(slots[9] != null && slots[9].getItem() == ModItems.rod_quad_water && this.water + 1000000 <= waterMax)
{
this.slots[9].stackSize--;
this.water += 1000000;
if(this.slots[9].stackSize == 0)
{
this.slots[9] = this.slots[9].getItem().getContainerItem(this.slots[9]);
}
}
if(slots[9] != null && slots[9].getItem() == ModItems.inf_water)
{
this.water = this.waterMax;
}
if(slots[10] != null && slots[10].getItem() == ModItems.rod_coolant && this.cool + 250000 <= coolMax)
{
this.slots[10].stackSize--;
this.cool += 250000;
if(this.slots[10].stackSize == 0)
{
this.slots[10] = this.slots[10].getItem().getContainerItem(this.slots[10]);
}
}
if(slots[10] != null && slots[10].getItem() == ModItems.rod_dual_coolant && this.cool + 500000 <= coolMax)
{
this.slots[10].stackSize--;
this.cool += 500000;
if(this.slots[10].stackSize == 0)
{
this.slots[10] = this.slots[10].getItem().getContainerItem(this.slots[10]);
}
}
if(slots[10] != null && slots[10].getItem() == ModItems.rod_quad_coolant && this.cool + 1000000 <= coolMax)
{
this.slots[10].stackSize--;
this.cool += 1000000;
if(this.slots[10].stackSize == 0)
{
this.slots[10] = this.slots[10].getItem().getContainerItem(this.slots[10]);
}
}
if(slots[10] != null && slots[10].getItem() == ModItems.inf_coolant)
{
this.cool = coolMax;
}
tanks[0].loadTank(9, 12, slots);
tanks[1].loadTank(10, 13, slots);
for(int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
//Batteries
power = Library.chargeItemsFromTE(slots, 11, power, powerMax);
for(int i = 0; i < 9; i++)
{
@ -542,19 +461,19 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
((slots[7] != null && !(slots[7].getItem() instanceof ItemFuelRod)) || slots[7] == null) &&
((slots[8] != null && !(slots[8].getItem() instanceof ItemFuelRod)) || slots[8] == null))
{
if(this.heat - 10 >= 0 && this.cool - 2 >= 0)
if(this.heat - 10 >= 0 && tanks[1].getFill() - 2 >= 0)
{
this.heat -= 10;
this.cool -= 2;
this.tanks[1].setFill(tanks[1].getFill() - 2);
}
if(this.heat < 10 && this.cool != 0)
if(this.heat < 10 && this.tanks[1].getFill() != 0)
{
this.heat--;
this.cool--;
this.tanks[1].setFill(tanks[1].getFill() - 1);
}
if(this.heat != 0 && this.cool == 0)
if(this.heat != 0 && this.tanks[1].getFill() == 0)
{
this.heat--;
}
@ -568,17 +487,13 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
this.isLoaded = true;
}
}
//Batteries
power = Library.chargeItemsFromTE(slots, 11, power, powerMax);
}
public void attemptPower(int i) {
if(this.water - i >= 0)
if(this.tanks[0].getFill() - i >= 0)
{
this.power += i;
this.water -= i;
this.tanks[0].setFill(tanks[0].getFill() - i);
}
}
@ -587,9 +502,9 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
int j = rand.nextInt(i);
if(this.cool - j >= 0)
if(this.tanks[1].getFill() - j >= 0)
{
this.cool -= j;
this.tanks[1].setFill(tanks[1].getFill() - j);
} else {
this.heat += i;
}
@ -651,4 +566,44 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
public void clearList() {
this.list.clear();
}
@Override
public int getMaxAFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else
return 0;
}
@Override
public void setAFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getAFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
}

View File

@ -7,11 +7,16 @@ import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.entity.particle.EntityGasFX;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IConsumer;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.interfaces.IFluidSource;
import com.hbm.interfaces.IGasAcceptor;
import com.hbm.interfaces.IGasSource;
import com.hbm.interfaces.IOilAcceptor;
import com.hbm.interfaces.IOilSource;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemBattery;
import com.hbm.lib.Library;
@ -29,22 +34,19 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.oredict.OreDictionary;
public class TileEntityMachineOilWell extends TileEntity implements ISidedInventory, IConsumer, IOilSource, IGasSource {
public class TileEntityMachineOilWell extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidSource {
private ItemStack slots[];
public int oil;
public int gas;
public int power;
public int warning;
public int warning2;
public static final int maxPower = 100000;
public static final int maxOil = 640;
public static final int maxGas = 640;
public int age = 0;
public int age2 = 0;
public List<IOilAcceptor> aclist = new ArrayList();
public List<IGasAcceptor> gaslist = new ArrayList();
public List<IFluidAcceptor> list1 = new ArrayList();
public List<IFluidAcceptor> list2 = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] {1};
private static final int[] slots_bottom = new int[] {2, 0};
@ -55,6 +57,9 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
public TileEntityMachineOilWell() {
slots = new ItemStack[6];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.OIL, 64000, 0);
tanks[1] = new FluidTank(FluidType.GAS, 64000, 1);
}
@Override
@ -163,9 +168,11 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
NBTTagList list = nbt.getTagList("items", 10);
this.power = nbt.getInteger("powerTime");
this.oil = nbt.getInteger("oil");
this.gas = nbt.getInteger("gas");
this.age = nbt.getInteger("age");
this.tanks[0].readFromNBT(nbt, "oil");
this.tanks[1].readFromNBT(nbt, "gas");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
@ -183,9 +190,11 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setInteger("powerTime", power);
nbt.setInteger("oil", oil);
nbt.setInteger("gas", gas);
nbt.setInteger("age", age);
this.tanks[0].writeToNBT(nbt, "oil");
this.tanks[1].writeToNBT(nbt, "gas");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
@ -217,14 +226,6 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
return false;
}
public int getOilScaled(int i) {
return (oil * i) / maxOil;
}
public int getGasScaled(int i) {
return (gas * i) / maxGas;
}
public int getPowerScaled(int i) {
return (power * i) / maxPower;
}
@ -241,42 +242,17 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
if(age2 >= 20)
age2 -= 20;
if(age2 == 9 || age2 == 19) {
fillInit();
fillGasInit();
fillFluidInit(tanks[0].getTankType());
fillFluidInit(tanks[1].getTankType());
}
if(!worldObj.isRemote) {
if(slots[1] != null && slots[1].getItem() == ModItems.canister_empty && oil >= 10) {
if(slots[2] == null) {
oil -= 10;
slots[2] = new ItemStack(ModItems.canister_oil);
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
} else if(slots[2] != null && slots[2].getItem() == ModItems.canister_oil && slots[2].stackSize < slots[2].getMaxStackSize()) {
oil -= 10;
slots[2].stackSize++;
slots[1].stackSize--;
if(slots[1].stackSize <= 0)
slots[1] = null;
}
}
this.tanks[0].unloadTank(1, 2, slots);
this.tanks[1].unloadTank(3, 4, slots);
if(slots[3] != null && slots[3].getItem() == ModItems.gas_empty && gas >= 10) {
if(slots[4] == null) {
gas -= 10;
slots[4] = new ItemStack(ModItems.gas_full);
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
} else if(slots[4] != null && slots[4].getItem() == ModItems.gas_full && slots[4].stackSize < slots[4].getMaxStackSize()) {
gas -= 10;
slots[4].stackSize++;
slots[3].stackSize--;
if(slots[3].stackSize <= 0)
slots[3] = null;
}
for(int i = 0; i < 2; i++) {
tanks[i].updateTank(xCoord, yCoord, zCoord);
}
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
@ -316,18 +292,20 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
warning = 2;
break;
} else if((b == ModBlocks.ore_oil || b == ModBlocks.ore_oil_empty) && this.oil < TileEntityMachineOilWell.maxOil && this.gas < TileEntityMachineOilWell.maxGas) {
} else if((b == ModBlocks.ore_oil || b == ModBlocks.ore_oil_empty) && this.tanks[0].getFill() < this.tanks[0].getMaxFill() && this.tanks[1].getFill() < this.tanks[1].getMaxFill()) {
if(succ(this.xCoord, i, this.zCoord)) {
oil += 5;
if(oil > maxOil)
oil = maxOil;
gas += rand.nextInt(26) + 25;
if(gas > maxGas)
gas = maxGas;
this.tanks[0].setFill(this.tanks[0].getFill() + 500);
if(this.tanks[0].getFill() > this.tanks[0].getMaxFill())
this.tanks[0].setFill(tanks[0].getMaxFill());
this.tanks[1].setFill(this.tanks[1].getFill() + (100 + rand.nextInt(401)));
if(this.tanks[1].getFill() > this.tanks[1].getMaxFill())
this.tanks[1].setFill(tanks[1].getMaxFill());
ExplosionLarge.spawnOilSpills(worldObj, xCoord + 0.5F, yCoord + 5.5F, zCoord + 0.5F, 3);
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "game.neutral.swim.splash", 3.0F, 0.5F);
worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "game.neutral.swim.splash", 2.0F, 0.5F);
break;
} else {
@ -351,12 +329,12 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
}
warning2 = 0;
if(gas > 0) {
if(tanks[1].getFill() > 0) {
if(slots[5] != null && (slots[5].getItem() == ModItems.fuse || slots[5].getItem() == ModItems.screwdriver)) {
warning2 = 2;
gas -= 1;
if(gas <= 0)
gas = 0;
tanks[1].setFill(tanks[1].getFill() - 50);
if(tanks[1].getFill() <= 0)
tanks[1].setFill(0);
worldObj.spawnEntityInWorld(new EntityGasFX(worldObj, this.xCoord + 0.5F, this.yCoord + 6.5F, this.zCoord + 0.5F, 0.0, 0.0, 0.0));
} else {
warning2 = 1;
@ -472,32 +450,6 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
return 65536.0D;
}
@Override
public void fillInit() {
fill(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
fill(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
fill(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
fill(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
}
@Override
public void fill(int x, int y, int z, boolean newTact) {
Library.transmitOil(x, y, z, newTact, this, worldObj);
}
@Override
public void fillGasInit() {
fillGas(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
fillGas(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
fillGas(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
fillGas(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
}
@Override
public void fillGas(int x, int y, int z, boolean newTact) {
Library.transmitGas(x, y, z, newTact, this, worldObj);
}
@Override
public boolean getTact() {
if (age2 >= 0 && age2 < 10) {
@ -508,43 +460,63 @@ public class TileEntityMachineOilWell extends TileEntity implements ISidedInvent
}
@Override
public int getSFill() {
return this.oil;
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 2, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 2, getTact(), type);
}
@Override
public void setSFill(int i) {
this.oil = i;
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@Override
public List<IOilAcceptor> getList() {
return aclist;
public int getSFluidFill(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
return 0;
}
@Override
public void clearList() {
this.aclist.clear();
public void setSFluidFill(int i, FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
}
@Override
public int getGasFill() {
return this.gas;
public List<IFluidAcceptor> getFluidList(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
return this.list1;
if(type.name().equals(tanks[1].getTankType().name()))
return this.list2;
return new ArrayList<IFluidAcceptor>();
}
@Override
public void setGasFill(int i) {
this.gas = i;
public void clearFluidList(FluidType type) {
if(type.name().equals(tanks[0].getTankType().name()))
list1.clear();
if(type.name().equals(tanks[1].getTankType().name()))
list2.clear();
}
@Override
public List<IGasAcceptor> getGasList() {
return this.gaslist;
public void setFillstate(int fill, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void clearGasList() {
this.gaslist.clear();
public void setType(FluidType type, int index) {
if(index < 2 && tanks[index] != null)
tanks[index].setTankType(type);
}
}

View File

@ -49,15 +49,10 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
slots = new ItemStack[12];
tanks = new FluidTank[5];
tanks[0] = new FluidTank(FluidType.OIL, 64000, 0);
tanks[1] = new FluidTank(FluidType.HEAVYOIL, 16000, 0);
tanks[2] = new FluidTank(FluidType.NAPHTHA, 16000, 0);
tanks[3] = new FluidTank(FluidType.LIGHTOIL, 16000, 0);
tanks[4] = new FluidTank(FluidType.PETROLEUM, 16000, 0);
tanks[0].index = 0;
tanks[1].index = 1;
tanks[2].index = 2;
tanks[3].index = 3;
tanks[4].index = 4;
tanks[1] = new FluidTank(FluidType.HEAVYOIL, 16000, 1);
tanks[2] = new FluidTank(FluidType.NAPHTHA, 16000, 2);
tanks[3] = new FluidTank(FluidType.LIGHTOIL, 16000, 3);
tanks[4] = new FluidTank(FluidType.PETROLEUM, 16000, 4);
}
@Override

View File

@ -192,7 +192,6 @@ public class TileEntityMachineUF6Tank extends TileEntity implements ISidedInvent
if(!worldObj.isRemote)
{
tank.loadTank(0, 1, slots);
tank.setType(0, 1, slots);
tank.unloadTank(2, 3, slots);
tank.updateTank(xCoord, yCoord, zCoord);
}