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

@ -28,7 +28,7 @@ public class ItemBush extends ItemBlock {
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, BUSH_TYPES.length);
return super.getUnlocalizedName() + BUSH_TYPES[meta];
return BUSH_TYPES[meta];
}

View file

@ -3,7 +3,6 @@ package MysticWorld.Client;
import net.minecraft.src.ModLoader;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import MysticWorld.CommonProxy;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Client.FX.LightCubeFX;
import MysticWorld.Client.FX.PowerAirFX;
@ -32,6 +31,7 @@ import MysticWorld.Renderer.ItemStaffWaterRenderer;
import MysticWorld.Renderer.RenderStaffPower;
import MysticWorld.Renderer.TileEntityPillarInsertRenderer;
import MysticWorld.TileEntity.TileEntityPillarInsert;
import MysticWorld.Util.CommonProxy;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;

View file

@ -3,9 +3,8 @@ package MysticWorld.Items;
import java.util.List;
import MysticWorld.MysticWorld;
import MysticWorld.Reference;
import MysticWorld.Lib.Strings;
import MysticWorld.Util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
@ -34,6 +33,7 @@ public class ItemBushFruit extends ItemFood {
this.setCreativeTab(MysticWorld.MysticWorldTab);
maxStackSize = 64;
setAlwaysEdible();
setUnlocalizedName("bushFruit");
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player)
@ -139,13 +139,6 @@ public class ItemBushFruit extends ItemFood {
{
return 24;
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + FRUIT_TYPES[meta];
}
@Override
@SideOnly(Side.CLIENT)

View file

@ -19,6 +19,7 @@ public class ItemStaff extends Item
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{

View file

@ -23,16 +23,25 @@ public class ItemStaffParts extends Item {
private static final String[] STAFF_PARTS = new String[] {"Staff", "Hilt", "Handle", "Head"};
public ItemStaffParts(int id) {
public ItemStaffParts(int id)
{
super(id);
this.setHasSubtypes(true);
this.setCreativeTab(MysticWorld.MysticWorldTab);
}
@Override
public String getUnlocalizedName(ItemStack itemStack) {
public String getUnlocalizedName(ItemStack itemStack)
{
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
return super.getUnlocalizedName() + STAFF_PARTS[meta];
return STAFF_PARTS[meta];
}
@Override
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
@Override

View file

@ -2,8 +2,7 @@ package MysticWorld.Items;
import java.util.List;
import MysticWorld.Reference;
import MysticWorld.Util.Reference;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;

View file

@ -1,92 +0,0 @@
package MysticWorld;
import MysticWorld.Blocks.BlockHandler;
import MysticWorld.Items.ItemHandler$1;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class Lang
{
public static void init()
{
//Creative Tab Name
LanguageRegistry.instance().addStringLocalization("itemGroup.MysticWorldTab", "en_US", "Mystic World!");
//Blocks
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 0), "Charred Stone");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 1), "Moistened Stone");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 2), "Mossified Stone");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 3), "Oxygenated Stone");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.oreImbuedStone, 1, 4), "Energized Stone");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 0), "Bush");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 1), "Poisonous Bush");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 2), "Bush of Weakness");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 3), "Bush of Slowness");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 4), "Bush of Harming");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 5), "Withering Bush");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 6), "Bush of Health");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 7), "Bush of Speed");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 8), "Bush of Flames");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 9), "Bush of Regen");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 10), "Bush of Vision");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.bush, 1, 11), "Bush of Invisibility");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.lightCube, 1), "Light Cube");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarPlatform, 1), "Pillar Platform");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillar, 1), "Pillar Tower");
LanguageRegistry.instance().addName(new ItemStack(BlockHandler.pillarInsert, 1), "Pillar Insert");
//Items
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 0), "Staff");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 1), "Staff Hilt");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 2), "Staff Handle");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.staffParts, 1, 3), "Staff Topper");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.imbuedShard, 1, 0), "Charred Shard");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.imbuedShard, 1, 1), "Moistened Shard");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.imbuedShard, 1, 2), "Mossified Shard");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.imbuedShard, 1, 3), "Oxygenated Shard");
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.imbuedShard, 1, 4), "Energized Shard");
LanguageRegistry.instance().addName(ItemHandler$1.fireStaff, "Fire Staff");
LanguageRegistry.instance().addName(ItemHandler$1.waterStaff, "Water Staff");
LanguageRegistry.instance().addName(ItemHandler$1.earthStaff, "Earth Staff");
LanguageRegistry.instance().addName(ItemHandler$1.airStaff, "Air Staff");
LanguageRegistry.instance().addName(ItemHandler$1.energyStaff, "Energy Staff");
LanguageRegistry.instance().addName(ItemHandler$1.verditeHelmet, "Verdite Helmet");
LanguageRegistry.instance().addName(ItemHandler$1.verditeChestplate, "Verdite Chestplate");
LanguageRegistry.instance().addName(ItemHandler$1.verditeLeggings, "Verdite Leggings");
LanguageRegistry.instance().addName(ItemHandler$1.verditeBoots, "Verdite Boots");
LanguageRegistry.instance().addName(ItemHandler$1.mithrilHelmet, "Mithril Helmet");
LanguageRegistry.instance().addName(ItemHandler$1.mithrilChestplate, "Mithril Chestplate");
LanguageRegistry.instance().addName(ItemHandler$1.mithrilLeggings, "Mithril Leggings");
LanguageRegistry.instance().addName(ItemHandler$1.mithrilBoots, "Mithril Boots");
LanguageRegistry.instance().addName(ItemHandler$1.adamantineHelmet, "Adamantine Helmet");
LanguageRegistry.instance().addName(ItemHandler$1.adamantineChestplate, "Adamantine Chestplate");
LanguageRegistry.instance().addName(ItemHandler$1.adamantineLeggings, "Adamantine Leggings");
LanguageRegistry.instance().addName(ItemHandler$1.adamantineBoots, "Adamantine Boots");
LanguageRegistry.instance().addName(ItemHandler$1.iridiumHelmet, "Iridium Helmet");
LanguageRegistry.instance().addName(ItemHandler$1.iridiumChestplate, "Iridium Chestplate");
LanguageRegistry.instance().addName(ItemHandler$1.iridiumLeggings, "Iridium Leggings");
LanguageRegistry.instance().addName(ItemHandler$1.iridiumBoots, "Iridium Boots");
LanguageRegistry.instance().addName(ItemHandler$1.fireOrb, "Fire Orb");
LanguageRegistry.instance().addName(ItemHandler$1.waterOrb, "Water Orb");
LanguageRegistry.instance().addName(ItemHandler$1.earthOrb, "Earth Orb");
LanguageRegistry.instance().addName(ItemHandler$1.airOrb, "Air Orb");
LanguageRegistry.instance().addName(ItemHandler$1.energyOrb, "Energy Orb");
LanguageRegistry.instance().addName(ItemHandler$1.voidShard, "Void Shard");
for (int i = 0; i < 12; i++)
{
LanguageRegistry.instance().addName(new ItemStack(ItemHandler$1.bushFruit, 1, i), "Strange Fruit");
}
}
}

View file

@ -11,6 +11,13 @@ import MysticWorld.Entity.EntityHandler;
import MysticWorld.Items.ItemHandler$1;
import MysticWorld.Lib.Strings;
import MysticWorld.TileEntity.TileEntityHandler;
import MysticWorld.Util.CommonProxy;
import MysticWorld.Util.Config;
import MysticWorld.Util.Localizations;
import MysticWorld.Util.RecipeHandler;
import MysticWorld.Util.Reference;
import MysticWorld.Util.TabMysticWorld;
import MysticWorld.Util.TickHandler;
import MysticWorld.WorldGen.*;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
@ -72,24 +79,15 @@ public class MysticWorld
this.tickHandler = new TickHandler();
TickRegistry.registerTickHandler(this.tickHandler, Side.SERVER);
VillagerRegistry.instance().registerVillagerSkin(98943, new ResourceLocation("/mods/MysticTextures/textures/mob/MysticVillager.png"));
VillagerRegistry.instance().registerVillageTradeHandler(98943, new VillageHutHandler());
VillagerRegistry.instance().registerVillageCreationHandler(new VillageHutHandler());
BlockHandler.init();
ItemHandler$1.init();
TileEntityHandler.init();
WorldGenHandler$1.init();
EntityHandler.init();
RecipeHandler.init();
MysticHutUtil.addLoot();
Lang.init();
Localizations.Initialize();
proxy.registerRenderIDs();
proxy.registerRenders();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
}
}

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.src.ModLoader;

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
import java.io.File;

View file

@ -0,0 +1,112 @@
package MysticWorld.Util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import MysticWorld.MysticWorld;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
*
* All credits go to copygirl (or copy....boy) for this one
* Couldn't have done any of this without your
* repository, many thanks friend c:
*
*/
public class Localizations
{
private Localizations(){}
public static void Initialize()
{
File source = Loader.instance().getReversedModObjectList().get(MysticWorld.instance).getSource();
Pattern pattern = Pattern.compile(".*(assets/" + "mysticmods/lang/(.+)\\.(.+))");
for(String file : getResources(source, pattern))
{
Matcher matcher = pattern.matcher(file);
matcher.find();
String resource = "/" + matcher.group(1);
String lang = matcher.group(2);
boolean isXML = matcher.group(3).equalsIgnoreCase("XML");
LanguageRegistry.instance().loadLocalization(resource, lang, isXML);
}
}
private static Collection<String> getResources(File file, Pattern pattern)
{
ArrayList<String> retval = new ArrayList<String>();
if(file.isDirectory())
retval.addAll(getResourcesFromDirectory(file, pattern));
else retval.addAll(getResourcesFromJarFile(file, pattern));
return retval;
}
private static Collection<String> getResourcesFromJarFile(File file, Pattern pattern)
{
ArrayList<String> retval = new ArrayList<String>();
ZipFile Zip;
try
{
Zip = new ZipFile(file);
}
catch (ZipException Ex)
{
throw new Error(Ex);
}
catch(IOException Ex)
{
throw new Error(Ex);
}
Enumeration<? extends ZipEntry> entries = Zip.entries();
while (entries.hasMoreElements())
{
ZipEntry ZipE = entries.nextElement();
String FileName = ZipE.getName();
boolean accept = pattern.matcher(FileName).matches();
if(accept)
retval.add(FileName);
}
try
{
Zip.close();
}
catch(IOException Ex)
{
throw new Error(Ex);
}
return retval;
}
private static Collection<String> getResourcesFromDirectory(File directory, Pattern pattern)
{
ArrayList<String> retval = new ArrayList<String>();
File[] FileList = directory.listFiles();
for (File file : FileList)
{
if (file.isDirectory())
{
retval.addAll(getResourcesFromDirectory(file, pattern));
}
else try
{
String fileName = file.getCanonicalPath().replace('\\', '/');
boolean accept = pattern.matcher(fileName).matches();
if (accept) retval.add(fileName);
}
catch(final IOException e)
{
throw new Error(e);
}
}
return retval;
}
}

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
public class Reference {

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;

View file

@ -1,4 +1,4 @@
package MysticWorld;
package MysticWorld.Util;
import java.util.EnumSet;
import java.util.List;

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());
}