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)); } }
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)); } }
private static List<ChestGenHooks> getChestGenerationHooks() { if (chestHooks != null) return chestHooks; chestHooks = new ArrayList<ChestGenHooks>(); final ConfigCategory c = chests.getCategory(ConfigProcessor.CONFIG_CHESTS); for (final ConfigCategory p : c.getChildren()) { if(!isContainerNode(p)) { processEntry(null, p, chestHooks); } else { for (final ConfigCategory cc : p.getChildren()) processEntry(p, cc, chestHooks); } } return chestHooks; }
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); } } } } }
@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; }
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 ); } }
@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; }
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)); } }
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 ) ); } }
@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; }
public void registerChestItems() { ChestGenHooks chestGenHooksDungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); chestGenHooksDungeon.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 30)); // chance < saddle (1/16, ca. 6%, in max 8 slots -> 40% at least 1 egg, 0.48 eggs per chest): I think that's okay ChestGenHooks chestGenHooksMineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR); chestGenHooksMineshaft.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 5)); // chance == gold ingot (1/18, ca. 6%, in 3-6 slots -> 23% at least 1 egg, 0.27 eggs per chest): // exploring a random mine shaft in creative mode yielded 2 eggs out of about 10 chests in 1 hour ChestGenHooks chestGenHooksJungleChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST); chestGenHooksJungleChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 15)); // chance == gold ingot (15/81, ca. 18%, in 2-5 slots -> 51% at least 1 egg, 0.65 eggs per chest, 1.3 eggs per temple): // jungle temples are so rare, it should be rewarded ChestGenHooks chestGenHooksDesertChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST); chestGenHooksDesertChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 10)); // chance == iron ingot (10/76, ca. 13%, in 2-5 slots -> 39% at least 1 egg, 0.46 eggs per chest, 1.8 eggs per temple): // desert temples are so rare, it should be rewarded }
public void registerChestItems() { ChestGenHooks chestGenHooksDungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); chestGenHooksDungeon.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 70)); // chance < saddle (1/16, ca. 6%, in max 8 slots -> 40% at least 1 egg, 0.48 eggs per chest): I think that's okay ChestGenHooks chestGenHooksMineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR); chestGenHooksMineshaft.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 5)); // chance == gold ingot (1/18, ca. 6%, in 3-6 slots -> 23% at least 1 egg, 0.27 eggs per chest): // exploring a random mine shaft in creative mode yielded 2 eggs out of about 10 chests in 1 hour ChestGenHooks chestGenHooksJungleChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST); chestGenHooksJungleChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 15)); // chance == gold ingot (15/81, ca. 18%, in 2-5 slots -> 51% at least 1 egg, 0.65 eggs per chest, 1.3 eggs per temple): // jungle temples are so rare, it should be rewarded ChestGenHooks chestGenHooksDesertChest = ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST); chestGenHooksDesertChest.addItem(new WeightedRandomChestContent(new ItemStack(ModItems.nileEssence), 1, 1, 10)); // chance == iron ingot (10/76, ca. 13%, in 2-5 slots -> 39% at least 1 egg, 0.46 eggs per chest, 1.8 eggs per temple): // desert temples are so rare, it should be rewarded }
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); } }
public static void addChestLoot() { for (int i = 0; i < Rings.proxy.spellRegistry.getSpellList().size(); i++) { ISpellEntry entry = Rings.proxy.spellRegistry.getSpellList().get(i); if (entry != null && entry.getSpell() != null) { ItemStack stack = new ItemStack(ModItems.spellParchment); if (!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.getTagCompound().setString(ModLibs.SPELL_ID, entry.getSpellID()); ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2)); ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(new WeightedRandomChestContent(stack, 0, 1, 2)); ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2)); ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(new WeightedRandomChestContent(stack, 0, 1, 2)); ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(new WeightedRandomChestContent(stack, 0, 1, 2)); } } ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.food), 1, 5, 100)); }
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)); } }
private String mapGenLocation (String location) { if (location.equals("mineshaftCorridor")) return ChestGenHooks.MINESHAFT_CORRIDOR; if (location.equals("pyramidDesertChest")) return ChestGenHooks.PYRAMID_DESERT_CHEST; if (location.equals("pyramidJungleChest")) return ChestGenHooks.PYRAMID_JUNGLE_CHEST; if (location.equals("strongholdCorridor")) return ChestGenHooks.STRONGHOLD_CORRIDOR; if (location.equals("strongholdLibrary")) return ChestGenHooks.STRONGHOLD_LIBRARY; if (location.equals("strongholdCrossing")) return ChestGenHooks.STRONGHOLD_CROSSING; if (location.equals("villageBlacksmith")) return ChestGenHooks.VILLAGE_BLACKSMITH; if (location.equals("dungeonChest")) return ChestGenHooks.DUNGEON_CHEST; return null; }
protected void createBonusChest() { WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand)); for (int i = 0; i < 10; ++i) { int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6); int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6); int l = this.getTopSolidOrLiquidBlock(j, k) + 1; if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k)) { break; } } }
@Override public WeightedRandomChestContent getChestGenBase(ChestGenHooks chest, Random rnd, WeightedRandomChestContent original) { ItemStack stack = original.theItemId; PhysisToolMaterial.writeMaterialToStack(PhysisToolMaterial.getRandomMaterial(rnd), stack); PhysisArtifacts.addSocketToItem(stack); if (rnd.nextInt(5) == 0) { PhysisArtifacts.addSocketToItem(stack); } if (rnd.nextInt(50) == 0) { PhysisArtifacts.addSocketToItem(stack); } original.theItemId = stack; return original; }
public static void init() { digSiteLootList = new LootList(); PhysisAPI.digSiteLootList = digSiteLootList; digSiteLootList.addItemStackChestGen(new ItemStack(PhysisItems.socketable), 1, 1, 1000); digSiteLootList.addItemStackChestGen(new ItemStack(Items.enchanted_book), 1, 1, 400); digSiteLootList.addOrePrefix("ingot", 2, 5, 350, 0.2); digSiteLootList.addOrePrefix("gem", 1, 3, 350, 0.2); digSiteLootList.addChest(ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST), 350); digSiteLootList.addChest(ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST), 250, 0.3); digSiteLootList.addChest(ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR), 200, 0.1); digSiteLootList.addChest(ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST), 200, 0.2); digSiteLootList.addItemStack(new ItemStack(Items.emerald), 1, 1, 200, 0.75); digSiteLootList.addOrePrefix("ingot", 1, 2, 150, 0.4); digSiteLootList.addItemStack(new ItemStack(PhysisItems.component, 1, 0), 1, 1, 100, 1.5); digSiteLootList.addOrePrefix("nugget", 1, 1, 80, 0.2); digSiteLootList.addItemStack(new ItemStack(Items.book), 1, 1, 40); digSiteLootList.addItemStack(new ItemStack(Items.paper), 1, 2, 25); }
/** * Generates a random number of items plus special boss chest loot */ public static void generateBossChestContents(World world, Random rand, IInventory chest, RoomBoss room) { generateChestContents(world, rand, chest, room, true); ChestGenHooks info = ChestGenHooks.getInfo(BOSS_LOOT); WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand)); WorldUtils.addItemToInventoryAtRandom(rand, new ItemStack(ZSSItems.heartPiece), chest, 3); // special items that always generate, i.e. the Pendants of Virtue ItemStack stack = room.getBossType().getSpecialItem(); if (stack != null) { WorldUtils.addItemToInventoryAtRandom(rand, stack, chest, 3); } // possibly select a random special item from the boss type's list stack = room.getBossType().getRandomSpecialItem(rand); if (stack != null && rand.nextFloat() < 0.2F) { WorldUtils.addItemToInventoryAtRandom(rand, stack, chest, 3); } else { WorldUtils.generateRandomChestContents(rand, skillOrbLootList, chest, 1, false); } }
private static void initLockedLoot() { setCategoryStats(ChestGenHooks.getInfo(LOCKED_LOOT), 1, 3, new WeightedRandomChestContent[] { getLoot(ZSSItems.arrowFire, 2, 5, Config.getLockedLootWeight()), getLoot(ZSSItems.arrowIce, 2, 5, Config.getLockedLootWeight()), getLoot(ZSSItems.arrowLight, 1, 3, 1), getLoot(Items.golden_apple, 1, 2, Math.max(Config.getLockedLootWeight() / 3, 1)), getLoot(Items.potionitem, LibPotionID.HEALING_II.id, 1, 1, Math.max(Config.getLockedLootWeight() / 2, 2)), getLoot(Items.potionitem, LibPotionID.HEALING_SPLASH.id, 1, 1, Math.max(Config.getLockedLootWeight() / 2, 2)), getLoot(ZSSItems.bombBag, 1, 1, Config.getBombBagWeight()), getLoot(ZSSItems.magicMirror, 1, 1, Config.getLockedLootWeight()), getLoot(ZSSItems.potionBlue, 1, 1, 1), getLoot(ZSSItems.swordOrdon, 1, 1, Config.getLockedLootWeight()), getLoot(ZSSItems.tunicHeroBoots, 1, 1, 1), getLoot(ZSSItems.tunicHeroLegs, 1, 1, 1), getLoot(ZSSItems.tunicHeroChest, 1, 1, 1), getLoot(ZSSItems.tunicHeroHelm, 1, 1, 1) }); }
@Override protected void onImpact(MovingObjectPosition mop) { if (mop.entityHit != null) { mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 2.0F); } int stateId = Block.getStateId(ZSSBlocks.ceramicJar.getDefaultState()); for (int i = 0; i < 20; ++i) { worldObj.spawnParticle(EnumParticleTypes.BLOCK_CRACK, posX, posY, posZ, motionX + rand.nextGaussian(), 0.01D, motionZ + rand.nextGaussian(), stateId); } WorldUtils.playSoundAtEntity(this, Sounds.BREAK_JAR, 0.4F, 0.5F); if (stack == null && rand.nextFloat() < Config.getJarDropChance()) { stack = ChestGenHooks.getInfo(DungeonLootLists.JAR_DROPS).getOneItem(rand); } if (stack != null) { WorldUtils.spawnItemWithRandom(worldObj, stack, (int) posX, (int) posY + 1, (int) posZ); } if (!worldObj.isRemote) { setDead(); } }
/** * Adds weighted chest contents to all ChestGenHooks, with possible exception of blacksmith and Bonus Chest */ private static void addLootToAll(WeightedRandomChestContent loot, boolean smith, boolean bonus) { ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_JUNGLE_CHEST).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CORRIDOR).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_LIBRARY).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.STRONGHOLD_CROSSING).addItem(loot); ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(loot); if (smith) { ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(loot); } if (bonus) { ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(loot); } }
/** * Creates the bonus chest in the world. */ protected void createBonusChest() { WorldGeneratorBonusChest worldgeneratorbonuschest = new WorldGeneratorBonusChest(ChestGenHooks.getItems(BONUS_CHEST, rand), ChestGenHooks.getCount(BONUS_CHEST, rand)); for (int i = 0; i < 10; ++i) { int j = this.worldInfo.getSpawnX() + this.rand.nextInt(6) - this.rand.nextInt(6); int k = this.worldInfo.getSpawnZ() + this.rand.nextInt(6) - this.rand.nextInt(6); int l = this.getTopSolidOrLiquidBlock(j, k) + 1; if (worldgeneratorbonuschest.generate(this, this.rand, j, l, k)) { break; } } }
public static ChestLootCategory fromChestGenHooks(String category) { ChestGenHooks chestGenHooks = ChestGenHooks.getInfo(category); ChestLootCategory lootCategory = new ChestLootCategory(); lootCategory.category = category; lootCategory.count_min = chestGenHooks.getMin(); lootCategory.count_max = chestGenHooks.getMax(); List<ChestLootItem> lootList = Lists.newArrayList(); try { for (WeightedRandomChestContent item : (List<WeightedRandomChestContent>)TooMuchLoot.contents.get(chestGenHooks)) { lootList.add(ChestLootItem.fromChestContent(item)); } } catch (Exception ex) { ex.printStackTrace(); } lootCategory.loot = lootList.toArray(new ChestLootItem[lootList.size()]); return lootCategory; }
public static void init() { for (int i = 0; i < UtilityCheck.getListOfMaterials().size(); i++) { if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getDimension() == MaterialDimension.OVERWORLD) { if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.INGOT || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.GEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.NUGGET ||((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.ALLOY || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PUREGEM) { ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/5, 1, Int.MaxValue()))); ChestGenHooks.addItem(ChestGenHooks.MINESHAFT_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 2, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/10, 1, Int.MaxValue()))); ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/7, 1, Int.MaxValue()))); ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 5, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/3, 1, Int.MaxValue()))); ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 7, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/2, 1, Int.MaxValue()))); } if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.INGOT || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.ALLOY || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PLATE || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.NUGGET) { ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/20, 1, Int.MaxValue()))); } if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.GEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.PUREGEM || ((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getType() == MaterialType.SHARD) { ModMisc.houseChest.addItem(new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 5, MiscUtility.clamp(UtilityCheck.getBaseRarity(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)))/2, 1, Int.MaxValue()))); } } else if(((ItemMaterial) UtilityCheck.getListOfMaterials().get(i)).getDimension() == MaterialDimension.END) { ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent((ItemMaterial) UtilityCheck.getListOfMaterials().get(i), 0, 1, 7, MiscUtility.clamp(UtilityCheck.getBaseRarity((ItemMaterial) UtilityCheck.getListOfMaterials().get(i))/2, 1, Int.MaxValue()))); } } ModMisc.houseChest.addItem(new WeightedRandomChestContent(Items.diamond, 0, 1, 5, 7)); ModMisc.houseChest.addItem(new WeightedRandomChestContent(Items.emerald, 0, 1, 5, 10)); ChestGenHooks.addItem(ChestGenHooks.VILLAGE_BLACKSMITH, new WeightedRandomChestContent(Items.gold_nugget, 0, 1, 3, MiscUtility.clamp(UtilityCheck.getBaseRarity((ModItems.nuggetSilver))/20, 1, Int.MaxValue()))); }
@Mod.EventHandler public void load (FMLInitializationEvent event) { proxy.registerRenderers(); MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); for (int i = 1; i < 256; i++) { if (!config.hasPattern(i)) continue; PatternConfig pattern = config.getPattern(i); for (int j = 0; j < pattern.getLocationCount(); j++) ChestGenHooks.addItem(pattern.getGenLocation(j), new WeightedRandomChestContent(items.potteryPattern, i, 1, 1, pattern.getGenRarity(j))); } VillagerTradeHandler.instance().load(); integration.init(); }
@EventHandler public void init(FMLInitializationEvent event) { printMessage("Initialization Event"); // Add name's to the Tabs LanguageRegistry.instance().addStringLocalization("itemGroup.tabJaffaCakes", "en_US", Strings.TAB_MAIN_NAME); // Initialize Blocks ModBlocks.init(); // Initialize Items ModItems.init(); // Create Recipes ModRecipes.init(); // Dungeon ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.itemJaffaCake), 1, 3, 115)); // Generate Tree's GameRegistry.registerWorldGenerator(new OrangeTreeGenerator()); }
@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)); } } }
public static void replaceDungeonLoot() { try { HashMap<String, ChestGenHooks> chestInfo = ReflectionHelper.getPrivateValue(ChestGenHooks.class, null, "chestInfo"); for (Map.Entry<String, ChestGenHooks> entry : chestInfo.entrySet()) { ChestGenHooks chestGenHooks = entry.getValue(); ArrayList<WeightedRandomChestContent> contents = ReflectionHelper.getPrivateValue(ChestGenHooks.class, chestGenHooks, "contents"); for (WeightedRandomChestContent weightedRandomChestContent : contents) { ItemStack output = weightedRandomChestContent.theItemId; ItemStack newOutput = getPreferredOre(output); if (newOutput == null) { continue; } log("Modifying dungeon loot in "+entry.getKey()+", replacing "+output.itemID+":"+output.getItemDamage()+" -> "+newOutput.itemID+":"+newOutput.getItemDamage()); weightedRandomChestContent.theItemId = newOutput; } } } catch (Throwable t) { System.out.println("Failed to replace dungeon loot: " + t); } }
private static void bindHooks() { ChestGenHooks hooks = ChestGenHooks.getInfo("Placemod"); for (ResourceLocation itemName : GameData.getItemRegistry().getKeys()) { Item item = Item.itemRegistry.getObject(itemName); int maxDmg = item.getMaxDamage(); for (int meta = 0; meta <= maxDmg; ++meta) { hooks.addItem(new WeightedRandomChestContent(new ItemStack(item, 1, meta), 1, maxChestStackSize, 256 / (1 + maxDmg))); } } hooks.setMin(minChestItems); hooks.setMax(maxChestItems); }
private static void bindHooks() { ChestGenHooks hooks = ChestGenHooks.getInfo("Placemod"); for (Object itemName : GameData.getItemRegistry().getKeys()) { Item item = (Item) Item.itemRegistry.getObject(itemName); int maxMeta = item.getMaxDamage(); for (int meta = 0; meta <= maxMeta; ++meta) { hooks.addItem(new WeightedRandomChestContent(new ItemStack(item, 1, meta), 1, maxChestStackSize, 256 / (maxMeta + 1))); } } hooks.setMin(minChestItems); hooks.setMax(maxChestItems); }
ChestGenHooks getChest() { if (setup) return fractureChest; setup = true; // No LMP: only the core drops the LMP. fractureChest.addItem(new WeightedRandomChestContent(new ItemStack(Core.registry.logicMatrixIdentifier), 1, 1, 6)); fractureChest.addItem(new WeightedRandomChestContent(new ItemStack(Core.registry.logicMatrixController), 1, 1, 6)); fractureChest.addItem(new WeightedRandomChestContent(new ItemStack(Core.registry.dark_iron_ingot), 1, 2, 12)); fractureChest.addItem(new WeightedRandomChestContent(Core.registry.dark_iron_sprocket.copy(), 2, 4, 1)); return fractureChest; }