diff options
Diffstat (limited to 'common/darkknight')
18 files changed, 618 insertions, 0 deletions
diff --git a/common/darkknight/jewelrycraft/CommonProxy.java b/common/darkknight/jewelrycraft/CommonProxy.java new file mode 100644 index 0000000..28ca770 --- /dev/null +++ b/common/darkknight/jewelrycraft/CommonProxy.java @@ -0,0 +1,24 @@ +package darkknight.jewelrycraft; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import cpw.mods.fml.common.network.IGuiHandler; + +public class CommonProxy implements IGuiHandler +{ + + @Override + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) + { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/common/darkknight/jewelrycraft/JewelrycraftMod.java b/common/darkknight/jewelrycraft/JewelrycraftMod.java new file mode 100644 index 0000000..d7a2939 --- /dev/null +++ b/common/darkknight/jewelrycraft/JewelrycraftMod.java @@ -0,0 +1,122 @@ +package darkknight.jewelrycraft; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.network.INetworkManager; +import net.minecraft.network.NetLoginHandler; +import net.minecraft.network.packet.NetHandler; +import net.minecraft.network.packet.Packet1Login; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.oredict.OreDictionary; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.Mod.EventHandler; +import cpw.mods.fml.common.Mod.Instance; +import cpw.mods.fml.common.Mod.Metadata; +import cpw.mods.fml.common.ModMetadata; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.network.IConnectionHandler; +import cpw.mods.fml.common.network.NetworkMod; +import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; +import cpw.mods.fml.common.network.Player; +import cpw.mods.fml.common.registry.GameRegistry; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.client.JewelryCraftClient; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.item.ItemList; +import darkknight.jewelrycraft.lib.Reference; +import darkknight.jewelrycraft.recipes.CraftingRecipes; +import darkknight.jewelrycraft.server.JewelryCraftServer; +import darkknight.jewelrycraft.worldGen.Generation; + +@Mod(modid = Reference.MODID, name = Reference.MODNAME, version = Reference.VERSION) +@NetworkMod(clientSideRequired = false, serverSideRequired = false, + clientPacketHandlerSpec = @SidedPacketHandler(channels = { Reference.PACKET_CHANNEL }, packetHandler = JewelryCraftClient.class), + serverPacketHandlerSpec = @SidedPacketHandler(channels = { Reference.PACKET_CHANNEL }, packetHandler = JewelryCraftServer.class), + connectionHandler = JewelrycraftMod.class) +public class JewelrycraftMod implements IConnectionHandler +{ + @Instance(Reference.MODID) + public static JewelrycraftMod instance; + + @Metadata(Reference.MODID) + public static ModMetadata metadata; + + @SidedProxy(clientSide = "darkknight.jewelrycraft.client.ClientProxy", serverSide = "darkknight.jewelrycraft.CommonProxy") + public static CommonProxy proxy; + + public static CreativeTabs jewelrycraft = new CreativeTabs("JewelryCraft") + { + @Override + public ItemStack getIconItemStack() + { + return new ItemStack(ItemList.shadowIngot, 1, 0); + } + }; + + @EventHandler + public void preInit(FMLPreInitializationEvent e) + { + ConfigHandler.preInit(e); + ItemList.preInit(e); + BlockList.preInit(e); + CraftingRecipes.preInit(e); + } + + @EventHandler + public void init(FMLInitializationEvent e) + { + OreDictionary.registerOre("ingotShadow", new ItemStack(ItemList.shadowIngot)); + GameRegistry.registerWorldGenerator(new Generation()); + } + + @EventHandler + public void postInit(FMLPostInitializationEvent e) + { + + } + + @Override + // 2) Called when a player logs into the server SERVER SIDE + public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) + { + + } + + @Override + // If you don't want the connection to continue, return a non-empty string here SERVER SIDE + public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) + { + return null; + } + + @Override + // 1) Fired when a remote connection is opened CLIENT SIDE + public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) + { + + } + + @Override + // 1) Fired when a local connection is opened CLIENT SIDE + public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager) + { + + } + + @Override + // Fired when a connection closes ALL SIDES + public void connectionClosed(INetworkManager manager) + { + + } + + @Override + // 3) Fired when the client established the connection to the server CLIENT SIDE + public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) + { + + } +} diff --git a/common/darkknight/jewelrycraft/block/BlockBase.java b/common/darkknight/jewelrycraft/block/BlockBase.java new file mode 100644 index 0000000..0378fb5 --- /dev/null +++ b/common/darkknight/jewelrycraft/block/BlockBase.java @@ -0,0 +1,19 @@ +package darkknight.jewelrycraft.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; + +public class BlockBase extends Block +{ + public BlockBase(int par1, Material mat) + { + super(par1, mat); + } + + @Override + public Block setUnlocalizedName(String name) + { + Block r = super.setUnlocalizedName(name); + return r.setTextureName(name.replaceAll("\\.", ":")); + } +} diff --git a/common/darkknight/jewelrycraft/block/BlockList.java b/common/darkknight/jewelrycraft/block/BlockList.java new file mode 100644 index 0000000..18bdb5b --- /dev/null +++ b/common/darkknight/jewelrycraft/block/BlockList.java @@ -0,0 +1,37 @@ +package darkknight.jewelrycraft.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.config.ConfigHandler; +import darkknight.jewelrycraft.tileentity.TileEntitySmelter; + +public class BlockList +{ + public static Block shadowOre; + public static Block smelter; + public static Block molder; + public static Block jewelCraftingTable; + + private static boolean isInitialized = false; + + public static void preInit(FMLPreInitializationEvent e) + { + if (!isInitialized) + { + shadowOre = new BlockBase(ConfigHandler.idShadowOre, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("jewelrycraft.oreShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); + smelter = new BlockSmelter(ConfigHandler.idSmelter, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("jewelrycraft.smelter").setCreativeTab(JewelrycraftMod.jewelrycraft); + molder = new BlockMolder(ConfigHandler.idMolder, Material.iron).setHardness(5.0F).setResistance(6.0F).setStepSound(Block.soundMetalFootstep).setUnlocalizedName("jewelrycraft.molder").setCreativeTab(JewelrycraftMod.jewelrycraft); + jewelCraftingTable = new BlockBase(ConfigHandler.idJewelCraftingTable, Material.rock).setHardness(3.0F).setResistance(5.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("jewelrycraft.jewelCraftingTable").setCreativeTab(JewelrycraftMod.jewelrycraft); + + GameRegistry.registerBlock(shadowOre, "shadowOre"); + GameRegistry.registerBlock(smelter, "Smelter"); + GameRegistry.registerBlock(molder, "Molder"); + GameRegistry.registerBlock(jewelCraftingTable, "jewelCraftingTable"); + + GameRegistry.registerTileEntity(TileEntitySmelter.class, "30"); + } + } +} diff --git a/common/darkknight/jewelrycraft/block/BlockMolder.java b/common/darkknight/jewelrycraft/block/BlockMolder.java new file mode 100644 index 0000000..05b7b0a --- /dev/null +++ b/common/darkknight/jewelrycraft/block/BlockMolder.java @@ -0,0 +1,27 @@ +package darkknight.jewelrycraft.block; + +import darkknight.jewelrycraft.tileentity.TileEntityMolder; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockMolder extends BlockContainer +{ + protected BlockMolder(int par1, Material par2Material) + { + super(par1, par2Material); + } + + @Override + public TileEntity createNewTileEntity(World world) + { + return new TileEntityMolder(); + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } +} diff --git a/common/darkknight/jewelrycraft/block/BlockSmelter.java b/common/darkknight/jewelrycraft/block/BlockSmelter.java new file mode 100644 index 0000000..2be6743 --- /dev/null +++ b/common/darkknight/jewelrycraft/block/BlockSmelter.java @@ -0,0 +1,60 @@ +package darkknight.jewelrycraft.block; + +import darkknight.jewelrycraft.tileentity.TileEntitySmelter; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockSmelter extends BlockContainer +{ + protected BlockSmelter(int par1, Material par2Material) + { + super(par1, par2Material); + } + + @Override + public TileEntity createNewTileEntity(World world) + { + return new TileEntitySmelter(); + } + + @Override + public boolean renderAsNormalBlock() + { + return false; + } + + @Override + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) + { + TileEntitySmelter te = (TileEntitySmelter) world.getBlockTileEntity(i, j, k); + ItemStack item = entityPlayer.inventory.getCurrentItem(); + if (te != null && !world.isRemote) + { + if (!te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot")) + { + te.metalID = item.getItem().itemID; + te.hasMetal = true; + te.melting = 200000; + --item.stackSize; + } + else if (te.hasMetal && !te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot")) + entityPlayer.addChatMessage("The Smelter already contains a " + new ItemStack(te.metalID, 1, 0).getDisplayName()); + else if (te.hasMoltenMetal && item != null && item.getDisplayName().contains("Ingot")) + entityPlayer.addChatMessage("The Smelter contains molten " + new ItemStack(te.moltenMetalID, 1, 0).getDisplayName().toLowerCase().replace("ingot", "")); + else if (item != null && !item.getDisplayName().contains("Ingot")) + entityPlayer.addChatMessage("The item needs to be an ingot!"); + + if (te.hasMetal && entityPlayer.isSneaking()) + { + entityPlayer.dropPlayerItem(new ItemStack(te.metalID, 1, 0)); + te.hasMetal = false; + } + world.setBlockTileEntity(i, j, k, te); + } + return true; + } +} diff --git a/common/darkknight/jewelrycraft/client/ClientProxy.java b/common/darkknight/jewelrycraft/client/ClientProxy.java new file mode 100644 index 0000000..e280402 --- /dev/null +++ b/common/darkknight/jewelrycraft/client/ClientProxy.java @@ -0,0 +1,8 @@ +package darkknight.jewelrycraft.client; + +import darkknight.jewelrycraft.CommonProxy; + +public class ClientProxy extends CommonProxy +{ + +} diff --git a/common/darkknight/jewelrycraft/client/JewelryCraftClient.java b/common/darkknight/jewelrycraft/client/JewelryCraftClient.java new file mode 100644 index 0000000..734e9d5 --- /dev/null +++ b/common/darkknight/jewelrycraft/client/JewelryCraftClient.java @@ -0,0 +1,16 @@ +package darkknight.jewelrycraft.client; + +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet250CustomPayload; +import cpw.mods.fml.common.network.IPacketHandler; +import cpw.mods.fml.common.network.Player; + +public class JewelryCraftClient implements IPacketHandler +{ + @Override + public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) + { + // TODO Auto-generated method stub + + } +} diff --git a/common/darkknight/jewelrycraft/config/ConfigHandler.java b/common/darkknight/jewelrycraft/config/ConfigHandler.java new file mode 100644 index 0000000..e90a69b --- /dev/null +++ b/common/darkknight/jewelrycraft/config/ConfigHandler.java @@ -0,0 +1,39 @@ +package darkknight.jewelrycraft.config; + +import net.minecraftforge.common.Configuration; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class ConfigHandler +{ + private static Configuration config; + public static int idThiefGloves = 17493; + public static int idShadowIngot = 17497; + + public static int idShadowOre = 1750; + public static int idSmelter = 1751; + public static int idMolder = 1752; + public static int idJewelCraftingTable = 1753; + + private static boolean isInitialized = false; + + public static void preInit(FMLPreInitializationEvent e) + { + if (!isInitialized) + { + config = new Configuration(e.getSuggestedConfigurationFile()); + + config.load(); + + idThiefGloves = config.getItem("id.ThiefGloves", idThiefGloves).getInt(); + idShadowIngot = config.getItem("id.ShadowIngot", idShadowIngot).getInt(); + idShadowOre = config.getBlock("id.ShadowOre", idShadowOre).getInt(); + idSmelter = config.getBlock("id.Smelter", idSmelter).getInt(); + idMolder = config.getBlock("id.Molder", idMolder).getInt(); + idJewelCraftingTable = config.getBlock("id.JewelCraftingTable", idJewelCraftingTable).getInt(); + + config.save(); + + isInitialized = true; + } + } +} diff --git a/common/darkknight/jewelrycraft/item/ItemBase.java b/common/darkknight/jewelrycraft/item/ItemBase.java new file mode 100644 index 0000000..7f806bf --- /dev/null +++ b/common/darkknight/jewelrycraft/item/ItemBase.java @@ -0,0 +1,18 @@ +package darkknight.jewelrycraft.item; + +import net.minecraft.item.Item; + +public class ItemBase extends Item +{ + public ItemBase(int par1) + { + super(par1); + } + + @Override + public Item setUnlocalizedName(String name) + { + Item r = super.setUnlocalizedName(name); + return r.setTextureName(name.replaceAll("\\.", ":")); + } +} diff --git a/common/darkknight/jewelrycraft/item/ItemList.java b/common/darkknight/jewelrycraft/item/ItemList.java new file mode 100644 index 0000000..7bf3705 --- /dev/null +++ b/common/darkknight/jewelrycraft/item/ItemList.java @@ -0,0 +1,24 @@ +package darkknight.jewelrycraft.item; + +import net.minecraft.item.Item; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.config.ConfigHandler; + +public class ItemList +{ + public static Item thiefGloves; + public static Item shadowIngot; + + private static boolean isInitialized = false; + + public static void preInit(FMLPreInitializationEvent e) + { + if (!isInitialized) + { + thiefGloves = new ItemThiefGloves(ConfigHandler.idThiefGloves).setUnlocalizedName("jewelrycraft.thiefGloves").setCreativeTab(JewelrycraftMod.jewelrycraft); + shadowIngot = new ItemBase(ConfigHandler.idShadowIngot).setUnlocalizedName("jewelrycraft.ingotShadow").setCreativeTab(JewelrycraftMod.jewelrycraft); + + } + } +} diff --git a/common/darkknight/jewelrycraft/item/ItemThiefGloves.java b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java new file mode 100644 index 0000000..97d83cd --- /dev/null +++ b/common/darkknight/jewelrycraft/item/ItemThiefGloves.java @@ -0,0 +1,64 @@ +package darkknight.jewelrycraft.item; + +import java.util.Iterator; +import java.util.Random; + +import cpw.mods.fml.relauncher.ReflectionHelper; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; + +public class ItemThiefGloves extends ItemBase +{ + public Random rand; + public ItemThiefGloves(int par1) + { + super(par1); + this.setCreativeTab(CreativeTabs.tabTools); + } + + @Override + public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase) + { + if (par3EntityLivingBase instanceof EntityVillager) + { + EntityVillager villager = (EntityVillager) par3EntityLivingBase; + int wealth = (Integer) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "wealth", "field_70956_bz"); + MerchantRecipeList buyingList = (MerchantRecipeList) ReflectionHelper.getPrivateValue(EntityVillager.class, villager, "buyingList", "field_70963_i"); + if(buyingList!=null) + { + Iterator<?> iterator = buyingList.iterator(); + while(iterator.hasNext()) + { + MerchantRecipe recipe = (MerchantRecipe)iterator.next(); + int quantity; + if(recipe.getItemToSell().isStackable()) quantity = recipe.getItemToSell().stackSize * 7; + else quantity = 1; + ItemStack s = new ItemStack(recipe.getItemToSell().itemID, quantity, recipe.getItemToSell().getItemDamage()); + s.setTagCompound(recipe.getItemToSell().getTagCompound()); + if(par2EntityPlayer.inventory.addItemStackToInventory(s)); + else villager.entityDropItem(s, 0); + par2EntityPlayer.addChatMessage("Villager #" + villager.getProfession() + ": Hmmm... I seem to have lost my " + s.getDisplayName() + "!"); + } + buyingList.clear(); + ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 300, "timeUntilReset", "field_70961_j"); + ReflectionHelper.setPrivateValue(EntityVillager.class, villager, true, "needsInitilization", "field_70959_by"); + } + + villager.dropItem(Item.emerald.itemID, wealth); + ReflectionHelper.setPrivateValue(EntityVillager.class, villager, 0, "wealth", "field_70956_bz"); + return true; + } + else + { + return super.itemInteractionForEntity(par1ItemStack, par2EntityPlayer, par3EntityLivingBase); + } + } + +} diff --git a/common/darkknight/jewelrycraft/lib/Reference.java b/common/darkknight/jewelrycraft/lib/Reference.java new file mode 100644 index 0000000..4514e5c --- /dev/null +++ b/common/darkknight/jewelrycraft/lib/Reference.java @@ -0,0 +1,9 @@ +package darkknight.jewelrycraft.lib; + +public class Reference +{ + public static final String MODID = "Jewelrycraft"; + public static final String MODNAME = "Jewelrycraft"; + public static final String VERSION = "1.0.0"; + public static final String PACKET_CHANNEL = "Jewelrycraft"; +} diff --git a/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java new file mode 100644 index 0000000..57d28fa --- /dev/null +++ b/common/darkknight/jewelrycraft/recipes/CraftingRecipes.java @@ -0,0 +1,22 @@ +package darkknight.jewelrycraft.recipes; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.item.ItemList; + +public class CraftingRecipes +{ + private static boolean isInitialized = false; + + public static void preInit(FMLPreInitializationEvent e) + { + if (!isInitialized) + { + GameRegistry.addRecipe(new ItemStack(ItemList.thiefGloves), "x x", "yxy", "yxy", 'x', ItemList.shadowIngot, 'y', new ItemStack(Block.cloth, 1, 15)); + GameRegistry.addSmelting(BlockList.shadowOre.blockID, new ItemStack(ItemList.shadowIngot), 1.5f); + } + } +} diff --git a/common/darkknight/jewelrycraft/server/JewelryCraftServer.java b/common/darkknight/jewelrycraft/server/JewelryCraftServer.java new file mode 100644 index 0000000..061175c --- /dev/null +++ b/common/darkknight/jewelrycraft/server/JewelryCraftServer.java @@ -0,0 +1,16 @@ +package darkknight.jewelrycraft.server; + +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet250CustomPayload; +import cpw.mods.fml.common.network.IPacketHandler; +import cpw.mods.fml.common.network.Player; + +public class JewelryCraftServer implements IPacketHandler +{ + @Override + public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) + { + // TODO Auto-generated method stub + + } +} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java new file mode 100644 index 0000000..fbf7203 --- /dev/null +++ b/common/darkknight/jewelrycraft/tileentity/TileEntityMolder.java @@ -0,0 +1,8 @@ +package darkknight.jewelrycraft.tileentity; + +import net.minecraft.tileentity.TileEntity; + +public class TileEntityMolder extends TileEntity +{ + +} diff --git a/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java new file mode 100644 index 0000000..1a9ce66 --- /dev/null +++ b/common/darkknight/jewelrycraft/tileentity/TileEntitySmelter.java @@ -0,0 +1,60 @@ +package darkknight.jewelrycraft.tileentity; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; + +public class TileEntitySmelter extends TileEntity +{ + public int moltenMetalID, metalID, melting; + public boolean hasMetal, hasMoltenMetal; + + public TileEntitySmelter() + { + this.moltenMetalID = 0; + this.metalID = 0; + this.melting = 0; + this.hasMetal = false; + this.hasMoltenMetal= false; + } + + @Override + public void writeToNBT(NBTTagCompound par1) + { + super.writeToNBT(par1); + par1.setInteger("moltenMetalID", moltenMetalID); + par1.setInteger("metalID", metalID); + par1.setInteger("melting", melting); + par1.setBoolean("hasMetal", hasMetal); + par1.setBoolean("hasMoltenMetal", hasMoltenMetal); + } + + @Override + public void readFromNBT(NBTTagCompound par1) + { + super.readFromNBT(par1); + this.moltenMetalID = par1.getInteger("moltenMetalID"); + this.metalID = par1.getInteger("metalID"); + this.melting = par1.getInteger("melting"); + this.hasMetal = par1.getBoolean("hasMetal"); + this.hasMoltenMetal = par1.getBoolean("hasMoltenMetal"); + } + + public void updateEntity() + { + super.updateEntity(); + if(this.hasMetal) + { + while(melting > 0){ + this.melting--; + System.out.println(melting); + } + if(melting == 0) + { + this.hasMetal = false; + this.moltenMetalID = metalID; + this.metalID = 0; + this.hasMoltenMetal = true; + } + } + } +} diff --git a/common/darkknight/jewelrycraft/worldGen/Generation.java b/common/darkknight/jewelrycraft/worldGen/Generation.java new file mode 100644 index 0000000..341b91e --- /dev/null +++ b/common/darkknight/jewelrycraft/worldGen/Generation.java @@ -0,0 +1,45 @@ +package darkknight.jewelrycraft.worldGen; + +import java.util.Random; + + +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.feature.WorldGenMinable; +import cpw.mods.fml.common.IWorldGenerator; +import darkknight.jewelrycraft.block.BlockList; + +public class Generation implements IWorldGenerator +{ + + @Override + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) + { + switch(world.provider.dimensionId){ + case -1: + generateNether(world, random, chunkX * 16, chunkZ * 16); + break; + case 0: + generateSurface(world, random, chunkX * 16, chunkZ * 16); + break; + case 1: + generateEnd(world, random, chunkX * 16, chunkZ * 16); + break; + } + } + + private void generateEnd(World world, Random random, int i, int j) {} + + private void generateSurface(World world, Random random, int i, int j) + { + for(int k = 0; k < 1; k++) { + int x = i + random.nextInt(16); + int y = random.nextInt(5); + int z = j + random.nextInt(16); + (new WorldGenMinable(BlockList.shadowOre.blockID, 1)).generate(world, random, x, y, z); + } + } + + private void generateNether(World world, Random random, int i, int j) {} + +} |
