Package net.minecraftforge.common

Examples of net.minecraftforge.common.ChestGenHooks


    if (holes < minHoles || holes > maxHoles)
      return false;

    NBTTagCompound tag = (NBTTagCompound) ((WeightedRandomNBTTag)WeightedRandom.getRandomItem(rand, spawners)).tag;
    ChestGenHooks table = ChestGenHooks.getInfo(((DungeonMob)WeightedRandom.getRandomItem(rand, lootTables)).type);

    for (x = xStart - xWidth - 1; x <= xStart + xWidth + 1; ++x) {
      for (z = zStart - zWidth - 1; z <= zStart + zWidth + 1; ++z) {
        for (y = yStart + height; y >= floor; --y) {

          if ((abs(x - xStart) != xWidth + 1 || abs(z - zStart) != zWidth + 1) && y != ceiling) {
            world.setBlockToAir(x, y, z);
          }
          else if (y >= 0 && !canGenerateInBlock(world, x, y - 1, z, genBlock)) {
            world.setBlockToAir(x, y, z);
          }
          else if (canGenerateInBlock(world, x, y, z, genBlock)) {
            if (y == floor)
              generateBlock(world, x, y, z, this.floor);
            else
              generateBlock(world, x, y, z, walls);
          }
        }
      }
    }

    for (int i = maxChests; i --> 0; ) {
      for (int j = 0; j < 3; ++j) {
        x = xStart + nextInt(rand, xWidth * 2 + 1) - xWidth;
        z = zStart + nextInt(rand, zWidth * 2 + 1) - zWidth;

        if (world.isAirBlock(x, yStart, z)) {
          int walls = 0;

          if (isWall(world, x - 1, yStart, z))
            ++walls;

          if (isWall(world, x + 1, yStart, z))
            ++walls;

          if (isWall(world, x, yStart, z + 1))
            ++walls;

          if (isWall(world, x, yStart, z + 1))
            ++walls;

          if (walls >= 1 && walls <= 2) {
            world.setBlock(x, yStart, z, Blocks.chest, 0, 2);
            TileEntityChest chest = (TileEntityChest)world.getTileEntity(x, yStart, z);

            if (chest != null) {
              WeightedRandomChestContent.generateChestContents(rand, table.getItems(rand), chest, table.getCount(rand));
            }

            break;
          }
        }
View Full Code Here


                        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;
                    }
View Full Code Here

                for (int i = 0; i < chest.getSizeInventory(); i++)
                {
                    chest.setInventorySlotContents(i, null);
                }

                ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);

                WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
            }

            this.chests.clear();
        }
    }
View Full Code Here

                for (int i = 0; i < chest.getSizeInventory(); i++)
                {
                    chest.setInventorySlotContents(i, null);
                }

                ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);

                WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
            }

            this.chests.clear();
        }
    }
View Full Code Here

                          for (int k = 0; k < chest.getSizeInventory(); k++)
                          {
                              chest.setInventorySlotContents(k, null);
                          }
 
                          ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
 
                          // Generate twice, since it's an 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));
 
                          ItemStack schematic = this.getGuaranteedLoot(this.rand);
                          int slot = this.rand.nextInt(chest.getSizeInventory());
                          chest.setInventorySlotContents(slot, schematic);
 
View Full Code Here

          // Add normal random backpack loot.
          WeightedRandomChestContent.generateChestContents(
              RandomUtils.random, randomBackpackItems, inventory, 20);
          // With a chance of 10%, add some random dungeon loot.
          if (RandomUtils.getDouble() < 0.1) {
            ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
            WeightedRandomChestContent.generateChestContents(
                RandomUtils.random, info.getItems(RandomUtils.random), inventory, 5);
          }
         
        }
       
        ItemBackpack.setBackpack(entity, backpack, contents);
View Full Code Here

    AEApi.instance().registries().wireless().registerWirelessHandler( (IWirelessTermHandler) AEApi.instance().items().itemWirelessTerminal.item() );

    if ( AEConfig.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
    {
      ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
      d.addItem( new WeightedRandomChestContent( AEApi.instance().materials().materialCertusQuartzCrystal.stack( 1 ), 1, 4, 2 ) );
      d.addItem( new WeightedRandomChestContent( AEApi.instance().materials().materialCertusQuartzDust.stack( 1 ), 1, 4, 2 ) );
    }

    // add villager trading to black smiths for a few basic materials
    if ( AEConfig.instance.isFeatureEnabled( AEFeature.VillagerTrading ) )
      VillagerRegistry.instance().registerVillageTradeHandler( 3, new AETrading() );
View Full Code Here

        addLootWorkshop(new ItemStack(Items.coal), 8, 16, "fuel.coal");
    }

    public static void increaseLootGen(int min, int max, String... locations) {
        for (String location : locations) {
            ChestGenHooks lootInfo = ChestGenHooks.getInfo(location);
            lootInfo.setMin(lootInfo.getMin() + min);
            lootInfo.setMax(lootInfo.getMax() + max);
        }
    }
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.ChestGenHooks

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.