finished cyclotron, recipe tweaks

This commit is contained in:
Bob 2020-09-20 23:31:37 +02:00
parent 94c8552bc8
commit b905837bf1
29 changed files with 742 additions and 782 deletions

View File

@ -1606,7 +1606,7 @@ item.rod_dual_tritium.name=Dual Tritium Cell
item.rod_dual_u233.name=U233 Dual Rod
item.rod_dual_u235.name=U235 Dual Rod
item.rod_dual_u238.name=U238 Dual Rod
item.rod_dual_uranium.name=Uranium Dual Fuel Rod
item.rod_dual_uranium.name=Uranium Dual Rod
item.rod_dual_uranium_fuel.name=Uranium Dual Fuel Rod
item.rod_dual_uranium_fuel_depleted.name=Depleted Uranium Dual Fuel Rod
item.rod_dual_waste.name=Nuclear Waste Dual Rod

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

View File

@ -1820,7 +1820,7 @@ public class ModBlocks {
GameRegistry.registerBlock(machine_generator, machine_generator.getUnlocalizedName());
GameRegistry.registerBlock(machine_controller, machine_controller.getUnlocalizedName());
GameRegistry.registerBlock(machine_reactor_small, machine_reactor_small.getUnlocalizedName());
//GameRegistry.registerBlock(machine_industrial_generator, machine_industrial_generator.getUnlocalizedName());
GameRegistry.registerBlock(machine_industrial_generator, machine_industrial_generator.getUnlocalizedName());
GameRegistry.registerBlock(machine_radgen, machine_radgen.getUnlocalizedName());
GameRegistry.registerBlock(machine_cyclotron, machine_cyclotron.getUnlocalizedName());
GameRegistry.registerBlock(machine_rtg_grey, machine_rtg_grey.getUnlocalizedName());

View File

@ -17,6 +17,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
public class DummyBlockIGenerator extends BlockContainer implements IDummy {
@ -80,23 +81,12 @@ public class DummyBlockIGenerator extends BlockContainer implements IDummy {
@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)
{
if(world.isRemote) {
return true;
} else if(!player.isSneaking())
{
TileEntity te = world.getTileEntity(x, y, z);
if(te != null && te instanceof TileEntityDummy) {
int a = ((TileEntityDummy)te).targetX;
int b = ((TileEntityDummy)te).targetY;
int c = ((TileEntityDummy)te).targetZ;
TileEntityMachineIGenerator entity = (TileEntityMachineIGenerator) world.getTileEntity(a, b, c);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_industrial_generator, world, a, b, c);
}
}
} else if(!player.isSneaking()) {
player.addChatComponentMessage(new ChatComponentText("The IGen has been retired, you may break it for recycling."));
return true;
} else {
return false;

View File

@ -13,7 +13,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

View File

@ -3,6 +3,7 @@ package com.hbm.blocks.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
@ -10,6 +11,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineCyclotron extends BlockDummyable {
@ -23,6 +25,9 @@ public class MachineCyclotron extends BlockDummyable {
if(meta >= 12)
return new TileEntityMachineCyclotron();
if(meta >= 6)
return new TileEntityProxyCombo(false, true, true);
return null;
}
@ -69,4 +74,17 @@ public class MachineCyclotron extends BlockDummyable {
public int getOffset() {
return 2;
}
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
this.makeExtra(world, x + dir.offsetX * o + 2, y, z + dir.offsetZ * o + 1);
this.makeExtra(world, x + dir.offsetX * o + 2, y, z + dir.offsetZ * o - 1);
this.makeExtra(world, x + dir.offsetX * o - 2, y, z + dir.offsetZ * o + 1);
this.makeExtra(world, x + dir.offsetX * o - 2, y, z + dir.offsetZ * o - 1);
this.makeExtra(world, x + dir.offsetX * o + 1, y, z + dir.offsetZ * o + 2);
this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o + 2);
this.makeExtra(world, x + dir.offsetX * o + 1, y, z + dir.offsetZ * o - 2);
this.makeExtra(world, x + dir.offsetX * o - 1, y, z + dir.offsetZ * o - 2);
}
}

View File

@ -1,10 +1,12 @@
package com.hbm.blocks.machine;
import java.util.ArrayList;
import java.util.Random;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.MultiblockHandler;
import com.hbm.interfaces.IMultiblock;
import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityDummy;
import com.hbm.tileentity.machine.TileEntityMachineIGenerator;
@ -16,11 +18,13 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
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.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -37,9 +41,41 @@ public class MachineIGenerator extends BlockContainer implements IMultiblock {
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
return Item.getItemFromBlock(ModBlocks.machine_industrial_generator);
}
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
//front
ret.add(new ItemStack(ModItems.ingot_steel, 3));
ret.add(new ItemStack(ModItems.plate_steel, 6));
ret.add(new ItemStack(ModItems.tank_steel, 4));
ret.add(new ItemStack(ModItems.turbine_titanium, 1));
ret.add(new ItemStack(ModItems.wire_red_copper, 6));
ret.add(new ItemStack(ModItems.wire_gold, 4));
//body
ret.add(new ItemStack(ModItems.wire_gold, 42));
ret.add(new ItemStack(Items.iron_ingot, 6));
ret.add(new ItemStack(ModItems.ingot_steel, 3));
ret.add(new ItemStack(ModItems.plate_iron, 1));
ret.add(new ItemStack(ModItems.wire_gold, 42));
ret.add(new ItemStack(ModItems.ingot_steel, 3));
//rotor
ret.add(new ItemStack(ModItems.wire_gold, 42));
ret.add(new ItemStack(Items.iron_ingot, 6));
ret.add(new ItemStack(ModItems.ingot_steel, 3));
ret.add(new ItemStack(ModItems.ingot_steel, 6));
ret.add(new ItemStack(ModItems.board_copper, 4));
ret.add(new ItemStack(ModItems.wire_gold, 8));
ret.add(new ItemStack(ModBlocks.red_wire_coated, 2));
ret.add(new ItemStack(ModItems.pedestal_steel, 2));
ret.add(new ItemStack(ModItems.circuit_copper, 4));
return ret;
}
@Override
public int getRenderType() {
@ -180,16 +216,12 @@ public class MachineIGenerator extends BlockContainer implements IMultiblock {
@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)
{
if(world.isRemote) {
return true;
} else if(!player.isSneaking())
{
TileEntityMachineIGenerator entity = (TileEntityMachineIGenerator) world.getTileEntity(x, y, z);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_industrial_generator, world, x, y, z);
}
} else if(!player.isSneaking()) {
player.addChatComponentMessage(new ChatComponentText("The IGen has been retired, you may break it for recycling."));
return true;
} else {
return false;

View File

@ -48,8 +48,11 @@ public class EntityShrapnel extends EntityThrowable {
if(this.ticksExisted > 5) {
this.setDead();
if(!this.worldObj.isRemote)
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 0.1F, true);
for(int i = 0; i < 5; i++)
worldObj.spawnParticle("lava", posX, posY, posZ, 0.0, 0.0, 0.0);
worldObj.playSoundEffect(posX, posY, posZ, "random.fizz", 1.0F, 1.0F);
}
}

View File

@ -459,49 +459,23 @@ public class ExplosionThermo {
bombStartStrength = (int)f;
}
public static void setEntitiesOnFire(World world, int x, int y, int z, int bombStartStrength) {
float f = bombStartStrength;
new HashSet();
int i;
int j;
int k;
double d5;
double d6;
double d7;
double wat = bombStartStrength;
bombStartStrength *= 2.0F;
i = MathHelper.floor_double(x - wat - 1.0D);
j = MathHelper.floor_double(x + wat + 1.0D);
k = MathHelper.floor_double(y - wat - 1.0D);
int i2 = MathHelper.floor_double(y + wat + 1.0D);
int l = MathHelper.floor_double(z - wat - 1.0D);
int j2 = MathHelper.floor_double(z + wat + 1.0D);
List list = world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(i, k, l, j, i2, j2));
Vec3.createVectorHelper(x, y, z);
public static void setEntitiesOnFire(World world, double x, double y, double z, int radius) {
for (int i1 = 0; i1 < list.size(); ++i1)
{
Entity entity = (Entity)list.get(i1);
double d4 = entity.getDistance(x, y, z) / bombStartStrength;
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(x - radius, y - radius, z - radius, x + radius, y + radius, z + radius));
if (d4 <= 1.0D)
{
d5 = entity.posX - x;
d6 = entity.posY + entity.getEyeHeight() - y;
d7 = entity.posZ - z;
double d9 = MathHelper.sqrt_double(d5 * d5 + d6 * d6 + d7 * d7);
if (d9 < wat && !(entity instanceof EntityOcelot) && entity instanceof EntityLivingBase)
{
for(Entity e : list) {
if(e.getDistance(x, y, z) <= radius) {
if(!(entity instanceof EntityPlayer && ArmorUtil.checkForAsbestos((EntityPlayer) entity))) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 15 * 20, 4));
entity.setFire(10);
}
}
}
}
bombStartStrength = (int)f;
if(!(e instanceof EntityPlayer && ArmorUtil.checkForAsbestos((EntityPlayer) e))) {
if(e instanceof EntityLivingBase)
((EntityLivingBase) e).addPotionEffect(new PotionEffect(Potion.weakness.getId(), 15 * 20, 4));
e.setFire(10);
}
}
}
}
}

View File

@ -6,7 +6,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.hbm.inventory.MachineRecipes;
import com.hbm.inventory.CyclotronRecipes;
import com.hbm.inventory.gui.GUIMachineCyclotron;
import com.hbm.lib.RefStrings;
@ -61,7 +61,7 @@ public class CyclotronRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if ((outputId.equals("cyclotronProcessing")) && getClass() == CyclotronRecipeHandler.class) {
Map<Object[], Object> recipes = MachineRecipes.instance().getCyclotronRecipes();
Map<Object[], Object> recipes = CyclotronRecipes.getRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
}
@ -72,7 +72,7 @@ public class CyclotronRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
Map<Object[], Object> recipes = MachineRecipes.instance().getCyclotronRecipes();
Map<Object[], Object> recipes = CyclotronRecipes.getRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue(), result))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
@ -90,7 +90,7 @@ public class CyclotronRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
Map<Object[], Object> recipes = MachineRecipes.instance().getCyclotronRecipes();
Map<Object[], Object> recipes = CyclotronRecipes.getRecipes();
for (Map.Entry<Object[], Object> recipe : recipes.entrySet()) {
if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[0]) || NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[1]))
this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey()[0], (ItemStack)recipe.getKey()[1], (ItemStack)recipe.getValue()));
@ -109,7 +109,7 @@ public class CyclotronRecipeHandler extends TemplateRecipeHandler {
guiGui = new LinkedList<Class<? extends GuiContainer>>();
transferRects.add(new RecipeTransferRect(new Rectangle(83 - 3 + 16 - 52, 5 + 18 + 1, 24, 18), "cyclotronProcessing"));
transferRectsGui.add(new RecipeTransferRect(new Rectangle(61 - 4, 26 - 10, 36, 36), "cyclotronProcessing"));
transferRectsGui.add(new RecipeTransferRect(new Rectangle(47, 15, 36, 36), "cyclotronProcessing"));
guiGui.add(GUIMachineCyclotron.class);
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);

View File

@ -159,7 +159,6 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModItems.telepad, 1), new AStack[] {new ComparableStack(ModItems.ingot_polymer, 12), new ComparableStack(ModItems.plate_schrabidium, 2), new ComparableStack(ModItems.plate_combine_steel, 4), new OreDictStack("plateSteel", 2), new ComparableStack(ModItems.wire_gold, 6), new ComparableStack(ModItems.circuit_schrabidium, 1), },300);
makeRecipe(new ComparableStack(ModItems.entanglement_kit, 1), new AStack[] {new ComparableStack(ModItems.coil_magnetized_tungsten, 6), new OreDictStack("plateLead", 16), new OreDictStack("plateDenseLead", 4), new ComparableStack(ModItems.singularity_counter_resonant, 1), new ComparableStack(ModItems.singularity_super_heated, 1), new ComparableStack(ModItems.powder_power, 4), },200);
makeRecipe(new ComparableStack(ModItems.dysfunctional_reactor, 1), new AStack[] {new OreDictStack("plateSteel", 15), new OreDictStack("ingotLead", 5), new ComparableStack(ModItems.rod_quad_empty, 10), new OreDictStack("dyeBrown", 3), },200);
makeRecipe(new ComparableStack(ModItems.generator_front, 1), new AStack[] {new OreDictStack("ingotSteel", 3), new OreDictStack("plateSteel", 6), new ComparableStack(ModItems.tank_steel, 4), new ComparableStack(ModItems.turbine_titanium, 1), new ComparableStack(ModItems.wire_red_copper, 6), new ComparableStack(ModItems.wire_gold, 4), },200);
makeRecipe(new ComparableStack(ModItems.missile_assembly, 1), new AStack[] {new ComparableStack(ModItems.hull_small_steel, 1), new ComparableStack(ModItems.hull_small_aluminium, 4), new OreDictStack("ingotSteel", 2), new OreDictStack("plateTitanium", 6), new ComparableStack(ModItems.wire_aluminium, 6), new ComparableStack(ModItems.canister_kerosene, 3), new ComparableStack(ModItems.circuit_targeting_tier1, 1), },200);
makeRecipe(new ComparableStack(ModItems.missile_carrier, 1), new AStack[] {new ComparableStack(ModItems.fluid_barrel_full, 16, 21), new ComparableStack(ModItems.thruster_medium, 4), new ComparableStack(ModItems.thruster_large, 1), new ComparableStack(ModItems.hull_big_titanium, 6), new ComparableStack(ModItems.hull_big_steel, 2), new ComparableStack(ModItems.hull_small_aluminium, 12), new OreDictStack("plateTitanium", 24), new ComparableStack(ModItems.plate_polymer, 128), new ComparableStack(ModBlocks.det_cord, 8), new ComparableStack(ModItems.circuit_targeting_tier3, 12), new ComparableStack(ModItems.circuit_targeting_tier4, 3), },4800);
makeRecipe(new ComparableStack(ModItems.warhead_generic_small, 1), new AStack[] {new OreDictStack("plateTitanium", 5), new OreDictStack("plateSteel", 3), new ComparableStack(Blocks.tnt, 2), },100);
@ -243,11 +242,11 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModItems.fuse, 1), new AStack[] {new OreDictStack("plateSteel", 2), new ComparableStack(Blocks.glass_pane, 1), new ComparableStack(ModItems.wire_aluminium, 1), },100);
makeRecipe(new ComparableStack(ModItems.redcoil_capacitor, 1), new AStack[] {new OreDictStack("plateGold", 3), new ComparableStack(ModItems.fuse, 1), new ComparableStack(ModItems.wire_advanced_alloy, 4), new ComparableStack(ModItems.coil_advanced_alloy, 6), new ComparableStack(Blocks.redstone_block, 2), },200);
makeRecipe(new ComparableStack(ModItems.titanium_filter, 1), new AStack[] {new OreDictStack("plateLead", 3), new ComparableStack(ModItems.fuse, 1), new ComparableStack(ModItems.wire_tungsten, 4), new OreDictStack("plateTitanium", 6), new ComparableStack(ModItems.ingot_u238, 2), },200);
makeRecipe(new ComparableStack(ModItems.part_lithium, 1), new AStack[] {new OreDictStack("plateSteel", 2), new ComparableStack(ModItems.powder_lithium, 2), },50);
makeRecipe(new ComparableStack(ModItems.part_beryllium, 1), new AStack[] {new OreDictStack("plateSteel", 2), new ComparableStack(ModItems.powder_beryllium, 2), },50);
makeRecipe(new ComparableStack(ModItems.part_carbon, 1), new AStack[] {new OreDictStack("plateSteel", 2), new OreDictStack("dustCoal", 2), },50);
makeRecipe(new ComparableStack(ModItems.part_copper, 1), new AStack[] {new OreDictStack("plateSteel", 2), new OreDictStack("dustCopper", 2), },50);
makeRecipe(new ComparableStack(ModItems.part_plutonium, 1), new AStack[] {new OreDictStack("plateSteel", 2), new ComparableStack(ModItems.powder_plutonium, 2), },50);
makeRecipe(new ComparableStack(ModItems.part_lithium, 1), new AStack[] {new ComparableStack(ModItems.plate_polymer, 1), new ComparableStack(ModItems.powder_lithium, 1), },50);
makeRecipe(new ComparableStack(ModItems.part_beryllium, 1), new AStack[] {new ComparableStack(ModItems.plate_polymer, 1), new ComparableStack(ModItems.powder_beryllium, 1), },50);
makeRecipe(new ComparableStack(ModItems.part_carbon, 1), new AStack[] {new ComparableStack(ModItems.plate_polymer, 1), new OreDictStack("dustCoal", 1), },50);
makeRecipe(new ComparableStack(ModItems.part_copper, 1), new AStack[] {new ComparableStack(ModItems.plate_polymer, 1), new OreDictStack("dustCopper", 1), },50);
makeRecipe(new ComparableStack(ModItems.part_plutonium, 1), new AStack[] {new ComparableStack(ModItems.plate_polymer, 1), new ComparableStack(ModItems.powder_plutonium, 1), },50);
makeRecipe(new ComparableStack(ModItems.thermo_element, 1), new AStack[] {new OreDictStack("plateSteel", 3), new OreDictStack("plateIron", 1), new OreDictStack("plateCopper", 2), new ComparableStack(ModItems.wire_red_copper, 2), new ComparableStack(ModItems.wire_aluminium, 2), new OreDictStack("dustNetherQuartz", 4), },150);
makeRecipe(new ComparableStack(ModItems.limiter, 1), new AStack[] {new OreDictStack("plateSteel", 3), new OreDictStack("plateIron", 1), new ComparableStack(ModItems.circuit_copper, 2), new ComparableStack(ModItems.wire_copper, 4), },150);
makeRecipe(new ComparableStack(ModItems.plate_dalekanium, 1), new AStack[] {new ComparableStack(ModBlocks.block_meteor, 1), },50);
@ -266,7 +265,6 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModBlocks.machine_diesel, 1), new AStack[] {new ComparableStack(ModItems.hull_small_steel, 4), new ComparableStack(Blocks.piston, 4), new OreDictStack("ingotSteel", 6), new OreDictStack("ingotRedCopperAlloy", 2), new OreDictStack("plateCopper", 4), new ComparableStack(ModItems.wire_red_copper, 6), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_selenium, 1), new AStack[] {new OreDictStack("ingotSteel", 4), new OreDictStack("plateTitanium", 6), new OreDictStack("plateCopper", 8), new ComparableStack(ModItems.hull_big_steel, 1), new ComparableStack(ModItems.hull_small_steel, 9), new ComparableStack(ModItems.pedestal_steel, 1), new ComparableStack(ModItems.coil_copper, 4), },250);
makeRecipe(new ComparableStack(ModBlocks.machine_reactor_small, 1), new AStack[] {new OreDictStack("ingotSteel", 6), new ComparableStack(ModItems.ingot_polymer, 4), new OreDictStack("plateLead", 8), new OreDictStack("plateCopper", 4), new OreDictStack("ingotLead", 12), new OreDictStack("ingotRedCopperAlloy", 6), new ComparableStack(ModItems.circuit_copper, 8), new ComparableStack(ModItems.circuit_red_copper, 4), },300);
makeRecipe(new ComparableStack(ModBlocks.machine_industrial_generator, 1), new AStack[] {new ComparableStack(ModItems.generator_front, 1), new ComparableStack(ModItems.generator_steel, 3), new ComparableStack(ModItems.rotor_steel, 3), new OreDictStack("ingotSteel", 6), new ComparableStack(ModItems.board_copper, 4), new ComparableStack(ModItems.wire_gold, 8), new ComparableStack(ModBlocks.red_wire_coated, 2), new ComparableStack(ModItems.pedestal_steel, 2), new ComparableStack(ModItems.circuit_copper, 4), },500);
makeRecipe(new ComparableStack(ModBlocks.machine_cyclotron, 1), new AStack[] {new ComparableStack(ModItems.cyclotron_tower, 1), new ComparableStack(ModItems.board_copper, 4), new OreDictStack("ingotSteel", 16), new ComparableStack(ModItems.ingot_polymer, 24), new OreDictStack("plateSteel", 6), new ComparableStack(ModBlocks.machine_battery, 4), new ComparableStack(ModItems.wire_red_copper, 20), new ComparableStack(ModItems.circuit_red_copper, 12), new ComparableStack(ModItems.circuit_gold, 3), },600);
makeRecipe(new ComparableStack(ModBlocks.machine_rtg_grey, 1), new AStack[] {new ComparableStack(ModItems.rtg_unit, 5), new OreDictStack("plateSteel", 8), new ComparableStack(ModItems.wire_red_copper, 4), new ComparableStack(ModItems.ingot_polymer, 6), },200);
makeRecipe(new ComparableStack(ModBlocks.machine_battery, 1), new AStack[] {new OreDictStack("ingotSteel", 4), new OreDictStack("dustSulfur", 12), new OreDictStack("dustLead", 12), new OreDictStack("ingotRedCopperAlloy", 2), new ComparableStack(ModItems.wire_red_copper, 4), },200);
@ -301,8 +299,6 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModBlocks.fusion_center, 1), new AStack[] {new OreDictStack("ingotTungsten", 4), new OreDictStack("plateSteel", 6), new ComparableStack(ModItems.wire_advanced_alloy, 24), },200);
makeRecipe(new ComparableStack(ModBlocks.fusion_motor, 1), new AStack[] {new OreDictStack("ingotTitanium", 4), new OreDictStack("ingotSteel", 2), new ComparableStack(ModItems.motor, 4), },250);
makeRecipe(new ComparableStack(ModBlocks.fusion_heater, 1), new AStack[] {new OreDictStack("ingotTungsten", 4), new OreDictStack("plateSteel", 2), new OreDictStack("plateDenseLead", 2), new OreDictStack("plateCopper", 4), new ComparableStack(ModItems.magnetron, 1), new ComparableStack(ModItems.wire_advanced_alloy, 4), },150);
makeRecipe(new ComparableStack(ModBlocks.fusion_hatch, 1), new AStack[] {new ComparableStack(ModBlocks.fusion_heater, 1), new OreDictStack("plateTitanium", 6), },250);
makeRecipe(new ComparableStack(ModBlocks.fusion_core, 1), new AStack[] {new ComparableStack(ModBlocks.fusion_center, 3), new ComparableStack(ModItems.circuit_red_copper, 48), new ComparableStack(ModItems.circuit_gold, 12), },350);
makeRecipe(new ComparableStack(ModBlocks.watz_element, 1), new AStack[] {new OreDictStack("ingotTungsten", 4), new ComparableStack(ModItems.plate_advanced_alloy, 4), new ComparableStack(ModItems.rod_empty, 2), new ComparableStack(ModItems.wire_magnetized_tungsten, 2), new ComparableStack(ModItems.wire_advanced_alloy, 4), },200);
makeRecipe(new ComparableStack(ModBlocks.watz_control, 1), new AStack[] {new OreDictStack("ingotTungsten", 4), new ComparableStack(ModItems.ingot_advanced_alloy, 4), new OreDictStack("ingotLead", 2), new ComparableStack(ModItems.wire_magnetized_tungsten, 4), new ComparableStack(ModItems.wire_advanced_alloy, 2), },250);
makeRecipe(new ComparableStack(ModBlocks.watz_cooler, 1), new AStack[] {new OreDictStack("ingotTungsten", 2), new OreDictStack("ingotSteel", 2), new OreDictStack("dustSaltpeter", 4), },300);

View File

@ -1,13 +1,16 @@
package com.hbm.inventory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.items.ModItems;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class CyclotronRecipes {
@ -16,75 +19,102 @@ public class CyclotronRecipes {
private static HashMap<Object, ItemStack> carbon = new HashMap();
private static HashMap<Object, ItemStack> copper = new HashMap();
private static HashMap<Object, ItemStack> plutonium = new HashMap();
private static HashMap<Object, Integer> liAmat = new HashMap();
private static HashMap<Object, Integer> beAmat = new HashMap();
private static HashMap<Object, Integer> caAmat = new HashMap();
private static HashMap<Object, Integer> coAmat = new HashMap();
private static HashMap<Object, Integer> plAmat = new HashMap();
public static void register() {
/// LITHIUM START ///
lithium.put("dustNetherQuartz", new ItemStack(ModItems.powder_fire));
lithium.put("dustPhosphorus", new ItemStack(ModItems.sulfur));
lithium.put("dustIron", new ItemStack(ModItems.powder_cobalt));
lithium.put("dustGold", new ItemStack(ModItems.nugget_mercury));
lithium.put("dustPolonium", new ItemStack(ModItems.powder_astatine));
lithium.put("dustLanthanium", new ItemStack(ModItems.powder_cerium));
lithium.put("dustActinium", new ItemStack(ModItems.powder_thorium));
lithium.put("dustUranium", new ItemStack(ModItems.powder_neptunium));
lithium.put("dustNeptunium", new ItemStack(ModItems.powder_plutonium));
int liA = 50;
makeRecipe(lithium, liAmat, "dustNetherQuartz", new ItemStack(ModItems.powder_fire), liA);
makeRecipe(lithium, liAmat, "dustPhosphorus", new ItemStack(ModItems.sulfur), liA);
makeRecipe(lithium, liAmat, "dustIron", new ItemStack(ModItems.powder_cobalt), liA);
makeRecipe(lithium, liAmat, "dustGold", new ItemStack(ModItems.nugget_mercury), liA);
makeRecipe(lithium, liAmat, "dustPolonium", new ItemStack(ModItems.powder_astatine), liA);
makeRecipe(lithium, liAmat, "dustLanthanium", new ItemStack(ModItems.powder_cerium), liA);
makeRecipe(lithium, liAmat, "dustActinium", new ItemStack(ModItems.powder_thorium), liA);
makeRecipe(lithium, liAmat, "dustUranium", new ItemStack(ModItems.powder_neptunium), liA);
makeRecipe(lithium, liAmat, "dustNeptunium", new ItemStack(ModItems.powder_plutonium), liA);
/// LITHIUM END ///
/// BERYLLIUM START ///
beryllium.put("dustNetherQuartz", new ItemStack(ModItems.sulfur));
beryllium.put(new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_niobium));
beryllium.put(new ComparableStack(ModItems.powder_cerium), new ItemStack(ModItems.powder_neodymium));
beryllium.put("dustThorium", new ItemStack(ModItems.powder_uranium));
int beA = 25;
makeRecipe(beryllium, beAmat, "dustNetherQuartz", new ItemStack(ModItems.sulfur), beA);
makeRecipe(beryllium, beAmat, new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_niobium), beA);
makeRecipe(beryllium, beAmat, new ComparableStack(ModItems.powder_cerium), new ItemStack(ModItems.powder_neodymium), beA);
makeRecipe(beryllium, beAmat, "dustThorium", new ItemStack(ModItems.powder_uranium), beA);
/// BERYLLIUM END ///
/// CARBON START ///
carbon.put("dustSulfur", new ItemStack(ModItems.powder_titanium));
carbon.put("dustTitanium", new ItemStack(ModItems.powder_iron));
carbon.put(new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_lanthanium));
carbon.put(new ComparableStack(ModItems.powder_neodymium), new ItemStack(ModItems.powder_gold));
carbon.put(new ComparableStack(ModItems.nugget_mercury), new ItemStack(ModItems.powder_polonium));
carbon.put(new ComparableStack(ModItems.powder_astatine), new ItemStack(ModItems.powder_actinium));
int caA = 10;
makeRecipe(carbon, caAmat, "dustSulfur", new ItemStack(ModItems.powder_titanium), caA);
makeRecipe(carbon, caAmat, "dustTitanium", new ItemStack(ModItems.powder_iron), caA);
makeRecipe(carbon, caAmat, new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_lanthanium), caA);
makeRecipe(carbon, caAmat, new ComparableStack(ModItems.powder_neodymium), new ItemStack(ModItems.powder_gold), caA);
makeRecipe(carbon, caAmat, new ComparableStack(ModItems.nugget_mercury), new ItemStack(ModItems.powder_polonium), caA);
makeRecipe(carbon, caAmat, new ComparableStack(ModItems.powder_astatine), new ItemStack(ModItems.powder_actinium), caA);
/// CARBON END ///
/// COPPER START ///
copper.put("dustBeryllium", new ItemStack(ModItems.powder_quartz));
copper.put("dustCoal", new ItemStack(ModItems.powder_bromine));
copper.put("dustTitanium", new ItemStack(ModItems.powder_strontium));
copper.put("dustIron", new ItemStack(ModItems.powder_niobium));
copper.put(new ComparableStack(ModItems.powder_bromine), new ItemStack(ModItems.powder_iodine));
copper.put(new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_neodymium));
copper.put(new ComparableStack(ModItems.powder_niobium), new ItemStack(ModItems.powder_caesium));
copper.put(new ComparableStack(ModItems.powder_iodine), new ItemStack(ModItems.powder_polonium));
copper.put(new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_actinium));
copper.put("dustGold", new ItemStack(ModItems.powder_uranium));
int coA = 15;
makeRecipe(copper, coAmat, "dustBeryllium", new ItemStack(ModItems.powder_quartz), coA);
makeRecipe(copper, coAmat, "dustCoal", new ItemStack(ModItems.powder_bromine), coA);
makeRecipe(copper, coAmat, "dustTitanium", new ItemStack(ModItems.powder_strontium), coA);
makeRecipe(copper, coAmat, "dustIron", new ItemStack(ModItems.powder_niobium), coA);
makeRecipe(copper, coAmat, new ComparableStack(ModItems.powder_bromine), new ItemStack(ModItems.powder_iodine), coA);
makeRecipe(copper, coAmat, new ComparableStack(ModItems.powder_strontium), new ItemStack(ModItems.powder_neodymium), coA);
makeRecipe(copper, coAmat, new ComparableStack(ModItems.powder_niobium), new ItemStack(ModItems.powder_caesium), coA);
makeRecipe(copper, coAmat, new ComparableStack(ModItems.powder_iodine), new ItemStack(ModItems.powder_polonium), coA);
makeRecipe(copper, coAmat, new ComparableStack(ModItems.powder_caesium), new ItemStack(ModItems.powder_actinium), coA);
makeRecipe(copper, coAmat, "dustGold", new ItemStack(ModItems.powder_uranium), coA);
/// COPPER END ///
/// PLUTONIUM START ///
plutonium.put("dustPhosphorus", new ItemStack(ModItems.powder_tennessine));
plutonium.put("dustPlutonium", new ItemStack(ModItems.powder_tennessine));
int plA = 100;
makeRecipe(plutonium, plAmat, "dustPhosphorus", new ItemStack(ModItems.powder_tennessine), plA);
makeRecipe(plutonium, plAmat, "dustPlutonium", new ItemStack(ModItems.powder_tennessine), plA);
makeRecipe(plutonium, plAmat, new ComparableStack(ModItems.pellet_charged), new ItemStack(ModItems.nugget_schrabidium), 200);
/// PLUTONIUM END ///
///TODO: fictional elements
}
public static ItemStack getOutput(ItemStack stack, ItemStack box) {
private static void makeRecipe(HashMap<Object, ItemStack> map, HashMap<Object, Integer> aMap, Object in, ItemStack out, int amat) {
map.put(in, out);
aMap.put(in, amat);
}
public static Object[] getOutput(ItemStack stack, ItemStack box) {
if(stack == null || stack.getItem() == null || box == null)
return null;
HashMap<Object, ItemStack> pool = null;
HashMap<Object, Integer> aPool = null;
if(box.getItem() == ModItems.part_lithium) {
pool = lithium;
aPool = liAmat;
} else if(box.getItem() == ModItems.part_beryllium) {
pool = beryllium;
aPool = beAmat;
} else if(box.getItem() == ModItems.part_carbon) {
pool = carbon;
aPool = caAmat;
} else if(box.getItem() == ModItems.part_copper) {
pool = copper;
aPool = coAmat;
} else if(box.getItem() == ModItems.part_plutonium) {
pool = plutonium;
aPool = plAmat;
}
if(pool == null)
@ -93,16 +123,48 @@ public class CyclotronRecipes {
ComparableStack comp = new ComparableStack(stack.getItem(), 1, stack.getItemDamage());
if(pool.containsKey(comp))
return pool.get(comp).copy();
return new Object[] {pool.get(comp).copy(), aPool.get(comp)};
String[] dictKeys = comp.getDictKeys();
for(String key : dictKeys) {
if(pool.containsKey(key))
return pool.get(key).copy();
return new Object[] {pool.get(key).copy(), aPool.get(key)};
}
return null;
}
public static Map<Object[], Object> getRecipes() {
Map<Object[], Object> recipes = new HashMap<Object[], Object>();
addRecipes(recipes, lithium, ModItems.part_lithium);
addRecipes(recipes, beryllium, ModItems.part_beryllium);
addRecipes(recipes, carbon, ModItems.part_carbon);
addRecipes(recipes, copper, ModItems.part_copper);
addRecipes(recipes, plutonium, ModItems.part_plutonium);
return recipes;
}
private static void addRecipes(Map<Object[], Object> recipes, HashMap<Object, ItemStack> map, Item part) {
for(Entry<Object, ItemStack> entry : map.entrySet()) {
if(entry.getKey() instanceof ItemStack) {
recipes.put(new ItemStack[] { new ItemStack(part), (ItemStack) entry.getKey() }, entry.getValue());
} else if(entry.getKey() instanceof String) {
List<ItemStack> ores = OreDictionary.getOres((String) entry.getKey());
for(ItemStack ore : ores) {
recipes.put(new ItemStack[] { new ItemStack(part), ore }, entry.getValue());
}
}
}
}
}

View File

@ -1,8 +1,14 @@
package com.hbm.inventory.container;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.inventory.FluidContainerRegistry;
import com.hbm.inventory.SlotMachineOutput;
import com.hbm.inventory.SlotUpgrade;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.tileentity.machine.TileEntityMachineCyclotron;
import api.hbm.energy.IBatteryItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@ -40,8 +46,8 @@ public class ContainerMachineCyclotron extends Container {
//Battery
this.addSlotToContainer(new Slot(tile, 13, 62, 108));
//Upgrades
this.addSlotToContainer(new Slot(tile, 14, 17, 90));
this.addSlotToContainer(new Slot(tile, 15, 17, 108));
this.addSlotToContainer(new SlotUpgrade(tile, 14, 17, 90));
this.addSlotToContainer(new SlotUpgrade(tile, 15, 17, 108));
for(int i = 0; i < 3; i++)
{
@ -58,41 +64,66 @@ public class ContainerMachineCyclotron extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
{
/*ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(par2);
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
if (var4 != null && var4.getHasStack())
{
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if (par2 <= 15) {
if (!this.mergeItemStack(var5, 16, this.inventorySlots.size(), true))
{
ItemStack var3 = null;
Slot slot = (Slot) this.inventorySlots.get(index);
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
var3 = stack.copy();
if(index <= 15) {
if(!this.mergeItemStack(stack, 16, this.inventorySlots.size(), true)) {
return null;
}
} else {
if(stack.getItem() instanceof IBatteryItem || stack.getItem() == ModItems.battery_creative) {
if(!this.mergeItemStack(stack, 13, 14, true))
return null;
} else if(FluidContainerRegistry.getFluidContent(stack, FluidType.COOLANT) > 0) {
if(!this.mergeItemStack(stack, 11, 12, true))
return null;
} else if(FluidContainerRegistry.getFullContainer(stack, FluidType.AMAT) != null) {
if(!this.mergeItemStack(stack, 9, 10, true))
return null;
} else if(stack.getItem() instanceof ItemMachineUpgrade) {
if(!this.mergeItemStack(stack, 14, 15, true))
if(!this.mergeItemStack(stack, 15, 16, true))
return null;
} else {
if(stack.getItem() == ModItems.part_lithium ||
stack.getItem() == ModItems.part_beryllium ||
stack.getItem() == ModItems.part_carbon ||
stack.getItem() == ModItems.part_copper ||
stack.getItem() == ModItems.part_plutonium) {
if(!this.mergeItemStack(stack, 0, 3, true))
return null;
} else {
if(!this.mergeItemStack(stack, 3, 6, true))
return null;
}
}
}
else if (!this.mergeItemStack(var5, 0, 16, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
if(stack.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
}
return var3;*/
return null;
}
return var3;
}
@Override
public boolean canInteractWith(EntityPlayer player) {

View File

@ -87,14 +87,5 @@ public class GUIIGenerator extends GuiInfoContainer {
} else {
drawTexturedModalRect(guiLeft + 12, guiTop + 59 + 24, 230, 0, 6, 6);
}
if(diFurnace.canLocateThermalElement() > 0) {
drawTexturedModalRect(guiLeft + 12, guiTop + 59 + 12, 230, 0, 6, 6);
}
if(diFurnace.lubricant > 0) {
drawTexturedModalRect(guiLeft + 12, guiTop + 59 + 36, 230, 0, 6, 6);
}
if(diFurnace.hasLimiter()) {
drawTexturedModalRect(guiLeft + 12, guiTop + 59 + 48, 230, 0, 6, 6);
}
}
}

View File

@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.container.ContainerMachineCyclotron;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxButtonPacket;
@ -31,7 +32,16 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 106 - 88, 16, 88, cyclotron.power, cyclotron.maxPower);
this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 80, guiTop + 72, 7, 52, cyclotron.power, cyclotron.maxPower);
cyclotron.coolant.renderTankInfo(this, mouseX, mouseY, guiLeft + 53, guiTop + 72, 7, 52);
cyclotron.amat.renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 90, 7, 34);
String[] text = new String[] { "Acceptable upgrades:",
" -Speed (stacks to level 3)",
" -Effectiveness (stacks to level 3)",
" -Power Saving (stacks to level 3)"};
this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 21, guiTop + 75, 8, 8, mouseX, mouseY, text);
}
@Override
@ -67,5 +77,12 @@ public class GUIMachineCyclotron extends GuiInfoContainer {
if(cyclotron.isOn)
drawTexturedModalRect(guiLeft + 97, guiTop + 107, 219, 0, 18, 18);
this.drawInfoPanel(guiLeft + 21, guiTop + 75, 8, 8, 8);
Minecraft.getMinecraft().getTextureManager().bindTexture(cyclotron.coolant.getSheet());
cyclotron.coolant.renderTank(this, guiLeft + 53, guiTop + 124, cyclotron.coolant.getTankType().textureX() * FluidTank.x, cyclotron.coolant.getTankType().textureY() * FluidTank.y, 7, 52);
Minecraft.getMinecraft().getTextureManager().bindTexture(cyclotron.amat.getSheet());
cyclotron.amat.renderTank(this, guiLeft + 134, guiTop + 124, cyclotron.amat.getTankType().textureX() * FluidTank.x, cyclotron.amat.getTankType().textureY() * FluidTank.y, 7, 34);
}
}

View File

@ -7,7 +7,6 @@ import org.lwjgl.opengl.GL11;
import com.hbm.config.WeaponConfig;
import com.hbm.inventory.container.ContainerMachineRadar;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.machine.TileEntityMachineRadar;
import api.hbm.entity.IRadarDetectable.RadarTargetType;

View File

@ -26,6 +26,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("Delay -10% / Consumption +1000");
list.add("");
list.add("Cyclotron");
list.add("Speed x2");
}
if(this == ModItems.upgrade_speed_2)
@ -41,6 +44,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("Delay -20% / Consumption +2000");
list.add("");
list.add("Cyclotron");
list.add("Speed x3");
}
if(this == ModItems.upgrade_speed_3)
@ -56,6 +62,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("Speed Delay -30% / Consumption +3000");
list.add("");
list.add("Cyclotron");
list.add("Speed x4");
}
if(this == ModItems.upgrade_effect_1)
@ -65,6 +74,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("+5% chance of not consuming an item / Acid consumption +1000mB");
list.add("");
list.add("Cyclotron");
list.add("-50% chance of incrementing overheat counter");
}
if(this == ModItems.upgrade_effect_2)
@ -74,6 +86,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("+10% chance of not consuming an item / Acid consumption +2000mB");
list.add("");
list.add("Cyclotron");
list.add("-66% chance of incrementing overheat counter");
}
if(this == ModItems.upgrade_effect_3)
@ -83,6 +98,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Crystallizer");
list.add("+15% chance of not consuming an item / Acid consumption +3000mB");
list.add("");
list.add("Cyclotron");
list.add("-75% chance of incrementing overheat counter");
}
if(this == ModItems.upgrade_power_1)
@ -95,6 +113,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Chemical Plant:");
list.add("Consumption -30 / Delay +5");
list.add("");
list.add("Cyclotron");
list.add("Consumption -100k");
}
if(this == ModItems.upgrade_power_2)
@ -107,6 +128,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Chemical Plant:");
list.add("Consumption -60 / Delay +10");
list.add("");
list.add("Cyclotron");
list.add("Consumption -200k");
}
if(this == ModItems.upgrade_power_3)
@ -119,6 +143,9 @@ public class ItemMachineUpgrade extends Item {
list.add("");
list.add("Chemical Plant:");
list.add("Consumption -90 / Delay +15");
list.add("");
list.add("Cyclotron");
list.add("Consumption -300k");
}
if(this == ModItems.upgrade_fortune_1)

View File

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

View File

@ -1614,6 +1614,8 @@ public class CraftingManager {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.cladding_lead, 1), new Object[] { "DPD", "PRP", "DPD", 'R', ModItems.cladding_rubber, 'P', "plateLead", 'D', ModItems.ducttape }));
GameRegistry.addRecipe(new ItemStack(ModItems.cladding_desh, 1), new Object[] { "DPD", "PRP", "DPD", 'R', ModItems.cladding_lead, 'P', ModItems.plate_desh, 'D', ModItems.ducttape });
GameRegistry.addRecipe(new ItemStack(ModBlocks.struct_plasma_core, 1), new Object[] { "CBC", "BHB", "CBC", 'C', ModItems.circuit_gold, 'B', ModBlocks.machine_lithium_battery, 'H', ModBlocks.fusion_heater });
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.circuit_red_copper, 48), new Object[] { ModBlocks.fusion_core });
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.fusion_heater), new Object[] { ModBlocks.fusion_hatch });
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade_nullifier, 1), new Object[] { "SPS", "PUP", "SPS", 'S', "plateSteel", 'P', ModItems.powder_fire, 'U', ModItems.upgrade_template }));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.upgrade_smelter, 1), new Object[] { "PHP", "CUC", "DTD", 'P', "plateCopper", 'H', Blocks.hopper, 'C', ModItems.coil_tungsten, 'U', ModItems.upgrade_template, 'D', ModItems.coil_copper, 'T', ModBlocks.machine_transformer }));

View File

@ -528,44 +528,14 @@ public class ModEventHandler
int i = player.ticksExisted * 3;
Vec3 vec = Vec3.createVectorHelper(3, 0, 0);
vec.rotateAroundY((float) (i * Math.PI / 180D));
NBTTagCompound p1 = new NBTTagCompound();
p1.setString("type", "vanillaExt");
p1.setString("mode", "reddust");
p1.setDouble("posX", player.posX + vec.xCoord);
p1.setDouble("posY", player.posY + 1.5);
p1.setDouble("posZ", player.posZ + vec.zCoord);
p1.setDouble("mX", 51F/256F);
p1.setDouble("mY", 64F/256F);
p1.setDouble("mZ", 119F/256F);
MainRegistry.proxy.effectNT(p1);
vec.rotateAroundY((float) (Math.PI * 2D / 3D));
NBTTagCompound p2 = new NBTTagCompound();
p2.setString("type", "vanillaExt");
p2.setString("mode", "reddust");
p2.setDouble("posX", player.posX + vec.xCoord);
p2.setDouble("posY", player.posY + 1.5);
p2.setDouble("posZ", player.posZ + vec.zCoord);
p2.setDouble("mX", 106F/256F);
p2.setDouble("mY", 41F/256F);
p2.setDouble("mZ", 143F/256F);
MainRegistry.proxy.effectNT(p2);
vec.rotateAroundY((float) (Math.PI * 2D / 3D));
NBTTagCompound p3 = new NBTTagCompound();
p3.setString("type", "vanillaExt");
p3.setString("mode", "reddust");
p3.setDouble("posX", player.posX + vec.xCoord);
p3.setDouble("posY", player.posY + 1.5);
p3.setDouble("posZ", player.posZ + vec.zCoord);
p3.setDouble("mX", 223F/256F);
p3.setDouble("mY", 55F/256F);
p3.setDouble("mZ", 149F/256F);
MainRegistry.proxy.effectNT(p3);
for(int k = 0; k < 5; k++) {
vec.rotateAroundY((float) (1F * Math.PI / 180D));
player.worldObj.spawnParticle("townaura", player.posX + vec.xCoord, player.posY + 1 + player.worldObj.rand.nextDouble() * 0.05, player.posZ + vec.zCoord, 0.0, 0.0, 0.0);
}
}
}
}

View File

@ -4,6 +4,8 @@ import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.tileentity.machine.TileEntityMachineReactorSmall;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
@ -22,12 +24,73 @@ public class RenderSmallReactor extends TileEntitySpecialRenderer {
bindTexture(ResourceManager.reactor_small_base_tex);
ResourceManager.reactor_small_base.renderAll();
GL11.glPushMatrix();
GL11.glTranslated(0.0D, reactor.rods / 100D, 0.0D);
bindTexture(ResourceManager.reactor_small_rods_tex);
ResourceManager.reactor_small_rods.renderAll();
GL11.glPopMatrix();
if(reactor.coreHeat > 0 && reactor.isSubmerged()) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glDisable(GL11.GL_ALPHA_TEST);
Tessellator tess = Tessellator.instance;
for(double d = 0.285; d < 0.7; d += 0.025) {
tess.startDrawingQuads();
tess.setColorRGBA_F(0.4F, 0.9F, 1.0F, 0.15F);
double top = 1.375;
double bottom = 1.375;
tess.addVertex(d, bottom - d, -d);
tess.addVertex(d, top + d, -d);
tess.addVertex(d, top + d, d);
tess.addVertex(d, bottom - d, d);
tess.addVertex(-d, bottom - d, -d);
tess.addVertex(-d, top + d, -d);
tess.addVertex(-d, top + d, d);
tess.addVertex(-d, bottom - d, d);
tess.addVertex(-d, bottom - d, d);
tess.addVertex(-d, top + d, d);
tess.addVertex(d, top + d, d);
tess.addVertex(d, bottom - d, d);
tess.addVertex(-d, bottom - d, -d);
tess.addVertex(-d, top + d, -d);
tess.addVertex(d, top + d, -d);
tess.addVertex(d, bottom - d, -d);
tess.addVertex(-d, top + d, -d);
tess.addVertex(-d, top + d, d);
tess.addVertex(d, top + d, d);
tess.addVertex(d, top + d, -d);
tess.addVertex(-d, bottom - d, -d);
tess.addVertex(-d, bottom - d, d);
tess.addVertex(d, bottom - d, d);
tess.addVertex(d, bottom - d, -d);
tess.draw();
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.BlockFluidBarrel;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;

View File

@ -236,7 +236,7 @@ public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInv
boolean b = false;
if(tank.getFill() >= 10 && power >= 100000 && slots[1] != null && slots[3] != null && (slots[4] == null || slots[4].stackSize <= 60))
if(tank.getFill() >= 1 && power >= 100000 && slots[1] != null && slots[3] != null && (slots[4] == null || slots[4].stackSize <= 60))
{
boolean flag0 = slots[1].getItem() == ModItems.ingot_magnetized_tungsten || slots[1].getItem() == ModItems.powder_magnetized_tungsten;
boolean flag1 = slots[3].getItem() == ModItems.ingot_advanced_alloy || slots[3].getItem() == ModItems.powder_advanced_alloy;
@ -252,7 +252,7 @@ public class TileEntityMachineCMBFactory extends TileEntity implements ISidedInv
}
public void process() {
tank.setFill(tank.getFill() - 10);
tank.setFill(tank.getFill() - 1);
power -= 100000;
process++;

View File

@ -4,17 +4,29 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.hbm.config.BombConfig;
import com.hbm.entity.effect.EntityBlackHole;
import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.explosion.ExplosionThermo;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidSource;
import com.hbm.inventory.CyclotronRecipes;
import com.hbm.inventory.FluidTank;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemMachineUpgrade;
import com.hbm.lib.Library;
import com.hbm.tileentity.TileEntityMachineBase;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineCyclotron extends TileEntityMachineBase implements IFluidSource, IFluidAcceptor {
@ -25,6 +37,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
public boolean isOn;
private int age;
private int countdown;
public int progress;
public static final int duration = 690;
@ -66,10 +79,12 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
if(isOn) {
if(canProcess()) {
int defConsumption = consumption - 100000 * getConsumption();
if(canProcess() && power >= defConsumption) {
progress++;
power -= consumption;
progress += this.getSpeed();
power -= defConsumption;
if(progress >= duration) {
process();
@ -78,12 +93,37 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
}
if(coolant.getFill() > 0) {
countdown = 0;
if(worldObj.rand.nextInt(3) == 0)
coolant.setFill(coolant.getFill() - 1);
} else {
worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 25, true, true);
} else if(worldObj.rand.nextInt(this.getSafety()) == 0) {
countdown++;
int chance = 7 - Math.min((int) Math.ceil(countdown / 200D), 6);
if(worldObj.rand.nextInt(chance) == 0)
ExplosionLarge.spawnTracers(worldObj, xCoord + 0.5, yCoord + 3.25, zCoord + 0.5, 1);
if(countdown > 1000) {
ExplosionThermo.setEntitiesOnFire(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 25);
ExplosionThermo.scorchLight(worldObj, xCoord, yCoord, zCoord, 7);
if(countdown % 4 == 0)
ExplosionLarge.spawnBurst(worldObj, xCoord + 0.5, yCoord + 3.25, zCoord + 0.5, 18, 1);
} else if(countdown > 600) {
ExplosionThermo.setEntitiesOnFire(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 10);
}
if(countdown == 1140)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:block.shutdown", 10.0F, 1.0F);
if(countdown > 1200)
explode();
}
} else {
@ -101,8 +141,8 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
data.setBoolean("isOn", isOn);
this.networkPack(data, 25);
this.coolant.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
this.amat.updateTank(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
coolant.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
amat.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
}
}
@ -113,25 +153,46 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
}
public void handleButtonPacket(int value, int meta) {
this.isOn = !this.isOn;
}
private void explode() {
System.out.println("Before: " + isOn);
ExplosionLarge.explodeFire(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 25, true, false, true);
if(this.isOn)
this.isOn = false;
else
this.isOn = true;
System.out.println("After: " + isOn);
int rand = worldObj.rand.nextInt(10);
if(rand < 2) {
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)(BombConfig.fatmanRadius * 1.5), xCoord + 0.5, yCoord + 1.5, zCoord + 0.5));
ExplosionParticle.spawnMush(worldObj, xCoord + 0.5, yCoord - 3, zCoord + 0.5);
} else if(rand < 4) {
EntityBalefire bf = new EntityBalefire(worldObj);
bf.posX = xCoord + 0.5;
bf.posY = yCoord + 1.5;
bf.posZ = zCoord + 0.5;
bf.destructionRange = (int)(BombConfig.fatmanRadius * 1.5);
worldObj.spawnEntityInWorld(bf);
ExplosionParticleB.spawnMush(worldObj, xCoord + 0.5, yCoord - 3, zCoord + 0.5);
} else if(rand < 5) {
EntityBlackHole bl = new EntityBlackHole(worldObj, 1.5F + worldObj.rand.nextFloat());
bl.posX = xCoord + 0.5F;
bl.posY = yCoord + 1.5F;
bl.posZ = zCoord + 0.5F;
worldObj.spawnEntityInWorld(bl);
}
}
public boolean canProcess() {
if(power < consumption)
return false;
for(int i = 0; i < 3; i++) {
ItemStack out = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
Object[] res = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
if(res == null)
continue;
ItemStack out = (ItemStack)res[0];
if(out == null)
continue;
@ -148,57 +209,101 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
public void process() {
int amat = 0;
for(int i = 0; i < 3; i++) {
ItemStack out = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
Object[] res = CyclotronRecipes.getOutput(slots[i + 3], slots[i]);
if(res == null)
continue;
ItemStack out = (ItemStack)res[0];
if(out == null)
continue;
if(slots[i + 6] == null) {
amat += this.getAmat(slots[i]);
this.decrStackSize(i, 1);
this.decrStackSize(i + 3, 1);
slots[i + 6] = out;
this.amat.setFill(this.amat.getFill() + (Integer)res[1]);
continue;
}
if(slots[i + 6].getItem() == out.getItem() && slots[i + 6].getItemDamage() == out.getItemDamage() && slots[i + 6].stackSize < out.getMaxStackSize()) {
amat += this.getAmat(slots[i]);
this.decrStackSize(i, 1);
this.decrStackSize(i + 3, 1);
slots[i + 6].stackSize++;
this.amat.setFill(this.amat.getFill() + (Integer)res[1]);
}
}
this.amat.setFill(this.amat.getFill() + amat);
if(this.amat.getFill() > this.amat.getMaxFill())
this.amat.setFill(this.amat.getMaxFill());
}
public int getAmat(ItemStack stack) {
public int getSpeed() {
//TODO: move to cyclotron recipe handler and register it on a per-recipe basis
int speed = 1;
if(stack == null)
return 0;
for(int i = 14; i < 16; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_speed_1)
speed += 1;
else if(slots[i].getItem() == ModItems.upgrade_speed_2)
speed += 2;
else if(slots[i].getItem() == ModItems.upgrade_speed_3)
speed += 3;
}
}
if(stack.getItem() == ModItems.part_lithium)
return 50;
if(stack.getItem() == ModItems.part_beryllium)
return 25;
if(stack.getItem() == ModItems.part_carbon)
return 10;
if(stack.getItem() == ModItems.part_copper)
return 15;
if(stack.getItem() == ModItems.part_plutonium)
return 100;
return Math.min(speed, 4);
}
public int getConsumption() {
return 0;
int speed = 0;
for(int i = 14; i < 16; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_power_1)
speed += 1;
else if(slots[i].getItem() == ModItems.upgrade_power_2)
speed += 2;
else if(slots[i].getItem() == ModItems.upgrade_power_3)
speed += 3;
}
}
return Math.min(speed, 3);
}
public int getSafety() {
int speed = 1;
for(int i = 14; i < 16; i++) {
if(slots[i] != null) {
if(slots[i].getItem() == ModItems.upgrade_effect_1)
speed += 1;
else if(slots[i].getItem() == ModItems.upgrade_effect_2)
speed += 2;
else if(slots[i].getItem() == ModItems.upgrade_effect_3)
speed += 3;
}
}
return Math.min(speed, 4);
}
public long getPowerScaled(long i) {
@ -211,6 +316,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
@Override
public void setFillstate(int fill, int index) {
if(index == 0)
coolant.setFill(fill);
else if(index == 1)
@ -230,7 +336,7 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
if(index == 0)
coolant.setTankType(type);
else if(index == 1)
coolant.setTankType(type);
amat.setTankType(type);
}
@Override
@ -290,4 +396,49 @@ public class TileEntityMachineCyclotron extends TileEntityMachineBase implements
return 0;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 4, zCoord + 3);
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
coolant.readFromNBT(nbt, "coolant");
amat.readFromNBT(nbt, "amat");
this.isOn = nbt.getBoolean("isOn");
this.countdown = nbt.getInteger("countdown");
this.progress = nbt.getInteger("progress");
this.power = nbt.getLong("power");
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
coolant.writeToNBT(nbt, "coolant");
amat.writeToNBT(nbt, "amat");
nbt.setBoolean("isOn", isOn);
nbt.setInteger("countdown", countdown);
nbt.setInteger("progress", progress);
nbt.setLong("power", power);
}
@Override
public void setInventorySlotContents(int i, ItemStack stack) {
super.setInventorySlotContents(i, stack);
if(stack != null && i >= 14 && i <= 15 && stack.getItem() instanceof ItemMachineUpgrade)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, "hbm:item.upgradePlug", 1.5F, 1.0F);
}
}

View File

@ -211,356 +211,7 @@ public class TileEntityMachineIGenerator extends TileEntity implements ISidedInv
}
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
age++;
if(age >= 20)
{
age = 0;
}
if(age == 9 || age == 19)
ffgeuaInit();
rotation += (this.torque / 100F);
if(burn > 0) {
burn--;
if(heat + 10 <= maxHeat)
heat += 10;
}
if(water > 0) {
if(heat >= 8) {
heat -= 8;
torque += 10;
water--;
}
} else {
if(heat >= 4) {
heat -= 4;
torque += 5;
}
}
heat += (5 * this.canLocateRTG());
heat += (3 * this.canLocateWeakRTG());
for(int i = 0; i < this.canLocateThermalElement(); i++) {
if(heat >= 10) {
heat -= 10;
if(power + 10 <= maxPower) {
power += 10;
}
}
}
this.power += this.torque;
if(power > maxPower)
power = maxPower;
if(torque > 0) {
if(lubricant > 0 ) {
torque--;
lubricant--;
} else {
torque -= 5;
}
}
if(torque < 0)
torque = 0;
if(torque > maxTorque && this.hasLimiter())
torque = maxTorque;
if(torque > maxTorque) {
worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Blocks.air);
}
if(this.getHeatScaled(100) < 90) {
if(fuel > 0) {
fuel --;
if(heat + 10 <= maxHeat)
heat += 10;
}
doSolidFuelTask();
}
doFuelTask();
doLubeTask();
doWaterTask();
doBatteryTask();
}
if(!worldObj.isRemote) {
PacketDispatcher.wrapper.sendToAllAround(new TEIGeneratorPacket(xCoord, yCoord, zCoord, rotation, torque), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
}
public void doFuelTask() {
if (slots[13] != null && slots[13].getItem() == ModItems.canister_fuel && fuel + 625 <= maxFuel) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
fuel += 625;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.canister_smear && fuel + 200 <= maxFuel) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
fuel += 200;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.canister_reoil && fuel + 350 <= maxFuel) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
fuel += 350;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.canister_petroil && fuel + 500 <= maxFuel) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
fuel += 500;
}
}
if (slots[13] != null && slots[13].getItem() == Item.getItemFromBlock(ModBlocks.red_barrel) && fuel + 5000 <= maxFuel) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == ModItems.tank_steel
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(ModItems.tank_steel);
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
fuel += 5000;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.fluid_barrel_infinite) {
this.fuel = TileEntityMachineIGenerator.maxFuel;
this.lubricant = TileEntityMachineIGenerator.maxLubricant;
this.water = TileEntityMachineIGenerator.maxWater;
}
}
public void doLubeTask() {
if (slots[13] != null && slots[13].getItem() == ModItems.canister_canola && lubricant + 625 <= maxLubricant) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
lubricant += 625;
}
}
}
public void doWaterTask() {
if (slots[13] != null && slots[13].getItem() == Items.water_bucket && water + 625 <= maxWater) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
water += 625;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.rod_water && water + 625 <= maxWater) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
water += 625;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.rod_dual_water && water + 1250 <= maxWater) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
water += 1250;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.rod_quad_water && water + 2500 <= maxWater) {
if (slots[14] == null || slots[14] != null && slots[14].getItem() == slots[13].getItem().getContainerItem()
&& slots[14].stackSize < slots[14].getMaxStackSize()) {
if (slots[14] == null)
slots[14] = new ItemStack(slots[13].getItem().getContainerItem());
else
slots[14].stackSize++;
slots[13].stackSize--;
if (slots[13].stackSize <= 0)
slots[13] = null;
water += 2500;
}
}
if (slots[13] != null && slots[13].getItem() == ModItems.inf_water)
this.water = TileEntityMachineIGenerator.maxWater;
}
public void doSolidFuelTask() {
if(slots[12] != null && slots[12].getItem() == Items.coal && burn <= 0)
{
slots[12].stackSize -= 1;
burn = 200;
if(slots[12].stackSize == 0)
{
slots[12] = null;
}
}
if(slots[12] != null && slots[12].getItem() == ModItems.powder_coal && burn <= 0)
{
slots[12].stackSize -= 1;
burn = 200;
if(slots[12].stackSize == 0)
{
slots[12] = null;
}
}
if(slots[12] != null && slots[12].getItem() == Item.getItemFromBlock(Blocks.coal_block) && burn <= 0)
{
slots[12].stackSize -= 1;
burn = 2000;
if(slots[12].stackSize == 0)
{
slots[12] = null;
}
}
}
public void doBatteryTask() {
power = Library.chargeItemsFromTE(slots, 15, power, maxPower);
}
public int canLocateThermalElement() {
int thermo = 0;
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null && slots[i].getItem() == ModItems.thermo_element)
thermo ++;
}
return thermo;
}
public int canLocateRTG() {
int rtg = 0;
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null && slots[i].getItem() == ModItems.pellet_rtg)
rtg ++;
}
return rtg;
}
public int canLocateWeakRTG() {
int rtg = 0;
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null && slots[i].getItem() == ModItems.pellet_rtg_weak)
rtg ++;
}
return rtg;
}
public boolean hasLimiter() {
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null && slots[i].getItem() == ModItems.limiter)
return true;
}
return false;
}
public void updateEntity() { }
public int getFuelScaled(int i) {
return (fuel * i) / maxFuel;

View File

@ -22,6 +22,7 @@ import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
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.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -33,8 +34,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileEntityMachineReactorSmall extends TileEntity
implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
public class TileEntityMachineReactorSmall extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
private ItemStack slots[];
@ -75,7 +75,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if (slots[i] != null) {
if(slots[i] != null) {
ItemStack itemStack = slots[i];
slots[i] = null;
return itemStack;
@ -87,7 +87,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public void setInventorySlotContents(int i, ItemStack itemStack) {
slots[i] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
}
}
@ -113,7 +113,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) {
return false;
} else {
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64;
@ -131,31 +131,28 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|| i == 11)
if (itemStack.getItem() instanceof ItemFuelRod)
if(i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11)
if(itemStack.getItem() instanceof ItemFuelRod)
return true;
if (i == 12)
if (itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water
|| itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket)
if(i == 12)
if(itemStack.getItem() == ModItems.rod_water || itemStack.getItem() == ModItems.rod_dual_water || itemStack.getItem() == ModItems.rod_quad_water || itemStack.getItem() == Items.water_bucket)
return true;
if (i == 14)
if (itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant
|| itemStack.getItem() == ModItems.rod_quad_coolant)
if(i == 14)
if(itemStack.getItem() == ModItems.rod_coolant || itemStack.getItem() == ModItems.rod_dual_coolant || itemStack.getItem() == ModItems.rod_quad_coolant)
return true;
return false;
}
@Override
public ItemStack decrStackSize(int i, int j) {
if (slots[i] != null) {
if (slots[i].stackSize <= 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) {
if(slots[i].stackSize == 0) {
slots[i] = null;
}
@ -179,10 +176,10 @@ public class TileEntityMachineReactorSmall extends TileEntity
tanks[1].readFromNBT(nbt, "coolant");
tanks[2].readFromNBT(nbt, "steam");
for (int i = 0; i < list.tagCount(); i++) {
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if (b0 >= 0 && b0 < slots.length) {
if(b0 >= 0 && b0 < slots.length) {
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
@ -200,8 +197,8 @@ public class TileEntityMachineReactorSmall extends TileEntity
tanks[1].writeToNBT(nbt, "coolant");
tanks[2].writeToNBT(nbt, "steam");
for (int i = 0; i < slots.length; i++) {
if (slots[i] != null) {
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);
@ -223,30 +220,15 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
if (i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10
|| i == 11)
if (itemStack.getItem() == ModItems.rod_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted
|| itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted
|| itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted)
if(i == 0 || i == 1 || i == 2 || i == 3 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11)
if(itemStack.getItem() == ModItems.rod_uranium_fuel_depleted || itemStack.getItem() == ModItems.rod_dual_uranium_fuel_depleted || itemStack.getItem() == ModItems.rod_quad_uranium_fuel_depleted || itemStack.getItem() == ModItems.rod_plutonium_fuel_depleted || itemStack.getItem() == ModItems.rod_dual_plutonium_fuel_depleted || itemStack.getItem() == ModItems.rod_quad_plutonium_fuel_depleted || itemStack.getItem() == ModItems.rod_mox_fuel_depleted || itemStack.getItem() == ModItems.rod_dual_mox_fuel_depleted || itemStack.getItem() == ModItems.rod_quad_mox_fuel_depleted || itemStack.getItem() == ModItems.rod_schrabidium_fuel_depleted || itemStack.getItem() == ModItems.rod_dual_schrabidium_fuel_depleted || itemStack.getItem() == ModItems.rod_quad_schrabidium_fuel_depleted)
return true;
if (i == 13 || i == 15)
if (itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty
|| itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty
|| itemStack.getItem() == ModItems.fluid_tank_empty
|| itemStack.getItem() == ModItems.fluid_barrel_empty)
if(i == 13 || i == 15)
if(itemStack.getItem() == Items.bucket || itemStack.getItem() == ModItems.rod_empty || itemStack.getItem() == ModItems.rod_dual_empty || itemStack.getItem() == ModItems.rod_quad_empty || itemStack.getItem() == ModItems.fluid_tank_empty || itemStack.getItem() == ModItems.fluid_barrel_empty)
return true;
return false;
}
public int getCoreHeatScaled(int i) {
@ -271,7 +253,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
private int[] getNeighbouringSlots(int id) {
switch (id) {
switch(id) {
case 0:
return new int[] { 1, 5 };
case 1:
@ -300,73 +282,69 @@ public class TileEntityMachineReactorSmall extends TileEntity
return null;
}
public int getFuelPercent() {
if(getRodCount() == 0)
return 0;
int rodMax = 0;
int rod = 0;
for(int i = 0; i < 12; i++) {
if(slots[i] != null && slots[i].getItem() instanceof ItemFuelRod) {
rodMax += ((ItemFuelRod)slots[i].getItem()).lifeTime;
rod += ((ItemFuelRod)slots[i].getItem()).lifeTime - ItemFuelRod.getLifeTime(slots[i]);
rodMax += ((ItemFuelRod) slots[i].getItem()).lifeTime;
rod += ((ItemFuelRod) slots[i].getItem()).lifeTime - ItemFuelRod.getLifeTime(slots[i]);
}
}
if(rodMax == 0)
return 0;
return rod * 100 / rodMax;
}
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
age++;
if (age >= 20) {
if(age >= 20) {
age = 0;
}
if (age == 9 || age == 19)
if(age == 9 || age == 19)
fillFluidInit(tanks[2].getTankType());
tanks[0].loadTank(12, 13, slots);
tanks[1].loadTank(14, 15, slots);
if (retracting && rods > 0) {
if(retracting && rods > 0) {
if (rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
0.75F);
if(rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, 0.75F);
rods--;
if (rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
1.0F);
if(rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, 1.0F);
}
if (!retracting && rods < rodsMax) {
if(!retracting && rods < rodsMax) {
if (rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F,
0.75F);
if(rods == 0)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStart", 1.0F, 0.75F);
rods++;
if (rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F,
1.0F);
if(rods == rodsMax)
this.worldObj.playSoundEffect(this.xCoord, this.yCoord, this.zCoord, "hbm:block.reactorStop", 1.0F, 1.0F);
}
if (rods >= rodsMax)
for (int i = 0; i < 12; i++) {
if (slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
if(rods >= rodsMax)
for(int i = 0; i < 12; i++) {
if(slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
decay(i);
}
@ -374,53 +352,52 @@ public class TileEntityMachineReactorSmall extends TileEntity
hullHeatMod = 1.0;
conversionMod = 1.0;
decayMod = 1.0;
getInteractions();
if (this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) {
if(this.coreHeat > 0 && this.tanks[1].getFill() > 0 && this.hullHeat < this.maxHullHeat) {
this.hullHeat += this.coreHeat * 0.175 * hullHeatMod;
this.coreHeat -= this.coreHeat * 0.1;
this.tanks[1].setFill(this.tanks[1].getFill() - 10);
if (this.tanks[1].getFill() < 0)
if(this.tanks[1].getFill() < 0)
this.tanks[1].setFill(0);
}
if (this.hullHeat > maxHullHeat) {
if(this.hullHeat > maxHullHeat) {
this.hullHeat = maxHullHeat;
}
if (this.hullHeat > 0 && this.tanks[0].getFill() > 0) {
if(this.hullHeat > 0 && this.tanks[0].getFill() > 0) {
generateSteam();
this.hullHeat -= this.hullHeat * 0.085;
}
if (this.coreHeat > maxCoreHeat) {
if(this.coreHeat > maxCoreHeat) {
this.explode();
}
if (rods > 0 && coreHeat > 0
&& !(blocksRad(xCoord + 1, yCoord + 1, zCoord)
&& blocksRad(xCoord - 1, yCoord + 1, zCoord)
&& blocksRad(xCoord, yCoord + 1, zCoord + 1)
&& blocksRad(xCoord, yCoord + 1, zCoord - 1))) {
if(rods > 0 && coreHeat > 0 && !(blocksRad(xCoord + 1, yCoord + 1, zCoord) && blocksRad(xCoord - 1, yCoord + 1, zCoord) && blocksRad(xCoord, yCoord + 1, zCoord + 1) && blocksRad(xCoord, yCoord + 1, zCoord - 1))) {
/*List<Entity> list = (List<Entity>) worldObj.getEntitiesWithinAABBExcludingEntity(null,
AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 - 5, zCoord + 0.5 - 5,
xCoord + 0.5 + 5, yCoord + 1.5 + 5, zCoord + 0.5 + 5));
/*
* List<Entity> list = (List<Entity>)
* worldObj.getEntitiesWithinAABBExcludingEntity(null,
* AxisAlignedBB.getBoundingBox(xCoord + 0.5 - 5, yCoord + 1.5 -
* 5, zCoord + 0.5 - 5, xCoord + 0.5 + 5, yCoord + 1.5 + 5,
* zCoord + 0.5 + 5));
*
* for (Entity e : list) { if (e instanceof EntityLivingBase)
* Library.applyRadiation((EntityLivingBase)e, 80, 24, 60, 19);
* }
*/
for (Entity e : list) {
if (e instanceof EntityLivingBase)
Library.applyRadiation((EntityLivingBase)e, 80, 24, 60, 19);
}*/
float rad = (float)coreHeat / (float)maxCoreHeat * 50F;
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++)
for(int i = 0; i < 3; i++)
tanks[i].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, rods, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 150));
@ -429,16 +406,16 @@ public class TileEntityMachineReactorSmall extends TileEntity
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, hullHeat, 3), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
}
@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)) * conversionMod;
// function of SHS produced per tick
// maxes out at heat% * tank capacity / 20
double steam = (((double) hullHeat / (double) maxHullHeat) * ((double) tanks[2].getMaxFill() / 50D)) * conversionMod;
double water = steam;
switch(tanks[2].getTankType()) {
case STEAM:
water /= 100D;
@ -449,25 +426,25 @@ public class TileEntityMachineReactorSmall extends TileEntity
case SUPERHOTSTEAM:
break;
}
tanks[0].setFill(tanks[0].getFill() - (int)Math.ceil(water));
tanks[2].setFill(tanks[2].getFill() + (int)Math.floor(steam));
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 getInteractions() {
getInteractionForBlock(xCoord + 1, yCoord + 1, zCoord);
getInteractionForBlock(xCoord - 1, yCoord + 1, zCoord);
getInteractionForBlock(xCoord, yCoord + 1, zCoord + 1);
getInteractionForBlock(xCoord, yCoord + 1, zCoord - 1);
TileEntity te1 = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord);
TileEntity te2 = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord);
TileEntity te3 = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2);
@ -477,16 +454,16 @@ public class TileEntityMachineReactorSmall extends TileEntity
boolean b2 = blocksRad(xCoord - 1, yCoord + 1, zCoord);
boolean b3 = blocksRad(xCoord, yCoord + 1, zCoord + 1);
boolean b4 = blocksRad(xCoord, yCoord + 1, zCoord - 1);
TileEntityMachineReactorSmall[] reactors = new TileEntityMachineReactorSmall[4];
reactors[0] = ((te1 instanceof TileEntityMachineReactorSmall && !b1) ? (TileEntityMachineReactorSmall)te1 : null);
reactors[1] = ((te2 instanceof TileEntityMachineReactorSmall && !b2) ? (TileEntityMachineReactorSmall)te2 : null);
reactors[2] = ((te3 instanceof TileEntityMachineReactorSmall && !b3) ? (TileEntityMachineReactorSmall)te3 : null);
reactors[3] = ((te4 instanceof TileEntityMachineReactorSmall && !b4) ? (TileEntityMachineReactorSmall)te4 : null);
reactors[0] = ((te1 instanceof TileEntityMachineReactorSmall && !b1) ? (TileEntityMachineReactorSmall) te1 : null);
reactors[1] = ((te2 instanceof TileEntityMachineReactorSmall && !b2) ? (TileEntityMachineReactorSmall) te2 : null);
reactors[2] = ((te3 instanceof TileEntityMachineReactorSmall && !b3) ? (TileEntityMachineReactorSmall) te3 : null);
reactors[3] = ((te4 instanceof TileEntityMachineReactorSmall && !b4) ? (TileEntityMachineReactorSmall) te4 : null);
for(int i = 0; i < 4; i++) {
if(reactors[i] != null && reactors[i].rods >= rodsMax && reactors[i].getRodCount() > 0) {
decayMod += reactors[i].getRodCount() / 2D;
}
@ -497,110 +474,110 @@ public class TileEntityMachineReactorSmall extends TileEntity
private double coreHeatMod = 1.0D;
private double hullHeatMod = 1.0D;
private double conversionMod = 1.0D;
private void getInteractionForBlock(int x, int y, int z) {
Block b = worldObj.getBlock(x, y, z);
TileEntity te = worldObj.getTileEntity(x, y, z);
if(b == Blocks.lava || b == Blocks.flowing_lava) {
hullHeatMod *= 3;
conversionMod *= 0.5;
} else if(b == Blocks.redstone_block) {
conversionMod *= 1.15;
} else if(b == ModBlocks.block_lead) {
decayMod += 1;
} else if(b == Blocks.water || b == Blocks.flowing_water) {
tanks[0].setFill(tanks[0].getFill() + 25);
if(tanks[0].getFill() > tanks[0].getMaxFill())
tanks[0].setFill(tanks[0].getMaxFill());
} else if(b == ModBlocks.block_niter) {
if(tanks[0].getFill() >= 50 && tanks[1].getFill() + 5 <= tanks[1].getMaxFill()) {
tanks[0].setFill(tanks[0].getFill() - 50);
tanks[1].setFill(tanks[1].getFill() + 5);
}
} else if(b == ModBlocks.machine_reactor) {
int[] pos = ((MachineReactor)ModBlocks.machine_reactor).findCore(worldObj, x, y, z);
int[] pos = ((MachineReactor) ModBlocks.machine_reactor).findCore(worldObj, x, y, z);
if(pos != null) {
TileEntity tile = worldObj.getTileEntity(pos[0], pos[1], pos[2]);
if(tile instanceof TileEntityMachineReactor) {
TileEntityMachineReactor reactor = (TileEntityMachineReactor)tile;
TileEntityMachineReactor reactor = (TileEntityMachineReactor) tile;
if(reactor.charge <= 1 && this.hullHeat > 0) {
reactor.charge = 1;
reactor.heat = (int)Math.floor(hullHeat * 4 / maxHullHeat) + 1;
reactor.heat = (int) Math.floor(hullHeat * 4 / maxHullHeat) + 1;
}
}
}
} else if(te instanceof TileEntityNukeFurnace) {
TileEntityNukeFurnace reactor = (TileEntityNukeFurnace)te;
TileEntityNukeFurnace reactor = (TileEntityNukeFurnace) te;
if(reactor.dualPower < 1 && this.coreHeat > 0)
reactor.dualPower = 1;
} else if(b == ModBlocks.block_uranium) {
coreHeatMod *= 1.05;
} else if(b == Blocks.coal_block) {
hullHeatMod *= 1.1;
} else if(b == ModBlocks.block_beryllium) {
hullHeatMod *= 0.95;
conversionMod *= 1.05;
} else if(b == ModBlocks.block_schrabidium) {
decayMod += 1;
conversionMod *= 1.25;
hullHeatMod *= 1.1;
} else if(b == ModBlocks.block_waste) {
decayMod += 3;
}
}
private boolean blocksRad(int x, int y, int z) {
Block b = worldObj.getBlock(x, y, z);
if(b == ModBlocks.block_lead || b == ModBlocks.block_desh || b == ModBlocks.brick_concrete)
return true;
if(b.getExplosionResistance(null) >= 100)
return true;
return false;
}
public int getRodCount() {
int count = 0;
for(int i = 0; i < 12; i++) {
if(slots[i] != null && slots[i].getItem() instanceof ItemFuelRod)
count++;
}
return count;
}
private boolean hasFuelRod(int id) {
if (id > 11)
if(id > 11)
return false;
if (slots[id] != null)
if(slots[id] != null)
return slots[id].getItem() instanceof ItemFuelRod;
return false;
@ -610,13 +587,13 @@ public class TileEntityMachineReactorSmall extends TileEntity
int[] neighbours = this.getNeighbouringSlots(id);
if (neighbours == null)
if(neighbours == null)
return 0;
int count = 0;
for (int i = 0; i < neighbours.length; i++)
if (hasFuelRod(neighbours[i]))
for(int i = 0; i < neighbours.length; i++)
if(hasFuelRod(neighbours[i]))
count++;
return count;
@ -625,14 +602,14 @@ public class TileEntityMachineReactorSmall extends TileEntity
// itemstack in slots[id] has to contain ItemFuelRod item
private void decay(int id) {
if (id > 11)
if(id > 11)
return;
int decay = getNeightbourCount(id) + 1;
decay *= decayMod;
for (int i = 0; i < decay; i++) {
for(int i = 0; i < decay; i++) {
ItemFuelRod rod = ((ItemFuelRod) slots[id].getItem());
this.coreHeat += rod.heat * coreHeatMod;
ItemFuelRod.setLifeTime(slots[id], ItemFuelRod.getLifeTime(slots[id]) + 1);
@ -647,59 +624,59 @@ public class TileEntityMachineReactorSmall extends TileEntity
// itemstack in slots[id] has to contain ItemFuelRod item
private void onRunOut(int id) {
//System.out.println("aaa");
// System.out.println("aaa");
Item item = slots[id].getItem();
if (item == ModItems.rod_uranium_fuel) {
if(item == ModItems.rod_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_uranium_fuel_depleted);
} else if (item == ModItems.rod_thorium_fuel) {
} else if(item == ModItems.rod_thorium_fuel) {
slots[id] = new ItemStack(ModItems.rod_thorium_fuel_depleted);
} else if (item == ModItems.rod_plutonium_fuel) {
} else if(item == ModItems.rod_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_plutonium_fuel_depleted);
} else if (item == ModItems.rod_mox_fuel) {
} else if(item == ModItems.rod_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_mox_fuel_depleted);
} else if (item == ModItems.rod_schrabidium_fuel) {
} else if(item == ModItems.rod_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_schrabidium_fuel_depleted);
} else if (item == ModItems.rod_dual_uranium_fuel) {
} else if(item == ModItems.rod_dual_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_uranium_fuel_depleted);
} else if (item == ModItems.rod_dual_thorium_fuel) {
} else if(item == ModItems.rod_dual_thorium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_thorium_fuel_depleted);
} else if (item == ModItems.rod_dual_plutonium_fuel) {
} else if(item == ModItems.rod_dual_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_plutonium_fuel_depleted);
} else if (item == ModItems.rod_dual_mox_fuel) {
} else if(item == ModItems.rod_dual_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_mox_fuel_depleted);
} else if (item == ModItems.rod_dual_schrabidium_fuel) {
} else if(item == ModItems.rod_dual_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_dual_schrabidium_fuel_depleted);
} else if (item == ModItems.rod_quad_uranium_fuel) {
} else if(item == ModItems.rod_quad_uranium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_uranium_fuel_depleted);
} else if (item == ModItems.rod_quad_thorium_fuel) {
} else if(item == ModItems.rod_quad_thorium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_thorium_fuel_depleted);
} else if (item == ModItems.rod_quad_plutonium_fuel) {
} else if(item == ModItems.rod_quad_plutonium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_plutonium_fuel_depleted);
} else if (item == ModItems.rod_quad_mox_fuel) {
} else if(item == ModItems.rod_quad_mox_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_mox_fuel_depleted);
} else if (item == ModItems.rod_quad_schrabidium_fuel) {
} else if(item == ModItems.rod_quad_schrabidium_fuel) {
slots[id] = new ItemStack(ModItems.rod_quad_schrabidium_fuel_depleted);
}
}
private void explode() {
for (int i = 0; i < slots.length; i++) {
for(int i = 0; i < slots.length; i++) {
this.slots[i] = null;
}
@ -731,7 +708,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public boolean getTact() {
if (age >= 0 && age < 10) {
if(age >= 0 && age < 10) {
return true;
}
@ -740,9 +717,9 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public int getMaxFluidFill(FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getMaxFill();
else if (type.name().equals(tanks[1].getTankType().name()))
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getMaxFill();
else
return 0;
@ -750,21 +727,21 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public void setFluidFill(int i, FluidType type) {
if (type.name().equals(tanks[0].getTankType().name()))
if(type.name().equals(tanks[0].getTankType().name()))
tanks[0].setFill(i);
else if (type.name().equals(tanks[1].getTankType().name()))
else if(type.name().equals(tanks[1].getTankType().name()))
tanks[1].setFill(i);
else if (type.name().equals(tanks[2].getTankType().name()))
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()))
if(type.name().equals(tanks[0].getTankType().name()))
return tanks[0].getFill();
else if (type.name().equals(tanks[1].getTankType().name()))
else if(type.name().equals(tanks[1].getTankType().name()))
return tanks[1].getFill();
else if (type.name().equals(tanks[2].getTankType().name()))
else if(type.name().equals(tanks[2].getTankType().name()))
return tanks[2].getFill();
else
return 0;
@ -772,13 +749,13 @@ public class TileEntityMachineReactorSmall extends TileEntity
@Override
public void setFillstate(int fill, int index) {
if (index < 3 && tanks[index] != null)
if(index < 3 && tanks[index] != null)
tanks[index].setFill(fill);
}
@Override
public void setType(FluidType type, int index) {
if (index < 3 && tanks[index] != null)
if(index < 3 && tanks[index] != null)
tanks[index].setTankType(type);
}
@ -788,7 +765,7 @@ public class TileEntityMachineReactorSmall extends TileEntity
list.add(tanks[0]);
list.add(tanks[1]);
list.add(tanks[2]);
return list;
}
@ -812,4 +789,12 @@ public class TileEntityMachineReactorSmall extends TileEntity
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
public boolean isSubmerged() {
return worldObj.getBlock(xCoord + 1, yCoord + 1, zCoord).getMaterial() == Material.water &&
worldObj.getBlock(xCoord, yCoord + 1, zCoord + 1).getMaterial() == Material.water &&
worldObj.getBlock(xCoord - 1, yCoord + 1, zCoord).getMaterial() == Material.water &&
worldObj.getBlock(xCoord, yCoord + 1, zCoord - 1).getMaterial() == Material.water;
}
}