bomber sounds, small reactor upgrade, new steam variants

This commit is contained in:
HbmMods 2018-11-08 14:39:05 +01:00
parent c5692c0533
commit bdcb9b3d88
33 changed files with 1128 additions and 116 deletions

View File

@ -43,6 +43,7 @@ hbmfluid.none=Nichts
hbmfluid.water=Wasser
hbmfluid.steam=Dampf
hbmfluid.hotsteam=Dichter Dampf
hbmfluid.superhotsteam=Superverdichteter Steam
hbmfluid.lava=Lava
hbmfluid.uf6=Uranhexafluorid
hbmfluid.puf6=Plutoniumhexafluorid
@ -339,7 +340,9 @@ tile.machine_boiler_on.name=Dampfkessel
container.machineBoiler=Dampfkessel
tile.machine_boiler_electric_off.name=Elektrischer Boiler
tile.machine_boiler_electric_on.name=Elektrischer Boiler
container.machineBoilerElectric=Elektrischer Boiler
container.machineElectricBoiler=Elektrischer Boiler
tile.machine_turbine.name=Dampfturbine
container.machineTurbine=Dampfturbine
tile.launch_pad.name=Raketenabschussrampe
container.launchPad=Raketenabschussrampe
tile.book_guide.name=Hbm's Nuclear Tech Mod Handbuch [LEGACY]

View File

@ -43,6 +43,7 @@ hbmfluid.none=None
hbmfluid.water=Water
hbmfluid.steam=Steam
hbmfluid.hotsteam=Dense Steam
hbmfluid.superhotsteam=Super Dense Steam
hbmfluid.lava=Lava
hbmfluid.uf6=Uranium Hexafluoride
hbmfluid.puf6=Plutonium Hexafluoride
@ -339,7 +340,9 @@ tile.machine_boiler_on.name=Boiler
container.machineBoiler=Boiler
tile.machine_boiler_electric_off.name=Electric Boiler
tile.machine_boiler_electric_on.name=Electric Boiler
container.machineBoilerElectric=Electric Boiler
container.machineElectricBoiler=Electric Boiler
tile.machine_turbine.name=Steam Turbine
container.machineTurbine=Steam Turbine
tile.launch_pad.name=Missile Launch Pad
container.launchPad=Missile Launch Pad
tile.book_guide.name=Hbm's Nuclear Tech Mod Manual [LEGACY]

View File

@ -102,6 +102,8 @@
"entity.chopperCrashingLoop": {"category": "hostile", "sounds": [{"name": "entity/chopperCrashingLoop", "stream": true}]},
"entity.oldExplosion": {"category": "ambient", "sounds": [{"name": "entity/oldExplosion", "stream": false}]},
"entity.rocketTakeoff": {"category": "player", "sounds": [{"name": "entity/rocketTakeoff", "stream": false}]},
"entity.bombDet": {"category": "player", "sounds": ["entity/bombDet1", "entity/bombDet2", "entity/bombDet3"]},
"entity.bombWhistle": {"category": "player", "sounds": [{"name": "entity/bombWhistle", "stream": false}]},
"potatos.random": {"category": "player", "sounds": ["potatos/randResponse0", "potatos/randResponse1", "potatos/randResponse2", "potatos/randResponse3", "potatos/randResponse4", "potatos/randResponse5", "potatos/randResponse6", "potatos/randResponse7"]},

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -125,6 +125,9 @@ public class EntityBomber extends Entity implements IChunkLoader {
ExplosionChaos.spawnChlorine(worldObj, this.posX, this.posY - 1F, this.posZ, 10, 0.5, 3);
} else {
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "hbm:entity.bombWhistle", 10.0F, 0.9F + rand.nextFloat() * 0.2F);
EntityBombletZeta zeta = new EntityBombletZeta(worldObj);
/*zeta.prevRotationYaw = zeta.rotationYaw = this.rotationYaw;
zeta.prevRotationPitch = zeta.rotationPitch = this.rotationPitch;*/
@ -137,8 +140,13 @@ public class EntityBomber extends Entity implements IChunkLoader {
zeta.posY = posY - rand.nextDouble();
zeta.posZ = posZ + rand.nextDouble() - 0.5;
zeta.motionX = motionX;
zeta.motionZ = motionZ;
if(type == 0) {
zeta.motionX = motionX + rand.nextGaussian() * 0.15;
zeta.motionZ = motionZ + rand.nextGaussian() * 0.15;
} else {
zeta.motionX = motionX;
zeta.motionZ = motionZ;
}
worldObj.spawnEntityInWorld(zeta);
}
@ -197,7 +205,7 @@ public class EntityBomber extends Entity implements IChunkLoader {
bomber.timer = 200;
bomber.bombStart = 50;
bomber.bombStop = 100;
bomber.bombRate = 3;
bomber.bombRate = 2;
bomber.fac(world, x, y, z);

View File

@ -49,10 +49,16 @@ public class EntityBombletZeta extends EntityThrowable {
{
if(type == 0) {
ExplosionLarge.explode(worldObj, this.posX + 0.5F, this.posY + 0.5F, this.posZ + 0.5F, 5.0F, true, false, false);
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "hbm:entity.bombDet", 25.0F, 0.8F + rand.nextFloat() * 0.4F);
}
if(type == 1) {
ExplosionLarge.explode(worldObj, this.posX + 0.5F, this.posY + 0.5F, this.posZ + 0.5F, 5.0F, true, false, false);
ExplosionChaos.burn(worldObj, (int)posX, (int)posY, (int)posZ, 7);
ExplosionLarge.explode(worldObj, this.posX + 0.5F, this.posY + 0.5F, this.posZ + 0.5F, 2.5F, false, false, false);
ExplosionChaos.burn(worldObj, (int)posX, (int)posY, (int)posZ, 9);
ExplosionChaos.flameDeath(worldObj, (int)posX, (int)posY, (int)posZ, 14);
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "hbm:entity.bombDet", 25.0F, 1.0F);
for(int i = 0; i < 5; i++)
ExplosionLarge.spawnBurst(worldObj, this.posX + 0.5F, this.posY + 1.0F, this.posZ + 0.5F, rand.nextInt(10) + 15, rand.nextFloat() * 2 + 2);
}
if(type == 2) {
worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F);

View File

@ -5,13 +5,13 @@ import java.util.Arrays;
public class FluidTypeHandler {
public enum FluidType {
NONE (0x888888, 8947848, 0, 1, 1, "hbmfluid.none"),
NONE (0x888888, 8947848, 0, 1, 1, "hbmfluid.none"),
WATER (0x3333FF, 3355647, 1, 1, 1, "hbmfluid.water"),
STEAM (0xe5e5e5, 15066597, 9, 2, 1, "hbmfluid.steam"),
HOTSTEAM (0xE7D6D6, 0xE7D6D6, 9, 2, 1, "hbmfluid.hotsteam"),
SUPERHOTSTEAM (0xE7B7B7, 0xE7B7B7, 9, 2, 1, "hbmfluid.superhotsteam"),
COOLANT (0xd8fcff, 14220543, 1, 1, 2, "hbmfluid.coolant"),
HOTSTEAM (0xE7D6D6, 0xE7D6D6, 1, 1, 2, "hbmfluid.hotsteam"),
SUPERHOTSTEAM (0xE7B7B7, 0xE7B7B7, 2, 1, 2, "hbmfluid.superhotsteam"),
COOLANT (0xd8fcff, 14220543, 2, 1, 1, "hbmfluid.coolant"),
LAVA (0xFF3300, 16724736, 3, 1, 1, "hbmfluid.lava"),

View File

@ -477,7 +477,8 @@ public class MachineRecipes {
switch(type) {
case WATER: return new Object[] { FluidType.STEAM, 5, 5, 10000 };
case STEAM: return new Object[] { FluidType.HOTSTEAM, 5, 50, 45000 };
case STEAM: return new Object[] { FluidType.HOTSTEAM, 5, 50, 30000 };
case HOTSTEAM: return new Object[] { FluidType.SUPERHOTSTEAM, 5, 50, 45000 };
case OIL: return new Object[] { FluidType.HOTOIL, 5, 5, 35000 };
}
@ -490,8 +491,8 @@ public class MachineRecipes {
switch(type) {
case STEAM: return new Object[] { FluidType.WATER, 5, 5, 50 };
case HOTSTEAM: return new Object[] { FluidType.STEAM, 50, 5, 250 };
case SUPERHOTSTEAM: return new Object[] { FluidType.HOTSTEAM, 50, 5, 750 };
case HOTSTEAM: return new Object[] { FluidType.STEAM, 50, 5, 100 };
case SUPERHOTSTEAM: return new Object[] { FluidType.HOTSTEAM, 50, 5, 150 };
}
return null;

View File

@ -38,9 +38,6 @@ private TileEntityMachineReactorSmall seleniumEngine;
this.addSlotToContainer(new Slot(tedf, 14, 26, 90));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, 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++)

View File

@ -0,0 +1,97 @@
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(invPlayer.player, tedf, 13, 8, 108));
this.addSlotToContainer(new Slot(tedf, 14, 26, 90));
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, 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);
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.container.ContainerCoreAdvanced;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityCoreAdvanced;
@ -12,7 +13,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUICoreAdvanced extends GuiContainer {
public class GUICoreAdvanced extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_advanced.png");
private TileEntityCoreAdvanced diFurnace;
@ -32,6 +33,18 @@ public class GUICoreAdvanced extends GuiContainer {
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);
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
String[] text = new String[] { "Basically just a larger furnace with a queue." };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Requires an advanced factory energy cluster as",
"an energy buffer, even if external power is used!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
@ -48,5 +61,8 @@ public class GUICoreAdvanced extends GuiContainer {
int j = diFurnace.getProgressScaled(90);
drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18);
}
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
}
}

View File

@ -12,7 +12,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUICoreTitanium extends GuiContainer {
public class GUICoreTitanium extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/factory_titanium.png");
private TileEntityCoreTitanium diFurnace;
@ -32,6 +32,18 @@ public class GUICoreTitanium extends GuiContainer {
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);
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
String[] text = new String[] { "Basically just a larger furnace with a queue." };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Requires a basic factory energy cluster as",
"an energy buffer, even if external power is used!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 16, text1);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
@ -48,5 +60,8 @@ public class GUICoreTitanium extends GuiContainer {
int j = diFurnace.getProgressScaled(90);
drawTexturedModalRect(guiLeft + 43, guiTop + 53, 0, 222, j, 18);
}
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);
}
}

View File

@ -46,8 +46,8 @@ public class GUIMachineBoiler extends GuiInfoContainer {
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/t (once boiling point is reached)",
" 0.05°C/t",
" or 1.0°C/t (for every subsequent multiple of boiling point)" };
" 0.4°C/t",
" or 8.0°C/t (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",

View File

@ -43,8 +43,8 @@ public class GUIMachineBoilerElectric extends GuiInfoContainer {
" or 3.0°C/s (base)",
" 0.25°C/t",
" or 5.0°C/t (once boiling point is reached)",
" 0.15°C/t",
" or 3.0°C/t (for every subsequent multiple of boiling point)" };
" 0.4°C/t",
" or 8.0°C/t (for every subsequent multiple of boiling point)" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, text);
String[] text1 = new String[] { "Boiling rate:",

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineReactorSmall;
import com.hbm.inventory.container.ContainerMachineSelenium;
@ -19,8 +20,8 @@ import net.minecraft.util.ResourceLocation;
public class GUIMachineReactorSmall 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 static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_experimental.png");
private static ResourceLocation overlay = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_overlay_experimental.png");
private TileEntityMachineReactorSmall diFurnace;
private boolean toggleOverlay = false;
@ -38,13 +39,13 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
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);
diFurnace.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 108, 88, 4);
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.",
"generate steam.",
"Water consumption rate:",
" 100 mB/t",
" 2000 mB/s",
@ -67,7 +68,8 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
}
if(diFurnace.tanks[1].getFill() <= 0) {
String[] text3 = new String[] { "Use of coolant is advised." };
String[] text3 = new String[] { "Error: Coolant is required for",
"the reactor to function properly!" };
this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36 + 32 + 16, 16, 16, guiLeft - 8, guiTop + 36 + 32 + 16, text3);
}
}
@ -88,6 +90,20 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
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));
}
if(guiLeft + 63 <= x && guiLeft + 63 + 14 > x && guiTop + 107 < y && guiTop + 107 + 18 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
int c = 0;
switch(diFurnace.tanks[2].getTankType()) {
case STEAM: c = 0; break;
case HOTSTEAM: c = 1; break;
case SUPERHOTSTEAM: c = 2; break;
}
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord, c, 1));
}
}
@Override
@ -100,14 +116,6 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
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);
@ -144,6 +152,12 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
}
}
switch(diFurnace.tanks[2].getTankType()) {
case STEAM: drawTexturedModalRect(guiLeft + 63, guiTop + 107, 176, 18, 14, 18); break;
case HOTSTEAM: drawTexturedModalRect(guiLeft + 63, guiTop + 107, 190, 18, 14, 18); break;
case SUPERHOTSTEAM: drawTexturedModalRect(guiLeft + 63, guiTop + 107, 204, 18, 14, 18); break;
}
this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 2);
this.drawInfoPanel(guiLeft - 16, guiTop + 36 + 16, 16, 16, 3);

View File

@ -0,0 +1,172 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineReactorSmallOld;
import com.hbm.inventory.container.ContainerMachineSelenium;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.machine.TileEntityMachineReactorSmallOld;
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
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;
}
}
}

View File

@ -398,7 +398,7 @@ public class HbmWorldGen implements IWorldGenerator {
}
}
if (MainRegistry.enableVaults && rand.nextInt(/*MainRegistry.vaultfreq*/ 1) == 0) {
if (MainRegistry.enableVaults && rand.nextInt(MainRegistry.vaultfreq) == 0) {
int x = i + rand.nextInt(16);
int z = j + rand.nextInt(16);
int y = world.getHeightValue(x, z);

View File

@ -560,6 +560,7 @@ public class CraftingManager {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_coal_off, 1), new Object[] { "STS", "SCS", "SFS", 'S', "ingotSteel", 'T', ModItems.tank_steel, 'C', "ingotRedstoneAlloy", 'F', Blocks.furnace }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_boiler_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', "ingotSteel", 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', Blocks.furnace }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_boiler_electric_off, 1), new Object[] { "SPS", "TFT", "SPS", 'S', "ingotDesh", 'P', ModItems.board_copper, 'T', ModItems.tank_steel, 'F', ModBlocks.machine_electric_furnace_off }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_turbine, 1), new Object[] { "PTP", "BMB", "PTP", 'P', "plateTitanium", 'T', ModItems.turbine_titanium, 'B', ModItems.tank_steel, 'M', ModItems.motor }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_converter_he_rf, 1), new Object[] { "SSS", "CRB", "SSS", 'S', "ingotSteel", 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', "blockRedstone" }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_converter_rf_he, 1), new Object[] { "SSS", "BRC", "SSS", 'S', ModItems.ingot_beryllium, 'C', ModItems.coil_copper, 'R', ModItems.coil_copper_torus, 'B', "blockRedstone" }));
//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_schrabidium_transmutator), 1), new Object[] { "TST", "ARA", "BBB", 'S', ModItems.nugget_schrabidium , 'T', "ingotTitanium", 'A', Item.getItemFromBlock(ModBlocks.factory_advanced_hull), 'R', Item.getItemFromBlock(ModBlocks.machine_reactor), 'B', Item.getItemFromBlock(ModBlocks.machine_battery) }));

View File

@ -1757,6 +1757,7 @@ public class MainRegistry
broadcaster = setDef(broadcaster, 1000);
minefreq = setDef(minefreq, 1000);
radfreq = setDef(radfreq, 1000);
vaultfreq = setDef(vaultfreq, 1000);
meteorStrikeChance = setDef(meteorStrikeChance, 1000);
meteorShowerChance = setDef(meteorShowerChance, 1000);
}

View File

@ -1,6 +1,7 @@
package com.hbm.packet;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.saveddata.SatelliteSaveStructure;
import com.hbm.saveddata.SatelliteSavedData;
import com.hbm.tileentity.bomb.TileEntityTurretCIWS;
@ -77,7 +78,25 @@ public class AuxButtonPacket implements IMessage {
if (te instanceof TileEntityMachineReactorSmall) {
TileEntityMachineReactorSmall reactor = (TileEntityMachineReactorSmall)te;
reactor.retracting = m.value == 1;
if(m.id == 0)
reactor.retracting = m.value == 1;
if(m.id == 1) {
FluidType type = FluidType.STEAM;
int fill = reactor.tanks[2].getFill();
switch(m.value) {
case 0: type = FluidType.HOTSTEAM; fill = (int)Math.floor(fill / 10D); break;
case 1: type = FluidType.SUPERHOTSTEAM; fill = (int)Math.floor(fill / 10D); break;
case 2: type = FluidType.STEAM; fill = (int)Math.floor(fill * 100); break;
}
if(fill > reactor.tanks[2].getMaxFill())
fill = reactor.tanks[2].getMaxFill();
reactor.tanks[2].setTankType(type);
reactor.tanks[2].setFill(fill);
}
}
if (te instanceof TileEntityRadioRec) {

View File

@ -3,6 +3,7 @@ package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.MachineBoiler;
import com.hbm.blocks.machine.MachineCoal;
import com.hbm.handler.FluidTypeHandler.FluidType;
@ -260,10 +261,12 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
}
if(burnTime == 0 && flag1) {
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
if(burnTime > 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_on)
MachineBoiler.updateBlockState(false, worldObj, xCoord, yCoord, zCoord);
if(heat > maxHeat)
heat = maxHeat;
@ -275,11 +278,13 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
slots[4] = null;
if(!flag1) {
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
mark = true;
}
}
if(burnTime > 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_off)
MachineBoiler.updateBlockState(true, worldObj, xCoord, yCoord, zCoord);
if(outs != null) {
for(int i = 0; i < (heat / ((Integer)outs[3]).intValue()); i++) {
@ -290,7 +295,7 @@ public class TileEntityMachineBoiler extends TileEntity implements ISidedInvento
if(i == 0)
heat -= 25;
else
heat -= 5;
heat -= 40;
}
}
}

View File

@ -84,7 +84,7 @@ public class TileEntityMachineBoilerElectric extends TileEntity implements ISide
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.machineElecricBoiler";
return this.hasCustomInventoryName() ? this.customName : "container.machineElectricBoiler";
}
@Override
@ -252,12 +252,14 @@ public class TileEntityMachineBoilerElectric extends TileEntity implements ISide
tanks[i].updateTank(xCoord, yCoord, zCoord);
if(heat > 2000) {
heat -= 15;
heat -= 30;
}
if(power > 0) {
power -= 100;
heat += 150;
power -= 150;
heat += Math.min(((double)power / (double)maxPower * 300), 150);
} else {
heat -= 100;
}
if(power <= 0 && worldObj.getBlock(xCoord, yCoord, zCoord) == ModBlocks.machine_boiler_electric_on) {
@ -282,9 +284,9 @@ public class TileEntityMachineBoilerElectric extends TileEntity implements ISide
tanks[1].setFill(tanks[1].getFill() + ((Integer)outs[1]).intValue());
if(i == 0)
heat -= 25;
heat -= 35;
else
heat -= 15;
heat -= 50;
}
}
}

View File

@ -10,6 +10,7 @@ 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.items.ModItems;
@ -39,7 +40,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineReactorSmall extends TileEntity
implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
private ItemStack slots[];
@ -47,26 +48,25 @@ public class TileEntityMachineReactorSmall extends TileEntity
public final int maxHullHeat = 100000;
public int coreHeat;
public final int maxCoreHeat = 50000;
public long power;
public final long powerMax = 250000;
public int rods;
public final int rodsMax = 100;
public boolean retracting = true;
public int age = 0;
public List<IConsumer> list = new ArrayList();
public List<IFluidAcceptor> list = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] { 16 };
private static final int[] slots_top = new int[] { 0 };
private static final int[] slots_bottom = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 16 };
private static final int[] slots_side = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 };
private String customName;
public TileEntityMachineReactorSmall() {
slots = new ItemStack[17];
tanks = new FluidTank[2];
slots = new ItemStack[16];
tanks = new FluidTank[3];
tanks[0] = new FluidTank(FluidType.WATER, 32000, 0);
tanks[1] = new FluidTank(FluidType.COOLANT, 16000, 1);
tanks[2] = new FluidTank(FluidType.STEAM, 16000, 2);
}
@Override
@ -149,9 +149,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
if (itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant
|| itemStack.getItem() == ModItems.rod_quad_coolant)
return true;
if (i == 16)
if (itemStack.getItem() instanceof ItemBattery)
return true;
return false;
}
@ -179,7 +176,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
power = nbt.getLong("power");
coreHeat = nbt.getInteger("heat");
hullHeat = nbt.getInteger("hullHeat");
slots = new ItemStack[getSizeInventory()];
@ -198,7 +194,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("power", power);
nbt.setInteger("heat", coreHeat);
nbt.setInteger("hullHeat", hullHeat);
NBTTagList list = new NBTTagList();
@ -249,16 +244,9 @@ public class TileEntityMachineReactorSmall extends TileEntity
|| itemStack.getItem() == ModItems.fluid_tank_empty
|| itemStack.getItem() == ModItems.fluid_barrel_empty)
return true;
if (i == 16)
if (itemStack.getItem() instanceof ItemBattery
&& ItemBattery.getCharge(itemStack) == ItemBattery.getMaxChargeStatic(itemStack))
return true;
return false;
}
public long getPowerScaled(long i) {
return (power * i) / powerMax;
}
public int getCoreHeatScaled(int i) {
@ -269,10 +257,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
return (hullHeat * i) / maxHullHeat;
}
public boolean hasPower() {
return power > 0;
}
public boolean hasCoreHeat() {
return coreHeat > 0;
}
@ -324,7 +308,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
}
if (age == 9 || age == 19)
ffgeuaInit();
fillFluidInit(tanks[2].getTankType());
if (tanks[0].getFill() < tanks[0].getMaxFill()) {
@ -376,12 +360,9 @@ public class TileEntityMachineReactorSmall extends TileEntity
1.0F);
}
for (int i = 0; i < 2; i++)
for (int i = 0; i < 3; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
// Batteries
power = Library.chargeItemsFromTE(slots, 11, power, powerMax);
if (rods >= rodsMax)
for (int i = 0; i < 12; i++) {
if (slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
@ -403,7 +384,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
}
if (this.hullHeat > 0 && this.tanks[0].getFill() > 0) {
this.power += this.hullHeat * 0.1;
generateSteam();
this.hullHeat -= this.hullHeat * 0.085;
this.tanks[0].setFill(this.tanks[0].getFill() - 100);
@ -412,10 +393,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
this.tanks[0].setFill(0);
}
if (this.power > powerMax) {
this.power = powerMax;
}
if (this.coreHeat > maxCoreHeat) {
this.explode();
}
@ -440,13 +417,32 @@ public class TileEntityMachineReactorSmall extends TileEntity
}
}
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, rods, 0));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, retracting ? 1 : 0, 1));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, coreHeat, 2));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 3));
}
}
private void generateSteam() {
//function of SHS produced per tick
//maxes out at heat% * tank capacity / 20
int producted = (int)
(((double)hullHeat / (double)maxHullHeat) * ((double)tanks[2].getMaxFill() / 20D));
switch(tanks[2].getTankType()) {
case STEAM:
break;
case HOTSTEAM:
break;
case SUPERHOTSTEAM:
break;
}
if(tanks[2].getFill() > tanks[2].getMaxFill())
tanks[2].setFill(tanks[2].getMaxFill());
}
private boolean hasFuelRod(int id) {
if (id > 11)
@ -551,22 +547,21 @@ public class TileEntityMachineReactorSmall extends TileEntity
}
@Override
public void ffgeua(int x, int y, int z, boolean newTact) {
Library.ffgeua(x, y, z, newTact, this, worldObj);
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
}
@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());
public void fillFluidInit(FluidType type) {
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
ffgeua(this.xCoord - 1, this.yCoord + 2, this.zCoord, getTact());
ffgeua(this.xCoord + 1, this.yCoord + 2, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord - 1, getTact());
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord + 1, getTact());
fillFluid(this.xCoord - 1, this.yCoord + 2, this.zCoord, getTact(), type);
fillFluid(this.xCoord + 1, this.yCoord + 2, this.zCoord, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 2, this.zCoord - 1, getTact(), type);
fillFluid(this.xCoord, this.yCoord + 2, this.zCoord + 1, getTact(), type);
}
@Override
@ -578,26 +573,6 @@ public class TileEntityMachineReactorSmall extends TileEntity
return false;
}
@Override
public long getSPower() {
return power;
}
@Override
public void setSPower(long i) {
this.power = i;
}
@Override
public List<IConsumer> getList() {
return list;
}
@Override
public void clearList() {
this.list.clear();
}
@Override
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
@ -614,6 +589,8 @@ public class TileEntityMachineReactorSmall extends TileEntity
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);
}
@Override
@ -622,19 +599,21 @@ public class TileEntityMachineReactorSmall extends TileEntity
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
return 0;
}
@Override
public void setFillstate(int fill, int index) {
if (index < 2 && tanks[index] != null)
if (index < 3 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if (index < 2 && tanks[index] != null)
if (index < 3 && tanks[index] != null)
tanks[index].setTankType(type);
}
@ -643,10 +622,21 @@ public class TileEntityMachineReactorSmall extends TileEntity
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
list.add(tanks[2]);
return list;
}
@Override
public List<IFluidAcceptor> getFluidList(FluidType type) {
return list;
}
@Override
public void clearFluidList(FluidType type) {
list.clear();
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;

View File

@ -0,0 +1,660 @@
package com.hbm.tileentity.machine;
import java.util.ArrayList;
import java.util.List;
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;
import com.hbm.lib.Library;
import com.hbm.lib.ModDamageSource;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.potion.HbmPotion;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.PotionEffect;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineReactorSmallOld extends TileEntity
implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public int hullHeat;
public final int maxHullHeat = 100000;
public int coreHeat;
public final int maxCoreHeat = 50000;
public long power;
public final long powerMax = 250000;
public int rods;
public final int rodsMax = 100;
public boolean retracting = true;
public int age = 0;
public List<IConsumer> list = new ArrayList();
public FluidTank[] tanks;
private static final int[] slots_top = new int[] { 16 };
private static final int[] slots_bottom = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 16 };
private static final int[] slots_side = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 };
private String customName;
public TileEntityMachineReactorSmallOld() {
slots = new ItemStack[17];
tanks = new FluidTank[2];
tanks[0] = new FluidTank(FluidType.WATER, 32000, 0);
tanks[1] = new FluidTank(FluidType.COOLANT, 16000, 1);
}
@Override
public int getSizeInventory() {
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i) {
return slots[i];
}
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if (slots[i] != null) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
} else {
return null;
}
}
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@Override
public String getInventoryName() {
return this.hasCustomInventoryName() ? this.customName : "container.reactorSmall";
}
@Override
public boolean hasCustomInventoryName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomName(String name) {
this.customName = name;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
}
}
// You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|| i == 11)
if (itemStack.getItem() instanceof ItemFuelRod)
return true;
if (i == 12)
if (itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water
|| itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket)
return true;
if (i == 14)
if (itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant
|| itemStack.getItem() == ModItems.rod_quad_coolant)
return true;
if (i == 16)
if (itemStack.getItem() instanceof ItemBattery)
return true;
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if (slots[i] != null) {
if (slots[i].stackSize <= j) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
}
ItemStack itemStack1 = slots[i].splitStack(j);
if (slots[i].stackSize == 0) {
slots[i] = null;
}
return itemStack1;
} else {
return null;
}
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
power = nbt.getLong("power");
coreHeat = nbt.getInteger("heat");
hullHeat = nbt.getInteger("hullHeat");
slots = new ItemStack[getSizeInventory()];
tanks[0].readFromNBT(nbt, "water");
tanks[1].readFromNBT(nbt, "coolant");
for (int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if (b0 >= 0 && b0 < slots.length) {
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("power", power);
nbt.setInteger("heat", coreHeat);
nbt.setInteger("hullHeat", hullHeat);
NBTTagList list = new NBTTagList();
tanks[0].writeToNBT(nbt, "water");
tanks[1].writeToNBT(nbt, "coolant");
for (int i = 0; i < slots.length; i++) {
if (slots[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte) i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
}
nbt.setTag("items", list);
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
return this.isItemValidForSlot(i, itemStack);
}
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|| i == 11)
if (itemStack.getItem() == ModItems.rod_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted)
return true;
if (i == 13 || i == 15)
if (itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty
|| itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty
|| itemStack.getItem() == ModItems.fluid_tank_empty
|| itemStack.getItem() == ModItems.fluid_barrel_empty)
return true;
if (i == 16)
if (itemStack.getItem() instanceof ItemBattery
&& ItemBattery.getCharge(itemStack) == ItemBattery.getMaxChargeStatic(itemStack))
return true;
return false;
}
public long getPowerScaled(long i) {
return (power * i) / powerMax;
}
public int getCoreHeatScaled(int i) {
return (coreHeat * i) / maxCoreHeat;
}
public int getHullHeatScaled(int i) {
return (hullHeat * i) / maxHullHeat;
}
public boolean hasPower() {
return power > 0;
}
public boolean hasCoreHeat() {
return coreHeat > 0;
}
public boolean hasHullHeat() {
return hullHeat > 0;
}
private int[] getNeighbouringSlots(int id) {
switch (id) {
case 0:
return new int[] { 1, 5 };
case 1:
return new int[] { 0, 6 };
case 2:
return new int[] { 3, 7 };
case 3:
return new int[] { 2, 4, 8 };
case 4:
return new int[] { 3, 9 };
case 5:
return new int[] { 0, 6, 0xA };
case 6:
return new int[] { 1, 5, 0xB };
case 7:
return new int[] { 2, 8 };
case 8:
return new int[] { 3, 7, 9 };
case 9:
return new int[] { 4, 8 };
case 10:
return new int[] { 5, 0xB };
case 11:
return new int[] { 6, 0xA };
}
return null;
}
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
age++;
if (age >= 20) {
age = 0;
}
if (age == 9 || age == 19)
ffgeuaInit();
if (tanks[0].getFill() < tanks[0].getMaxFill()) {
if (worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.water
|| worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) == Blocks.flowing_water)
tanks[0].setFill(tanks[0].getFill() + 25);
if (worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.water
|| worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) == Blocks.flowing_water)
tanks[0].setFill(tanks[0].getFill() + 25);
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.water
|| worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) == Blocks.flowing_water)
tanks[0].setFill(tanks[0].getFill() + 25);
if (worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.water
|| worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) == Blocks.flowing_water)
tanks[0].setFill(tanks[0].getFill() + 25);
if (tanks[0].getFill() > tanks[0].getMaxFill())
tanks[0].setFill(tanks[0].getMaxFill());
}
tanks[0].loadTank(12, 13, slots);
tanks[1].loadTank(14, 15, slots);
if (retracting && rods > 0) {
if (rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
0.75F);
rods--;
if (rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
1.0F);
}
if (!retracting && rods < rodsMax) {
if (rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
0.75F);
rods++;
if (rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
1.0F);
}
for (int i = 0; i < 2; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord);
// Batteries
power = Library.chargeItemsFromTE(slots, 11, power, powerMax);
if (rods >= rodsMax)
for (int i = 0; i < 12; i++) {
if (slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
decay(i);
}
if (this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) {
this.hullHeat += this.coreHeat * 0.175;
this.coreHeat -= this.coreHeat * 0.1;
this.tanks[1].setFill(this.tanks[1].getFill() - 10);
if (this.tanks[1].getFill() < 0)
this.tanks[1].setFill(0);
}
if (this.hullHeat > maxHullHeat) {
this.hullHeat = maxHullHeat;
}
if (this.hullHeat > 0 && this.tanks[0].getFill() > 0) {
this.power += this.hullHeat * 0.1;
this.hullHeat -= this.hullHeat * 0.085;
this.tanks[0].setFill(this.tanks[0].getFill() - 100);
if (this.tanks[0].getFill() < 0)
this.tanks[0].setFill(0);
}
if (this.power > powerMax) {
this.power = powerMax;
}
if (this.coreHeat > maxCoreHeat) {
this.explode();
}
if (rods > 0 && coreHeat > 0
&& !(worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord).isNormalCube()
&& worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord).isNormalCube()
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1).isNormalCube()
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1).isNormalCube()
&& worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord) != Blocks.air
&& worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord) != Blocks.air
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1) != Blocks.air
&& worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1) != Blocks.air)) {
List<Entity> list = (List<Entity>) worldObj.getEntitiesWithinAABBExcludingEntity(null,
AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 - 5, zCoord + 0.5 - 5,
xCoord + 0.5 + 5, yCoord + 1.5 + 5, zCoord + 0.5 + 5));
for (Entity e : list) {
if (e instanceof EntityLivingBase)
Library.applyRadiation((EntityLivingBase)e, 80, 24, 60, 19);
}
}
PacketDispatcher.wrapper.sendToAll(new AuxElectricityPacket(xCoord, yCoord, zCoord, power));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, rods, 0));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, retracting ? 1 : 0, 1));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, coreHeat, 2));
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 3));
}
}
private boolean hasFuelRod(int id) {
if (id > 11)
return false;
if (slots[id] != null)
return slots[id].getItem() instanceof ItemFuelRod;
return false;
}
private int getNeightbourCount(int id) {
int[] neighbours = this.getNeighbouringSlots(id);
if (neighbours == null)
return 0;
int count = 0;
for (int i = 0; i < neighbours.length; i++)
if (hasFuelRod(neighbours[i]))
count++;
return count;
}
// itemstack in slots[id] has to contain ItemFuelRod item
private void decay(int id) {
if (id > 11)
return;
int decay = getNeightbourCount(id) + 1;
for (int i = 0; i < decay; i++) {
ItemFuelRod rod = ((ItemFuelRod) slots[id].getItem());
this.coreHeat += rod.heat;
ItemFuelRod.setLifeTime(slots[id], ItemFuelRod.getLifeTime(slots[id]) + 1);
ItemFuelRod.updateDamage(slots[id]);
if (ItemFuelRod.getLifeTime(slots[id]) > ((ItemFuelRod) slots[id].getItem()).lifeTime) {
onRunOut(id);
return;
}
}
}
// itemstack in slots[id] has to contain ItemFuelRod item
private void onRunOut(int id) {
System.out.println("aaa");
Item item = slots[id].getItem();
if (item == ModItems.rod_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_uranium_fuel_depleted);
} else if (item == ModItems.rod_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_plutonium_fuel_depleted);
} else if (item == ModItems.rod_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_mox_fuel_depleted);
} else if (item == ModItems.rod_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted);
} else if (item == ModItems.rod_dual_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted);
} else if (item == ModItems.rod_dual_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted);
} else if (item == ModItems.rod_dual_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted);
} else if (item == ModItems.rod_dual_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted);
} else if (item == ModItems.rod_quad_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted);
} else if (item == ModItems.rod_quad_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted);
} else if (item == ModItems.rod_quad_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted);
} else if (item == ModItems.rod_quad_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted);
}
}
private void explode() {
for (int i = 0; i < slots.length; i++) {
this.slots[i] = null;
}
worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 18.0F, true);
ExplosionNukeGeneric.waste(worldObj, this.xCoord, this.yCoord, this.zCoord, 35);
worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.flowing_lava);
}
@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 - 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 - 1, this.yCoord + 2, this.zCoord, getTact());
ffgeua(this.xCoord + 1, this.yCoord + 2, this.zCoord, getTact());
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord - 1, getTact());
ffgeua(this.xCoord, this.yCoord + 2, this.zCoord + 1, getTact());
}
@Override
public boolean getTact() {
if (age >= 0 && age < 10) {
return true;
}
return false;
}
@Override
public long getSPower() {
return power;
}
@Override
public void setSPower(long i) {
this.power = i;
}
@Override
public List<IConsumer> getList() {
return list;
}
@Override
public void clearList() {
this.list.clear();
}
@Override
public int getMaxFluidFill(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 setFluidFill(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 getFluidFill(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);
}
@Override
public List<FluidTank> getTanks() {
List<FluidTank> list = new ArrayList();
list.add(tanks[0]);
list.add(tanks[1]);
return list;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}