protected boolean func_74879_a( World p_74879_1_, StructureBoundingBox p_74879_2_, Random p_74879_3_, int p_74879_4_, int p_74879_5_, int p_74879_6_, WeightedRandomChestContent[] p_74879_7_, int p_74879_8_) { int var9 = this.func_74865_a(p_74879_4_, p_74879_6_); int var10 = this.func_74862_a(p_74879_5_); int var11 = this.func_74873_b(p_74879_4_, p_74879_6_); if (p_74879_2_.func_78890_b(var9, var10, var11) && p_74879_1_.func_72798_a(var9, var10, var11) != Block.field_72077_au.field_71990_ca) { p_74879_1_.func_72832_d(var9, var10, var11, Block.field_72077_au.field_71990_ca, 0, 2); TileEntityChest var12 = (TileEntityChest) p_74879_1_.func_72796_p(var9, var10, var11); if (var12 != null) { WeightedRandomChestContent.func_76293_a(p_74879_3_, p_74879_7_, var12, p_74879_8_); } return true; } else { return false; } }
protected boolean func_74869_a( World p_74869_1_, StructureBoundingBox p_74869_2_, Random p_74869_3_, int p_74869_4_, int p_74869_5_, int p_74869_6_, int p_74869_7_, WeightedRandomChestContent[] p_74869_8_, int p_74869_9_) { int var10 = this.func_74865_a(p_74869_4_, p_74869_6_); int var11 = this.func_74862_a(p_74869_5_); int var12 = this.func_74873_b(p_74869_4_, p_74869_6_); if (p_74869_2_.func_78890_b(var10, var11, var12) && p_74869_1_.func_72798_a(var10, var11, var12) != Block.field_71958_P.field_71990_ca) { p_74869_1_.func_72832_d( var10, var11, var12, Block.field_71958_P.field_71990_ca, this.func_74863_c(Block.field_71958_P.field_71990_ca, p_74869_7_), 2); TileEntityDispenser var13 = (TileEntityDispenser) p_74869_1_.func_72796_p(var10, var11, var12); if (var13 != null) { WeightedRandomChestContent.func_76294_a(p_74869_3_, p_74869_8_, var13, p_74869_9_); } return true; } else { return false; } }
/** Generates the Dispenser contents. */ public static void generateDispenserContents( Random par0Random, WeightedRandomChestContent[] par1ArrayOfWeightedRandomChestContent, TileEntityDispenser par2TileEntityDispenser, int par3) { for (int j = 0; j < par3; ++j) { WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent) WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent); ItemStack[] stacks = weightedrandomchestcontent.generateChestContent(par0Random, par2TileEntityDispenser); for (ItemStack item : stacks) { par2TileEntityDispenser.setInventorySlotContents( par0Random.nextInt(par2TileEntityDispenser.getSizeInventory()), item); } } }
@Override protected void handleTileEntities(Random rand) { for (final ChunkCoordinates chestCoords : this.chests) { final TileEntityChest chest = (TileEntityChest) this.worldObj.getBlockTileEntity( chestCoords.posX, chestCoords.posY, chestCoords.posZ); if (chest != null) { ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); WeightedRandomChestContent.generateChestContents( rand, info.getItems(rand), chest, info.getCount(rand)); } } }
@Override protected void handleTileEntities(Random rand) { for (final ChunkCoordinates chestCoords : this.chests) { final TileEntity chest = this.worldObj.getBlockTileEntity(chestCoords.posX, chestCoords.posY, chestCoords.posZ); if (chest != null && chest instanceof GCCoreTileEntityTreasureChest) { ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); WeightedRandomChestContent.generateChestContents( rand, info.getItems(rand), (GCCoreTileEntityTreasureChest) chest, info.getCount(rand)); ((GCCoreTileEntityTreasureChest) chest) .setInventorySlotContents( rand.nextInt(((GCCoreTileEntityTreasureChest) chest).getSizeInventory()), this.getGuaranteedLoot(rand)); } } }
@Override public boolean generate(World world, Random rand, int i, int j, int k) { while (LocationIsValidSpawn(world, i, j, k) && j > 0) j--; j++; if (LocationIsValidSpawn(world, i, j, k) && LocationIsValidSpawn(world, i, j + 2, k)) { world.setBlock(i, j, k, Block.blockNetherQuartz.blockID, 2, 3); world.setBlock(i + 1, j, k, Block.blockNetherQuartz.blockID, 2, 3); world.setBlock(i - 1, j, k, Block.blockNetherQuartz.blockID, 2, 3); world.setBlock(i, j, k + 1, Block.blockNetherQuartz.blockID, 2, 3); world.setBlock(i, j, k - 1, Block.blockNetherQuartz.blockID, 2, 3); world.setBlock(i, j, k, Block.chest.blockID, 2, 2); WeightedRandomChestContent[] content = new WeightedRandomChestContent[] { new WeightedRandomChestContent(AtlantisMod.atlantisWand.itemID, 1, 1, 1, 1) }; TileEntityChest tileentitychest = (TileEntityChest) world.getBlockTileEntity(i, j, k); if (tileentitychest != null) WeightedRandomChestContent.generateChestContents(rand, content, tileentitychest, 1); } return false; }
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5) { byte b0 = 3; int l = par2Random.nextInt(2) + 2; int i1 = par2Random.nextInt(2) + 2; int j1 = 0; int k1; int l1; int i2; for (k1 = par3 - l - 1; k1 <= par3 + l + 1; ++k1) { for (l1 = par4 - 1; l1 <= par4 + b0 + 1; ++l1) { for (i2 = par5 - i1 - 1; i2 <= par5 + i1 + 1; ++i2) { Material material = par1World.getBlockMaterial(k1, l1, i2); if (l1 == par4 - 1 && !material.isSolid()) { return false; } if (l1 == par4 + b0 + 1 && !material.isSolid()) { return false; } if ((k1 == par3 - l - 1 || k1 == par3 + l + 1 || i2 == par5 - i1 - 1 || i2 == par5 + i1 + 1) && l1 == par4 && par1World.isAirBlock(k1, l1, i2) && par1World.isAirBlock(k1, l1 + 1, i2)) { ++j1; } } } } if (j1 >= 1 && j1 <= 5) { for (k1 = par3 - l - 1; k1 <= par3 + l + 1; ++k1) { for (l1 = par4 + b0; l1 >= par4 - 1; --l1) { for (i2 = par5 - i1 - 1; i2 <= par5 + i1 + 1; ++i2) { if (k1 != par3 - l - 1 && l1 != par4 - 1 && i2 != par5 - i1 - 1 && k1 != par3 + l + 1 && l1 != par4 + b0 + 1 && i2 != par5 + i1 + 1) { par1World.setBlockToAir(k1, l1, i2); } else if (l1 >= 0 && !par1World.getBlockMaterial(k1, l1 - 1, i2).isSolid()) { par1World.setBlockToAir(k1, l1, i2); } else if (par1World.getBlockMaterial(k1, l1, i2).isSolid()) { if (l1 == par4 - 1 && par2Random.nextInt(4) != 0) { par1World.setBlock(k1, l1, i2, OverworldBlockHelper.divineStoneMossy.blockID, 0, 2); } else { par1World.setBlock(k1, l1, i2, Block.cobblestone.blockID, 0, 2); } } } } } k1 = 0; while (k1 < 2) { l1 = 0; while (true) { if (l1 < 3) { label101: { i2 = par3 + par2Random.nextInt(l * 2 + 1) - l; int j2 = par5 + par2Random.nextInt(i1 * 2 + 1) - i1; if (par1World.isAirBlock(i2, par4, j2)) { int k2 = 0; if (par1World.getBlockMaterial(i2 - 1, par4, j2).isSolid()) { ++k2; } if (par1World.getBlockMaterial(i2 + 1, par4, j2).isSolid()) { ++k2; } if (par1World.getBlockMaterial(i2, par4, j2 - 1).isSolid()) { ++k2; } if (par1World.getBlockMaterial(i2, par4, j2 + 1).isSolid()) { ++k2; } if (k2 == 1) { par1World.setBlock(i2, par4, j2, Block.chest.blockID, 0, 2); TileEntityChest tileentitychest = (TileEntityChest) par1World.getBlockTileEntity(i2, par4, j2); if (tileentitychest != null) { ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); WeightedRandomChestContent.generateChestContents( par2Random, info.getItems(par2Random), tileentitychest, info.getCount(par2Random)); } break label101; } } ++l1; continue; } } ++k1; break; } } par1World.setBlock(par3, par4, par5, OverworldBlockHelper.spawner.blockID, 0, 2); TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) par1World.getBlockTileEntity(par3, par4, par5); if (tileentitymobspawner != null) { tileentitymobspawner.getSpawnerLogic().setMobID(this.pickMobSpawner(par2Random)); } else { System.err.println( "Failed to fetch mob spawner entity at (" + par3 + ", " + par4 + ", " + par5 + ")"); } return true; } else { return false; } }
@SuppressWarnings("unchecked") @Override protected void onDeathUpdate() { ++this.deathTicks; if (this.deathTicks >= 180 && this.deathTicks <= 200) { final float f = (this.rand.nextFloat() - 0.5F) * 1.5F; final float f1 = (this.rand.nextFloat() - 0.5F) * 2.0F; final float f2 = (this.rand.nextFloat() - 0.5F) * 1.5F; this.worldObj.spawnParticle( "hugeexplosion", this.posX + f, this.posY + 2.0D + f1, this.posZ + f2, 0.0D, 0.0D, 0.0D); } int i; int j; if (!this.worldObj.isRemote) { if (this.deathTicks >= 180 && this.deathTicks % 5 == 0) { GalacticraftCore.packetPipeline.sendToAllAround( new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_EXPLODE, new Object[] {}), new TargetPoint( this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 40.0D)); // PacketDispatcher.sendPacketToAllAround(this.posX, this.posY, // this.posZ, 40.0, this.worldObj.provider.dimensionId, // PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketClient.PLAY_SOUND_EXPLODE, new Object[] { 0 })); } if (this.deathTicks > 150 && this.deathTicks % 5 == 0) { i = 30; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; this.worldObj.spawnEntityInWorld( new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } } if (this.deathTicks == 1) { GalacticraftCore.packetPipeline.sendToAllAround( new PacketSimple(EnumSimplePacket.C_PLAY_SOUND_BOSS_DEATH, new Object[] {}), new TargetPoint( this.worldObj.provider.dimensionId, this.posX, this.posY, this.posZ, 40.0D)); // PacketDispatcher.sendPacketToAllAround(this.posX, this.posY, // this.posZ, 40.0, this.worldObj.provider.dimensionId, // PacketUtil.createPacket(GalacticraftCore.CHANNEL, // EnumPacketClient.PLAY_SOUND_BOSS_DEATH, new Object[] { 0 })); } } this.moveEntity(0.0D, 0.10000000149011612D, 0.0D); this.renderYawOffset = this.rotationYaw += 20.0F; if (this.deathTicks == 200 && !this.worldObj.isRemote) { i = 20; while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; this.worldObj.spawnEntityInWorld( new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, j)); } for (final TileEntity tile : (List<TileEntity>) this.worldObj.loadedTileEntityList) { if (tile instanceof TileEntityT7TreasureChest) { final double d3 = tile.xCoord + 0.5D - this.posX; final double d4 = tile.yCoord + 0.5D - this.posY; final double d5 = tile.zCoord + 0.5D - this.posZ; final double dSq = d3 * d3 + d4 * d4 + d5 * d5; TileEntityT7TreasureChest chest = (TileEntityT7TreasureChest) tile; if (dSq < 10000) { if (!chest.locked) { chest.locked = true; } for (int k = 0; k < chest.getSizeInventory(); k++) { chest.setInventorySlotContents(k, null); } ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); // Generate three times, since it's an extra extra // special chest WeightedRandomChestContent.generateChestContents( this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); WeightedRandomChestContent.generateChestContents( this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); WeightedRandomChestContent.generateChestContents( this.rand, info.getItems(this.rand), chest, info.getCount(this.rand)); chest.setInventorySlotContents( this.rand.nextInt(chest.getSizeInventory()), this.getGuaranteedLoot(this.rand)); break; } } } this.entityDropItem(new ItemStack(ExtraPlanets_Items.T7key, 1, 0), 0.5F); super.setDead(); if (this.spawner != null) { this.spawner.isBossDefeated = true; this.spawner.boss = null; this.spawner.spawned = false; } } }