<commit_before>package de.katzenpapst.amunra.world.mapgen.pyramid;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

import cpw.mods.fml.common.FMLLog;
import de.katzenpapst.amunra.block.ARBlocks;
import de.katzenpapst.amunra.helper.CoordHelper;
import de.katzenpapst.amunra.item.ARItems;
import de.katzenpapst.amunra.world.mapgen.BaseStructureStart;
import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair;
import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraftforge.common.ChestGenHooks;

public class Pyramid extends BaseStructureStart
{
    protected int pyramidSize = 56;
    protected BlockMetaPair wallMaterial = ARBlocks.blockAluCrate;
    protected BlockMetaPair floorMaterial = ARBlocks.blockSmoothBasalt;
    protected BlockMetaPair fillMaterial = ARBlocks.blockBasaltBrick;

    // how far in the inner ring is
    private int innerRingOffset = 32;
    private int tunnelWidth = 3;
    private int tunnelHeight = 4;

    private int mainRoomOffset = 3;

    private int sideRoomWidth = 13;
    private int innerRoomOffset = 13;

    private int smallRoomWidth = 17;

    private PyramidRoom[] roomList = new PyramidRoom[12];

    private PyramidRoom centralRoom = null;

    // loot
    public static final String LOOT_CATEGORY_BASIC = "amunraPyramidChest";
    public static final String LOOT_CATEGORY_BOSS = "amunraPyramidChestBoss";


    static private boolean initDone = false;

    static void initLoot() {
        if(initDone) {
            return;
        }
        initDone = true;

        /*public static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {
         * new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10),
         * new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5),
         * new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5),
         * new WeightedRandomChestContent(Items.dye, 4, 4, 9, 5),
         * new WeightedRandomChestContent(Items.diamond, 0, 1, 2, 3),
         * new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10),
         * new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15),
         * new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1),
         * new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.rail), 0, 4, 8, 1),
         * new WeightedRandomChestContent(Items.melon_seeds, 0, 2, 4, 10),
         * new WeightedRandomChestContent(Items.pumpkin_seeds, 0, 2, 4, 10),
         * new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3),
         * new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1)};*/

        // itemStack, MinimumChanceToGenerate, MaximumChanceToGenerate, weight
        WeightedRandomChestContent alienBook = new WeightedRandomChestContent(ARItems.alienBook.getItemStack(0), 1, 1, 3);
        WeightedRandomChestContent ironIngot = new WeightedRandomChestContent(new ItemStack(Items.iron_ingot, 2), 1, 5, 10);
        WeightedRandomChestContent goldIngot = new WeightedRandomChestContent(new ItemStack(Items.gold_ingot, 0), 1, 3, 5);
        WeightedRandomChestContent diamond 	 = new WeightedRandomChestContent(new ItemStack(Items.diamond, 0), 1, 3, 5);

        WeightedRandomChestContent lithium   = new WeightedRandomChestContent(ARItems.lithiumGem.getItemStack(1), 1, 3, 5);
        WeightedRandomChestContent coldcrystal   = new WeightedRandomChestContent(ARItems.coldCrystal.getItemStack(1), 1, 3, 5);
        WeightedRandomChestContent ruby   = new WeightedRandomChestContent(ARItems.rubyGem.getItemStack(1), 1, 3, 5);

        // try to add some GC stuff
        WeightedRandomChestContent deshPick	 = new WeightedRandomChestContent(new ItemStack(MarsItems.deshPickaxe, 0), 1, 1, 1);

        //WeightedRandomChestContent desh 	 = new WeightedRandomChestContent(new ItemStack(MarsItems.deshPickaxe, 0, 2), 1, 1, 1);


        WeightedRandomChestContent desh      = new WeightedRandomChestContent(new ItemStack(MarsItems.marsItemBasic, 0, 0), 1, 1, 5);


        // nanites
        WeightedRandomChestContent nanites      = new WeightedRandomChestContent(ARItems.naniteCluster.getItemStack(1), 1, 1, 2);

        ChestGenHooks basicLoot = ChestGenHooks.getInfo(LOOT_CATEGORY_BASIC);
        basicLoot.setMin(5);
        basicLoot.setMax(8);

        basicLoot.addItem(LOOT_CATEGORY_BASIC, alienBook);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, ironIngot);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, goldIngot);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, diamond);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, nanites);

        basicLoot.addItem(LOOT_CATEGORY_BASIC, lithium);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, coldcrystal);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, ruby);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, deshPick);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, desh);

    }





    public Pyramid(World world, int chunkX, int chunkZ, Random rand) {
        super(world, chunkX, chunkZ, rand);
        int startX = CoordHelper.chunkToMinBlock(chunkX);
        int startZ = CoordHelper.chunkToMinBlock(chunkZ);
        StructureBoundingBox bb = new StructureBoundingBox(startX-56,startZ-56,startX+56-1,startZ+56-1);
        this.setStructureBoundingBox(bb);
        //	initRooms();
        initLoot();

        FMLLog.info("Generating Pyramid at "+startX+"/"+startZ);
    }
    /*
	protected void initRooms() {
		for(int i=0;i<12;i++) {<commit_msg>added ender pearls as pyramid loot<commit_after>package de.katzenpapst.amunra.world.mapgen.pyramid;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

import cpw.mods.fml.common.FMLLog;
import de.katzenpapst.amunra.block.ARBlocks;
import de.katzenpapst.amunra.helper.CoordHelper;
import de.katzenpapst.amunra.item.ARItems;
import de.katzenpapst.amunra.world.mapgen.BaseStructureStart;
import micdoodle8.mods.galacticraft.api.prefab.core.BlockMetaPair;
import micdoodle8.mods.galacticraft.planets.mars.items.MarsItems;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraftforge.common.ChestGenHooks;

public class Pyramid extends BaseStructureStart
{
    protected int pyramidSize = 56;
    protected BlockMetaPair wallMaterial = ARBlocks.blockAluCrate;
    protected BlockMetaPair floorMaterial = ARBlocks.blockSmoothBasalt;
    protected BlockMetaPair fillMaterial = ARBlocks.blockBasaltBrick;

    // how far in the inner ring is
    private int innerRingOffset = 32;
    private int tunnelWidth = 3;
    private int tunnelHeight = 4;

    private int mainRoomOffset = 3;

    private int sideRoomWidth = 13;
    private int innerRoomOffset = 13;

    private int smallRoomWidth = 17;

    private PyramidRoom[] roomList = new PyramidRoom[12];

    private PyramidRoom centralRoom = null;

    // loot
    public static final String LOOT_CATEGORY_BASIC = "amunraPyramidChest";
    public static final String LOOT_CATEGORY_BOSS = "amunraPyramidChestBoss";


    static private boolean initDone = false;

    static void initLoot() {
        if(initDone) {
            return;
        }
        initDone = true;

        /*public static final WeightedRandomChestContent[] mineshaftChestContents = new WeightedRandomChestContent[] {
         * new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10),
         * new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5),
         * new WeightedRandomChestContent(Items.redstone, 0, 4, 9, 5),
         * new WeightedRandomChestContent(Items.dye, 4, 4, 9, 5),
         * new WeightedRandomChestContent(Items.diamond, 0, 1, 2, 3),
         * new WeightedRandomChestContent(Items.coal, 0, 3, 8, 10),
         * new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15),
         * new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 1),
         * new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.rail), 0, 4, 8, 1),
         * new WeightedRandomChestContent(Items.melon_seeds, 0, 2, 4, 10),
         * new WeightedRandomChestContent(Items.pumpkin_seeds, 0, 2, 4, 10),
         * new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3),
         * new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1)};*/

        // itemStack, MinimumChanceToGenerate, MaximumChanceToGenerate, weight
        WeightedRandomChestContent alienBook = new WeightedRandomChestContent(ARItems.alienBook.getItemStack(0), 1, 1, 3);
        WeightedRandomChestContent ironIngot = new WeightedRandomChestContent(new ItemStack(Items.iron_ingot, 2), 1, 5, 10);
        WeightedRandomChestContent goldIngot = new WeightedRandomChestContent(new ItemStack(Items.gold_ingot, 0), 1, 3, 5);
        WeightedRandomChestContent diamond 	 = new WeightedRandomChestContent(new ItemStack(Items.diamond, 0), 1, 3, 5);

        WeightedRandomChestContent lithium   = new WeightedRandomChestContent(ARItems.lithiumGem.getItemStack(1), 1, 3, 5);
        WeightedRandomChestContent coldcrystal   = new WeightedRandomChestContent(ARItems.coldCrystal.getItemStack(1), 1, 3, 5);
        WeightedRandomChestContent ruby   = new WeightedRandomChestContent(ARItems.rubyGem.getItemStack(1), 1, 3, 5);

        // try to add some GC stuff
        WeightedRandomChestContent deshPick	 = new WeightedRandomChestContent(new ItemStack(MarsItems.deshPickaxe, 0), 1, 1, 1);

        //WeightedRandomChestContent desh 	 = new WeightedRandomChestContent(new ItemStack(MarsItems.deshPickaxe, 0, 2), 1, 1, 1);


        WeightedRandomChestContent desh      = new WeightedRandomChestContent(new ItemStack(MarsItems.marsItemBasic, 0, 0), 1, 1, 5);


        // nanites
        WeightedRandomChestContent nanites      = new WeightedRandomChestContent(ARItems.naniteCluster.getItemStack(1), 1, 1, 2);
        WeightedRandomChestContent pearl      = new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 1, 2);

        ChestGenHooks basicLoot = ChestGenHooks.getInfo(LOOT_CATEGORY_BASIC);
        basicLoot.setMin(5);
        basicLoot.setMax(8);

        basicLoot.addItem(LOOT_CATEGORY_BASIC, alienBook);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, ironIngot);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, goldIngot);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, diamond);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, nanites);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, pearl);

        basicLoot.addItem(LOOT_CATEGORY_BASIC, lithium);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, coldcrystal);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, ruby);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, deshPick);
        basicLoot.addItem(LOOT_CATEGORY_BASIC, desh);

    }





    public Pyramid(World world, int chunkX, int chunkZ, Random rand) {
        super(world, chunkX, chunkZ, rand);
        int startX = CoordHelper.chunkToMinBlock(chunkX);
        int startZ = CoordHelper.chunkToMinBlock(chunkZ);
        StructureBoundingBox bb = new StructureBoundingBox(startX-56,startZ-56,startX+56-1,startZ+56-1);
        this.setStructureBoundingBox(bb);
        //	initRooms();
        initLoot();

        FMLLog.info("Generating Pyramid at "+startX+"/"+startZ);
    }
    /*
	protected void initRooms() {
		for(int i=0;i<12;i++) {
{'fraction_non_alphanumeric': 0.09544487015751384, 'fraction_numerical': 0.023414218816517667, 'mean_word_length': 3.9436026936026938, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5650120', 'n_tokens_mistral': 4255, 'n_tokens_neox': 3885, 'n_words': 765}