New Localization System Implemented :D

This commit is contained in:
oitsjustjose 2013-08-23 22:37:00 -05:00
commit 3363c4561f
41 changed files with 468 additions and 428 deletions

View file

@ -1,120 +0,0 @@
package MysticWorld.WorldGen;
import java.util.List;
import java.util.Random;
import MysticOres.Blocks.BlockHandler;
import MysticOres.Items.Items;
import MysticStones.MysticStones;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.ComponentVillage;
import net.minecraft.world.gen.structure.ComponentVillageStartPiece;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
public class ComponentVillagerHut extends ComponentVillage
{
private int averageGroundLevel = -1;
public ComponentVillagerHut(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5)
{
super(par1ComponentVillageStartPiece, par2);
this.coordBaseMode = par5;
this.boundingBox = par4StructureBoundingBox;
}
public static ComponentVillagerHut buildComponent (ComponentVillageStartPiece villagePiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, 7, 6, 7, p4);
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(pieces, structureboundingbox) == null ? new ComponentVillagerHut(villagePiece, p5, random,
structureboundingbox, p4) : null;
}
public boolean addComponentParts (World world, Random random, StructureBoundingBox sbb)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if (this.averageGroundLevel < 0)
{
return true;
}
this.boundingBox.offset(0, this.averageGroundLevel - this.boundingBox.maxY + 4, 0);
}
/*------------------------------------------------------------------Base------------------------------------------------------------------------*/
this.fillWithMetadataBlocks(world, sbb, 0, 0, 0, 6, 0, 6, MysticStones.StoneBricks.blockID, 2, MysticStones.StoneBricks.blockID, 2, false);
this.fillWithBlocks(world, sbb, 0, 5, 0, 6, 5, 6, Block.cobblestoneWall.blockID, Block.cobblestoneWall.blockID, false);
this.fillWithMetadataBlocks(world, sbb, 1, 0, 1, 5, 0, 5, MysticStones.StoneBricks.blockID, 2, MysticStones.StoneBricks.blockID, 2, false);
this.fillWithMetadataBlocks(world, sbb, 2, 0, 2, 4, 0, 4, MysticStones.ReinforcedBricks.blockID, 4, MysticStones.ReinforcedBricks.blockID, 4, false);
/*------------------------------------------------------------------Edges-------------------------------------------------------------------------*/
this.fillWithMetadataBlocks(world, sbb, 0, 1, 0, 0, 4, 0, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 0, 1, 6, 0, 4, 6, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 6, 1, 0, 6, 4, 0, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 6, 1, 6, 6, 4, 6, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
/*-------------------------------------------------------------------Walls------------------------------------------------------------------------*/
this.fillWithMetadataBlocks(world, sbb, 0, 1, 1, 0, 1, 5, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 1, 1, 0, 5, 1, 0, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 6, 1, 1, 6, 1, 5, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 1, 1, 6, 5, 1, 6, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 0, 3, 1, 0, 3, 5, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 1, 3, 0, 5, 3, 0, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 6, 3, 1, 6, 3, 5, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 1, 3, 6, 5, 3, 6, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
this.fillWithMetadataBlocks(world, sbb, 0, 4, 1, 0, 4, 5, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 1, 4, 0, 5, 4, 0, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 6, 4, 1, 6, 4, 5, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithMetadataBlocks(world, sbb, 1, 4, 6, 5, 4, 6, Block.stoneBrick.blockID, 0, Block.stoneBrick.blockID, 0, false);
this.fillWithBlocks(world, sbb, 1, 1, 1, 5, 5, 5, 0, 0, false);
this.fillWithMetadataBlocks(world, sbb, 1, 4, 1, 5, 4, 5, MysticStones.Planks.blockID, 5, MysticStones.Planks.blockID, 5, false);
/*---------------------------------------------------------Glass and Door--------------------------------------------------------------------------*/
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 1, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, MysticStones.Planks.blockID, 5, 2, 2, 0, sbb);
this.placeDoorAtCurrentPosition(world, sbb, random, 3, 1, 0, this.getMetadataWithOffset(Block.doorWood.blockID, 1));
this.placeBlockAtCurrentPosition(world, MysticStones.Planks.blockID, 5, 4, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 5, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 1, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 2, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, MysticStones.Planks.blockID, 5, 3, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 4, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 5, 2, 6, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 0, 2, 1, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 0, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, MysticStones.Planks.blockID, 5, 0, 2, 3, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 0, 2, 4, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 0, 2, 5, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 6, 2, 1, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 6, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, MysticStones.Planks.blockID, 5, 6, 2, 3, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 6, 2, 4, sbb);
this.placeBlockAtCurrentPosition(world, BlockHandler.BlockBase.blockID, 12, 6, 2, 5, sbb);
/*-------------------------------------------------------------Ladders---------------------------------------------------------------------------*/
int i = this.getMetadataWithOffset(Block.ladder.blockID, 3);
this.placeBlockAtCurrentPosition(world, Block.ladder.blockID, i, 3, 1, 5, sbb);
this.placeBlockAtCurrentPosition(world, Block.ladder.blockID, i, 3, 2, 5, sbb);
this.placeBlockAtCurrentPosition(world, Block.ladder.blockID, i, 3, 3, 5, sbb);
this.placeBlockAtCurrentPosition(world, Block.ladder.blockID, i, 3, 4, 5, sbb);
/*---------------------------------------------------------------Inside--------------------------------------------------------------------------*/
this.placeBlockAtCurrentPosition(world, Block.furnaceIdle.blockID, i, 1, 1, 1, sbb);
this.placeBlockAtCurrentPosition(world, Block.workbench.blockID, 0, 1, 1, 4, sbb);
this.placeBlockAtCurrentPosition(world, Block.anvil.blockID, 2, 1, 1, 5, sbb);
this.generateStructureChestContents(world, sbb, random, 4, 1, 5, MysticHutUtil.MysticHutChest.getItems(random), MysticHutUtil.MysticHutChest.getCount(random));
for (int l = 0; l < 6; ++l)
{
for (int i1 = 0; i1 < 9; ++i1)
{
this.clearCurrentPositionBlocksUpwards(world, i1, 9, l, sbb);
this.fillCurrentPositionBlocksDownwards(world, MysticStones.StoneBricks.blockID, 2, i1, -1, l, sbb);
}
}
this.spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
protected int getVillagerType (int par1)
{
return 98943;
}
}

View file

@ -1,28 +0,0 @@
package MysticWorld.WorldGen;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import MysticOres.Items.Items;
import MysticWorld.Items.ItemHandler$1;
public class MysticHutUtil
{
public MysticHutUtil()
{
addLoot();
}
public static ChestGenHooks MysticHutChest;
public static void addLoot()
{
MysticHutChest = new ChestGenHooks("MysticHutChest", new WeightedRandomChestContent[0], 1, 15);
MysticHutChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.Resource, 1, 13), 0, 1, 1000));
MysticHutChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.Resource, 1, 9), 0, 1, 1000));
MysticHutChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.Resource, 1, 4), 0, 1, 1000));
}
}

View file

@ -1,51 +0,0 @@
package MysticWorld.WorldGen;
import java.util.List;
import java.util.Random;
import MysticWorld.Items.ItemHandler$1;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import net.minecraft.world.gen.structure.ComponentVillageStartPiece;
import net.minecraft.world.gen.structure.StructureVillagePieceWeight;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
public class VillageHutHandler implements IVillageCreationHandler, IVillageTradeHandler
{
@Override
public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random)
{
if (villager.getProfession() == 98943)
{
recipeList.add(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 19, 0), new ItemStack(Item.emerald, 1, 0)));
recipeList.add(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 16, 1), new ItemStack(Item.emerald, 1, 0)));
recipeList.add(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 17, 2), new ItemStack(Item.emerald, 1, 0)));
recipeList.add(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 13, 3), new ItemStack(Item.emerald, 1, 0)));
recipeList.add(new MerchantRecipe(new ItemStack(ItemHandler$1.imbuedShard, 11, 4), new ItemStack(Item.emerald, 1, 0)));
}
}
@Override
public StructureVillagePieceWeight getVillagePieceWeight (Random random, int i)
{
return new StructureVillagePieceWeight(ComponentVillagerHut.class, 30, i + random.nextInt(4));
}
@Override
public Class<?> getComponentClass ()
{
return ComponentVillagerHut.class;
}
@Override
public Object buildComponent (StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5)
{
return ComponentVillagerHut.buildComponent(startPiece, pieces, random, p1, p2, p3, p4, p5);
}
}

View file

@ -8,9 +8,7 @@ public class WorldGenHandler$1 {
public static void init()
{
if(Booleans.ENABLE_BUSH_GEN)
{
GameRegistry.registerWorldGenerator(new WorldGenBushes());
}
GameRegistry.registerWorldGenerator(new WorldGenStones());
}