Java 类net.minecraft.util.WeightedRandomChestContent 实例源码

项目:DecompiledMinecraft    文件:StructureComponent.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest)
    {
        IBlockState iblockstate = Blocks.chest.getDefaultState();
        worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureComponent.java   
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
    {
        worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureMineshaftPieces.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
    {
        int i = rand.nextBoolean() ? 1 : 0;
        worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureComponent.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest)
    {
        IBlockState iblockstate = Blocks.chest.getDefaultState();
        worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureComponent.java   
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
    {
        worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureMineshaftPieces.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
    {
        int i = rand.nextBoolean() ? 1 : 0;
        worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureComponent.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest)
    {
        IBlockState iblockstate = Blocks.chest.getDefaultState();
        worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureComponent.java   
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
    {
        worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureMineshaftPieces.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
    {
        int i = rand.nextBoolean() ? 1 : 0;
        worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureComponent.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.chest)
    {
        IBlockState iblockstate = Blocks.chest.getDefaultState();
        worldIn.setBlockState(blockpos, Blocks.chest.correctFacing(worldIn, blockpos, iblockstate), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            WeightedRandomChestContent.generateChestContents(rand, listIn, (TileEntityChest)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureComponent.java   
protected boolean generateDispenserContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, int meta, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock() != Blocks.dispenser)
    {
        worldIn.setBlockState(blockpos, Blocks.dispenser.getStateFromMeta(this.getMetadataWithOffset(Blocks.dispenser, meta)), 2);
        TileEntity tileentity = worldIn.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityDispenser)
        {
            WeightedRandomChestContent.generateDispenserContents(rand, listIn, (TileEntityDispenser)tileentity, max);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureMineshaftPieces.java   
protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max)
{
    BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z));

    if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air)
    {
        int i = rand.nextBoolean() ? 1 : 0;
        worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F));
        WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max);
        worldIn.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
项目:connor41-etfuturum2    文件:BeetrootSeeds.java   
public BeetrootSeeds() {
    super(ModBlocks.beetroot, Blocks.farmland);
    setTextureName("beetroot_seeds");
    setUnlocalizedName(Utils.getUnlocalisedName("beetroot_seeds"));
    setCreativeTab(EtFuturum.enableBeetroot ? EtFuturum.creativeTab : null);

    if (EtFuturum.enableBeetroot) {
        ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
    }
}
项目:TRHS_Club_Mod_2016    文件:ChestGenHooks.java   
/**
 * Gets an array of all random objects that are associated with this category.
 *
 * @return The random objects
 */
public WeightedRandomChestContent[] getItems(Random rnd)
{
    ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();

    for (WeightedRandomChestContent orig : contents)
    {
        Item item = orig.field_76297_b.func_77973_b();

        if (item != null)
        {
            WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
            if (n != null)
            {
                ret.add(n);
            }
        }
    }

    return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
项目:Hammer-Mod    文件:LootRegistry.java   
public static void addToChests() {
    int numHammers = 94;
    for (int i = 0; i < numHammers ; i++) {

            if(HammerMod.DEBUG_MODE == true) {
                System.out.println("DEBUG: Injected Hammer with ID " + i + " into the Minecraft LootChests.");
            }

        ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
        ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(hammers.get(i), 0, 1, 1));
    }

}
项目:CauldronGit    文件:ChestGenHooks.java   
/**
 * Gets an array of all random objects that are associated with this category.
 *
 * @return The random objects
 */
public WeightedRandomChestContent[] getItems(Random rnd)
{
    ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();

    for (WeightedRandomChestContent orig : contents)
    {
        Item item = orig.theItemId.getItem();

        if (item != null)
        {
            WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
            if (n != null)
            {
                ret.add(n);
            }
        }
    }

    return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
项目:Structures    文件:LootCategory.java   
public void register() {
  ChestGenHooks cat = ChestGenHooks.getInfo(category);
  cat.setMin(minItems);
  cat.setMax(maxItems);

  if(entries != null) {
    for(LootEntry entry : entries) {
      if(entry != null) {
        WeightedRandomChestContent content = entry.createContent();
        if(content != null) {
          cat.addItem(content);
        }
      }
    }
  }    
}
项目:amunra    文件:FillChest.java   
@Override
public boolean populate(World world) {
    // world.setBlock(x, y, z, chestBlock.getBlock(), chestBlock.getMetadata(), 2);
    IInventory chest = (IInventory) world.getTileEntity(x, y, z);

    if (chest != null)
    {
        // this clears the chest
        for (int i = 0; i < chest.getSizeInventory(); i++)
        {
            chest.setInventorySlotContents(i, null);
        }

        // hmm that is an interesting concept
        ChestGenHooks info = ChestGenHooks.getInfo(chestGenName);

        WeightedRandomChestContent.generateChestContents(world.rand, info.getItems(world.rand), chest, info.getCount(world.rand));
        return true;
    }
    return false;
}
项目:ComponentEquipment    文件:ComponentEquipment.java   
private void registerWorldGen()
{
    if ( config.get( "world", "genPersistium", true ).getBoolean( true ) )
    {
        GameRegistry.registerWorldGenerator( persistiumOreGen = new PersistiumOreGenerator(), 10 );
    }

    if ( config.get( "world", "modifierEssenceLoot", true ).getBoolean( true ) )
    {
        ItemStack modStack = new ItemStack( items.modifierEssence );
        WeightedRandomChestContent wrcc = new WeightedRandomChestContent( modStack, 1, 1, 1 );

        ChestGenHooks.addItem( ChestGenHooks.MINESHAFT_CORRIDOR, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.VILLAGE_BLACKSMITH, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.PYRAMID_DESERT_CHEST, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.PYRAMID_JUNGLE_CHEST, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CORRIDOR, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_LIBRARY, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.STRONGHOLD_CROSSING, wrcc );
        ChestGenHooks.addItem( ChestGenHooks.DUNGEON_CHEST, wrcc );
    }
}
项目:ComponentEquipment    文件:ModifierItem.java   
@Override
  public WeightedRandomChestContent getChestGenBase( ChestGenHooks chest, Random rnd, WeightedRandomChestContent original )
  {
Modifier mod = Modifier.getModifier( Modifier.getTypes()[ rnd.nextInt( Modifier.getTypes().length ) ] ); 
int level = 1 + rnd.nextInt( mod.getMaxLevel() );

NBTTagCompound tag = new NBTTagCompound();
tag.setString( "Modifier", mod.type );
tag.setInteger( "Level", level );

ItemStack loot = new ItemStack( this );
loot.setTagCompound( tag );
original.theItemId = loot;

//System.out.println( "Did generation " + chest.category + " " + mod.type + " " + level );

      return original;
  }
项目:betterbeginnings-MC1.7    文件:Worldgen.java   
public static void addWorldgen()
{
    if(BBConfig.spawnMarshmallows){
    ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
            RegisterItems.marshmallow), 1, 5, 100));
    ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST)
            .addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 10, 200));
    ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(
            RegisterItems.marshmallow), 1, 10, 200));
    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING)
            .addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
    ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR)
            .addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
    ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR)
            .addItem(new WeightedRandomChestContent(new ItemStack(RegisterItems.marshmallow), 1, 12, 150));
    }
}
项目:Et-Futurum    文件:BeetrootSeeds.java   
public BeetrootSeeds() {
    super(ModBlocks.beetroot, Blocks.farmland);
    setTextureName("beetroot_seeds");
    setUnlocalizedName(Utils.getUnlocalisedName("beetroot_seeds"));
    setCreativeTab(EtFuturum.enableBeetroot ? EtFuturum.creativeTab : null);

    if (EtFuturum.enableBeetroot) {
        ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CROSSING, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
        ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(new ItemStack(this), 1, 2, 5));
    }
}
项目:Resilience-Client-Source    文件:StructureComponent.java   
/**
 * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests.
 */
protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8)
{
    int var9 = this.getXWithOffset(par4, par6);
    int var10 = this.getYWithOffset(par5);
    int var11 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlock(var9, var10, var11) != Blocks.chest)
    {
        par1World.setBlock(var9, var10, var11, Blocks.chest, 0, 2);
        TileEntityChest var12 = (TileEntityChest)par1World.getTileEntity(var9, var10, var11);

        if (var12 != null)
        {
            WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var12, par8);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Resilience-Client-Source    文件:StructureComponent.java   
/**
 * Used to generate dispenser contents for structures. ex: Jungle Temples.
 */
protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9)
{
    int var10 = this.getXWithOffset(par4, par6);
    int var11 = this.getYWithOffset(par5);
    int var12 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(var10, var11, var12) && par1World.getBlock(var10, var11, var12) != Blocks.dispenser)
    {
        par1World.setBlock(var10, var11, var12, Blocks.dispenser, this.func_151555_a(Blocks.dispenser, par7), 2);
        TileEntityDispenser var13 = (TileEntityDispenser)par1World.getTileEntity(var10, var11, var12);

        if (var13 != null)
        {
            WeightedRandomChestContent.func_150706_a(par3Random, par8ArrayOfWeightedRandomChestContent, var13, par9);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Resilience-Client-Source    文件:StructureMineshaftPieces.java   
protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8)
{
    int var9 = this.getXWithOffset(par4, par6);
    int var10 = this.getYWithOffset(par5);
    int var11 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlock(var9, var10, var11).getMaterial() == Material.air)
    {
        int var12 = par3Random.nextBoolean() ? 1 : 0;
        par1World.setBlock(var9, var10, var11, Blocks.rail, this.func_151555_a(Blocks.rail, var12), 2);
        EntityMinecartChest var13 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F));
        WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var13, par8);
        par1World.spawnEntityInWorld(var13);
        return true;
    }
    else
    {
        return false;
    }
}
项目:UsefulPets    文件:UsefulPets.java   
private void registerChestStuff()
{
    if ( config.get( "general", "bonusChestAdditions", true ).getBoolean( true ) )
    {
        ChestGenHooks bonusChest = ChestGenHooks.getInfo( ChestGenHooks.BONUS_CHEST );
        bonusChest.addItem( new WeightedRandomChestContent( items.domesticEgg.getPetEgg( "dog" ), 1, 1, 3 ) ); // Wolf
        bonusChest.addItem( new WeightedRandomChestContent( items.domesticEgg.getPetEgg( "cat" ), 1, 1, 3 ) ); // Ocelot
    }

    if ( config.get( "general", "dungeonChestAdditions", true ).getBoolean( true ) )
    {
        ChestGenHooks dungeonChest = ChestGenHooks.getInfo( ChestGenHooks.DUNGEON_CHEST );
        dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.goldClaws ), 1, 1, 6 ) );
        dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.ironClaws ), 1, 1, 4 ) );
        dungeonChest.addItem( new WeightedRandomChestContent( new ItemStack( items.diamondClaws ), 1, 1, 2 ) );
    }

    if ( config.get( "general", "startWithWand", true ).getBoolean( true ) )
    {
        StarterItemEventHandler.addStarterItem( "PetWand", new ItemStack( items.wand ) );
    }
}
项目:atlantis-mod    文件:WorldGenOverworldShrine.java   
@Override
public boolean generate(World world, Random rand, int i, int j, int k) {
    while(LocationIsInvalid(world, i, j, k) && j > 0) j--;
    j++;
    if(!LocationIsInvalid(world, i, j, k) && !LocationIsInvalid(world, i, j + 2, k)) {
        world.setBlock(i, j, k, Blocks.quartz_block, 2, 3);
        world.setBlock(i+1, j, k, Blocks.quartz_block, 2, 3);
        world.setBlock(i-1, j, k, Blocks.quartz_block, 2, 3);
        world.setBlock(i, j, k+1, Blocks.quartz_block, 2, 3);
        world.setBlock(i, j, k-1, Blocks.quartz_block, 2, 3);
        world.setBlock(i, j+1, k, Blocks.chest, 2, 2);
        WeightedRandomChestContent[] content = new WeightedRandomChestContent[] {new WeightedRandomChestContent(AtlantisMod.atlantisEye, 1, 1, 1, 1)};
        TileEntityChest tileentitychest = (TileEntityChest)world.getTileEntity(i, j, k);
        if (tileentitychest != null) WeightedRandomChestContent.generateChestContents(rand, content, tileentitychest, 1);
        return true;
    }
    return false;
}
项目:LootAdjuster    文件:LootConfigHelper.java   
public static String toLootString(WeightedRandomChestContent loot) {
    GameRegistry.UniqueIdentifier uid = GameRegistry.findUniqueIdentifierFor(loot.theItemId.getItem());
    String combinedName = "";

    if (uid != null) {
        combinedName = String.format("%s:%s", uid.modId, uid.name);
    } else {
        combinedName = loot.theItemId.getItem().getUnlocalizedName();
        LootAdjuster.logger.error("Couldn't find unique identifier for item %s, falling back to unlocalized name, things might break!", combinedName);
    }

    return String.format("\"%s:%d,%d,%d,%d\"", 
        combinedName,
        loot.theItemId.getItemDamage(),
        loot.theMinimumChanceToGenerateItem,
        loot.theMaximumChanceToGenerateItem,
        loot.itemWeight
    );
}
项目:NEI-Integration    文件:ChestLootDumper.java   
@Override
public Iterable<String[]> dump(int mode) {
    List<String[]> list = new LinkedList<String[]>();

    Map<String, ChestGenHooks> lootTables = ReflectionHelper.getPrivateValue(ChestGenHooks.class, null, "chestInfo");
    List<String> names = new ArrayList<String>();
    names.addAll(lootTables.keySet());
    Collections.sort(names);

    for (String name : names) {
        List<WeightedRandomChestContent> contents = ReflectionHelper.getPrivateValue(ChestGenHooks.class, lootTables.get(name), "contents");

        for (WeightedRandomChestContent w : contents) {
            String displayName;
            try {
                displayName = w.theItemId.getDisplayName();
            } catch (Exception ex) {
                displayName = "-";
            }
            list.add(new String[] { name, w.theItemId.toString(), displayName, Item.itemRegistry.getNameForObject(w.theItemId.getItem()), String.valueOf(w.itemWeight) });
        }
    }

    return list;
}
项目:FantasyCraft-Mod    文件:FCraftLoot.java   
public static void init(){
    for (int i = 0; i < 11; i++)
    {
        // Grimoire Page
        WeightedRandomChestContent grimoirePages = new WeightedRandomChestContent(FCraftItems.grimoirePage.itemID, i, 1, 1, 1);

        // Put in corresponding chest
        ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_DISPENSER).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(grimoirePages);
        ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(grimoirePages);
    }
}
项目:SamsPowerups    文件:ChestLootGenerator.java   
private static void addToAllChests(ItemStack[] items,int min,int max,int weight)
{ 
    for(int i = 0; i < items.length; i++)
    {
        max = items[i].stackSize;//will this upp the obsidian size to 1?
        //args are item, min, max, ?odds
        ChestGenHooks.addItem(PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(items[i], min, max, weight));
        ChestGenHooks.addItem(PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(items[i], min, max, weight)); 
        ChestGenHooks.addItem(VILLAGE_BLACKSMITH, new WeightedRandomChestContent(  items[i], min, max, weight));
        ChestGenHooks.addItem(DUNGEON_CHEST, new WeightedRandomChestContent(       items[i], min, max, weight));
        ChestGenHooks.addItem(MINESHAFT_CORRIDOR, new WeightedRandomChestContent(  items[i], min, max, weight));
        ChestGenHooks.addItem(STRONGHOLD_CORRIDOR, new WeightedRandomChestContent( items[i], min, max, weight));
        ChestGenHooks.addItem(STRONGHOLD_CROSSING, new WeightedRandomChestContent (items[i], min, max, weight));
        ChestGenHooks.addItem(STRONGHOLD_LIBRARY, new WeightedRandomChestContent(  items[i], min, max, weight));
        ChestGenHooks.addItem(NETHER_FORTRESS, new WeightedRandomChestContent(     items[i], min, max, weight));

        //brainstorm what would make sense, be Fun, and Not overpowered in bonus chests
        // if food then not too much
        //stack of fun potions
        //

        //this was for testing. on a new world we got 4 records right away
        //weight=9;
        //ChestGenHooks.addItem(BONUS_CHEST, new WeightedRandomChestContent(items[i], min, max, weight));
    }
}
项目:RuneCraftery    文件:StructureComponent.java   
/**
 * Used to generate dispenser contents for structures. ex: Jungle Temples.
 */
protected boolean generateStructureDispenserContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, int par7, WeightedRandomChestContent[] par8ArrayOfWeightedRandomChestContent, int par9)
{
    int j1 = this.getXWithOffset(par4, par6);
    int k1 = this.getYWithOffset(par5);
    int l1 = this.getZWithOffset(par4, par6);

    if (par2StructureBoundingBox.isVecInside(j1, k1, l1) && par1World.getBlockId(j1, k1, l1) != Block.dispenser.blockID)
    {
        par1World.setBlock(j1, k1, l1, Block.dispenser.blockID, this.getMetadataWithOffset(Block.dispenser.blockID, par7), 2);
        TileEntityDispenser tileentitydispenser = (TileEntityDispenser)par1World.getBlockTileEntity(j1, k1, l1);

        if (tileentitydispenser != null)
        {
            WeightedRandomChestContent.generateDispenserContents(par3Random, par8ArrayOfWeightedRandomChestContent, tileentitydispenser, par9);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Cauldron    文件:ChestGenHooks.java   
/**
 * Gets an array of all random objects that are associated with this category.
 *
 * @return The random objects
 */
public WeightedRandomChestContent[] getItems(Random rnd)
{
    ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();

    for (WeightedRandomChestContent orig : contents)
    {
        Item item = orig.theItemId.getItem();

        if (item != null)
        {
            WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
            if (n != null)
            {
                ret.add(n);
            }
        }
    }

    return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
项目:Cauldron    文件:ChestGenHooks.java   
/**
 * Gets an array of all random objects that are associated with this category.
 *
 * @return The random objects
 */
public WeightedRandomChestContent[] getItems(Random rnd)
{
    ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();

    for (WeightedRandomChestContent orig : contents)
    {
        Item item = orig.theItemId.getItem();

        if (item != null)
        {
            WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
            if (n != null)
            {
                ret.add(n);
            }
        }
    }

    return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
项目:Cauldron    文件:StructureComponent.java   
protected boolean generateStructureChestContents(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 i1 = this.getXWithOffset(p_74879_4_, p_74879_6_);
    int j1 = this.getYWithOffset(p_74879_5_);
    int k1 = this.getZWithOffset(p_74879_4_, p_74879_6_);

    if (p_74879_2_.isVecInside(i1, j1, k1) && p_74879_1_.getBlock(i1, j1, k1) != Blocks.chest)
    {
        p_74879_1_.setBlock(i1, j1, k1, Blocks.chest, 0, 2);
        TileEntityChest tileentitychest = (TileEntityChest)p_74879_1_.getTileEntity(i1, j1, k1);

        if (tileentitychest != null)
        {
            WeightedRandomChestContent.generateChestContents(p_74879_3_, p_74879_7_, tileentitychest, p_74879_8_);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Cauldron    文件:StructureComponent.java   
protected boolean generateStructureDispenserContents(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 j1 = this.getXWithOffset(p_74869_4_, p_74869_6_);
    int k1 = this.getYWithOffset(p_74869_5_);
    int l1 = this.getZWithOffset(p_74869_4_, p_74869_6_);

    if (p_74869_2_.isVecInside(j1, k1, l1) && p_74869_1_.getBlock(j1, k1, l1) != Blocks.dispenser)
    {
        p_74869_1_.setBlock(j1, k1, l1, Blocks.dispenser, this.getMetadataWithOffset(Blocks.dispenser, p_74869_7_), 2);
        TileEntityDispenser tileentitydispenser = (TileEntityDispenser)p_74869_1_.getTileEntity(j1, k1, l1);

        if (tileentitydispenser != null)
        {
            WeightedRandomChestContent.generateDispenserContents(p_74869_3_, p_74869_8_, tileentitydispenser, p_74869_9_);
        }

        return true;
    }
    else
    {
        return false;
    }
}
项目:Cauldron    文件:StructureMineshaftPieces.java   
protected boolean generateStructureChestContents(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 i1 = this.getXWithOffset(p_74879_4_, p_74879_6_);
    int j1 = this.getYWithOffset(p_74879_5_);
    int k1 = this.getZWithOffset(p_74879_4_, p_74879_6_);

    if (p_74879_2_.isVecInside(i1, j1, k1) && p_74879_1_.getBlock(i1, j1, k1).getMaterial() == Material.air)
    {
        int l1 = p_74879_3_.nextBoolean() ? 1 : 0;
        p_74879_1_.setBlock(i1, j1, k1, Blocks.rail, this.getMetadataWithOffset(Blocks.rail, l1), 2);
        EntityMinecartChest entityminecartchest = new EntityMinecartChest(p_74879_1_, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F));
        WeightedRandomChestContent.generateChestContents(p_74879_3_, p_74879_7_, entityminecartchest, p_74879_8_);
        p_74879_1_.spawnEntityInWorld(entityminecartchest);
        return true;
    }
    else
    {
        return false;
    }
}
项目:Cauldron    文件:ChestGenHooks.java   
/**
 * Gets an array of all random objects that are associated with this category.
 *
 * @return The random objects
 */
public WeightedRandomChestContent[] getItems(Random rnd)
{
    ArrayList<WeightedRandomChestContent> ret = new ArrayList<WeightedRandomChestContent>();

    for (WeightedRandomChestContent orig : contents)
    {
        Item item = orig.theItemId.getItem();

        if (item != null)
        {
            WeightedRandomChestContent n = item.getChestGenBase(this, rnd, orig);
            if (n != null)
            {
                ret.add(n);
            }
        }
    }

    return ret.toArray(new WeightedRandomChestContent[ret.size()]);
}
项目:RuneCraftery    文件:StructureComponent.java   
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;
   }
}
项目:Cauldron    文件:StructureComponent.java   
protected boolean generateStructureChestContents(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 i1 = this.getXWithOffset(p_74879_4_, p_74879_6_);
    int j1 = this.getYWithOffset(p_74879_5_);
    int k1 = this.getZWithOffset(p_74879_4_, p_74879_6_);

    if (p_74879_2_.isVecInside(i1, j1, k1) && p_74879_1_.getBlock(i1, j1, k1) != Blocks.chest)
    {
        p_74879_1_.setBlock(i1, j1, k1, Blocks.chest, 0, 2);
        TileEntityChest tileentitychest = (TileEntityChest)p_74879_1_.getTileEntity(i1, j1, k1);

        if (tileentitychest != null)
        {
            WeightedRandomChestContent.generateChestContents(p_74879_3_, p_74879_7_, tileentitychest, p_74879_8_);
        }

        return true;
    }
    else
    {
        return false;
    }
}