mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
The great energy massacre: Finale
This commit is contained in:
parent
5b8d478c22
commit
3f731951ce
@ -1,97 +0,0 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorSmallOld;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineReactorSmallOld extends Container {
|
||||
|
||||
private TileEntityMachineReactorSmallOld seleniumEngine;
|
||||
|
||||
public ContainerMachineReactorSmallOld(InventoryPlayer invPlayer, TileEntityMachineReactorSmallOld tedf) {
|
||||
|
||||
seleniumEngine = tedf;
|
||||
|
||||
//Rods
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 98, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 134, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 80, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 116, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 152, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 98, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 134, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 80, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 8, 116, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 152, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 98, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 11, 134, 90));
|
||||
|
||||
//Fluid IO
|
||||
this.addSlotToContainer(new Slot(tedf, 12, 8, 90));
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 13, 8, 108));
|
||||
this.addSlotToContainer(new Slot(tedf, 14, 26, 90));
|
||||
this.addSlotToContainer(new SlotMachineOutput(tedf, 15, 26, 108));
|
||||
|
||||
//Battery
|
||||
this.addSlotToContainer(new Slot(tedf, 16, 62, 108));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 16) {
|
||||
if (!this.mergeItemStack(var5, 17, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (!this.mergeItemStack(var5, 0, 13, true))
|
||||
if (!this.mergeItemStack(var5, 14, 15, true))
|
||||
if (!this.mergeItemStack(var5, 16, 17, true))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return seleniumEngine.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -1,169 +0,0 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerMachineReactorSmallOld;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorSmallOld;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineReactorSmallOld extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_small.png");
|
||||
private static ResourceLocation overlay = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_small_overlay.png");
|
||||
private TileEntityMachineReactorSmallOld diFurnace;
|
||||
private boolean toggleOverlay = false;
|
||||
|
||||
public GUIMachineReactorSmallOld(InventoryPlayer invPlayer, TileEntityMachineReactorSmallOld tedf) {
|
||||
super(new ContainerMachineReactorSmallOld(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
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 + 36, 16, 52);
|
||||
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 36, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 108, 88, 4, diFurnace.power, diFurnace.powerMax);
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 114, 88, 4, new String[] { "Hull Temperature:", " " + Math.round((diFurnace.hullHeat) * 0.00001 * 980 + 20) + "°C" });
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 120, 88, 4, new String[] { "Core Temperature:", " " + Math.round((diFurnace.coreHeat) * 0.00002 * 980 + 20) + "°C" });
|
||||
|
||||
String[] text = new String[] { "Coolant will move heat from the core to",
|
||||
"the hull. Water will use that heat and",
|
||||
"generate power.",
|
||||
"Water consumption rate:",
|
||||
" 100 mB/t",
|
||||
" 2000 mB/s",
|
||||
"Coolant consumption rate:",
|
||||
" 10 mB/t",
|
||||
" 200 mB/s",
|
||||
"Water next to the reactor's open",
|
||||
"sides will pour into the tank." };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
|
||||
|
||||
String[] text1 = new String[] { "Raise/lower the control rods",
|
||||
"using the button next to the",
|
||||
"fluid gauges." };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
|
||||
|
||||
if(diFurnace.tanks[0].getFill() <= 0) {
|
||||
String[] text2 = new String[] { "Error: Water is required for",
|
||||
"the reactor to function properly!" };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32, 16, 16, guiLeft - 8, guiTop + 36 + 32 + 16, text2);
|
||||
}
|
||||
|
||||
if(diFurnace.tanks[1].getFill() <= 0) {
|
||||
String[] text3 = new String[] { "Use of coolant is advised." };
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 32 + 16, text3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 53 <= x && guiLeft + 53 + 16 > x && guiTop + 54 < y && guiTop + 54 + 16 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord, diFurnace.retracting ? 0 : 1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if(toggleOverlay)
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(overlay);
|
||||
else
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(diFurnace.power > 0) {
|
||||
int i = (int)diFurnace.getPowerScaled(88);
|
||||
|
||||
i = (int) Math.min(i, 88);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 108, 0, 222, i, 4);
|
||||
}
|
||||
|
||||
if(diFurnace.hasHullHeat()) {
|
||||
int i = diFurnace.getHullHeatScaled(88);
|
||||
|
||||
i = (int) Math.min(i, 160);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 114, 0, 226, i, 4);
|
||||
}
|
||||
|
||||
if(diFurnace.hasCoreHeat()) {
|
||||
int i = diFurnace.getCoreHeatScaled(88);
|
||||
|
||||
i = (int) Math.min(i, 160);
|
||||
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 120, 0, 230, i, 4);
|
||||
}
|
||||
|
||||
if(!diFurnace.retracting)
|
||||
drawTexturedModalRect(guiLeft + 52, guiTop + 53, 212, 0, 18, 18);
|
||||
|
||||
if(!toggleOverlay) {
|
||||
if(diFurnace.rods >= diFurnace.rodsMax) {
|
||||
|
||||
for(int x = 0; x < 3; x++)
|
||||
for(int y = 0; y < 3; y++)
|
||||
drawTexturedModalRect(guiLeft + 79 + 36 * x, guiTop + 17 + 36 * y, 176, 0, 18, 18);
|
||||
|
||||
} else if(diFurnace.rods > 0) {
|
||||
|
||||
for(int x = 0; x < 3; x++)
|
||||
for(int y = 0; y < 3; y++)
|
||||
drawTexturedModalRect(guiLeft + 79 + 36 * x, guiTop + 17 + 36 * y, 194, 0, 18, 18);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
|
||||
|
||||
if(diFurnace.tanks[0].getFill() <= 0)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32, 16, 16, 6);
|
||||
|
||||
if(diFurnace.tanks[1].getFill() <= 0)
|
||||
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 32 + 16, 16, 16, 7);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
|
||||
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);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[1].getSheet());
|
||||
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);
|
||||
}
|
||||
|
||||
protected void keyTyped(char p_73869_1_, int p_73869_2_)
|
||||
{
|
||||
super.keyTyped(p_73869_1_, p_73869_2_);
|
||||
|
||||
if (p_73869_2_ == 56)
|
||||
{
|
||||
this.toggleOverlay = !this.toggleOverlay;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -4,33 +4,33 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineSPP extends TileEntity implements ISource {
|
||||
public class TileEntityMachineSPP extends TileEntity implements IEnergyGenerator {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
public int age = 0;
|
||||
public int gen = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
age -= 20;
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
//if(age == 1)
|
||||
|
||||
this.sendPower(worldObj, xCoord + 1, yCoord, zCoord, Library.POS_X);
|
||||
this.sendPower(worldObj, xCoord - 1, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord + 1, Library.POS_Z);
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord - 1, Library.NEG_Z);
|
||||
this.sendPower(worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||
|
||||
if(worldObj.getTotalWorldTime() % 20 == 0)
|
||||
gen = checkStructure() * 15;
|
||||
|
||||
if(gen > 0)
|
||||
power += gen;
|
||||
if(power > maxPower)
|
||||
@ -75,47 +75,18 @@ public class TileEntityMachineSPP extends TileEntity implements ISource {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return this.list;
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
@ -18,7 +17,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineShredderLarge extends TileEntity implements ISidedInventory, IConsumer {
|
||||
public class TileEntityMachineShredderLarge extends TileEntity implements ISidedInventory {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -205,23 +204,6 @@ public class TileEntityMachineShredderLarge extends TileEntity implements ISided
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
power = i;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPower() {
|
||||
return power;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
|
||||
@ -4,11 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.ISource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.recipes.MachineRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
@ -16,6 +14,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@ -23,15 +22,15 @@ 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.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineTurbine extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, ISource {
|
||||
public class TileEntityMachineTurbine extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list1 = new ArrayList();
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
|
||||
@ -222,7 +221,9 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent
|
||||
}
|
||||
|
||||
fillFluidInit(tanks[1].getTankType());
|
||||
ffgeuaInit();
|
||||
|
||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||
this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir);
|
||||
|
||||
tanks[0].setType(0, 1, slots);
|
||||
tanks[0].loadTank(2, 3, slots);
|
||||
@ -259,22 +260,6 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord, this.yCoord + 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord - 1, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 1, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
|
||||
@ -359,22 +344,17 @@ public class TileEntityMachineTurbine extends TileEntity implements ISidedInvent
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list1.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,10 +7,8 @@ import java.util.Random;
|
||||
import com.hbm.entity.particle.EntitySSmokeFX;
|
||||
import com.hbm.entity.particle.EntityTSmokeFX;
|
||||
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.lib.Library;
|
||||
@ -20,6 +18,7 @@ import com.hbm.packet.LoopedSoundPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TETurbofanPacket;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -32,15 +31,13 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineTurbofan extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineTurbofan extends TileEntity implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public int soundCycle = 0;
|
||||
public static final long maxPower = 150000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tank;
|
||||
Random rand = new Random();
|
||||
public int afterburner;
|
||||
@ -229,13 +226,15 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
this.sendPower(worldObj, this.xCoord + 2, this.yCoord + 1, this.zCoord - 1, Library.POS_X);
|
||||
this.sendPower(worldObj, this.xCoord + 2, this.yCoord + 1, this.zCoord + 1, Library.POS_X);
|
||||
this.sendPower(worldObj, this.xCoord + 1, this.yCoord + 1, this.zCoord + 2, Library.POS_Z);
|
||||
this.sendPower(worldObj, this.xCoord - 1, this.yCoord + 1, this.zCoord + 2, Library.POS_Z);
|
||||
this.sendPower(worldObj, this.xCoord - 2, this.yCoord + 1, this.zCoord + 1, Library.NEG_X);
|
||||
this.sendPower(worldObj, this.xCoord - 2, this.yCoord + 1, this.zCoord - 1, Library.NEG_X);
|
||||
this.sendPower(worldObj, this.xCoord - 1, this.yCoord + 1, this.zCoord - 2, Library.NEG_Z);
|
||||
this.sendPower(worldObj, this.xCoord + 1, this.yCoord + 1, this.zCoord - 2, Library.NEG_Z);
|
||||
|
||||
//Tank Management
|
||||
tank.loadTank(0, 1, slots);
|
||||
@ -480,52 +479,20 @@ public class TileEntityMachineTurbofan extends TileEntity implements ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord + 2, this.yCoord + 1, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord + 2, this.yCoord + 1, this.zCoord + 1, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord + 1, this.zCoord + 2, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord + 1, this.zCoord + 2, getTact());
|
||||
ffgeua(this.xCoord - 2, this.yCoord + 1, this.zCoord + 1, getTact());
|
||||
ffgeua(this.xCoord - 2, this.yCoord + 1, this.zCoord - 1, getTact());
|
||||
ffgeua(this.xCoord - 1, this.yCoord + 1, this.zCoord - 2, getTact());
|
||||
ffgeua(this.xCoord + 1, this.yCoord + 1, this.zCoord - 2, getTact());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
public long getMaxPower() {
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -12,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMicrowave extends TileEntityMachineBase implements IConsumer {
|
||||
public class TileEntityMicrowave extends TileEntityMachineBase implements IEnergyUser {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 50000;
|
||||
@ -36,6 +36,8 @@ public class TileEntityMicrowave extends TileEntityMachineBase implements IConsu
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
|
||||
this.power = Library.chargeTEFromItems(slots, 2, power, maxPower);
|
||||
|
||||
if(canProcess()) {
|
||||
|
||||
@ -6,7 +6,6 @@ import java.util.List;
|
||||
import com.hbm.handler.MissileStruct;
|
||||
import com.hbm.entity.missile.EntitySoyuz;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -16,6 +15,7 @@ import com.hbm.main.MainRegistry;
|
||||
import com.hbm.sound.AudioWrapper;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import api.hbm.item.IDesignatorItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -27,7 +27,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 1000000;
|
||||
@ -59,6 +59,8 @@ public class TileEntitySoyuzLauncher extends TileEntityMachineBase implements IS
|
||||
public void updateEntity() {
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
this.trySubscribe(worldObj, xCoord, yCoord - 1, zCoord);
|
||||
|
||||
tanks[0].loadTank(4, 5, slots);
|
||||
tanks[1].loadTank(6, 7, slots);
|
||||
|
||||
@ -25,6 +25,11 @@ public class TileEntityMachineFrackingTower extends TileEntityOilDrillBase imple
|
||||
return "container.frackingTower";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateConnections() {
|
||||
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 5_000_000;
|
||||
@ -109,5 +114,4 @@ public class TileEntityMachineFrackingTower extends TileEntityOilDrillBase imple
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
return type == tanks[2].getTankType() ? tanks[2].getMaxFill() : 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,16 +7,15 @@ import java.util.Random;
|
||||
import com.hbm.entity.particle.EntityGasFlameFX;
|
||||
import com.hbm.explosion.ExplosionThermo;
|
||||
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.lib.Library;
|
||||
import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -28,14 +27,12 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineGasFlare extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
|
||||
public class TileEntityMachineGasFlare extends TileEntity implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public long power;
|
||||
public static final long maxPower = 100000;
|
||||
public int age = 0;
|
||||
public List<IConsumer> list = new ArrayList();
|
||||
public FluidTank tank;
|
||||
|
||||
private static final int[] slots_top = new int[] {1};
|
||||
@ -213,13 +210,12 @@ public class TileEntityMachineGasFlare extends TileEntity implements ISidedInven
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
age++;
|
||||
if(age >= 20)
|
||||
age -= 20;
|
||||
if(age == 9 || age == 19)
|
||||
ffgeuaInit();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.sendPower(worldObj, xCoord + 2, yCoord, zCoord, Library.POS_X);
|
||||
this.sendPower(worldObj, xCoord - 2, yCoord, zCoord, Library.NEG_X);
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord + 2, Library.POS_Z);
|
||||
this.sendPower(worldObj, xCoord, yCoord, zCoord - 2, Library.NEG_Z);
|
||||
|
||||
tank.loadTank(1, 2, slots);
|
||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
@ -234,7 +230,7 @@ public class TileEntityMachineGasFlare extends TileEntity implements ISidedInven
|
||||
worldObj.spawnEntityInWorld(new EntityGasFlameFX(worldObj, this.xCoord + 0.5F, this.yCoord + 11F, this.zCoord + 0.5F, 0.0, 0.0, 0.0));
|
||||
ExplosionThermo.setEntitiesOnFire(worldObj, this.xCoord, this.yCoord + 11, zCoord, 5);
|
||||
|
||||
if(age % 5 == 0)
|
||||
if(worldObj.getTotalWorldTime() % 5 == 0)
|
||||
this.worldObj.playSoundEffect(this.xCoord, this.yCoord + 11, this.zCoord, "hbm:weapon.flamethrowerShoot", 1.5F, 1F);
|
||||
}
|
||||
|
||||
@ -258,46 +254,18 @@ public class TileEntityMachineGasFlare extends TileEntity implements ISidedInven
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearList() {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeuaInit() {
|
||||
ffgeua(this.xCoord + 2, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord - 2, this.yCoord, this.zCoord, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord + 2, getTact());
|
||||
ffgeua(this.xCoord, this.yCoord, this.zCoord - 2, getTact());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Library.ffgeua(x, y, z, newTact, this, worldObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSPower() {
|
||||
public long getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSPower(long i) {
|
||||
this.power = i;
|
||||
public long getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IConsumer> getList() {
|
||||
return this.list;
|
||||
public void setPower(long i) {
|
||||
this.power = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -16,6 +16,14 @@ public class TileEntityMachineOilWell extends TileEntityOilDrillBase {
|
||||
return "container.oilWell";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord, yCoord, zCoord - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 100_000;
|
||||
|
||||
@ -22,6 +22,18 @@ public class TileEntityMachinePumpjack extends TileEntityOilDrillBase {
|
||||
return "container.pumpjack";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateConnections() {
|
||||
this.getBlockMetadata();
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.blockMetadata);
|
||||
ForgeDirection rot = dir.getRotation(ForgeDirection.DOWN);
|
||||
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3 + 1, yCoord, zCoord + rot.offsetZ * 3 + 1);
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3 + 1, yCoord, zCoord + rot.offsetZ * 3 - 1);
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3 - 1, yCoord, zCoord + rot.offsetZ * 3 + 1);
|
||||
this.trySubscribe(worldObj, xCoord + rot.offsetX * 3 - 1, yCoord, zCoord + rot.offsetZ * 3 - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMaxPower() {
|
||||
return 250_000;
|
||||
|
||||
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
@ -17,6 +16,7 @@ import com.hbm.packet.AuxElectricityPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import api.hbm.energy.IBatteryItem;
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -28,7 +28,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineRefinery extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
public class TileEntityMachineRefinery extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -254,6 +254,8 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
age++;
|
||||
@ -313,6 +315,17 @@ public class TileEntityMachineRefinery extends TileEntity implements ISidedInven
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord + 2, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord + 1);
|
||||
this.trySubscribe(worldObj, xCoord - 2, yCoord, zCoord - 1);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord + 2);
|
||||
this.trySubscribe(worldObj, xCoord + 1, yCoord, zCoord - 2);
|
||||
this.trySubscribe(worldObj, xCoord - 1, yCoord, zCoord - 2);
|
||||
}
|
||||
|
||||
public long getPowerScaled(long i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
@ -19,6 +18,7 @@ import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.Tuple;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@ -28,7 +28,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public abstract class TileEntityOilDrillBase extends TileEntityMachineBase implements IConsumer, IFluidSource {
|
||||
public abstract class TileEntityOilDrillBase extends TileEntityMachineBase implements IEnergyUser, IFluidSource {
|
||||
|
||||
public int indicator = 0;
|
||||
|
||||
@ -70,6 +70,8 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.updateConnections();
|
||||
|
||||
this.tanks[0].unloadTank(1, 2, slots);
|
||||
this.tanks[1].unloadTank(3, 4, slots);
|
||||
|
||||
@ -132,6 +134,8 @@ public abstract class TileEntityOilDrillBase extends TileEntityMachineBase imple
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void updateConnections();
|
||||
|
||||
public void sendUpdate() {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user