Big Reactors
@ -113,6 +113,15 @@ tile.factory_advanced_core.name=Fortgeschrittene Fabrikkernkomponente
|
||||
item.factory_core_advanced.name=Fortgeschrittener Fabrikenergiecluster
|
||||
container.factoryAdvanced=Fortgeschrittene Fabrik
|
||||
|
||||
tile.reactor_element.name=Reaktorkammer
|
||||
tile.reactor_control.name=Steuerstäbe
|
||||
tile.reactor_hatch.name=Kraftwerkszugriffsluke
|
||||
tile.reactor_conductor.name=Stromanschluss
|
||||
tile.reactor_computer.name=Reaktorsteuerung
|
||||
container.reactorMultiblock=Großer Atomreaktor
|
||||
|
||||
item.fuse.name=Sicherung
|
||||
|
||||
tile.test_nuke.name=Test Atombombe
|
||||
|
||||
item.ingot_uranium.name=Uranbarren
|
||||
|
||||
@ -113,6 +113,15 @@ tile.factory_advanced_core.name=Advanced Factory Core Component
|
||||
item.factory_core_advanced.name=Advanced Factory Energy Cluster
|
||||
container.factoryAdvanced=Advanced Factory
|
||||
|
||||
tile.reactor_element.name=Reaktor Chamber
|
||||
tile.reactor_control.name=Control Rods
|
||||
tile.reactor_hatch.name=Reactor Access Hatch
|
||||
tile.reactor_conductor.name=Reactor Electricity Port
|
||||
tile.reactor_computer.name=Reaktor Control
|
||||
container.reactorMultiblock=Big Nuclear Reactor
|
||||
|
||||
item.fuse.name=Fuse
|
||||
|
||||
tile.test_nuke.name=Test Nuke
|
||||
|
||||
item.ingot_uranium.name=Uranium Ingot
|
||||
|
||||
BIN
assets/hbm/textures/blocks/reactor_computer.png
Normal file
|
After Width: | Height: | Size: 538 B |
BIN
assets/hbm/textures/blocks/reactor_conductor_side.png
Normal file
|
After Width: | Height: | Size: 482 B |
BIN
assets/hbm/textures/blocks/reactor_conductor_top.png
Normal file
|
After Width: | Height: | Size: 496 B |
BIN
assets/hbm/textures/blocks/reactor_control_side.png
Normal file
|
After Width: | Height: | Size: 440 B |
BIN
assets/hbm/textures/blocks/reactor_control_top.png
Normal file
|
After Width: | Height: | Size: 405 B |
BIN
assets/hbm/textures/blocks/reactor_element_side.png
Normal file
|
After Width: | Height: | Size: 435 B |
BIN
assets/hbm/textures/blocks/reactor_element_top.png
Normal file
|
After Width: | Height: | Size: 421 B |
BIN
assets/hbm/textures/blocks/reactor_hatch.png
Normal file
|
After Width: | Height: | Size: 513 B |
BIN
assets/hbm/textures/gui/gui_reactor_multiblock.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
assets/hbm/textures/items/fuse.png
Normal file
|
After Width: | Height: | Size: 275 B |
47
com/hbm/blocks/BlockReactor.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockReactor extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconTop;
|
||||
|
||||
protected BlockReactor(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
if(this == ModBlocks.reactor_conductor)
|
||||
{
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":reactor_conductor_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":reactor_conductor_side");
|
||||
}
|
||||
if(this == ModBlocks.reactor_control)
|
||||
{
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":reactor_control_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":reactor_control_side");
|
||||
}
|
||||
if(this == ModBlocks.reactor_element)
|
||||
{
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":reactor_element_top");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":reactor_element_side");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon);
|
||||
}
|
||||
|
||||
}
|
||||
@ -29,9 +29,6 @@ public class MachineGenerator extends BlockContainer {
|
||||
private final Random field_149933_a = new Random();
|
||||
private Random rand;
|
||||
private static boolean keepInventory;
|
||||
public int heat = 0;
|
||||
|
||||
public boolean isLoaded = false;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconSide;
|
||||
@ -141,7 +138,7 @@ public class MachineGenerator extends BlockContainer {
|
||||
if (!p_149723_1_.isRemote)
|
||||
{
|
||||
TileEntityMachineGenerator entity = (TileEntityMachineGenerator) p_149723_1_.getTileEntity(p_149723_2_, p_149723_3_, p_149723_4_);
|
||||
if(this.isLoaded)
|
||||
if(entity != null && entity.isLoaded)
|
||||
{
|
||||
p_149723_1_.createExplosion(null, p_149723_2_, p_149723_3_, p_149723_4_, 18.0F, true);
|
||||
ExplosionNukeGeneric.waste(p_149723_1_, p_149723_2_, p_149723_3_, p_149723_4_, 35);
|
||||
|
||||
@ -183,6 +183,13 @@ public class ModBlocks {
|
||||
public static Block factory_advanced_core;
|
||||
public static final int guiID_factory_advanced = 25;
|
||||
|
||||
public static Block reactor_element;
|
||||
public static Block reactor_control;
|
||||
public static Block reactor_hatch;
|
||||
public static Block reactor_conductor;
|
||||
public static Block reactor_computer;
|
||||
public static final int guiID_reactor_multiblock = 26;
|
||||
|
||||
public static Block launch_pad;
|
||||
public static Block launch_pad_generic;
|
||||
public static Block launch_pad_incendiary;
|
||||
@ -348,6 +355,12 @@ public class ModBlocks {
|
||||
factory_advanced_hull = new BlockGeneric(Material.iron).setBlockName("factory_advanced_hull").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_hull");
|
||||
factory_advanced_furnace = new FactoryHatch(Material.iron).setBlockName("factory_advanced_furnace").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_furnace");
|
||||
factory_advanced_core = new FactoryCoreAdvanced(Material.iron).setBlockName("factory_advanced_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":factory_advanced_core");
|
||||
|
||||
reactor_element = new BlockReactor(Material.iron).setBlockName("reactor_element").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":reactor_element_side");
|
||||
reactor_control = new BlockReactor(Material.iron).setBlockName("reactor_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":reactor_control_side");
|
||||
reactor_hatch = new ReactorHatch(Material.iron).setBlockName("reactor_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":brick_concrete");
|
||||
reactor_conductor = new BlockReactor(Material.iron).setBlockName("reactor_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":reactor_conductor_side");
|
||||
reactor_computer = new ReactorCore(Material.iron).setBlockName("reactor_computer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":reactor_computer");
|
||||
|
||||
launch_pad = new LaunchPad(Material.iron).setBlockName("launch_pad").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabNuke).setBlockTextureName(RefStrings.MODID + ":launch_pad");
|
||||
launch_pad_generic = new LaunchPad(Material.iron).setBlockName("launch_pad_generic").setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":launch_pad");
|
||||
@ -496,7 +509,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_coal_off, machine_coal_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_coal_on, machine_coal_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_generator, machine_generator.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
|
||||
//GameRegistry.registerBlock(red_wire_coated, red_wire_coated.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_battery, machine_battery.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_off, machine_electric_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_on, machine_electric_furnace_on.getUnlocalizedName());
|
||||
@ -510,6 +523,13 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(factory_advanced_furnace, factory_advanced_furnace.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(factory_advanced_core, factory_advanced_core.getUnlocalizedName());
|
||||
|
||||
//Multiblock Generators
|
||||
GameRegistry.registerBlock(reactor_element, reactor_element.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_control, reactor_control.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_hatch, reactor_hatch.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_conductor, reactor_conductor.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(reactor_computer, reactor_computer.getUnlocalizedName());
|
||||
|
||||
//Launch Pads
|
||||
GameRegistry.registerBlock(launch_pad, launch_pad.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(launch_pad_generic, launch_pad_generic.getUnlocalizedName());
|
||||
|
||||
97
com/hbm/blocks/ReactorCore.java
Normal file
@ -0,0 +1,97 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ReactorCore extends BlockContainer {
|
||||
|
||||
public boolean keepInventory = false;
|
||||
public Random field_149933_a = new Random();
|
||||
|
||||
protected ReactorCore(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityReactorMultiblock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityReactorMultiblock tileentityfurnace = (TileEntityReactorMultiblock)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
|
||||
@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_);
|
||||
if(entity != null && entity.isLoaded)
|
||||
{
|
||||
entity.explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
178
com/hbm/blocks/ReactorHatch.java
Normal file
@ -0,0 +1,178 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ReactorHatch extends Block {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconFront;
|
||||
|
||||
protected ReactorHatch(Material p_i45394_1_) {
|
||||
super(p_i45394_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconFront = iconRegister.registerIcon(RefStrings.MODID + ":reactor_hatch");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":brick_concrete");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
return metadata == 0 && side == 3 ? this.iconFront : (side == metadata ? this.iconFront : this.blockIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
//this.setDefaultDirection(world, x, y, z);
|
||||
}
|
||||
|
||||
private void setDefaultDirection(World world, int x, int y, int z) {
|
||||
if(!world.isRemote)
|
||||
{
|
||||
Block block1 = world.getBlock(x, y, z - 1);
|
||||
Block block2 = world.getBlock(x, y, z + 1);
|
||||
Block block3 = world.getBlock(x - 1, y, z);
|
||||
Block block4 = world.getBlock(x + 1, y, z);
|
||||
|
||||
byte b0 = 3;
|
||||
|
||||
if(block1.func_149730_j() && !block2.func_149730_j())
|
||||
{
|
||||
b0 = 3;
|
||||
}
|
||||
if(block2.func_149730_j() && !block1.func_149730_j())
|
||||
{
|
||||
b0 = 2;
|
||||
}
|
||||
if(block3.func_149730_j() && !block4.func_149730_j())
|
||||
{
|
||||
b0 = 5;
|
||||
}
|
||||
if(block4.func_149730_j() && !block3.func_149730_j())
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, b0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if(i == 0)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
if(world.getBlockMetadata(x, y, z) == 2)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z + 2) instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x, y, z + 2)).isStructureValid(world))
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x, y, z + 2);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor] Error: Reactor Structure not valid!"));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor Error: Reactor Core not found!"));
|
||||
}
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 3)
|
||||
{
|
||||
if(world.getTileEntity(x, y, z - 2) instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x, y, z - 2)).isStructureValid(world))
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x, y, z - 2);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor] Error: Reactor Structure not valid!"));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor Error: Reactor Core not found!"));
|
||||
}
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 4)
|
||||
{
|
||||
if(world.getTileEntity(x + 2, y, z) instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x + 2, y, z)).isStructureValid(world))
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x + 2, y, z);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor] Error: Reactor Structure not valid!"));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor Error: Reactor Core not found!"));
|
||||
}
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z) == 5)
|
||||
{
|
||||
if(world.getTileEntity(x - 2, y, z) instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
if(((TileEntityReactorMultiblock)world.getTileEntity(x - 2, y, z)).isStructureValid(world))
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_reactor_multiblock, world, x - 2, y, z);
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor] Error: Reactor Structure not valid!"));
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(new ChatComponentText("[Nuclear Reactor Error: Reactor Core not found!"));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.items.ItemFuelRod;
|
||||
import com.hbm.items.ModItems;
|
||||
@ -25,6 +27,7 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
public final int heatMax = 100000;
|
||||
public int power;
|
||||
public final int powerMax = 100000;
|
||||
public boolean isLoaded = false;
|
||||
|
||||
private static final int[] slots_top = new int[] {};
|
||||
private static final int[] slots_bottom = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
|
||||
@ -482,12 +485,12 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
}
|
||||
|
||||
if(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) instanceof MachineGenerator)
|
||||
((MachineGenerator)this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord)).isLoaded = false;
|
||||
this.isLoaded = false;
|
||||
|
||||
} else {
|
||||
|
||||
if(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) instanceof MachineGenerator)
|
||||
((MachineGenerator)this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord)).isLoaded = true;
|
||||
this.isLoaded = true;
|
||||
}
|
||||
}
|
||||
/*//Electric Furnace
|
||||
@ -800,9 +803,13 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve
|
||||
}
|
||||
|
||||
public void attemptHeat(int i) {
|
||||
if(this.cool - i >= 0)
|
||||
Random rand = new Random();
|
||||
|
||||
int j = rand.nextInt(i);
|
||||
|
||||
if(this.cool - j >= 0)
|
||||
{
|
||||
this.cool -= i;
|
||||
this.cool -= j;
|
||||
} else {
|
||||
this.heat += i;
|
||||
}
|
||||
|
||||
757
com/hbm/blocks/TileEntityReactorMultiblock.java
Normal file
@ -0,0 +1,757 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.entity.EntityNuclearCreeper;
|
||||
import com.hbm.entity.EntityNukeCloudSmall;
|
||||
import com.hbm.entity.EntityNukeExplosionAdvanced;
|
||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||
import com.hbm.explosion.ExplosionParticle;
|
||||
import com.hbm.interfaces.IReactor;
|
||||
import com.hbm.items.ItemFuelRod;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityCreeper;
|
||||
import net.minecraft.entity.passive.EntityMooshroom;
|
||||
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.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileEntityReactorMultiblock extends TileEntity implements ISidedInventory, IReactor {
|
||||
|
||||
public int water;
|
||||
public final static int waterMax = 10000000;
|
||||
public int cool;
|
||||
public final static int coolMax = 10000000;
|
||||
public int heat;
|
||||
public final static int heatMax = 1000000;
|
||||
public int power;
|
||||
public final static int maxPower = 1000000;
|
||||
private ItemStack slots[];
|
||||
|
||||
public boolean isLoaded = false;
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityReactorMultiblock() {
|
||||
slots = new ItemStack[34];
|
||||
}
|
||||
@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.reactorMultiblock";
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@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 int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
water = nbt.getShort("water");
|
||||
cool = nbt.getShort("cool");
|
||||
power = nbt.getShort("power");
|
||||
heat = nbt.getShort("heat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setShort("water", (short) water);
|
||||
nbt.setShort("cool", (short) cool);
|
||||
nbt.setShort("power", (short) power);
|
||||
nbt.setShort("heat", (short) heat);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
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 void updateEntity() {
|
||||
if(isStructureValid(worldObj))
|
||||
{
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(slots[30] != null && slots[30].getItem() == Items.water_bucket && this.water + 250000 <= waterMax)
|
||||
{
|
||||
this.slots[30].stackSize--;
|
||||
this.water += 250000;
|
||||
if(this.slots[30].stackSize == 0)
|
||||
{
|
||||
this.slots[30] = this.slots[30].getItem().getContainerItem(this.slots[30]);
|
||||
}
|
||||
}
|
||||
if(slots[30] != null && slots[30].getItem() == ModItems.rod_water && this.water + 250000 <= waterMax)
|
||||
{
|
||||
this.slots[30].stackSize--;
|
||||
this.water += 250000;
|
||||
if(this.slots[30].stackSize == 0)
|
||||
{
|
||||
this.slots[30] = this.slots[30].getItem().getContainerItem(this.slots[30]);
|
||||
}
|
||||
}
|
||||
if(slots[30] != null && slots[30].getItem() == ModItems.rod_dual_water && this.water + 500000 <= waterMax)
|
||||
{
|
||||
this.slots[30].stackSize--;
|
||||
this.water += 500000;
|
||||
if(this.slots[30].stackSize == 0)
|
||||
{
|
||||
this.slots[30] = this.slots[30].getItem().getContainerItem(this.slots[30]);
|
||||
}
|
||||
}
|
||||
if(slots[30] != null && slots[30].getItem() == ModItems.rod_quad_water && this.water + 1000000 <= waterMax)
|
||||
{
|
||||
this.slots[30].stackSize--;
|
||||
this.water += 1000000;
|
||||
if(this.slots[30].stackSize == 0)
|
||||
{
|
||||
this.slots[30] = this.slots[30].getItem().getContainerItem(this.slots[30]);
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[31] != null && slots[31].getItem() == ModItems.rod_coolant && this.cool + 250000 <= coolMax)
|
||||
{
|
||||
this.slots[31].stackSize--;
|
||||
this.cool += 250000;
|
||||
if(this.slots[31].stackSize == 0)
|
||||
{
|
||||
this.slots[31] = this.slots[31].getItem().getContainerItem(this.slots[31]);
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[31] != null && slots[31].getItem() == ModItems.rod_dual_coolant && this.cool + 500000 <= coolMax)
|
||||
{
|
||||
this.slots[31].stackSize--;
|
||||
this.cool += 500000;
|
||||
if(this.slots[31].stackSize == 0)
|
||||
{
|
||||
this.slots[31] = this.slots[31].getItem().getContainerItem(this.slots[31]);
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[31] != null && slots[31].getItem() == ModItems.rod_quad_coolant && this.cool + 1000000 <= coolMax)
|
||||
{
|
||||
this.slots[31].stackSize--;
|
||||
this.cool += 1000000;
|
||||
if(this.slots[31].stackSize == 0)
|
||||
{
|
||||
this.slots[31] = this.slots[31].getItem().getContainerItem(this.slots[31]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(slots[33] != null && slots[33].getItem() == ModItems.fuse)
|
||||
{
|
||||
for(int i = 0; i < 30; i++)
|
||||
{
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_uranium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(10);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_uranium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(10);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_uranium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(10);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_plutonium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(15);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_plutonium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(15);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_plutonium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(2);
|
||||
attemptPower(15);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_mox_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(5);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_mox_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(5);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_mox_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(1);
|
||||
attemptPower(5);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_schrabidium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(25);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_dual_schrabidium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(25);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
if(slots[i] != null && slots[i].getItem() == ModItems.rod_quad_schrabidium_fuel)
|
||||
{
|
||||
int j = slots[i].getItemDamage();
|
||||
this.slots[i].setItemDamage(j += 1);
|
||||
attemptHeat(10);
|
||||
attemptPower(25);
|
||||
|
||||
if(this.slots[i].getItemDamage() == this.slots[i].getMaxDamage())
|
||||
{
|
||||
this.slots[i] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.power > maxPower)
|
||||
{
|
||||
this.power = maxPower;
|
||||
}
|
||||
|
||||
if(this.heat > heatMax)
|
||||
{
|
||||
this.explode();
|
||||
}
|
||||
|
||||
if(((slots[0] != null && slots[0].getItem() instanceof ItemFuelRod) || slots[0] == null) &&
|
||||
((slots[1] != null && !(slots[1].getItem() instanceof ItemFuelRod)) || slots[1] == null) &&
|
||||
((slots[2] != null && !(slots[2].getItem() instanceof ItemFuelRod)) || slots[2] == null) &&
|
||||
((slots[3] != null && !(slots[3].getItem() instanceof ItemFuelRod)) || slots[3] == null) &&
|
||||
((slots[4] != null && !(slots[4].getItem() instanceof ItemFuelRod)) || slots[4] == null) &&
|
||||
((slots[5] != null && !(slots[5].getItem() instanceof ItemFuelRod)) || slots[5] == null) &&
|
||||
((slots[6] != null && !(slots[6].getItem() instanceof ItemFuelRod)) || slots[6] == null) &&
|
||||
((slots[7] != null && !(slots[7].getItem() instanceof ItemFuelRod)) || slots[7] == null) &&
|
||||
((slots[8] != null && !(slots[8].getItem() instanceof ItemFuelRod)) || slots[8] == null) &&
|
||||
((slots[9] != null && !(slots[9].getItem() instanceof ItemFuelRod)) || slots[9] == null) &&
|
||||
((slots[10] != null && !(slots[10].getItem() instanceof ItemFuelRod)) || slots[10] == null) &&
|
||||
((slots[11] != null && !(slots[11].getItem() instanceof ItemFuelRod)) || slots[11] == null) &&
|
||||
((slots[12] != null && !(slots[12].getItem() instanceof ItemFuelRod)) || slots[12] == null) &&
|
||||
((slots[13] != null && !(slots[13].getItem() instanceof ItemFuelRod)) || slots[13] == null) &&
|
||||
((slots[14] != null && !(slots[14].getItem() instanceof ItemFuelRod)) || slots[14] == null) &&
|
||||
((slots[15] != null && !(slots[15].getItem() instanceof ItemFuelRod)) || slots[15] == null) &&
|
||||
((slots[16] != null && !(slots[16].getItem() instanceof ItemFuelRod)) || slots[16] == null) &&
|
||||
((slots[17] != null && !(slots[17].getItem() instanceof ItemFuelRod)) || slots[17] == null) &&
|
||||
((slots[18] != null && !(slots[18].getItem() instanceof ItemFuelRod)) || slots[18] == null) &&
|
||||
((slots[19] != null && !(slots[19].getItem() instanceof ItemFuelRod)) || slots[19] == null) &&
|
||||
((slots[20] != null && !(slots[20].getItem() instanceof ItemFuelRod)) || slots[20] == null) &&
|
||||
((slots[21] != null && !(slots[21].getItem() instanceof ItemFuelRod)) || slots[21] == null) &&
|
||||
((slots[22] != null && !(slots[22].getItem() instanceof ItemFuelRod)) || slots[22] == null) &&
|
||||
((slots[23] != null && !(slots[23].getItem() instanceof ItemFuelRod)) || slots[23] == null) &&
|
||||
((slots[24] != null && !(slots[24].getItem() instanceof ItemFuelRod)) || slots[24] == null) &&
|
||||
((slots[25] != null && !(slots[25].getItem() instanceof ItemFuelRod)) || slots[25] == null) &&
|
||||
((slots[26] != null && !(slots[26].getItem() instanceof ItemFuelRod)) || slots[26] == null) &&
|
||||
((slots[27] != null && !(slots[27].getItem() instanceof ItemFuelRod)) || slots[27] == null) &&
|
||||
((slots[28] != null && !(slots[28].getItem() instanceof ItemFuelRod)) || slots[28] == null) &&
|
||||
((slots[29] != null && !(slots[29].getItem() instanceof ItemFuelRod)) || slots[29] == null))
|
||||
{
|
||||
if(this.heat - 10 >= 0 && this.cool - 10 >= 0)
|
||||
{
|
||||
this.heat -= 10;
|
||||
this.cool -= 10;
|
||||
}
|
||||
|
||||
if(this.heat < 10 && this.cool != 0)
|
||||
{
|
||||
this.heat--;
|
||||
this.cool--;
|
||||
}
|
||||
|
||||
if(this.heat != 0 && this.cool == 0)
|
||||
{
|
||||
this.heat--;
|
||||
}
|
||||
|
||||
if(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) instanceof MachineGenerator)
|
||||
isLoaded = false;
|
||||
|
||||
} else {
|
||||
|
||||
if(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) instanceof MachineGenerator)
|
||||
isLoaded = true;
|
||||
|
||||
if(!this.isCoatingValid(worldObj))
|
||||
{
|
||||
int strength = 20;
|
||||
float f = strength;
|
||||
HashSet hashset = new HashSet();
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
double d5;
|
||||
double d6;
|
||||
double d7;
|
||||
double wat = 20;
|
||||
boolean isOccupied = false;
|
||||
|
||||
i = MathHelper.floor_double(this.xCoord - wat - 1.0D);
|
||||
j = MathHelper.floor_double(this.xCoord + wat + 1.0D);
|
||||
k = MathHelper.floor_double(this.yCoord - wat - 1.0D);
|
||||
int i2 = MathHelper.floor_double(this.yCoord + wat + 1.0D);
|
||||
int l = MathHelper.floor_double(this.zCoord - wat - 1.0D);
|
||||
int j2 = MathHelper.floor_double(this.zCoord + wat + 1.0D);
|
||||
List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2));
|
||||
Vec3 vec3 = Vec3.createVectorHelper(this.xCoord, this.yCoord, this.zCoord);
|
||||
|
||||
for (int i1 = 0; i1 < list.size(); ++i1)
|
||||
{
|
||||
Entity entity = (Entity)list.get(i1);
|
||||
double d4 = entity.getDistance(this.xCoord, this.yCoord, this.zCoord) / 4;
|
||||
|
||||
if (d4 <= 20)
|
||||
{
|
||||
d5 = entity.posX - this.xCoord;
|
||||
d6 = entity.posY + entity.getEyeHeight() - this.yCoord;
|
||||
d7 = entity.posZ - this.zCoord;
|
||||
double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
|
||||
if (d9 < wat)
|
||||
{
|
||||
if(entity instanceof EntityPlayer && Library.checkForHazmat((EntityPlayer)entity))
|
||||
{
|
||||
/*Library.damageSuit(((EntityPlayer)entity), 0);
|
||||
Library.damageSuit(((EntityPlayer)entity), 1);
|
||||
Library.damageSuit(((EntityPlayer)entity), 2);
|
||||
Library.damageSuit(((EntityPlayer)entity), 3);*/
|
||||
|
||||
} else if(entity instanceof EntityCreeper) {
|
||||
EntityNuclearCreeper creep = new EntityNuclearCreeper(this.worldObj);
|
||||
creep.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);
|
||||
//creep.setRotationYawHead(((EntityCreeper)entity).rotationYawHead);
|
||||
if(!entity.isDead)
|
||||
if(!worldObj.isRemote)
|
||||
worldObj.spawnEntityInWorld(creep);
|
||||
entity.setDead();
|
||||
} else if(entity instanceof EntityLivingBase && !(entity instanceof EntityNuclearCreeper) && !(entity instanceof EntityMooshroom))
|
||||
{
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.getId(), 2 * 60 * 20, 2));
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.wither.getId(), 20, 4));
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 1 * 60 * 20, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Batteries
|
||||
if(power - 100 >= 0 && slots[32] != null && slots[32].getItem() == ModItems.battery_generic && slots[32].getItemDamage() > 0)
|
||||
{
|
||||
power -= 100;
|
||||
slots[32].setItemDamage(slots[32].getItemDamage() - 1);
|
||||
}
|
||||
if(power - 100 >= 0 && slots[32] != null && slots[32].getItem() == ModItems.battery_advanced && slots[32].getItemDamage() > 0)
|
||||
{
|
||||
power -= 100;
|
||||
slots[32].setItemDamage(slots[32].getItemDamage() - 1);
|
||||
}
|
||||
if(power - 100 >= 0 && slots[32] != null && slots[32].getItem() == ModItems.battery_schrabidium && slots[32].getItemDamage() > 0)
|
||||
{
|
||||
power -= 100;
|
||||
slots[32].setItemDamage(slots[32].getItemDamage() - 1);
|
||||
}
|
||||
if(power - 100 >= 0 && slots[32] != null && slots[32].getItem() == ModItems.factory_core_titanium && slots[32].getItemDamage() > 0)
|
||||
{
|
||||
power -= 100;
|
||||
slots[32].setItemDamage(slots[32].getItemDamage() - 1);
|
||||
}
|
||||
if(power - 100 >= 0 && slots[32] != null && slots[32].getItem() == ModItems.factory_core_advanced && slots[32].getItemDamage() > 0)
|
||||
{
|
||||
power -= 100;
|
||||
slots[32].setItemDamage(slots[32].getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStructureValid(World world) {
|
||||
if(world.getBlock(this.xCoord, this.yCoord, this.zCoord) == ModBlocks.reactor_computer &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_conductor &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_conductor &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_control &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 0, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 1) == ModBlocks.reactor_element &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord, this.yCoord, this.zCoord + 2) == ModBlocks.reactor_hatch &&
|
||||
world.getBlock(this.xCoord, this.yCoord, this.zCoord - 2) == ModBlocks.reactor_hatch)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCoatingValid(World world) {
|
||||
if(world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 2, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 2, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord - 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 2, this.yCoord + 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord - 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord + 1)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 2, this.yCoord + 1, this.zCoord - 1)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord + 2)== ModBlocks.brick_concrete &&
|
||||
|
||||
world.getBlock(this.xCoord + 1, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord - 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord + 1, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete &&
|
||||
world.getBlock(this.xCoord - 1, this.yCoord + 1, this.zCoord - 2)== ModBlocks.brick_concrete)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterScaled(int i) {
|
||||
return (water * i) / waterMax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCoolantScaled(int i) {
|
||||
return (cool * i) / coolMax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPowerScaled(int i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeatScaled(int i) {
|
||||
return (heat * i) / heatMax;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFuse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void attemptPower(int i) {
|
||||
if(this.water - i >= 0)
|
||||
{
|
||||
this.power += i;
|
||||
this.water -= i;
|
||||
}
|
||||
}
|
||||
|
||||
public void attemptHeat(int i) {
|
||||
Random rand = new Random();
|
||||
|
||||
int j = rand.nextInt(i);
|
||||
|
||||
if(this.cool - j >= 0)
|
||||
{
|
||||
this.cool -= j;
|
||||
} else {
|
||||
this.heat += i;
|
||||
}
|
||||
}
|
||||
|
||||
public void explode() {
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
this.slots[i] = null;
|
||||
}
|
||||
|
||||
EntityNukeExplosionAdvanced explosion = new EntityNukeExplosionAdvanced(this.worldObj);
|
||||
explosion.speed = 25;
|
||||
explosion.coefficient = 5.0F;
|
||||
explosion.destructionRange = 35;
|
||||
explosion.posX = this.xCoord;
|
||||
explosion.posY = this.yCoord;
|
||||
explosion.posZ = this.zCoord;
|
||||
this.worldObj.spawnEntityInWorld(explosion);
|
||||
ExplosionParticle.spawnMush(this.worldObj, (int)this.xCoord, (int)this.yCoord - 3, (int)this.zCoord);
|
||||
}
|
||||
}
|
||||
@ -123,5 +123,4 @@ public class ContainerGenerator extends Container {
|
||||
diFurnace.heat = j;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
153
com/hbm/gui/ContainerReactorMultiblock.java
Normal file
@ -0,0 +1,153 @@
|
||||
package com.hbm.gui;
|
||||
|
||||
import com.hbm.blocks.TileEntityMachineGenerator;
|
||||
import com.hbm.blocks.TileEntityReactorMultiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerReactorMultiblock extends Container {
|
||||
|
||||
private TileEntityReactorMultiblock diFurnace;
|
||||
|
||||
private int water;
|
||||
private int cool;
|
||||
private int power;
|
||||
private int heat;
|
||||
|
||||
public ContainerReactorMultiblock(InventoryPlayer invPlayer, TileEntityReactorMultiblock 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
|
||||
this.addSlotToContainer(new Slot(tedf, 30, 8, 90));
|
||||
//Coolant
|
||||
this.addSlotToContainer(new Slot(tedf, 31, 26, 90));
|
||||
//Batteries
|
||||
this.addSlotToContainer(new Slot(tedf, 32, 44, 90));
|
||||
//Fuse
|
||||
this.addSlotToContainer(new Slot(tedf, 33, 8, 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 void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.water);
|
||||
crafting.sendProgressBarUpdate(this, 1, this.diFurnace.cool);
|
||||
crafting.sendProgressBarUpdate(this, 2, this.diFurnace.power);
|
||||
crafting.sendProgressBarUpdate(this, 3, this.diFurnace.heat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
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.water != this.diFurnace.water)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 0, this.diFurnace.water);
|
||||
}
|
||||
|
||||
if(this.cool != this.diFurnace.cool)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 1, this.diFurnace.cool);
|
||||
}
|
||||
|
||||
if(this.power != this.diFurnace.power)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 2, this.diFurnace.power);
|
||||
}
|
||||
|
||||
if(this.heat != this.diFurnace.heat)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 3, this.diFurnace.heat);
|
||||
}
|
||||
}
|
||||
|
||||
this.water = this.diFurnace.water;
|
||||
this.cool = this.diFurnace.cool;
|
||||
this.power = this.diFurnace.power;
|
||||
this.heat = this.diFurnace.heat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if(i == 0)
|
||||
{
|
||||
diFurnace.water = j;
|
||||
}
|
||||
if(i == 1)
|
||||
{
|
||||
diFurnace.cool = j;
|
||||
}
|
||||
if(i == 2)
|
||||
{
|
||||
diFurnace.power = j;
|
||||
}
|
||||
if(i == 3)
|
||||
{
|
||||
diFurnace.heat = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
56
com/hbm/gui/GUIReactorMultiblock.java
Normal file
@ -0,0 +1,56 @@
|
||||
package com.hbm.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.TileEntityMachineGenerator;
|
||||
import com.hbm.blocks.TileEntityReactorMultiblock;
|
||||
import com.hbm.blocks.TileEntityRtgFurnace;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIReactorMultiblock extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_reactor_multiblock.png");
|
||||
private TileEntityReactorMultiblock diFurnace;
|
||||
|
||||
public GUIReactorMultiblock(InventoryPlayer invPlayer, TileEntityReactorMultiblock tedf) {
|
||||
super(new ContainerReactorMultiblock(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@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 i = diFurnace.getWaterScaled(70);
|
||||
drawTexturedModalRect(guiLeft + 8, guiTop + 88 - i, 176, 70 - i, 16, i);
|
||||
|
||||
int j = diFurnace.getCoolantScaled(70);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 88 - j, 192, 70 - j, 16, j);
|
||||
|
||||
int k = diFurnace.getPowerScaled(70);
|
||||
drawTexturedModalRect(guiLeft + 44, guiTop + 88 - k, 208, 70 - k, 16, k);
|
||||
|
||||
int l = diFurnace.getHeatScaled(124);
|
||||
drawTexturedModalRect(guiLeft + 26, guiTop + 108, 0, 222, l, 16);
|
||||
}
|
||||
}
|
||||
21
com/hbm/interfaces/IReactor.java
Normal file
@ -0,0 +1,21 @@
|
||||
package com.hbm.interfaces;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IReactor {
|
||||
|
||||
boolean isStructureValid(World world);
|
||||
|
||||
boolean isCoatingValid(World world);
|
||||
|
||||
boolean hasFuse();
|
||||
|
||||
int getWaterScaled(int i);
|
||||
|
||||
int getCoolantScaled(int i);
|
||||
|
||||
int getPowerScaled(int i);
|
||||
|
||||
int getHeatScaled(int i);
|
||||
|
||||
}
|
||||
@ -289,6 +289,16 @@ public class ItemCustomLore extends Item {
|
||||
list.add("and some shards are missing.");
|
||||
list.add("It stopped ticking at 2:34.");
|
||||
}
|
||||
|
||||
if(this == ModItems.fuse)
|
||||
{
|
||||
list.add("This item is needed for every large");
|
||||
list.add("nuclear reactor, as it allows the");
|
||||
list.add("reactor to generate electricity and");
|
||||
list.add("use up it's fuel. Removing the fuse");
|
||||
list.add("from a reactor will instantly shut");
|
||||
list.add("it down.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -356,6 +356,7 @@ public class ModItems {
|
||||
public static Item battery_creative;
|
||||
|
||||
public static Item fusion_core;
|
||||
public static Item fuse;
|
||||
|
||||
public static Item factory_core_titanium;
|
||||
public static Item factory_core_advanced;
|
||||
@ -765,6 +766,7 @@ public class ModItems {
|
||||
battery_creative = new Item().setUnlocalizedName("battery_creative").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":battery_creative");
|
||||
|
||||
fusion_core = new ItemBattery(5000).setUnlocalizedName("fusion_core").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fusion_core");
|
||||
fuse = new ItemCustomLore().setUnlocalizedName("fuse").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fuse");
|
||||
|
||||
factory_core_titanium = new ItemBattery(70400).setUnlocalizedName("factory_core_titanium").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":factory_core_titanium");
|
||||
factory_core_advanced = new ItemBattery(41600).setUnlocalizedName("factory_core_advanced").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":factory_core_advanced");
|
||||
@ -1024,6 +1026,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(fusion_core, fusion_core.getUnlocalizedName());
|
||||
GameRegistry.registerItem(factory_core_titanium, factory_core_titanium.getUnlocalizedName());
|
||||
GameRegistry.registerItem(factory_core_advanced, factory_core_advanced.getUnlocalizedName());
|
||||
GameRegistry.registerItem(fuse, fuse.getUnlocalizedName());
|
||||
|
||||
//Fuelrods
|
||||
GameRegistry.registerItem(rod_empty, rod_empty.getUnlocalizedName());
|
||||
|
||||
@ -333,7 +333,7 @@ public class CraftingManager {
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_rtg_furnace_off), 1), new Object[] { "NNN", "NFN", "UUU", 'N', ModItems.neutron_reflector, 'U', ModItems.rtg_unit, 'F', Item.getItemFromBlock(Blocks.furnace) });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', ModItems.ingot_beryllium, 'R', ModItems.coil_tungsten, 'W', ModItems.wire_red_copper, 'F', Item.getItemFromBlock(Blocks.furnace) });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_generator), 1), new Object[] { "SLS", "LCL", "SLS", 'C', ModItems.circuit_red_copper, 'L', ModItems.rod_quad_lead, 'S', ModItems.ingot_steel });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.red_wire_coated), 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.ingot_tungsten, 'I', ModItems.ingot_red_copper, 'R', ModItems.wire_red_copper });
|
||||
//GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.red_wire_coated), 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.ingot_tungsten, 'I', ModItems.ingot_red_copper, 'R', ModItems.wire_red_copper });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_deuterium), 1), new Object[] { "TIT", "RFR", "CCC", 'T', ModItems.tank_steel, 'I', ModItems.ingot_titanium, 'R', ModItems.wire_red_copper, 'F', Item.getItemFromBlock(ModBlocks.machine_difurnace_off), 'C', ModItems.coil_tungsten });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_battery), 1), new Object[] { "TST", "RIR", "TLT", 'T', ModItems.ingot_tungsten, 'I', ModItems.ingot_red_copper, 'R', ModItems.wire_red_copper, 'S', Item.getItemFromBlock(ModBlocks.block_sulfur), 'L', Item.getItemFromBlock(ModBlocks.block_lead) });
|
||||
GameRegistry.addRecipe(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_battery), 1), new Object[] { "TLT", "RIR", "TST", 'T', ModItems.ingot_tungsten, 'I', ModItems.ingot_red_copper, 'R', ModItems.wire_red_copper, 'S', Item.getItemFromBlock(ModBlocks.block_sulfur), 'L', Item.getItemFromBlock(ModBlocks.block_lead) });
|
||||
|
||||
@ -23,6 +23,7 @@ import com.hbm.blocks.TileEntityNukeMan;
|
||||
import com.hbm.blocks.TileEntityNukeMike;
|
||||
import com.hbm.blocks.TileEntityNukePrototype;
|
||||
import com.hbm.blocks.TileEntityNukeTsar;
|
||||
import com.hbm.blocks.TileEntityReactorMultiblock;
|
||||
import com.hbm.blocks.TileEntityRtgFurnace;
|
||||
import com.hbm.blocks.TileEntityTestNuke;
|
||||
import com.hbm.gui.ContainerBombMulti;
|
||||
@ -46,6 +47,7 @@ import com.hbm.gui.ContainerNukePrototype;
|
||||
import com.hbm.gui.ContainerNukeTsar;
|
||||
import com.hbm.gui.ContainerPuF6Tank;
|
||||
import com.hbm.gui.ContainerReactor;
|
||||
import com.hbm.gui.ContainerReactorMultiblock;
|
||||
import com.hbm.gui.ContainerRtgFurnace;
|
||||
import com.hbm.gui.ContainerTestNuke;
|
||||
import com.hbm.gui.ContainerUF6Tank;
|
||||
@ -70,6 +72,7 @@ import com.hbm.gui.GUINukeMan;
|
||||
import com.hbm.gui.GUINukeMike;
|
||||
import com.hbm.gui.GUINukePrototype;
|
||||
import com.hbm.gui.GUINukeTsar;
|
||||
import com.hbm.gui.GUIReactorMultiblock;
|
||||
import com.hbm.gui.GUIRtgFurnace;
|
||||
import com.hbm.gui.GUITestDiFurnace;
|
||||
import com.hbm.gui.GUITestNuke;
|
||||
@ -279,6 +282,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new ContainerCoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_reactor_multiblock:
|
||||
{
|
||||
if(entity instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
return new ContainerReactorMultiblock(player.inventory, (TileEntityReactorMultiblock) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -483,6 +494,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new GUICoreAdvanced(player.inventory, (TileEntityCoreAdvanced) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_reactor_multiblock:
|
||||
{
|
||||
if(entity instanceof TileEntityReactorMultiblock)
|
||||
{
|
||||
return new GUIReactorMultiblock(player.inventory, (TileEntityReactorMultiblock) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -46,6 +46,7 @@ import com.hbm.blocks.TileEntityNukeMike;
|
||||
import com.hbm.blocks.TileEntityNukePrototype;
|
||||
import com.hbm.blocks.TileEntityNukeTsar;
|
||||
import com.hbm.blocks.TileEntityObjTester;
|
||||
import com.hbm.blocks.TileEntityReactorMultiblock;
|
||||
import com.hbm.blocks.TileEntityRedBarrel;
|
||||
import com.hbm.blocks.TileEntityRotationTester;
|
||||
import com.hbm.blocks.TileEntityRtgFurnace;
|
||||
@ -204,6 +205,7 @@ 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");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
|
||||