large nuclear reactor almost finished
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 11 KiB |
BIN
assets/hbm/textures/items/gun_buckshot_dragon.png
Normal file
|
After Width: | Height: | Size: 244 B |
BIN
assets/hbm/textures/items/gun_buckshot_explosive.png
Normal file
|
After Width: | Height: | Size: 250 B |
BIN
assets/hbm/textures/items/gun_buckshot_poison.png
Normal file
|
After Width: | Height: | Size: 247 B |
BIN
assets/hbm/textures/items/gun_buckshot_shock.png
Normal file
|
After Width: | Height: | Size: 253 B |
BIN
assets/hbm/textures/items/gun_buckshot_wither.png
Normal file
|
After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 302 B |
@ -7,6 +7,7 @@ import com.hbm.entity.mob.EntityNuclearCreeper;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.saveddata.RadiationSavedData;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@ -91,19 +92,19 @@ public class WasteEarth extends Block {
|
||||
@Override
|
||||
public void onEntityWalking(World p_149724_1_, int p_149724_2_, int p_149724_3_, int p_149724_4_, Entity entity)
|
||||
{
|
||||
/*if (entity instanceof EntityLivingBase && this == ModBlocks.waste_earth)
|
||||
{
|
||||
Library.applyRadiation((EntityLivingBase)entity, 4, 10, 0, 0);
|
||||
}*/
|
||||
if (entity instanceof EntityLivingBase && this == ModBlocks.waste_earth) {
|
||||
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 15 * 20, 0));
|
||||
}
|
||||
|
||||
if (entity instanceof EntityLivingBase && this == ModBlocks.frozen_grass) {
|
||||
|
||||
if (entity instanceof EntityLivingBase && this == ModBlocks.frozen_grass)
|
||||
{
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2 * 60 * 20, 2));
|
||||
}
|
||||
/*if (entity instanceof EntityLivingBase && this == ModBlocks.waste_mycelium)
|
||||
{
|
||||
Library.applyRadiation((EntityLivingBase)entity, 30, 14, 15, 9);
|
||||
}*/
|
||||
if (entity instanceof EntityLivingBase && this == ModBlocks.waste_mycelium) {
|
||||
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 30 * 20, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorMultiblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@ -25,7 +26,7 @@ public class ReactorCore extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityReactorMultiblock();
|
||||
return new TileEntityMachineReactorLarge();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -33,7 +34,7 @@ public class ReactorCore extends BlockContainer {
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityReactorMultiblock tileentityfurnace = (TileEntityReactorMultiblock)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
TileEntityMachineReactorLarge tileentityfurnace = (TileEntityMachineReactorLarge)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
@ -80,17 +81,17 @@ public class ReactorCore extends BlockContainer {
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_)
|
||||
{
|
||||
if (!p_149723_1_.isRemote)
|
||||
{
|
||||
TileEntityReactorMultiblock entity = (TileEntityReactorMultiblock) p_149723_1_.getTileEntity(p_149723_2_, p_149723_3_, p_149723_4_);
|
||||
TileEntityMachineReactorLarge entity = (TileEntityMachineReactorLarge) p_149723_1_.getTileEntity(p_149723_2_, p_149723_3_, p_149723_4_);
|
||||
if(entity != null && entity.isLoaded)
|
||||
{
|
||||
entity.explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import java.util.Random;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorMultiblock;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
@ -118,9 +119,9 @@ public class ReactorHatch extends Block {
|
||||
{
|
||||
if(world.getBlockMetadata(x, y, z) == 2)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z + 2) instanceof TileEntityReactorMultiblock)
|
||||
if(world.getTileEntity(x, y, z + 2) instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x, y, z + 2)).isStructureValid(world))
|
||||
if(((TileEntityMachineReactorLarge)world.getTileEntity(x, y, z + 2)).checkBody())
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x, y, z + 2);
|
||||
} else {
|
||||
@ -132,9 +133,9 @@ public class ReactorHatch extends Block {
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 3)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z - 2) instanceof TileEntityReactorMultiblock)
|
||||
if(world.getTileEntity(x, y, z - 2) instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x, y, z - 2)).isStructureValid(world))
|
||||
if(((TileEntityMachineReactorLarge)world.getTileEntity(x, y, z - 2)).checkBody())
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x, y, z - 2);
|
||||
} else {
|
||||
@ -146,9 +147,9 @@ public class ReactorHatch extends Block {
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 4)
|
||||
{
|
||||
if(world.getTileEntity(x + 2, y, z) instanceof TileEntityReactorMultiblock)
|
||||
if(world.getTileEntity(x + 2, y, z) instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x + 2, y, z)).isStructureValid(world))
|
||||
if(((TileEntityMachineReactorLarge)world.getTileEntity(x + 2, y, z)).checkBody())
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x + 2, y, z);
|
||||
} else {
|
||||
@ -160,9 +161,9 @@ public class ReactorHatch extends Block {
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 5)
|
||||
{
|
||||
if(world.getTileEntity(x - 2, y, z) instanceof TileEntityReactorMultiblock)
|
||||
if(world.getTileEntity(x - 2, y, z) instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x - 2, y, z)).isStructureValid(world))
|
||||
if(((TileEntityMachineReactorLarge)world.getTileEntity(x - 2, y, z)).checkBody())
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x - 2, y, z);
|
||||
} else {
|
||||
|
||||
@ -237,9 +237,9 @@ public class GUIHandler implements IGuiHandler {
|
||||
|
||||
case ModBlocks.guiID_reactor_multiblock:
|
||||
{
|
||||
if(entity instanceof TileEntityReactorMultiblock)
|
||||
if(entity instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
return new ContainerReactorMultiblock(player.inventory, (TileEntityReactorMultiblock) entity);
|
||||
return new ContainerReactorMultiblock(player.inventory, (TileEntityMachineReactorLarge) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -931,9 +931,9 @@ public class GUIHandler implements IGuiHandler {
|
||||
|
||||
case ModBlocks.guiID_reactor_multiblock:
|
||||
{
|
||||
if(entity instanceof TileEntityReactorMultiblock)
|
||||
if(entity instanceof TileEntityMachineReactorLarge)
|
||||
{
|
||||
return new GUIReactorMultiblock(player.inventory, (TileEntityReactorMultiblock) entity);
|
||||
return new GUIReactorMultiblock(player.inventory, (TileEntityMachineReactorLarge) entity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -61,6 +61,18 @@ public class FluidTank {
|
||||
return maxFluid;
|
||||
}
|
||||
|
||||
public int changeTankSize(int size) {
|
||||
maxFluid = size;
|
||||
|
||||
if(fluid > maxFluid) {
|
||||
int dif = fluid - maxFluid;
|
||||
fluid = maxFluid;
|
||||
return dif;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Called on TE update
|
||||
public void updateTank(int x, int y, int z) {
|
||||
|
||||
@ -154,6 +166,13 @@ public class FluidTank {
|
||||
return;
|
||||
}
|
||||
|
||||
if(slots[in].getItem() == ModItems.inf_water && this.type.name().equals(FluidType.WATER.name())) {
|
||||
this.fluid -= 50;
|
||||
if(this.fluid < 0)
|
||||
this.fluid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
full = FluidContainerRegistry.getFullContainer(slots[in], type);
|
||||
}
|
||||
if(full == null)
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.inventory.SlotMachineOutput;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorMultiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -11,56 +13,31 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerReactorMultiblock extends Container {
|
||||
|
||||
private TileEntityReactorMultiblock diFurnace;
|
||||
private TileEntityMachineReactorLarge diFurnace;
|
||||
|
||||
private int heat;
|
||||
|
||||
public ContainerReactorMultiblock(InventoryPlayer invPlayer, TileEntityReactorMultiblock tedf) {
|
||||
public ContainerReactorMultiblock(InventoryPlayer invPlayer, TileEntityMachineReactorLarge tedf) {
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 80, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 98, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 116, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 134, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 152, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 62, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 80, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 8, 98, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 9, 116, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 10, 134, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 11, 152, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 12, 62, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 13, 80, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 14, 98, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 15, 116, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 16, 134, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 17, 152, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 18, 62, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 19, 80, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 20, 98, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 21, 116, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 22, 134, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 23, 152, 72));
|
||||
this.addSlotToContainer(new Slot(tedf, 24, 62, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 25, 80, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 26, 98, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 27, 116, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 28, 134, 90));
|
||||
this.addSlotToContainer(new Slot(tedf, 29, 152, 90));
|
||||
//Water In
|
||||
this.addSlotToContainer(new Slot(tedf, 30, 8, 90 - 18));
|
||||
//Water Out
|
||||
this.addSlotToContainer(new Slot(tedf, 31, 8, 90));
|
||||
//Coolant In
|
||||
this.addSlotToContainer(new Slot(tedf, 32, 26, 90 - 18));
|
||||
//Coolant Out
|
||||
this.addSlotToContainer(new Slot(tedf, 33, 26, 90));
|
||||
//Batteries
|
||||
this.addSlotToContainer(new Slot(tedf, 34, 44, 90));
|
||||
//Fuse
|
||||
this.addSlotToContainer(new Slot(tedf, 35, 8, 108));
|
||||
//Water in
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 90));
|
||||
//Water out
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 1, 8, 108));
|
||||
//Coolant in
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 26, 90));
|
||||
//Coolant out
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 3, 26, 108));
|
||||
|
||||
//Fuel in
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 80, 36));
|
||||
//Fuel out
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 5, 80, 72));
|
||||
//Waste in
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 152, 36));
|
||||
//Waste out
|
||||
this.addSlotToContainer(new SlotMachineOutput(invPlayer.player, tedf, 7, 152, 72));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
@ -76,12 +53,6 @@ public class ContainerReactorMultiblock extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
@ -93,8 +64,8 @@ public class ContainerReactorMultiblock extends Container {
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 33) {
|
||||
if (!this.mergeItemStack(var5, 34, this.inventorySlots.size(), true))
|
||||
if (par2 <= 7) {
|
||||
if (!this.mergeItemStack(var5, 8, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -119,29 +90,4 @@ public class ContainerReactorMultiblock extends Container {
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for(int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting par1 = (ICrafting)this.crafters.get(i);
|
||||
|
||||
if(this.heat != this.diFurnace.heat)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 1, this.diFurnace.heat);
|
||||
}
|
||||
}
|
||||
|
||||
this.heat = this.diFurnace.heat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if(i == 1)
|
||||
{
|
||||
diFurnace.heat = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,11 +82,11 @@ public class GUIMachineReactorSmall extends GuiInfoContainer {
|
||||
case SUPERHOTSTEAM: s = "100x"; break;
|
||||
}
|
||||
|
||||
String[] text4 = new String[] { "Steam compression switch.",
|
||||
String[] text4 = new String[] { "Steam compression switch",
|
||||
"Current compression level: " + s};
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 63, guiTop + 107, 14, 18, mouseX, mouseY, text4);
|
||||
|
||||
String[] text5 = new String[] { diFurnace.retracting ? "Raise control rods." : "Lower control rods."};
|
||||
String[] text5 = new String[] { diFurnace.retracting ? "Raise control rods" : "Lower control rods"};
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 52, guiTop + 53, 18, 18, mouseX, mouseY, text5);
|
||||
}
|
||||
|
||||
|
||||
@ -5,9 +5,13 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerReactorMultiblock;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorMultiblock;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@ -15,10 +19,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIReactorMultiblock extends GuiInfoContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_multiblock.png");
|
||||
private TileEntityReactorMultiblock diFurnace;
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_large_experimental.png");
|
||||
private TileEntityMachineReactorLarge diFurnace;
|
||||
|
||||
public GUIReactorMultiblock(InventoryPlayer invPlayer, TileEntityReactorMultiblock tedf) {
|
||||
public GUIReactorMultiblock(InventoryPlayer invPlayer, TileEntityMachineReactorLarge tedf) {
|
||||
super(new ContainerReactorMultiblock(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
@ -32,8 +36,71 @@ public class GUIReactorMultiblock extends GuiInfoContainer {
|
||||
|
||||
diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 70 - 52, 16, 52);
|
||||
diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 70 - 52, 16, 52);
|
||||
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 88 - 70, 16, 70, diFurnace.power, diFurnace.maxPower);
|
||||
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 115, guiTop + 17, 18, 90, new String[] { "Operating Level: " + diFurnace.rods + "%" });
|
||||
|
||||
String fuel = "";
|
||||
|
||||
switch(diFurnace.type) {
|
||||
case URANIUM:
|
||||
fuel = "Uranium";
|
||||
break;
|
||||
case MOX:
|
||||
fuel = "MOX";
|
||||
break;
|
||||
case PLUTONIUM:
|
||||
fuel = "Plutonium";
|
||||
break;
|
||||
case SCHRABIDIUM:
|
||||
fuel = "Schrabidium";
|
||||
break;
|
||||
case UNKNOWN:
|
||||
fuel = "ERROR";
|
||||
break;
|
||||
}
|
||||
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 98, guiTop + 18, 16, 88, new String[] { fuel + ": " + (diFurnace.fuel / diFurnace.fuelMult) + "/" + (diFurnace.maxFuel / diFurnace.fuelMult) + "ng" });
|
||||
this.drawCustomInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 18, 16, 88, new String[] { "Depleted " + fuel + ": " + (diFurnace.waste / diFurnace.fuelMult) + "/" + (diFurnace.maxWaste / diFurnace.fuelMult) + "ng" });
|
||||
|
||||
String[] text0 = new String[] { diFurnace.rods > 0 ? "Reactor is ON" : "Reactor is OFF"};
|
||||
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 52, guiTop + 53, 18, 18, mouseX, mouseY, text0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
protected void mouseClicked(int x, int y, int i) {
|
||||
super.mouseClicked(x, y, i);
|
||||
|
||||
if(guiLeft + 115 <= x && guiLeft + 115 + 18 > x && guiTop + 17 < y && guiTop + 17 + 90 >= y) {
|
||||
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
|
||||
int rods = (y - (guiTop + 24)) * 100 / 76;
|
||||
|
||||
if(rods < 0)
|
||||
rods = 0;
|
||||
|
||||
if(rods > 100)
|
||||
rods = 100;
|
||||
|
||||
rods = 100 - rods;
|
||||
|
||||
PacketDispatcher.wrapper.sendToServer(new AuxButtonPacket(diFurnace.xCoord, diFurnace.yCoord, diFurnace.zCoord, rods, 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
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
@ -43,22 +110,72 @@ public class GUIReactorMultiblock extends GuiInfoContainer {
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
@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);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int k = (int)diFurnace.getPowerScaled(70);
|
||||
drawTexturedModalRect(guiLeft + 44, guiTop + 88 - k, 208, 70 - k, 16, k);
|
||||
|
||||
int l = diFurnace.getHeatScaled(142);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 108, 0, 222, l, 16);
|
||||
|
||||
int k = diFurnace.rods;
|
||||
drawTexturedModalRect(guiLeft + 115, guiTop + 107 - 14 - (k * 76 / 100), 208, 36, 18, 14);
|
||||
|
||||
if(diFurnace.rods > 0)
|
||||
drawTexturedModalRect(guiLeft + 52, guiTop + 53, 212, 0, 18, 18);
|
||||
|
||||
int q = diFurnace.getFuelScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 98, guiTop + 106 - q, 176, 124 - q, 16, q);
|
||||
|
||||
int j = diFurnace.getWasteScaled(88);
|
||||
drawTexturedModalRect(guiLeft + 134, guiTop + 106 - j, 192, 124 - j, 16, j);
|
||||
|
||||
int s = diFurnace.size;
|
||||
|
||||
if(s < 8)
|
||||
drawTexturedModalRect(guiLeft + 50, guiTop + 17, 208, 50 + s * 18, 22, 18);
|
||||
else
|
||||
drawTexturedModalRect(guiLeft + 50, guiTop + 17, 230, 50 + (s - 8) * 18, 22, 18);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.tanks[2].getFill() > 0) {
|
||||
int i = diFurnace.getSteamScaled(88);
|
||||
|
||||
//i = (int) Math.min(i, 160);
|
||||
|
||||
int offset = 234;
|
||||
|
||||
switch(diFurnace.tanks[2].getTankType()) {
|
||||
case HOTSTEAM: offset += 4; break;
|
||||
case SUPERHOTSTEAM: offset += 8; break;
|
||||
}
|
||||
|
||||
drawTexturedModalRect(guiLeft + 80, guiTop + 108, 0, offset, i, 4);
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(diFurnace.tanks[0].getSheet());
|
||||
diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 70, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
|
||||
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 + 70, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
diFurnace.tanks[1].renderTank(this, guiLeft + 26, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,6 +306,8 @@ import com.hbm.tileentity.machine.TileEntityMachineRTG;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadGen;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRadar;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactor;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge.ReactorFuelType;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineRefinery;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSPP;
|
||||
@ -659,7 +661,6 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityDecoBlock.class, "tileentity_deco");
|
||||
GameRegistry.registerTileEntity(TileEntityCoreTitanium.class, "tileentity_core_titanium");
|
||||
GameRegistry.registerTileEntity(TileEntityCoreAdvanced.class, "tileentity_core_advanced");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorMultiblock.class, "tileentity_reactor_multiblock");
|
||||
GameRegistry.registerTileEntity(TileEntityFusionMultiblock.class, "tileentity_fusion_multiblock");
|
||||
GameRegistry.registerTileEntity(TileEntityCrashedBomb.class, "tileentity_crashed_balefire");
|
||||
GameRegistry.registerTileEntity(TileEntityCable.class, "tileentity_cable");
|
||||
@ -747,6 +748,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityMachineShredderLarge.class, "tileentity_machine_big_shredder");
|
||||
GameRegistry.registerTileEntity(TileEntityRFDuct.class, "tileentity_hbm_rfduct");
|
||||
GameRegistry.registerTileEntity(TileEntityReactorControl.class, "tileentity_reactor_remote_control");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineReactorLarge.class, "tileentity_large_reactor");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
@ -1597,6 +1599,42 @@ public class MainRegistry
|
||||
HazmatRegistry.instance.registerHazmat(ModItems.euphemium_plate, 12F);
|
||||
HazmatRegistry.instance.registerHazmat(ModItems.euphemium_legs, 9F);
|
||||
HazmatRegistry.instance.registerHazmat(ModItems.euphemium_boots, 3F);
|
||||
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(1, ReactorFuelType.URANIUM, false, ModItems.nugget_uranium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(9, ReactorFuelType.URANIUM, false, ModItems.ingot_uranium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.URANIUM, false, ModItems.rod_uranium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.URANIUM, false, ModItems.rod_dual_uranium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.URANIUM, false, ModItems.rod_quad_uranium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.URANIUM, true, ModItems.rod_uranium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.URANIUM, true, ModItems.rod_dual_uranium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.URANIUM, true, ModItems.rod_quad_uranium_fuel_depleted);
|
||||
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(1, ReactorFuelType.PLUTONIUM, false, ModItems.nugget_plutonium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(9, ReactorFuelType.PLUTONIUM, false, ModItems.ingot_plutonium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.PLUTONIUM, false, ModItems.rod_plutonium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.PLUTONIUM, false, ModItems.rod_dual_plutonium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.PLUTONIUM, false, ModItems.rod_quad_plutonium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.PLUTONIUM, true, ModItems.rod_plutonium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.PLUTONIUM, true, ModItems.rod_dual_plutonium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.PLUTONIUM, true, ModItems.rod_quad_plutonium_fuel_depleted);
|
||||
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(1, ReactorFuelType.MOX, false, ModItems.nugget_mox_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(9, ReactorFuelType.MOX, false, ModItems.ingot_mox_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.MOX, false, ModItems.rod_mox_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.MOX, false, ModItems.rod_dual_mox_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.MOX, false, ModItems.rod_quad_mox_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.MOX, true, ModItems.rod_mox_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.MOX, true, ModItems.rod_dual_mox_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.MOX, true, ModItems.rod_quad_mox_fuel_depleted);
|
||||
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(1, ReactorFuelType.SCHRABIDIUM, false, ModItems.nugget_schrabidium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(9, ReactorFuelType.SCHRABIDIUM, false, ModItems.ingot_schrabidium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.SCHRABIDIUM, false, ModItems.rod_schrabidium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.SCHRABIDIUM, false, ModItems.rod_dual_schrabidium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.SCHRABIDIUM, false, ModItems.rod_quad_schrabidium_fuel);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(6, ReactorFuelType.SCHRABIDIUM, true, ModItems.rod_schrabidium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(12, ReactorFuelType.SCHRABIDIUM, true, ModItems.rod_dual_schrabidium_fuel_depleted);
|
||||
TileEntityMachineReactorLarge.registerFuelEntry(24, ReactorFuelType.SCHRABIDIUM, true, ModItems.rod_quad_schrabidium_fuel_depleted);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@ -11,6 +11,7 @@ import com.hbm.tileentity.machine.TileEntityAMSEmitter;
|
||||
import com.hbm.tileentity.machine.TileEntityAMSLimiter;
|
||||
import com.hbm.tileentity.machine.TileEntityForceField;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
import com.hbm.tileentity.machine.TileEntityRadioRec;
|
||||
@ -154,6 +155,30 @@ public class AuxButtonPacket implements IMessage {
|
||||
}
|
||||
}
|
||||
|
||||
if (te instanceof TileEntityMachineReactorLarge) {
|
||||
TileEntityMachineReactorLarge reactor = (TileEntityMachineReactorLarge)te;
|
||||
|
||||
if(m.id == 0)
|
||||
reactor.rods = m.value;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//} catch (Exception x) { }
|
||||
|
||||
return null;
|
||||
|
||||
@ -17,6 +17,8 @@ import com.hbm.tileentity.machine.TileEntityMachineCoal;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineDiesel;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorLarge.ReactorFuelType;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
|
||||
import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
import com.hbm.tileentity.machine.TileEntityRadioRec;
|
||||
@ -209,6 +211,24 @@ public class AuxGaugePacket implements IMessage {
|
||||
|
||||
nuke.primed = m.value == 1;
|
||||
}
|
||||
if (te instanceof TileEntityMachineReactorLarge) {
|
||||
TileEntityMachineReactorLarge reactor = (TileEntityMachineReactorLarge)te;
|
||||
|
||||
if(m.id == 0)
|
||||
reactor.rods = m.value;
|
||||
if(m.id == 1)
|
||||
reactor.coreHeat = m.value;
|
||||
if(m.id == 2)
|
||||
reactor.hullHeat = m.value;
|
||||
if(m.id == 3)
|
||||
reactor.size = m.value;
|
||||
if(m.id == 4)
|
||||
reactor.fuel = m.value;
|
||||
if(m.id == 5)
|
||||
reactor.waste = m.value;
|
||||
if(m.id == 6)
|
||||
reactor.type = ReactorFuelType.getEnum(m.value);
|
||||
}
|
||||
|
||||
} catch (Exception x) {}
|
||||
return null;
|
||||
|
||||
672
com/hbm/tileentity/machine/TileEntityMachineReactorLarge.java
Normal file
@ -0,0 +1,672 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemFuelRod;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxGaugePacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.saveddata.RadiationSavedData;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineReactorLarge extends TileEntity
|
||||
implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public int hullHeat;
|
||||
public final int maxHullHeat = 100000;
|
||||
public int coreHeat;
|
||||
public final int maxCoreHeat = 50000;
|
||||
public int rods;
|
||||
public final int rodsMax = 100;
|
||||
public int age = 0;
|
||||
public List<IFluidAcceptor> list = new ArrayList();
|
||||
public FluidTank[] tanks;
|
||||
public ReactorFuelType type;
|
||||
public int fuel;
|
||||
public int maxFuel = 240 * fuelMult;
|
||||
public int waste;
|
||||
public int maxWaste = 240 * fuelMult;
|
||||
|
||||
public static int fuelMult = 1000;
|
||||
public static int cycleDuration = 24000;
|
||||
private static int fuelBase = 240 * fuelMult;
|
||||
private static int waterBase = 128 * 1000;
|
||||
private static int coolantBase = 64 * 1000;
|
||||
private static int steamBase = 32 * 1000;
|
||||
|
||||
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 TileEntityMachineReactorLarge() {
|
||||
slots = new ItemStack[8];
|
||||
tanks = new FluidTank[3];
|
||||
tanks[0] = new FluidTank(FluidType.WATER, 128000, 0);
|
||||
tanks[1] = new FluidTank(FluidType.COOLANT, 64000, 1);
|
||||
tanks[2] = new FluidTank(FluidType.STEAM, 32000, 2);
|
||||
type = ReactorFuelType.URANIUM;
|
||||
}
|
||||
|
||||
@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.reactorLarge";
|
||||
}
|
||||
|
||||
@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) {
|
||||
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);
|
||||
|
||||
coreHeat = nbt.getInteger("heat");
|
||||
hullHeat = nbt.getInteger("hullHeat");
|
||||
rods = nbt.getInteger("rods");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
tanks[0].readFromNBT(nbt, "water");
|
||||
tanks[1].readFromNBT(nbt, "coolant");
|
||||
type = ReactorFuelType.getEnum(nbt.getInteger("type"));
|
||||
|
||||
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.setInteger("heat", coreHeat);
|
||||
nbt.setInteger("hullHeat", hullHeat);
|
||||
nbt.setInteger("rods", rods);
|
||||
NBTTagList list = new NBTTagList();
|
||||
tanks[0].writeToNBT(nbt, "water");
|
||||
tanks[1].writeToNBT(nbt, "coolant");
|
||||
nbt.setInteger("type", type.getID());
|
||||
|
||||
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 false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public int getCoreHeatScaled(int i) {
|
||||
return (coreHeat * i) / maxCoreHeat;
|
||||
}
|
||||
|
||||
public int getHullHeatScaled(int i) {
|
||||
return (hullHeat * i) / maxHullHeat;
|
||||
}
|
||||
|
||||
public int getFuelScaled(int i) {
|
||||
return (fuel * i) / maxFuel;
|
||||
}
|
||||
|
||||
public int getWasteScaled(int i) {
|
||||
return (waste * i) / maxWaste;
|
||||
}
|
||||
|
||||
public int getSteamScaled(int i) {
|
||||
return (tanks[2].getFill() * i) / tanks[2].getMaxFill();
|
||||
}
|
||||
|
||||
public boolean hasCoreHeat() {
|
||||
return coreHeat > 0;
|
||||
}
|
||||
|
||||
public boolean hasHullHeat() {
|
||||
return hullHeat > 0;
|
||||
}
|
||||
|
||||
public boolean checkBody() {
|
||||
|
||||
return worldObj.getBlock(xCoord + 1, yCoord, zCoord + 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord, zCoord + 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord, zCoord - 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord + 1, yCoord, zCoord - 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord + 1, yCoord, zCoord) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord, zCoord) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord, yCoord, zCoord + 1) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord, yCoord, zCoord - 1) == ModBlocks.reactor_control;
|
||||
}
|
||||
|
||||
public boolean checkSegment(int offset) {
|
||||
|
||||
return worldObj.getBlock(xCoord + 1, yCoord + offset, zCoord + 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord + offset, zCoord + 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord + offset, zCoord - 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord + 1, yCoord + offset, zCoord - 1) == ModBlocks.reactor_element &&
|
||||
worldObj.getBlock(xCoord + 1, yCoord + offset, zCoord) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord - 1, yCoord + offset, zCoord) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord, yCoord + offset, zCoord + 1) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord, yCoord + offset, zCoord - 1) == ModBlocks.reactor_control &&
|
||||
worldObj.getBlock(xCoord, yCoord + offset, zCoord) == ModBlocks.reactor_conductor;
|
||||
}
|
||||
|
||||
int height;
|
||||
int depth;
|
||||
public int size;
|
||||
|
||||
private void caluclateSize() {
|
||||
|
||||
height = 0;
|
||||
depth = 0;
|
||||
|
||||
for(int i = 0; i < 7; i++) {
|
||||
|
||||
if(checkSegment(i + 1))
|
||||
height++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 7; i++) {
|
||||
|
||||
if(checkSegment(-i - 1))
|
||||
depth++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
size = height + depth + 1;
|
||||
}
|
||||
|
||||
private int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
private void generate() {
|
||||
|
||||
int consumption = (maxFuel / cycleDuration) * rods / 100;
|
||||
|
||||
if(consumption > fuel)
|
||||
consumption = fuel;
|
||||
|
||||
if(consumption + waste > maxWaste)
|
||||
consumption = maxWaste - waste;
|
||||
|
||||
fuel -= consumption;
|
||||
waste += consumption;
|
||||
|
||||
int heat = consumption * type.heat / fuelMult;
|
||||
|
||||
this.coreHeat += heat;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if (!worldObj.isRemote && checkBody()) {
|
||||
|
||||
age++;
|
||||
if (age >= 20) {
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if (age == 9 || age == 19)
|
||||
fillFluidInit(tanks[2].getTankType());
|
||||
|
||||
caluclateSize();
|
||||
|
||||
tanks[0].changeTankSize(waterBase * getSize());
|
||||
tanks[1].changeTankSize(coolantBase * getSize());
|
||||
tanks[2].changeTankSize(steamBase * getSize());
|
||||
}
|
||||
|
||||
maxWaste = maxFuel = fuelBase * getSize();
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
if(waste > maxWaste)
|
||||
waste = maxWaste;
|
||||
|
||||
if(fuel > maxFuel)
|
||||
fuel = maxFuel;
|
||||
|
||||
tanks[0].loadTank(0, 1, slots);
|
||||
tanks[1].loadTank(2, 3, slots);
|
||||
|
||||
if(fuel == 0) {
|
||||
|
||||
if(slots[4] != null && !getFuelType(slots[4].getItem()).toString().equals(ReactorFuelType.UNKNOWN.toString())) {
|
||||
|
||||
this.type = getFuelType(slots[4].getItem());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[4] != null && getFuelContent(slots[4].getItem(), type) > 0) {
|
||||
|
||||
int cont = getFuelContent(slots[4].getItem(), type) * fuelMult;
|
||||
|
||||
System.out.println(type.toString());
|
||||
|
||||
if(fuel + cont <= maxFuel) {
|
||||
|
||||
if(!slots[4].getItem().hasContainerItem()) {
|
||||
|
||||
slots[4].stackSize--;
|
||||
fuel += cont;
|
||||
|
||||
} else if(slots[5] == null) {
|
||||
|
||||
slots[5] = new ItemStack(slots[4].getItem().getContainerItem());
|
||||
slots[4].stackSize--;
|
||||
fuel += cont;
|
||||
|
||||
} else if(slots[4].getItem().getContainerItem() == slots[5].getItem() && slots[5].stackSize < slots[5].getMaxStackSize()) {
|
||||
|
||||
slots[4].stackSize--;
|
||||
slots[5].stackSize++;
|
||||
fuel += cont;
|
||||
|
||||
}
|
||||
|
||||
if(slots[4].stackSize == 0)
|
||||
slots[4] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(rods > 0)
|
||||
generate();
|
||||
|
||||
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) {
|
||||
generateSteam();
|
||||
this.hullHeat -= this.hullHeat * 0.085;
|
||||
}
|
||||
|
||||
if (this.coreHeat > maxCoreHeat) {
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if (rods > 0 && coreHeat > 0 /*rad block*/) {
|
||||
|
||||
float rad = (float)coreHeat / (float)maxCoreHeat * 50F;
|
||||
RadiationSavedData data = RadiationSavedData.getData(worldObj);
|
||||
data.incrementRad(worldObj, xCoord, zCoord, rad, rad * 4);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, rods, 0));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, coreHeat, 1));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 2));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, size, 3));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, fuel, 4));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, waste, 5));
|
||||
PacketDispatcher.wrapper.sendToAll(new AuxGaugePacket(xCoord, yCoord, zCoord, type.getID(), 6));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
private void generateSteam() {
|
||||
|
||||
//function of SHS produced per tick
|
||||
//maxes out at heat% * tank capacity / 20
|
||||
double steam = (((double)hullHeat / (double)maxHullHeat) * ((double)tanks[2].getMaxFill() / 50D)) * size;
|
||||
|
||||
double water = steam;
|
||||
|
||||
switch(tanks[2].getTankType()) {
|
||||
case STEAM:
|
||||
water /= 100D;
|
||||
break;
|
||||
case HOTSTEAM:
|
||||
water /= 10;
|
||||
break;
|
||||
case SUPERHOTSTEAM:
|
||||
break;
|
||||
}
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - (int)Math.ceil(water));
|
||||
tanks[2].setFill(tanks[2].getFill() + (int)Math.floor(steam));
|
||||
|
||||
if(tanks[0].getFill() < 0)
|
||||
tanks[0].setFill(0);
|
||||
|
||||
if(tanks[2].getFill() > tanks[2].getMaxFill())
|
||||
tanks[2].setFill(tanks[2].getMaxFill());
|
||||
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
for (int i = 0; i < slots.length; i++) {
|
||||
this.slots[i] = null;
|
||||
}
|
||||
|
||||
worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 7.5F, true);
|
||||
ExplosionNukeGeneric.waste(worldObj, this.xCoord, this.yCoord, this.zCoord, 35);
|
||||
worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, ModBlocks.toxic_block);
|
||||
|
||||
for(int i = yCoord - depth; i <= yCoord + height; i++) {
|
||||
|
||||
if(worldObj.rand.nextInt(4) == 0) {
|
||||
worldObj.setBlock(this.xCoord + 1, i, this.zCoord + 1, ModBlocks.toxic_block);
|
||||
}
|
||||
if(worldObj.rand.nextInt(4) == 0) {
|
||||
worldObj.setBlock(this.xCoord + 1, i, this.zCoord - 1, ModBlocks.toxic_block);
|
||||
}
|
||||
if(worldObj.rand.nextInt(4) == 0) {
|
||||
worldObj.setBlock(this.xCoord - 1, i, this.zCoord - 1, ModBlocks.toxic_block);
|
||||
}
|
||||
if(worldObj.rand.nextInt(4) == 0) {
|
||||
worldObj.setBlock(this.xCoord - 1, i, this.zCoord + 1, ModBlocks.toxic_block);
|
||||
}
|
||||
|
||||
if(worldObj.rand.nextInt(10) == 0) {
|
||||
worldObj.createExplosion(null, this.xCoord, this.yCoord, this.zCoord, 5.0F, true);
|
||||
}
|
||||
}
|
||||
|
||||
RadiationSavedData data = RadiationSavedData.getData(worldObj);
|
||||
data.incrementRad(worldObj, xCoord, zCoord, 1000F, 2000F);
|
||||
}
|
||||
|
||||
@Override
|
||||
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 fillFluidInit(FluidType type) {
|
||||
fillFluid(this.xCoord - 3, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord + 3, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 3, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 3, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@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);
|
||||
else if (type.name().equals(tanks[2].getTankType().name()))
|
||||
tanks[2].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 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 < 3 && tanks[index] != null)
|
||||
tanks[index].setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
if (index < 3 && 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]);
|
||||
list.add(tanks[2]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
list.clear();
|
||||
}
|
||||
|
||||
public enum ReactorFuelType {
|
||||
|
||||
URANIUM(250000),
|
||||
PLUTONIUM(312500),
|
||||
MOX(250000),
|
||||
SCHRABIDIUM(20850000),
|
||||
UNKNOWN(1);
|
||||
|
||||
private ReactorFuelType(int i) {
|
||||
heat = i;
|
||||
}
|
||||
|
||||
//Heat per nugget burned
|
||||
private int heat;
|
||||
|
||||
public int getHeat() {
|
||||
return heat;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return Arrays.asList(ReactorFuelType.values()).indexOf(this);
|
||||
}
|
||||
|
||||
public static ReactorFuelType getEnum(int i) {
|
||||
if(i < ReactorFuelType.values().length)
|
||||
return ReactorFuelType.values()[i];
|
||||
else
|
||||
return ReactorFuelType.URANIUM;
|
||||
}
|
||||
}
|
||||
|
||||
static class ReactorFuelEntry {
|
||||
|
||||
int value;
|
||||
ReactorFuelType type;
|
||||
boolean isWaste;
|
||||
Item item;
|
||||
|
||||
public ReactorFuelEntry(int value, ReactorFuelType type, boolean isWaste, Item item) {
|
||||
this.value = value;
|
||||
this.type = type;
|
||||
this.isWaste = isWaste;
|
||||
this.item = item;
|
||||
}
|
||||
}
|
||||
|
||||
static List<ReactorFuelEntry> entries = new ArrayList();
|
||||
|
||||
public static void registerFuelEntry(int nuggets, ReactorFuelType type, boolean isWaste, Item fuel) {
|
||||
entries.add(new ReactorFuelEntry(nuggets, type, isWaste, fuel));
|
||||
}
|
||||
|
||||
public static int getFuelContent(Item item, ReactorFuelType type) {
|
||||
|
||||
for(ReactorFuelEntry ent : entries) {
|
||||
if(!ent.isWaste && ent.item == item && type.toString().equals(ent.type.toString()))
|
||||
return ent.value;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static ReactorFuelType getFuelType(Item item) {
|
||||
|
||||
for(ReactorFuelEntry ent : entries) {
|
||||
if(!ent.isWaste && ent.item == item)
|
||||
return ent.type;
|
||||
}
|
||||
|
||||
return ReactorFuelType.UNKNOWN;
|
||||
}
|
||||
}
|
||||