diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index b011fc1b3..07c9b8b26 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -579,6 +579,7 @@ item.fragment_niobium.name=Niobium Ffragment item.fragment_cerium.name=Cerium Ffragment item.fragment_lanthanium.name=Lanthanfragment item.fragment_actinium.name=Actiniumfragment +item.fragment_meteorite.name=Meteoritenfragment item.battery_generic.name=Batterie item.battery_advanced.name=Fortgeschrittene Batterie @@ -1192,7 +1193,12 @@ item.desh_shovel.name=Arbeitslegierungsschaufel item.desh_hoe.name=Arbeitslegierungsfeldhacke tile.red_cable.name=Rotes Kupferkabel + tile.block_meteor.name=Meteoritenblock +tile.block_meteor_broken.name=Gebrochener Meteoritenblock +tile.block_meteor_cobble.name=Meteoritenpflasterstein +tile.block_meteor_molten.name=Heißer Meteoritenpflasterstein +tile.block_meteor_treasure.name=Meteoritenschatz item.cape_radiation.name=Cape (Radioaktiv) item.cape_gasmask.name=Cape (Gasmaske) diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index afc7248e8..092384775 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -579,6 +579,7 @@ item.fragment_niobium.name=Niobium Fragment item.fragment_cerium.name=Cerium Fragment item.fragment_lanthanium.name=Lanthanium Fragment item.fragment_actinium.name=Actinium Fragment +item.fragment_meteorite.name=Meteorite Fragment item.battery_generic.name=Battery item.battery_advanced.name=Advanced Battery @@ -1192,7 +1193,12 @@ item.desh_shovel.name=Worker's Alloy Shovel item.desh_hoe.name=Worker's Alloy Hoe tile.red_cable.name=Red Copper Cable -tile.block_meteor.name=Meteor Block + +tile.block_meteor.name=Meteorite Block +tile.block_meteor_broken.name=Broken Meteorite Block +tile.block_meteor_cobble.name=Meteorite Cobblestone +tile.block_meteor_molten.name=Hot Meteorite Cobblestone +tile.block_meteor_treasure.name=Meteorite Treasure Block item.cape_radiation.name=Cape (Radiation) item.cape_gasmask.name=Cape (Gas Mask) diff --git a/assets/hbm/textures/blocks/block_meteor_broken.png b/assets/hbm/textures/blocks/block_meteor_broken.png new file mode 100644 index 000000000..1b1d23e6a Binary files /dev/null and b/assets/hbm/textures/blocks/block_meteor_broken.png differ diff --git a/assets/hbm/textures/blocks/block_meteor_cobble.png b/assets/hbm/textures/blocks/block_meteor_cobble.png new file mode 100644 index 000000000..cb6ddeff6 Binary files /dev/null and b/assets/hbm/textures/blocks/block_meteor_cobble.png differ diff --git a/assets/hbm/textures/blocks/block_meteor_molten.png b/assets/hbm/textures/blocks/block_meteor_molten.png new file mode 100644 index 000000000..041c564f9 Binary files /dev/null and b/assets/hbm/textures/blocks/block_meteor_molten.png differ diff --git a/assets/hbm/textures/blocks/block_meteor_treasure.png b/assets/hbm/textures/blocks/block_meteor_treasure.png new file mode 100644 index 000000000..35f33552c Binary files /dev/null and b/assets/hbm/textures/blocks/block_meteor_treasure.png differ diff --git a/assets/hbm/textures/gui/GUICoal.png b/assets/hbm/textures/gui/GUICoal.png index 0fbef7260..55baf1719 100644 Binary files a/assets/hbm/textures/gui/GUICoal.png and b/assets/hbm/textures/gui/GUICoal.png differ diff --git a/assets/hbm/textures/gui/gui_cmb_manufactory.png b/assets/hbm/textures/gui/gui_cmb_manufactory.png index 596063df9..e23738da6 100644 Binary files a/assets/hbm/textures/gui/gui_cmb_manufactory.png and b/assets/hbm/textures/gui/gui_cmb_manufactory.png differ diff --git a/assets/hbm/textures/gui/gui_fusion_multiblock.png b/assets/hbm/textures/gui/gui_fusion_multiblock.png index c3ba9ce8a..0ac0e9ab6 100644 Binary files a/assets/hbm/textures/gui/gui_fusion_multiblock.png and b/assets/hbm/textures/gui/gui_fusion_multiblock.png differ diff --git a/assets/hbm/textures/gui/gui_reactor_multiblock.png b/assets/hbm/textures/gui/gui_reactor_multiblock.png index f6975e534..fbc7c9044 100644 Binary files a/assets/hbm/textures/gui/gui_reactor_multiblock.png and b/assets/hbm/textures/gui/gui_reactor_multiblock.png differ diff --git a/assets/hbm/textures/gui/gui_watz_multiblock.png b/assets/hbm/textures/gui/gui_watz_multiblock.png index c644737c6..a89e83f6b 100644 Binary files a/assets/hbm/textures/gui/gui_watz_multiblock.png and b/assets/hbm/textures/gui/gui_watz_multiblock.png differ diff --git a/assets/hbm/textures/items/fragment_meteorite.png b/assets/hbm/textures/items/fragment_meteorite.png new file mode 100644 index 000000000..74dd58c7f Binary files /dev/null and b/assets/hbm/textures/items/fragment_meteorite.png differ diff --git a/com/hbm/blocks/ModBlocks.java b/com/hbm/blocks/ModBlocks.java index 0b79e4063..57058a799 100644 --- a/com/hbm/blocks/ModBlocks.java +++ b/com/hbm/blocks/ModBlocks.java @@ -119,8 +119,12 @@ public class ModBlocks { public static Block cmb_brick; public static Block cmb_brick_reinforced; - + public static Block block_meteor; + public static Block block_meteor_cobble; + public static Block block_meteor_broken; + public static Block block_meteor_molten; + public static Block block_meteor_treasure; public static Block tape_recorder; public static Block steel_poles; @@ -527,6 +531,10 @@ public class ModBlocks { cmb_brick_reinforced = new BlockGeneric(Material.rock).setBlockName("cmb_brick_reinforced").setCreativeTab(MainRegistry.tabBlock).setHardness(25.0F).setResistance(60000.0F).setBlockTextureName(RefStrings.MODID + ":cmb_brick_reinforced"); block_meteor = new BlockOre(Material.rock).setBlockName("block_meteor").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor"); + block_meteor_cobble = new BlockOre(Material.rock).setBlockName("block_meteor_cobble").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_cobble"); + block_meteor_broken = new BlockOre(Material.rock).setBlockName("block_meteor_broken").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_broken"); + block_meteor_molten = new BlockOre(Material.rock).setBlockName("block_meteor_molten").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_molten"); + block_meteor_treasure = new BlockOre(Material.rock).setBlockName("block_meteor_treasure").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":block_meteor_treasure"); tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.rock).setBlockName("steel_poles").setCreativeTab(MainRegistry.tabBlock).setHardness(15.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_steel_poles"); @@ -862,6 +870,10 @@ public class ModBlocks { //Decoration Blocks GameRegistry.registerBlock(block_meteor, block_meteor.getUnlocalizedName()); + GameRegistry.registerBlock(block_meteor_cobble, block_meteor_cobble.getUnlocalizedName()); + GameRegistry.registerBlock(block_meteor_broken, block_meteor_broken.getUnlocalizedName()); + GameRegistry.registerBlock(block_meteor_molten, block_meteor_molten.getUnlocalizedName()); + GameRegistry.registerBlock(block_meteor_treasure, block_meteor_treasure.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/com/hbm/blocks/generic/BlockOre.java b/com/hbm/blocks/generic/BlockOre.java index 058511c97..df14d072e 100644 --- a/com/hbm/blocks/generic/BlockOre.java +++ b/com/hbm/blocks/generic/BlockOre.java @@ -20,16 +20,20 @@ import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityMooshroom; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; import net.minecraft.world.World; public class BlockOre extends Block { public BlockOre(Material p_i45394_1_) { super(p_i45394_1_); + //if(this == ModBlocks.block_meteor_molten) + this.setTickRandomly(true); } @Override @@ -71,6 +75,54 @@ public class BlockOre extends Block { { return rand.nextInt(10) == 0 ? ModItems.plate_dalekanium : Item.getItemFromBlock(ModBlocks.block_meteor); } + if(this == ModBlocks.block_meteor_cobble) + { + return ModItems.fragment_meteorite; + } + if(this == ModBlocks.block_meteor_broken) + { + return ModItems.fragment_meteorite; + } + if(this == ModBlocks.block_meteor_treasure) + { + switch(rand.nextInt(35)) { + case 0: return ModItems.coil_advanced_alloy; + case 1: return ModItems.plate_advanced_alloy; + case 2: return ModItems.powder_desh_mix; + case 3: return ModItems.ingot_desh; + case 4: return ModItems.fusion_core; + case 5: return ModItems.battery_lithium_cell; + case 6: return ModItems.battery_schrabidium; + case 7: return ModItems.nugget_schrabidium; + case 8: return ModItems.ingot_pu238; + case 9: return ModItems.ingot_pu239; + case 10: return ModItems.ingot_u235; + case 11: return ModItems.turbine_tungsten; + case 12: return ModItems.ingot_dura_steel; + case 13: return ModItems.ingot_polymer; + case 14: return ModItems.ingot_tungsten; + case 15: return ModItems.ingot_combine_steel; + case 16: return ModItems.ingot_lanthanium; + case 17: return ModItems.ingot_actinium; + case 18: return Item.getItemFromBlock(ModBlocks.block_meteor); + case 19: return Item.getItemFromBlock(ModBlocks.fusion_heater); + case 20: return Item.getItemFromBlock(ModBlocks.fusion_core); + case 21: return Item.getItemFromBlock(ModBlocks.watz_element); + case 22: return Item.getItemFromBlock(ModBlocks.ore_rare); + case 23: return Item.getItemFromBlock(ModBlocks.fusion_conductor); + case 24: return Item.getItemFromBlock(ModBlocks.reactor_computer); + case 25: return Item.getItemFromBlock(ModBlocks.machine_diesel); + case 26: return Item.getItemFromBlock(ModBlocks.machine_rtg_grey); + case 27: return ModItems.pellet_rtg; + case 28: return ModItems.pellet_rtg_weak; + case 29: return ModItems.rtg_unit; + case 30: return ModItems.gun_spark_ammo; + case 31: return ModItems.gun_fatman_ammo; + case 32: return ModItems.gun_mirv_ammo; + case 33: return ModItems.gun_defabricator_ammo; + case 34: return ModItems.gun_osipr_ammo2; + } + } if(this == ModBlocks.ore_rare) { switch(rand.nextInt(6)) { @@ -109,6 +161,14 @@ public class BlockOre extends Block { { return 2 + p_149745_1_.nextInt(4); } + if(this == ModBlocks.block_meteor_broken) + { + return 1 + p_149745_1_.nextInt(3); + } + if(this == ModBlocks.block_meteor_treasure) + { + return 1 + p_149745_1_.nextInt(3); + } return 1; } @@ -221,6 +281,9 @@ public class BlockOre extends Block { ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 5 * 20, 1)); } } + + if(this == ModBlocks.block_meteor_molten) + entity.setFire(5); } @Override @@ -244,5 +307,23 @@ public class BlockOre extends Block { world.setBlock(x, y - 1, z, ModBlocks.ore_oil); } } + + @Override + public void updateTick(World world, int x, int y, int z, Random rand) + { + if(this == ModBlocks.block_meteor_molten && rand.nextInt(3) == 0) { + if(!world.isRemote) + world.setBlock(x, y, z, ModBlocks.block_meteor_cobble); + world.playSoundEffect((double)((float)x + 0.5F), (double)((float)y + 0.5F), (double)((float)z + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); + } + } + @Override + public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int i) { + + if(this == ModBlocks.block_meteor_molten) { + if(!world.isRemote) + world.setBlock(x, y, z, Blocks.lava); + } + } } diff --git a/com/hbm/blocks/test/TestEventTester.java b/com/hbm/blocks/test/TestEventTester.java index f040b2176..42c3745e4 100644 --- a/com/hbm/blocks/test/TestEventTester.java +++ b/com/hbm/blocks/test/TestEventTester.java @@ -1,19 +1,23 @@ package com.hbm.blocks.test; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Random; +import com.hbm.blocks.ModBlocks; import com.hbm.entity.effect.EntityBlackHole; import com.hbm.main.MainRegistry; +import com.hbm.world.Meteorite; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.enchantment.EnchantmentProtection; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; @@ -78,7 +82,12 @@ public class TestEventTester extends Block { bl.posY = y + 0.5F; bl.posZ = z + 0.5F; worldObj.spawnEntityInWorld(bl);*/ - if(!worldObj.isRemote) + + + + + + /*if(!worldObj.isRemote) { try { Chunk oldChunk = worldObj.getChunkFromBlockCoords(x1, z1); @@ -119,7 +128,25 @@ public class TestEventTester extends Block { System.out.println("Rejuvenation Failed!"); e.printStackTrace(); } - } + }*/ + + + if(!worldObj.isRemote) { + switch(itemRand.nextInt(3)) { + case 0: + (new Meteorite()).generateLarge(worldObj, itemRand, x1, y1, z1); + break; + case 1: + (new Meteorite()).generateMedium(worldObj, itemRand, x1, y1, z1); + break; + case 2: + (new Meteorite()).generateSmall(worldObj, itemRand, x1, y1, z1); + break; + } + } + + + } } diff --git a/com/hbm/inventory/container/ContainerFusionMultiblock.java b/com/hbm/inventory/container/ContainerFusionMultiblock.java index 2a86a765a..72a2c3539 100644 --- a/com/hbm/inventory/container/ContainerFusionMultiblock.java +++ b/com/hbm/inventory/container/ContainerFusionMultiblock.java @@ -23,15 +23,26 @@ public class ContainerFusionMultiblock extends Container { diFurnace = tedf; - this.addSlotToContainer(new Slot(tedf, 0, 8, 108)); - this.addSlotToContainer(new Slot(tedf, 1, 26, 108)); - this.addSlotToContainer(new Slot(tedf, 2, 134, 108)); - this.addSlotToContainer(new Slot(tedf, 3, 152, 108)); + //Water Input + this.addSlotToContainer(new Slot(tedf, 0, 8, 108 - 18)); + //Battery + this.addSlotToContainer(new Slot(tedf, 1, 26, 108 - 18)); + //Deut Input + this.addSlotToContainer(new Slot(tedf, 2, 134, 108 - 18)); + //Trit Input + this.addSlotToContainer(new Slot(tedf, 3, 152, 108 - 18)); + //Startup this.addSlotToContainer(new Slot(tedf, 4, 53, 45)); this.addSlotToContainer(new Slot(tedf, 5, 107, 45)); this.addSlotToContainer(new Slot(tedf, 6, 53, 81)); this.addSlotToContainer(new Slot(tedf, 7, 107, 81)); this.addSlotToContainer(new Slot(tedf, 8, 80, 63)); + //Water Output + this.addSlotToContainer(new Slot(tedf, 9, 8, 108)); + //Deut Output + this.addSlotToContainer(new Slot(tedf, 10, 134, 108)); + //Trit Output + this.addSlotToContainer(new Slot(tedf, 11, 152, 108)); for(int i = 0; i < 3; i++) { @@ -50,11 +61,8 @@ public class ContainerFusionMultiblock extends Container { @Override public void addCraftingToCrafters(ICrafting crafting) { super.addCraftingToCrafters(crafting); - crafting.sendProgressBarUpdate(this, 0, this.diFurnace.water); - crafting.sendProgressBarUpdate(this, 1, this.diFurnace.deut); - crafting.sendProgressBarUpdate(this, 2, this.diFurnace.power); - crafting.sendProgressBarUpdate(this, 3, this.diFurnace.trit); - crafting.sendProgressBarUpdate(this, 4, isRunning ? 1 : 0); + crafting.sendProgressBarUpdate(this, 0, this.diFurnace.power); + crafting.sendProgressBarUpdate(this, 1, isRunning ? 1 : 0); } @Override @@ -68,8 +76,8 @@ public class ContainerFusionMultiblock extends Container { ItemStack var5 = var4.getStack(); var3 = var5.copy(); - if (par2 <= 8) { - if (!this.mergeItemStack(var5, 9, this.inventorySlots.size(), true)) + if (par2 <= 11) { + if (!this.mergeItemStack(var5, 12, this.inventorySlots.size(), true)) { return null; } @@ -103,58 +111,28 @@ public class ContainerFusionMultiblock extends Container { { ICrafting par1 = (ICrafting)this.crafters.get(i); - if(this.water != this.diFurnace.water) - { - par1.sendProgressBarUpdate(this, 0, this.diFurnace.water); - } - - if(this.deut != this.diFurnace.deut) - { - par1.sendProgressBarUpdate(this, 1, this.diFurnace.deut); - } - if(this.power != this.diFurnace.power) { - par1.sendProgressBarUpdate(this, 2, this.diFurnace.power); - } - - if(this.trit != this.diFurnace.trit) - { - par1.sendProgressBarUpdate(this, 3, this.diFurnace.trit); + par1.sendProgressBarUpdate(this, 0, this.diFurnace.power); } if(this.isRunning != this.diFurnace.isRunning()) { - par1.sendProgressBarUpdate(this, 4, this.diFurnace.isRunning() ? 1 : 0); + par1.sendProgressBarUpdate(this, 1, this.diFurnace.isRunning() ? 1 : 0); } } - this.water = this.diFurnace.water; - this.deut = this.diFurnace.deut; this.power = this.diFurnace.power; - this.trit = this.diFurnace.trit; this.isRunning = this.diFurnace.isRunning(); } @Override public void updateProgressBar(int i, int j) { if(i == 0) - { - diFurnace.water = j; - } - if(i == 1) - { - diFurnace.deut = j; - } - if(i == 2) { diFurnace.power = j; } - if(i == 3) - { - diFurnace.trit = j; - } - if(i == 4) + if(i == 1) { if(j == 0) { diff --git a/com/hbm/inventory/container/ContainerWatzCore.java b/com/hbm/inventory/container/ContainerWatzCore.java index 1464a13e8..c8b02b34c 100644 --- a/com/hbm/inventory/container/ContainerWatzCore.java +++ b/com/hbm/inventory/container/ContainerWatzCore.java @@ -13,9 +13,7 @@ public class ContainerWatzCore extends Container { private TileEntityWatzCore diFurnace; - private int water; private int power; - private int trit; public ContainerWatzCore(InventoryPlayer invPlayer, TileEntityWatzCore tedf) { @@ -57,9 +55,14 @@ public class ContainerWatzCore extends Container { this.addSlotToContainer(new Slot(tedf, 33, 62, 108)); this.addSlotToContainer(new Slot(tedf, 34, 80, 108)); this.addSlotToContainer(new Slot(tedf, 35, 98, 108)); - this.addSlotToContainer(new Slot(tedf, 36, 134, 108)); + //Mud Input + this.addSlotToContainer(new Slot(tedf, 36, 134, 108 - 18)); + //Battery this.addSlotToContainer(new Slot(tedf, 37, 152, 108)); + //Filter this.addSlotToContainer(new Slot(tedf, 38, 116, 63)); + //Mud Output + this.addSlotToContainer(new Slot(tedf, 39, 134, 108)); for(int i = 0; i < 3; i++) { @@ -78,8 +81,7 @@ public class ContainerWatzCore extends Container { @Override public void addCraftingToCrafters(ICrafting crafting) { super.addCraftingToCrafters(crafting); - crafting.sendProgressBarUpdate(this, 0, this.diFurnace.waste); - crafting.sendProgressBarUpdate(this, 1, this.diFurnace.power); + crafting.sendProgressBarUpdate(this, 0, this.diFurnace.power); } @Override @@ -93,8 +95,8 @@ public class ContainerWatzCore extends Container { ItemStack var5 = var4.getStack(); var3 = var5.copy(); - if (par2 <= 38) { - if (!this.mergeItemStack(var5, 39, this.inventorySlots.size(), true)) + if (par2 <= 39) { + if (!this.mergeItemStack(var5, 40, this.inventorySlots.size(), true)) { return null; } @@ -128,28 +130,18 @@ public class ContainerWatzCore extends Container { { ICrafting par1 = (ICrafting)this.crafters.get(i); - if(this.water != this.diFurnace.waste) - { - par1.sendProgressBarUpdate(this, 0, this.diFurnace.waste); - } - if(this.power != this.diFurnace.power) { - par1.sendProgressBarUpdate(this, 1, this.diFurnace.power); + par1.sendProgressBarUpdate(this, 0, this.diFurnace.power); } } - this.water = this.diFurnace.waste; this.power = this.diFurnace.power; } @Override public void updateProgressBar(int i, int j) { if(i == 0) - { - diFurnace.waste = j; - } - if(i == 1) { diFurnace.power = j; } diff --git a/com/hbm/inventory/gui/GUIFusionMultiblock.java b/com/hbm/inventory/gui/GUIFusionMultiblock.java index 9d52dc7c3..581a6f01d 100644 --- a/com/hbm/inventory/gui/GUIFusionMultiblock.java +++ b/com/hbm/inventory/gui/GUIFusionMultiblock.java @@ -2,6 +2,7 @@ package com.hbm.inventory.gui; import org.lwjgl.opengl.GL11; +import com.hbm.inventory.FluidTank; import com.hbm.inventory.container.ContainerFusionMultiblock; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityFusionMultiblock; @@ -12,7 +13,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUIFusionMultiblock extends GuiContainer { +public class GUIFusionMultiblock extends GuiFluidContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_fusion_multiblock.png"); private TileEntityFusionMultiblock diFurnace; @@ -25,6 +26,15 @@ public class GUIFusionMultiblock extends GuiContainer { this.ySize = 222; } + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + diFurnace.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 88 - 70, 16, 70); + diFurnace.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 88 - 70, 16, 70); + diFurnace.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 88 - 70, 16, 70); + } + @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); @@ -38,20 +48,17 @@ public class GUIFusionMultiblock extends GuiContainer { 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(88); - drawTexturedModalRect(guiLeft + 8, guiTop + 106 - i, 176, 88 - i, 16, i); - - int j = diFurnace.getCoolantScaled(88); - drawTexturedModalRect(guiLeft + 134, guiTop + 106 - j, 208, 88 - j, 16, j); - + int k = diFurnace.getPowerScaled(88); - drawTexturedModalRect(guiLeft + 26, guiTop + 106 - k, 192, 88 - k, 16, k); - - int l = diFurnace.getHeatScaled(88); - drawTexturedModalRect(guiLeft + 152, guiTop + 106 - l, 224, 88 - l, 16, l); + drawTexturedModalRect(guiLeft + 26, guiTop + 88 - k, 192, 88 - k, 16, k); if(diFurnace.isRunning()) drawTexturedModalRect(guiLeft + 80, guiTop + 18, 240, 0, 16, 16); + + Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures); + + diFurnace.tanks[0].renderTank(this, guiLeft + 8, guiTop + 88, diFurnace.tanks[0].getTankType().textureX() * FluidTank.x, diFurnace.tanks[0].getTankType().textureY() * FluidTank.y, 16, 70); + diFurnace.tanks[1].renderTank(this, guiLeft + 134, guiTop + 88, diFurnace.tanks[1].getTankType().textureX() * FluidTank.x, diFurnace.tanks[1].getTankType().textureY() * FluidTank.y, 16, 70); + diFurnace.tanks[2].renderTank(this, guiLeft + 152, guiTop + 88, diFurnace.tanks[2].getTankType().textureX() * FluidTank.x, diFurnace.tanks[2].getTankType().textureY() * FluidTank.y, 16, 70); } } diff --git a/com/hbm/inventory/gui/GUIWatzCore.java b/com/hbm/inventory/gui/GUIWatzCore.java index c05627f9c..8bc63c394 100644 --- a/com/hbm/inventory/gui/GUIWatzCore.java +++ b/com/hbm/inventory/gui/GUIWatzCore.java @@ -2,6 +2,7 @@ package com.hbm.inventory.gui; import org.lwjgl.opengl.GL11; +import com.hbm.inventory.FluidTank; import com.hbm.inventory.container.ContainerWatzCore; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityWatzCore; @@ -12,7 +13,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUIWatzCore extends GuiContainer { +public class GUIWatzCore extends GuiFluidContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_watz_multiblock.png"); private TileEntityWatzCore diFurnace; @@ -26,6 +27,13 @@ public class GUIWatzCore extends GuiContainer { this.ySize = 256; } + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + diFurnace.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 106 - 18 - 70, 16, 70); + } + @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName()); @@ -34,7 +42,7 @@ public class GUIWatzCore extends GuiContainer { this.fontRendererObj.drawString(I18n.format("container.inventory")/* + String.valueOf(diFurnace.powerList)*/, 8, this.ySize - 96 + 2 - 34, 4210752); this.fontRendererObj.drawString(String.valueOf(diFurnace.powerList + " HE/tick"), 8, this.ySize - 50 + 2 + 13, 4210752); this.fontRendererObj.drawString(String.valueOf(diFurnace.heatList + " heat"), 8, this.ySize - 50 + 2 + 22, 4210752); - this.fontRendererObj.drawString(String.valueOf((diFurnace.decayMultiplier * diFurnace.heat)/100 + " waste/tick"), 8, this.ySize - 50 + 2 + 31, 4210752); + this.fontRendererObj.drawString(String.valueOf((diFurnace.decayMultiplier * diFurnace.heat)/100 /100 + " waste/tick"), 8, this.ySize - 50 + 2 + 31, 4210752); this.fontRendererObj.drawString(String.valueOf(diFurnace.powerMultiplier + "% power"), 100, this.ySize - 50 + 2 + 13, 4210752); this.fontRendererObj.drawString(String.valueOf(diFurnace.heatMultiplier + "% heat"), 100, this.ySize - 50 + 2 + 22, 4210752); this.fontRendererObj.drawString(String.valueOf(diFurnace.decayMultiplier + "% decay"), 100, this.ySize - 50 + 2 + 31, 4210752); @@ -46,10 +54,11 @@ public class GUIWatzCore extends GuiContainer { Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); - int j = diFurnace.getWaterScaled(88); - drawTexturedModalRect(guiLeft + 134, guiTop + 106 - j, 176, 88 - j, 16, j); + int l = diFurnace.getPowerScaled(70); + drawTexturedModalRect(guiLeft + 152, guiTop + 106 - 18 - l, 192, 70 - l, 16, l); - int l = diFurnace.getPowerScaled(88); - drawTexturedModalRect(guiLeft + 152, guiTop + 106 - l, 192, 88 - l, 16, l); + Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures); + + diFurnace.tank.renderTank(this, guiLeft + 134, guiTop + 106 - 18, diFurnace.tank.getTankType().textureX() * FluidTank.x, diFurnace.tank.getTankType().textureY() * FluidTank.y, 16, 70); } } diff --git a/com/hbm/items/ModItems.java b/com/hbm/items/ModItems.java index 7139d6b9d..0828416dc 100644 --- a/com/hbm/items/ModItems.java +++ b/com/hbm/items/ModItems.java @@ -209,6 +209,7 @@ public class ModItems { public static Item fragment_cerium; public static Item fragment_lanthanium; public static Item fragment_actinium; + public static Item fragment_meteorite; public static Item biomass; @@ -1216,6 +1217,7 @@ public class ModItems { fragment_cerium = new Item().setUnlocalizedName("fragment_cerium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fragment_cerium"); fragment_lanthanium = new Item().setUnlocalizedName("fragment_lanthanium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fragment_lanthanium"); fragment_actinium = new Item().setUnlocalizedName("fragment_actinium").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fragment_actinium"); + fragment_meteorite = new Item().setUnlocalizedName("fragment_meteorite").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":fragment_meteorite"); biomass = new Item().setUnlocalizedName("biomass").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":biomass"); @@ -2164,6 +2166,7 @@ public class ModItems { GameRegistry.registerItem(fragment_cerium, fragment_cerium.getUnlocalizedName()); GameRegistry.registerItem(fragment_lanthanium, fragment_lanthanium.getUnlocalizedName()); GameRegistry.registerItem(fragment_actinium, fragment_actinium.getUnlocalizedName()); + GameRegistry.registerItem(fragment_meteorite, fragment_meteorite.getUnlocalizedName()); //Things that look like rotten flesh but aren't GameRegistry.registerItem(biomass, biomass.getUnlocalizedName()); diff --git a/com/hbm/lib/Library.java b/com/hbm/lib/Library.java index 17694f283..25eea6fce 100644 --- a/com/hbm/lib/Library.java +++ b/com/hbm/lib/Library.java @@ -317,7 +317,10 @@ public class Library { world.getBlock(x, y, z) == ModBlocks.dummy_port_fluidtank || world.getBlock(x, y, z) == ModBlocks.dummy_port_refinery || world.getBlock(x, y, z) == ModBlocks.dummy_port_pumpjack || - world.getBlock(x, y, z) == ModBlocks.dummy_port_turbofan) + world.getBlock(x, y, z) == ModBlocks.dummy_port_turbofan || + world.getBlock(x, y, z) == ModBlocks.reactor_hatch || + world.getBlock(x, y, z) == ModBlocks.fusion_hatch || + world.getBlock(x, y, z) == ModBlocks.watz_hatch) { return true; } @@ -980,6 +983,40 @@ public class Library { { tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ); } + //Large Nuclear Reactor + if(block == ModBlocks.reactor_hatch && worldObj.getBlock(x, y, z + 2) == ModBlocks.reactor_computer) + { + tileentity = worldObj.getTileEntity(x, y, z + 2); + } + if(block == ModBlocks.reactor_hatch && worldObj.getBlock(x, y, z - 2) == ModBlocks.reactor_computer) + { + tileentity = worldObj.getTileEntity(x, y, z - 2); + } + if(block == ModBlocks.reactor_hatch && worldObj.getBlock(x + 2, y, z) == ModBlocks.reactor_computer) + { + tileentity = worldObj.getTileEntity(x + 2, y, z); + } + if(block == ModBlocks.reactor_hatch && worldObj.getBlock(x - 2, y, z) == ModBlocks.reactor_computer) + { + tileentity = worldObj.getTileEntity(x - 2, y, z); + } + //Large Fusion Reactor + if(block == ModBlocks.fusion_hatch && worldObj.getBlock(x, y, z + 8) == ModBlocks.fusion_core) + { + tileentity = worldObj.getTileEntity(x, y, z + 8); + } + if(block == ModBlocks.fusion_hatch && worldObj.getBlock(x, y, z - 8) == ModBlocks.fusion_core) + { + tileentity = worldObj.getTileEntity(x, y, z - 8); + } + if(block == ModBlocks.fusion_hatch && worldObj.getBlock(x + 8, y, z) == ModBlocks.fusion_core) + { + tileentity = worldObj.getTileEntity(x + 8, y, z); + } + if(block == ModBlocks.fusion_hatch && worldObj.getBlock(x - 8, y, z) == ModBlocks.fusion_core) + { + tileentity = worldObj.getTileEntity(x - 8, y, z); + } if(tileentity == that) tileentity = null; diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index 5a212aabc..d90bbc2d5 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -899,6 +899,15 @@ public class MainRegistry FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_sas3), new ItemStack(ModItems.cell_empty), FluidType.SAS3, 1000)); FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModBlocks.ore_oil), new ItemStack(ModBlocks.ore_oil_empty), FluidType.OIL, 500)); + + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 1), new ItemStack(ModItems.tank_waste, 1, 0), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 2), new ItemStack(ModItems.tank_waste, 1, 1), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 3), new ItemStack(ModItems.tank_waste, 1, 2), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 4), new ItemStack(ModItems.tank_waste, 1, 3), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 5), new ItemStack(ModItems.tank_waste, 1, 4), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 6), new ItemStack(ModItems.tank_waste, 1, 5), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 7), new ItemStack(ModItems.tank_waste, 1, 6), FluidType.WATZ, 8000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.tank_waste, 1, 8), new ItemStack(ModItems.tank_waste, 1, 7), FluidType.WATZ, 8000)); for(int i = 1; i < FluidType.values().length; i++) { FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.fluid_tank_full, 1, i), new ItemStack(ModItems.fluid_tank_empty), FluidType.getEnum(i), 1000)); diff --git a/com/hbm/tileentity/machine/TileEntityFusionMultiblock.java b/com/hbm/tileentity/machine/TileEntityFusionMultiblock.java index 0f4ef49da..c2e97f397 100644 --- a/com/hbm/tileentity/machine/TileEntityFusionMultiblock.java +++ b/com/hbm/tileentity/machine/TileEntityFusionMultiblock.java @@ -4,9 +4,13 @@ import java.util.ArrayList; import java.util.List; import com.hbm.blocks.ModBlocks; +import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.interfaces.IConsumer; +import com.hbm.interfaces.IFluidAcceptor; +import com.hbm.interfaces.IFluidContainer; import com.hbm.interfaces.IReactor; import com.hbm.interfaces.ISource; +import com.hbm.inventory.FluidTank; import com.hbm.items.ModItems; import com.hbm.lib.Library; @@ -20,24 +24,23 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class TileEntityFusionMultiblock extends TileEntity implements ISidedInventory, IReactor, ISource { +public class TileEntityFusionMultiblock extends TileEntity implements ISidedInventory, IReactor, ISource, IFluidContainer, IFluidAcceptor { - public int water; - public final static int waterMax = 10000000; - public int deut; - public final static int deutMax = 10000000; - public int trit; - public final static int tritMax = 10000000; public int power; public final static int maxPower = 100000000; private ItemStack slots[]; public int age = 0; public List list = new ArrayList(); + public FluidTank tanks[]; private String customName; public TileEntityFusionMultiblock() { - slots = new ItemStack[9]; + slots = new ItemStack[12]; + tanks = new FluidTank[3]; + tanks[0] = new FluidTank(FluidType.WATER, 128000, 0); + tanks[1] = new FluidTank(FluidType.DEUTERIUM, 64000, 1); + tanks[2] = new FluidTank(FluidType.TRITIUM, 64000, 2); } @Override public int getSizeInventory() { @@ -152,10 +155,10 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - water = nbt.getInteger("water"); - deut = nbt.getInteger("deut"); power = nbt.getInteger("power"); - trit = nbt.getInteger("trit"); + tanks[0].readFromNBT(nbt, "water"); + tanks[1].readFromNBT(nbt, "deut"); + tanks[2].readFromNBT(nbt, "trit"); slots = new ItemStack[getSizeInventory()]; @@ -173,10 +176,12 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setInteger("water", water); - nbt.setInteger("deut", deut); + nbt.setInteger("power", power); - nbt.setInteger("trit", trit); + tanks[0].writeToNBT(nbt, "water"); + tanks[1].writeToNBT(nbt, "deut"); + tanks[2].writeToNBT(nbt, "trit"); + NBTTagList list = new NBTTagList(); for(int i = 0; i < slots.length; i++) @@ -947,17 +952,17 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve @Override public int getWaterScaled(int i) { - return (water * i) / waterMax; + return 0; } @Override public int getCoolantScaled(int i) { - return (deut * i) / deutMax; + return 0; } @Override public int getHeatScaled(int i) { - return (trit * i) / tritMax; + return 0; } @Override @@ -976,97 +981,49 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve if(age == 9 || age == 19) ffgeuaInit(); - //if(!worldObj.isRemote) + if(!worldObj.isRemote) { - if(slots[0] != null && slots[0].getItem() == Items.water_bucket && this.water + 250000 <= waterMax) + tanks[0].loadTank(0, 9, slots); + tanks[1].loadTank(2, 10, slots); + tanks[2].loadTank(3, 11, slots); + + for(int i = 0; i < 3; i++) + tanks[i].updateTank(xCoord, yCoord, zCoord); + + if(slots[2] != null && slots[2].getItem() == ModItems.tritium_deuterium_cake) { - this.slots[0].stackSize--; - this.water += 250000; - if(this.slots[0].stackSize == 0) + this.slots[2].stackSize--; + if(this.slots[2].stackSize == 0) { - this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]); + this.slots[2] = null; } - } - if(slots[0] != null && slots[0].getItem() == ModItems.rod_water && this.water + 250000 <= waterMax) - { - this.slots[0].stackSize--; - this.water += 250000; - if(this.slots[0].stackSize == 0) - { - this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]); - } - } - if(slots[0] != null && slots[0].getItem() == ModItems.rod_dual_water && this.water + 500000 <= waterMax) - { - this.slots[0].stackSize--; - this.water += 500000; - if(this.slots[0].stackSize == 0) - { - this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]); - } - } - if(slots[0] != null && slots[0].getItem() == ModItems.rod_quad_water && this.water + 1000000 <= waterMax) - { - this.slots[0].stackSize--; - this.water += 1000000; - if(this.slots[0].stackSize == 0) - { - this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]); - } - } - if(slots[2] != null && slots[2].getItem() == ModItems.cell_deuterium && this.deut + 1000000 <= deutMax) - { - this.slots[2].stackSize--; - this.deut += 1000000; - if(this.slots[2].stackSize == 0) - { - this.slots[2] = null; - } + tanks[1].setFill(tanks[1].getFill() + 10000); + tanks[2].setFill(tanks[2].getFill() + 10000); + + if(tanks[1].getFill() > tanks[1].getMaxFill()) + tanks[1].setFill(tanks[1].getMaxFill()); + + if(tanks[2].getFill() > tanks[2].getMaxFill()) + tanks[2].setFill(tanks[2].getMaxFill()); } - if(slots[3] != null && slots[3].getItem() == ModItems.cell_tritium && this.trit + 1000000 <= tritMax) + + if(slots[3] != null && slots[3].getItem() == ModItems.tritium_deuterium_cake) { this.slots[3].stackSize--; - this.trit += 1000000; if(this.slots[3].stackSize == 0) { this.slots[3] = null; } - } - - if(slots[2] != null && slots[2].getItem() == ModItems.tritium_deuterium_cake && trit + 7500000 <= tritMax && deut + 7500000 <= deutMax) - { - this.slots[2].stackSize--; - this.deut += 7500000; - this.trit += 7500000; - if(this.slots[2].stackSize == 0) - { - this.slots[2] = null; - } - } - - if(slots[3] != null && slots[3].getItem() == ModItems.tritium_deuterium_cake && trit + 7500000 <= tritMax && deut + 7500000 <= deutMax) - { - this.slots[3].stackSize--; - this.deut += 7500000; - this.trit += 7500000; - if(this.slots[3].stackSize == 0) - { - this.slots[3] = null; - } - } - - if(slots[0] != null && slots[0].getItem() == ModItems.inf_water) - { - this.water = waterMax; - } - if(slots[2] != null && slots[2].getItem() == ModItems.inf_deuterium) - { - this.deut = deutMax; - } - if(slots[3] != null && slots[3].getItem() == ModItems.inf_tritium) - { - this.trit = tritMax; + + tanks[1].setFill(tanks[1].getFill() + 10000); + tanks[2].setFill(tanks[2].getFill() + 10000); + + if(tanks[1].getFill() > tanks[1].getMaxFill()) + tanks[1].setFill(tanks[1].getMaxFill()); + + if(tanks[2].getFill() > tanks[2].getMaxFill()) + tanks[2].setFill(tanks[2].getMaxFill()); } if(!isRunning() && @@ -1075,7 +1032,7 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve slots[6] != null && (slots[6].getItem() == ModItems.fusion_core || slots[6].getItem() == ModItems.energy_core) && slots[6].getItemDamage() == 0 && slots[7] != null && (slots[7].getItem() == ModItems.fusion_core || slots[7].getItem() == ModItems.energy_core) && slots[7].getItemDamage() == 0 && hasFuse() && - deut > 0 && trit > 0) + tanks[1].getFill() > 0 && tanks[2].getFill() > 0) { slots[4] = null; slots[5] = null; @@ -1085,12 +1042,12 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve } else { if(isStructureValid(worldObj) && isRunning()) { - deut -= 100; - trit -= 100; + tanks[1].setFill(tanks[1].getFill() - 1); + tanks[2].setFill(tanks[2].getFill() - 1); - if(water - 100 >= 0) + if(tanks[0].getFill() >= 20) { - water -= 100; + tanks[0].setFill(tanks[0].getFill() - 20); power += 100000; if(isCoatingValid(worldObj)) @@ -1115,7 +1072,7 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve emptyPlasma(); } - if(deut <= 0 || trit <= 0) + if(tanks[1].getFill() <= 0 || tanks[2].getFill() <= 0) { emptyPlasma(); } @@ -1286,4 +1243,50 @@ public class TileEntityFusionMultiblock extends TileEntity implements ISidedInve this.list.clear(); } + @Override + public void setFillstate(int fill, int index) { + if(index < 3 && tanks[index] != null) + tanks[index].setFill(fill); + } + + @Override + public void setType(FluidType type, int index) { + if(index < 3 && tanks[index] != null) + tanks[index].setTankType(type); + } + + @Override + public void setAFluidFill(int i, FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + tanks[0].setFill(i); + else if(type.name().equals(tanks[1].getTankType().name())) + tanks[1].setFill(i); + else if(type.name().equals(tanks[2].getTankType().name())) + tanks[2].setFill(i); + } + + @Override + public int getAFluidFill(FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + return tanks[0].getFill(); + else if(type.name().equals(tanks[1].getTankType().name())) + return tanks[1].getFill(); + else if(type.name().equals(tanks[2].getTankType().name())) + return tanks[2].getFill(); + else + return 0; + } + + @Override + public int getMaxAFluidFill(FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + return tanks[0].getMaxFill(); + else if(type.name().equals(tanks[1].getTankType().name())) + return tanks[1].getMaxFill(); + else if(type.name().equals(tanks[2].getTankType().name())) + return tanks[2].getMaxFill(); + else + return 0; + } + } diff --git a/com/hbm/tileentity/machine/TileEntityMachineGenerator.java b/com/hbm/tileentity/machine/TileEntityMachineGenerator.java index ec262e87b..159bb6cc6 100644 --- a/com/hbm/tileentity/machine/TileEntityMachineGenerator.java +++ b/com/hbm/tileentity/machine/TileEntityMachineGenerator.java @@ -488,12 +488,17 @@ public class TileEntityMachineGenerator extends TileEntity implements ISidedInve } } } - + public void attemptPower(int i) { - if(this.tanks[0].getFill() - i >= 0) + + int j = (int) Math.ceil(i / 100); + + if(this.tanks[0].getFill() - j >= 0) { this.power += i; - this.tanks[0].setFill(tanks[0].getFill() - i); + if(j > tanks[0].getMaxFill() / 25) + j = tanks[0].getMaxFill() / 25; + this.tanks[0].setFill(tanks[0].getFill() - j); } } diff --git a/com/hbm/tileentity/machine/TileEntityReactorMultiblock.java b/com/hbm/tileentity/machine/TileEntityReactorMultiblock.java index a6a831041..8c044db62 100644 --- a/com/hbm/tileentity/machine/TileEntityReactorMultiblock.java +++ b/com/hbm/tileentity/machine/TileEntityReactorMultiblock.java @@ -12,6 +12,7 @@ import com.hbm.entity.mob.EntityNuclearCreeper; import com.hbm.explosion.ExplosionParticle; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.interfaces.IConsumer; +import com.hbm.interfaces.IFluidAcceptor; import com.hbm.interfaces.IFluidContainer; import com.hbm.interfaces.IReactor; import com.hbm.interfaces.ISource; @@ -38,7 +39,7 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class TileEntityReactorMultiblock extends TileEntity implements ISidedInventory, ISource, IFluidContainer { +public class TileEntityReactorMultiblock extends TileEntity implements ISidedInventory, ISource, IFluidContainer, IFluidAcceptor { public int heat; public final static int heatMax = 1000000; @@ -633,10 +634,15 @@ public class TileEntityReactorMultiblock extends TileEntity implements ISidedInv } public void attemptPower(int i) { - if(this.tanks[0].getFill() - i >= 0) + + int j = (int) Math.ceil(i / 100); + + if(this.tanks[0].getFill() - j >= 0) { this.power += i; - this.tanks[0].setFill(tanks[0].getFill() - i); + if(j > tanks[0].getMaxFill() / 25) + j = tanks[0].getMaxFill() / 25; + this.tanks[0].setFill(tanks[0].getFill() - j); } } @@ -723,4 +729,32 @@ public class TileEntityReactorMultiblock extends TileEntity implements ISidedInv if(index < 2 && tanks[index] != null) tanks[index].setTankType(type); } + + @Override + public void setAFluidFill(int i, FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + tanks[0].setFill(i); + else if(type.name().equals(tanks[1].getTankType().name())) + tanks[1].setFill(i); + } + + @Override + public int getAFluidFill(FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + return tanks[0].getFill(); + else if(type.name().equals(tanks[1].getTankType().name())) + return tanks[1].getFill(); + else + return 0; + } + + @Override + public int getMaxAFluidFill(FluidType type) { + if(type.name().equals(tanks[0].getTankType().name())) + return tanks[0].getMaxFill(); + else if(type.name().equals(tanks[1].getTankType().name())) + return tanks[1].getMaxFill(); + else + return 0; + } } diff --git a/com/hbm/tileentity/machine/TileEntityWatzCore.java b/com/hbm/tileentity/machine/TileEntityWatzCore.java index 0f6fd33b0..76655539c 100644 --- a/com/hbm/tileentity/machine/TileEntityWatzCore.java +++ b/com/hbm/tileentity/machine/TileEntityWatzCore.java @@ -6,9 +6,14 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.entity.logic.EntityNukeExplosionMK3; +import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.interfaces.IConsumer; +import com.hbm.interfaces.IFluidAcceptor; +import com.hbm.interfaces.IFluidContainer; +import com.hbm.interfaces.IFluidSource; import com.hbm.interfaces.IReactor; import com.hbm.interfaces.ISource; +import com.hbm.inventory.FluidTank; import com.hbm.items.ModItems; import com.hbm.items.special.WatzFuel; import com.hbm.lib.Library; @@ -24,10 +29,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -public class TileEntityWatzCore extends TileEntity implements ISidedInventory, IReactor, ISource { +public class TileEntityWatzCore extends TileEntity implements ISidedInventory, IReactor, ISource, IFluidContainer, IFluidSource { - public int waste; - public final static int wasteMax = 10000000; public int power; public final static int maxPower = 100000000; public int heat; @@ -45,11 +48,14 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I private ItemStack slots[]; public int age = 0; public List list = new ArrayList(); + public List list1 = new ArrayList(); + public FluidTank tank; private String customName; public TileEntityWatzCore() { - slots = new ItemStack[39]; + slots = new ItemStack[40]; + tank = new FluidTank(FluidType.WATZ, 64000, 0); } @Override public int getSizeInventory() { @@ -164,8 +170,8 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("items", 10); - waste = nbt.getInteger("deut"); power = nbt.getInteger("power"); + tank.readFromNBT(nbt, "watz"); slots = new ItemStack[getSizeInventory()]; @@ -183,8 +189,10 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - nbt.setInteger("deut", waste); + nbt.setInteger("power", power); + tank.writeToNBT(nbt, "watz"); + NBTTagList list = new NBTTagList(); for(int i = 0; i < slots.length; i++) @@ -486,7 +494,7 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I @Override public int getWaterScaled(int i) { - return (waste * i) / wasteMax; + return 0; } @Override @@ -513,8 +521,10 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I age = 0; } - if (age == 9 || age == 19) + if (age == 9 || age == 19) { ffgeuaInit(); + fillFluidInit(tank.getTankType()); + } powerMultiplier = 100; heatMultiplier = 100; @@ -552,39 +562,30 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I powerList /= 100; power += powerList; - waste += ((decayMultiplier * heat) / 100); + tank.setFill(tank.getFill() + ((decayMultiplier * heat) / 100) / 100); if(power > maxPower) power = maxPower; //Gets rid of 1/4 of the total waste, if at least one access hatch is not occupied - if(waste > wasteMax) + if(tank.getFill() > tank.getMaxFill()) emptyWaste(); power = Library.chargeItemsFromTE(slots, 37, power, maxPower); - if(waste - 2500000 >= 0 && slots[36] != null && slots[36].getItem() == ModItems.tank_waste && slots[36].getItemDamage() < 8) - { - waste -= 2500000; - slots[36].setItemDamage(slots[36].getItemDamage() + 1); - } - - if(waste - 2500000 >= 0 && slots[36] != null && slots[36].getItem() == Items.bucket) - { - waste -= 2500000; - slots[36] = new ItemStack(ModItems.bucket_mud).copy(); - } + tank.updateTank(xCoord, yCoord, zCoord); + tank.unloadTank(36, 39, slots); if(slots[36] != null && slots[36].getItem() == ModItems.titanium_filter && slots[36].getItemDamage() + 100 <= slots[36].getMaxDamage()) { - if(waste - 10000 >= 0) + if(tank.getFill() - 10 >= 0) { - waste -= 10000; + tank.setFill(tank.getFill() - 10); slots[36].setItemDamage(slots[36].getItemDamage() + 100); } else { - if(waste > 0) + if(tank.getFill() > 0) { - waste = 0; + tank.setFill(0); slots[36].setItemDamage(slots[36].getItemDamage() + 100); } } @@ -627,8 +628,8 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I } public void emptyWaste() { - this.waste /= 4; - this.waste *= 3; + tank.setFill(tank.getFill() / 4); + tank.setFill(tank.getFill() * 3); if (!worldObj.isRemote) { if (this.worldObj.getBlock(this.xCoord + 4, this.yCoord, this.zCoord) == Blocks.air) { @@ -718,4 +719,42 @@ public class TileEntityWatzCore extends TileEntity implements ISidedInventory, I public void clearList() { this.list.clear(); } + + @Override + public void setFillstate(int fill, int index) { + tank.setFill(fill); + } + + @Override + public void setType(FluidType type, int index) { + tank.setTankType(type); + } + @Override + public void fillFluidInit(FluidType type) { + fillFluid(this.xCoord + 4, this.yCoord, this.zCoord, getTact(), type); + fillFluid(this.xCoord - 4, this.yCoord, this.zCoord, getTact(), type); + fillFluid(this.xCoord, this.yCoord, this.zCoord + 4, getTact(), type); + fillFluid(this.xCoord, this.yCoord, this.zCoord - 4, getTact(), type); + + } + @Override + public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) { + Library.transmitFluid(x, y, z, newTact, this, worldObj, type); + } + @Override + public int getSFluidFill(FluidType type) { + return tank.getFill(); + } + @Override + public void setSFluidFill(int i, FluidType type) { + tank.setFill(i); + } + @Override + public List getFluidList(FluidType type) { + return list1; + } + @Override + public void clearFluidList(FluidType type) { + list1.clear(); + } } diff --git a/com/hbm/world/Meteorite.java b/com/hbm/world/Meteorite.java new file mode 100644 index 000000000..0ccca147b --- /dev/null +++ b/com/hbm/world/Meteorite.java @@ -0,0 +1,524 @@ +package com.hbm.world; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import com.hbm.blocks.ModBlocks; + +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +public class Meteorite { + + public void generate(World world, Random rand, int x, int y, int z) { + + switch(rand.nextInt(3)) { + case 0: + generateLarge(world, rand, x, y, z); + break; + case 1: + generateMedium(world, rand, x, y, z); + break; + case 2: + generateSmall(world, rand, x, y, z); + break; + } + } + + public void generateLarge(World world, Random rand, int x, int y, int z) { + //0 - Molten + //1 - Cobble + //2 - Broken + //3 - Mix + int hull = rand.nextInt(4); + + //0 - Cobble + //1 - Broken + //2 - Mix + int outerPadding = 0; + + if(hull == 2) + outerPadding = 1 + rand.nextInt(2); + else if(hull == 3) + outerPadding = 2; + + //0 - Broken + //1 - Stone + //2 - Netherrack + int innerPadding = rand.nextInt(hull == 0 ? 3 : 2); + + //0 - Meteor + //1 - Treasure + //2 - Ore + int core = rand.nextInt(3); + + List hullL = new ArrayList(); + switch(hull) { + case 0: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + break; + case 1: + hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + break; + case 2: + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 3: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + } + + List opL = new ArrayList(); + switch(outerPadding) { + case 0: + opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + break; + case 1: + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 2: + opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + } + + List ipL = new ArrayList(); + switch(innerPadding) { + case 0: + ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 1: + ipL.add(new ItemStack(Blocks.stone)); + break; + case 2: + ipL.add(new ItemStack(Blocks.netherrack)); + break; + } + + List coreL = new ArrayList(); + switch(core) { + case 0: + coreL.add(new ItemStack(ModBlocks.block_meteor)); + break; + case 1: + coreL.add(new ItemStack(ModBlocks.block_meteor_treasure)); + break; + case 2: + coreL.addAll(this.getRandomOre(rand)); + break; + } + + switch(rand.nextInt(5)) { + case 0: + genL1(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 1: + genL2(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 2: + genL3(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 3: + genL4(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 4: + genL5(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + } + } + + public void generateMedium(World world, Random rand, int x, int y, int z) { + //0 - Molten + //1 - Cobble + //2 - Broken + //3 - Mix + int hull = rand.nextInt(4); + + //0 - Cobble + //1 - Broken + //2 - Mix + int outerPadding = 0; + + if(hull == 2) + outerPadding = 1 + rand.nextInt(2); + else if(hull == 3) + outerPadding = 2; + + //0 - Broken + //1 - Stone + //2 - Netherrack + int innerPadding = rand.nextInt(hull == 0 ? 3 : 2); + + //0 - Meteor + //1 - Treasure + //2 - Ore + int core = rand.nextInt(3); + + List hullL = new ArrayList(); + switch(hull) { + case 0: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + break; + case 1: + hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + break; + case 2: + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 3: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + } + + List opL = new ArrayList(); + switch(outerPadding) { + case 0: + opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + break; + case 1: + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 2: + opL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + opL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + } + + List ipL = new ArrayList(); + switch(innerPadding) { + case 0: + ipL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 1: + ipL.add(new ItemStack(Blocks.stone)); + break; + case 2: + ipL.add(new ItemStack(Blocks.netherrack)); + break; + } + + List coreL = new ArrayList(); + switch(core) { + case 0: + coreL.add(new ItemStack(ModBlocks.block_meteor)); + break; + case 1: + coreL.add(new ItemStack(ModBlocks.block_meteor_treasure)); + break; + case 2: + coreL.addAll(this.getRandomOre(rand)); + break; + } + + List sCore = new ArrayList(); + switch(core) { + case 0: + sCore.add(new ItemStack(ModBlocks.block_meteor)); + break; + case 1: + sCore.add(new ItemStack(ModBlocks.block_meteor_treasure)); + break; + case 2: + sCore.add(new ItemStack(ModBlocks.block_meteor_treasure)); + sCore.add(new ItemStack(ModBlocks.block_meteor)); + break; + } + + switch(rand.nextInt(6)) { + case 0: + genM1(world, rand, x, y, z, hullL, opL, ipL, sCore); + break; + case 1: + genM2(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 2: + genM3(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 3: + genM4(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 4: + genM5(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + case 5: + genM6(world, rand, x, y, z, hullL, opL, ipL, coreL); + break; + } + } + + public void generateSmall(World world, Random rand, int x, int y, int z) { + //0 - Molten + //1 - Cobble + //2 - Broken + //3 - Mix + int hull = rand.nextInt(4); + + //0 - Meteor + //1 - Treasure + //2 - Ore + int core = rand.nextInt(3); + + List hullL = new ArrayList(); + switch(hull) { + case 0: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + break; + case 1: + hullL.add(new ItemStack(ModBlocks.block_meteor_cobble)); + break; + case 2: + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + case 3: + hullL.add(new ItemStack(ModBlocks.block_meteor_molten)); + hullL.add(new ItemStack(ModBlocks.block_meteor_broken)); + break; + } + + List sCore = new ArrayList(); + switch(core) { + case 0: + sCore.add(new ItemStack(ModBlocks.block_meteor)); + break; + case 1: + sCore.add(new ItemStack(ModBlocks.block_meteor_treasure)); + break; + case 2: + sCore.add(new ItemStack(ModBlocks.block_meteor_treasure)); + sCore.add(new ItemStack(ModBlocks.block_meteor)); + break; + } + + generateBox(world, rand, x, y, z, hullL); + ItemStack stack = sCore.get(rand.nextInt(sCore.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genL1(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere7x7(world, rand, x, y, z, hull); + generateStar5x5(world, rand, x, y, z, op); + generateStar3x3(world, rand, x, y, z, ip); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genL2(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere7x7(world, rand, x, y, z, hull); + generateSphere5x5(world, rand, x, y, z, op); + generateStar3x3(world, rand, x, y, z, ip); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genL3(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere7x7(world, rand, x, y, z, hull); + generateSphere5x5(world, rand, x, y, z, op); + generateBox(world, rand, x, y, z, ip); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genL4(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere7x7(world, rand, x, y, z, hull); + generateSphere5x5(world, rand, x, y, z, op); + generateBox(world, rand, x, y, z, ip); + generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genL5(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere7x7(world, rand, x, y, z, hull); + generateSphere5x5(world, rand, x, y, z, op); + generateStar5x5(world, rand, x, y, z, ip); + generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM1(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM2(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + generateStar3x3(world, rand, x, y, z, op); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM3(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + generateBox(world, rand, x, y, z, op); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM4(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + generateBox(world, rand, x, y, z, op); + generateStar3x3(world, rand, x, y, z, ip); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM5(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + generateBox(world, rand, x, y, z, ip); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void genM6(World world, Random rand, int x, int y, int z, List hull, List op, List ip, List core) { + generateSphere5x5(world, rand, x, y, z, hull); + generateBox(world, rand, x, y, z, ip); + generateStar3x3(world, rand, x, y, z, this.getRandomOre(rand)); + ItemStack stack = core.get(rand.nextInt(core.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void generateSphere7x7(World world, Random rand, int x, int y, int z, List set) { + for(int a = -3; a < 4; a++) + for(int b = -1; b < 2; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -1; a < 2; a++) + for(int b = -3; b < 4; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -1; a < 2; a++) + for(int b = -1; b < 2; b++) + for(int c = -3; c < 4; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + for(int a = -2; a < 3; a++) + for(int b = -2; b < 3; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -1; a < 2; a++) + for(int b = -2; b < 3; b++) + for(int c = -2; c < 3; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -2; a < 3; a++) + for(int b = -1; b < 2; b++) + for(int c = -2; c < 3; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + } + + public void generateSphere5x5(World world, Random rand, int x, int y, int z, List set) { + for(int a = -2; a < 3; a++) + for(int b = -1; b < 2; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -1; a < 2; a++) + for(int b = -2; b < 3; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + for(int a = -1; a < 2; a++) + for(int b = -1; b < 2; b++) + for(int c = -2; c < 3; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + } + + public void generateBox(World world, Random rand, int x, int y, int z, List set) { + for(int a = -1; a < 2; a++) + for(int b = -1; b < 2; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + } + + public void generateStar5x5(World world, Random rand, int x, int y, int z, List set) { + for(int a = -1; a < 2; a++) + for(int b = -1; b < 2; b++) + for(int c = -1; c < 2; c++) { + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + a, y + b, z + c, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x - 2, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y + 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y - 2, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y, z + 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y, z - 2, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public void generateStar3x3(World world, Random rand, int x, int y, int z, List set) { + + ItemStack stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x + 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x - 1, y, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y + 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y - 1, z, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y, z + 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + stack = set.get(rand.nextInt(set.size())); + world.setBlock(x, y, z - 1, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 2); + } + + public List getRandomOre(Random rand) { + List ores = new ArrayList(); + + String[] names = OreDictionary.getOreNames(); + + for(int i = 0; i < names.length; i++) { + if(names[i].length() > 3 && names[i].substring(0, 3).equals("ore")) { + + List ota = OreDictionary.getOres(names[i]); + for(int j = 0; j < ota.size(); j++) { + ItemStack stack = ota.get(j); + if(Block.getBlockFromItem(stack.getItem()) != null) + ores.add(stack.copy()); + } + } + } + + if(ores.isEmpty()) { + List list = new ArrayList(); + list.add(new ItemStack(Blocks.iron_ore, 1).copy()); + return list; + } else { + return ores; + } + } + +}