New Localization System Implemented :D
This commit is contained in:
parent
7816fb82b8
commit
3363c4561f
41 changed files with 468 additions and 428 deletions
39
common/MysticWorld/Util/CommonProxy.java
Normal file
39
common/MysticWorld/Util/CommonProxy.java
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.src.ModLoader;
|
||||
import net.minecraft.world.World;
|
||||
import MysticWorld.Client.FX.PowerAirFX;
|
||||
import MysticWorld.Client.FX.LightCubeFX;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void registerRenderIDs(){
|
||||
}
|
||||
|
||||
public void registerRenders(){
|
||||
}
|
||||
|
||||
public int addArmor(String armor){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void airFeetFX(World worldObj, double x, double y, double z, float scale, int age){
|
||||
}
|
||||
|
||||
public void earthFX(World worldObj, double x, double y, double z, float scale){
|
||||
}
|
||||
|
||||
public void energyFX(World worldObj, double x, double y, double z, float scale){
|
||||
}
|
||||
|
||||
public void fireFX(World worldObj, double x, double y, double z, float scale){
|
||||
}
|
||||
|
||||
public void waterFX(World worldObj, double x, double y, double z, float scale){
|
||||
}
|
||||
|
||||
public void lightCubeFX(World worldObj, double x, double y, double z, double motionX, double motionY, double motionZ, float scale){
|
||||
}
|
||||
|
||||
}
|
||||
88
common/MysticWorld/Util/Config.java
Normal file
88
common/MysticWorld/Util/Config.java
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import MysticWorld.Lib.BlockIds;
|
||||
import MysticWorld.Lib.EntityIds;
|
||||
import MysticWorld.Lib.ItemIds;
|
||||
import MysticWorld.Lib.Strings;
|
||||
import MysticWorld.Lib.Booleans;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
|
||||
public class Config
|
||||
{
|
||||
public static Configuration config;
|
||||
|
||||
public static void initialize(File file)
|
||||
{
|
||||
config = new Configuration(file);
|
||||
|
||||
//Boolean Configurations
|
||||
Booleans.ENABLE_BUSH_GEN = config.get("World Generation", "Enable Bush Generation", true).getBoolean(Booleans.ENABLE_BUSH_GEN);
|
||||
Booleans.ENABLE_GLACIER_GEN = config.get("World Generation", "Enable Glacier Biome", true).getBoolean(Booleans.ENABLE_GLACIER_GEN);
|
||||
Booleans.ENABLE_JUNGLE_REWRITE = config.get("World Generation", "Enable Vanilla Jungle Biome Modification", true).getBoolean(Booleans.ENABLE_JUNGLE_REWRITE);
|
||||
Booleans.ENABLE_MOUNTAIN_GEN = config.get("World Generation", "Enable Mountain Biome", true).getBoolean(Booleans.ENABLE_MOUNTAIN_GEN);
|
||||
Booleans.ENABLE_STEPPE_GEN = config.get("World Generation", "Enable Steppe Biome", true).getBoolean(Booleans.ENABLE_STEPPE_GEN);
|
||||
Booleans.ENABLE_TUNDRA_GEN = config.get("World Generation", "Enable Tundra Biome", true).getBoolean(Booleans.ENABLE_TUNDRA_GEN);
|
||||
|
||||
//Block Configuration
|
||||
BlockIds.ORE_STONE_1 = config.getBlock(Strings.IMBUED_STONE_NAME, BlockIds.ORE_STONE_1_DEFAULT).getInt(BlockIds.ORE_STONE_1);
|
||||
BlockIds.BUSH = config.getBlock(Strings.BUSH_NAME, BlockIds.BUSH_DEFAULT).getInt(BlockIds.BUSH_DEFAULT);
|
||||
BlockIds.LIGHT_CUBE = config.getBlock(Strings.LIGHT_CUBE_NAME, BlockIds.LIGHT_CUBE_DEFAULT).getInt(BlockIds.LIGHT_CUBE_DEFAULT);
|
||||
|
||||
BlockIds.PLATFORM = config.getBlock(Strings.PLATFORM_NAME, BlockIds.PLATFORM_DEFAULT).getInt(BlockIds.PLATFORM_DEFAULT);
|
||||
BlockIds.PILLAR = config.getBlock(Strings.PILLAR_NAME, BlockIds.PILLAR_DEFAULT).getInt(BlockIds.PILLAR_DEFAULT);
|
||||
BlockIds.PILLAR_INSERT = config.getBlock(Strings.PILLAR_INSERT_NAME, BlockIds.PILLAR_INSERT_DEFAULT).getInt(BlockIds.PILLAR_INSERT_DEFAULT);
|
||||
|
||||
|
||||
//Item Configuration
|
||||
ItemIds.IMBUED_SHARD = config.getItem(Strings.IMBUED_SHARD_NAME, ItemIds.IMBUED_SHARD_DEFAULT).getInt(ItemIds.IMBUED_SHARD_DEFAULT);
|
||||
ItemIds.STAFF_PARTS = config.getItem(Strings.STAFF_NAME, ItemIds.STAFF_PARTS_DEFAULT).getInt(ItemIds.STAFF_PARTS_DEFAULT);
|
||||
|
||||
ItemIds.FIRE_STAFF = config.getItem(Strings.FIRE_STAFF_NAME, ItemIds.FIRE_STAFF_DEFAULT).getInt(ItemIds.FIRE_STAFF_DEFAULT);
|
||||
ItemIds.WATER_STAFF = config.getItem(Strings.WATER_STAFF_NAME, ItemIds.WATER_STAFF_DEFAULT).getInt(ItemIds.WATER_STAFF_DEFAULT);
|
||||
ItemIds.EARTH_STAFF = config.getItem(Strings.EARTH_STAFF_NAME, ItemIds.EARTH_STAFF_DEFAULT).getInt(ItemIds.EARTH_STAFF_DEFAULT);
|
||||
ItemIds.AIR_STAFF = config.getItem(Strings.AIR_STAFF_NAME, ItemIds.AIR_STAFF_DEFAULT).getInt(ItemIds.AIR_STAFF_DEFAULT);
|
||||
ItemIds.ENERGY_STAFF = config.getItem(Strings.ENERGY_STAFF_NAME, ItemIds.ENERGY_STAFF_DEFAULT).getInt(ItemIds.ENERGY_STAFF_DEFAULT);
|
||||
|
||||
ItemIds.STAFF_POWER = config.getItem(Strings.POWER_STAFF_NAME, ItemIds.STAFF_POWER_DEFAULT).getInt(ItemIds.STAFF_POWER_DEFAULT);
|
||||
|
||||
ItemIds.BUSH_FRUIT = config.getItem(Strings.BUSH_FRUIT_NAME, ItemIds.BUSH_FRUIT_DEFAULT).getInt(ItemIds.BUSH_FRUIT_DEFAULT);
|
||||
|
||||
ItemIds.VERDITE_HELMET = config.getItem(Strings.VERDITE_HELMET_NAME, ItemIds.VERDITE_HELMET_DEFAULT).getInt(ItemIds.VERDITE_HELMET_DEFAULT);
|
||||
ItemIds.VERDITE_CHESTPLATE = config.getItem(Strings.VERDITE_CHESTPLATE_NAME, ItemIds.VERDITE_CHESTPLATE_DEFAULT).getInt(ItemIds.VERDITE_CHESTPLATE_DEFAULT);
|
||||
ItemIds.VERDITE_LEGGINGS = config.getItem(Strings.VERDITE_LEGGINGS_NAME, ItemIds.VERDITE_LEGGINGS_DEFAULT).getInt(ItemIds.VERDITE_LEGGINGS_DEFAULT);
|
||||
ItemIds.VERDITE_BOOTS = config.getItem(Strings.VERDITE_BOOTS_NAME, ItemIds.VERDITE_BOOTS_DEFAULT).getInt(ItemIds.VERDITE_BOOTS_DEFAULT);
|
||||
|
||||
ItemIds.MITHRIL_HELMET = config.getItem(Strings.MITHRIL_HELMET_NAME, ItemIds.MITHRIL_HELMET_DEFAULT).getInt(ItemIds.MITHRIL_HELMET_DEFAULT);
|
||||
ItemIds.MITHRIL_CHESTPLATE = config.getItem(Strings.MITHRIL_CHESTPLATE_NAME, ItemIds.MITHRIL_CHESTPLATE_DEFAULT).getInt(ItemIds.MITHRIL_CHESTPLATE_DEFAULT);
|
||||
ItemIds.MITHRIL_LEGGINGS = config.getItem(Strings.MITHRIL_LEGGINGS_NAME, ItemIds.MITHRIL_LEGGINGS_DEFAULT).getInt(ItemIds.MITHRIL_LEGGINGS_DEFAULT);
|
||||
ItemIds.MITHRIL_BOOTS = config.getItem(Strings.MITHRIL_BOOTS_NAME, ItemIds.MITHRIL_BOOTS_DEFAULT).getInt(ItemIds.MITHRIL_BOOTS_DEFAULT);
|
||||
|
||||
ItemIds.ADAMANTINE_HELMET = config.getItem(Strings.ADAMANTINE_HELMET_NAME, ItemIds.ADAMANTINE_HELMET_DEFAULT).getInt(ItemIds.ADAMANTINE_HELMET_DEFAULT);
|
||||
ItemIds.ADAMANTINE_CHESTPLATE = config.getItem(Strings.ADAMANTINE_CHESTPLATE_NAME, ItemIds.ADAMANTINE_CHESTPLATE_DEFAULT).getInt(ItemIds.ADAMANTINE_CHESTPLATE_DEFAULT);
|
||||
ItemIds.ADAMANTINE_LEGGINGS = config.getItem(Strings.ADAMANTINE_LEGGINGS_NAME, ItemIds.ADAMANTINE_LEGGINGS_DEFAULT).getInt(ItemIds.ADAMANTINE_LEGGINGS_DEFAULT);
|
||||
ItemIds.ADAMANTINE_BOOTS = config.getItem(Strings.ADAMANTINE_BOOTS_NAME, ItemIds.ADAMANTINE_BOOTS_DEFAULT).getInt(ItemIds.ADAMANTINE_BOOTS_DEFAULT);
|
||||
|
||||
ItemIds.IRIDIUM_HELMET = config.getItem(Strings.IRIDIUM_HELMET_NAME, ItemIds.IRIDIUM_HELMET_DEFAULT).getInt(ItemIds.IRIDIUM_HELMET_DEFAULT);
|
||||
ItemIds.IRIDIUM_CHESTPLATE = config.getItem(Strings.IRIDIUM_CHESTPLATE_NAME, ItemIds.IRIDIUM_CHESTPLATE_DEFAULT).getInt(ItemIds.IRIDIUM_CHESTPLATE_DEFAULT);
|
||||
ItemIds.IRIDIUM_LEGGINGS = config.getItem(Strings.IRIDIUM_LEGGINGS_NAME, ItemIds.IRIDIUM_LEGGINGS_DEFAULT).getInt(ItemIds.IRIDIUM_LEGGINGS_DEFAULT);
|
||||
ItemIds.IRIDIUM_BOOTS = config.getItem(Strings.IRIDIUM_BOOTS_NAME, ItemIds.IRIDIUM_BOOTS_DEFAULT).getInt(ItemIds.IRIDIUM_BOOTS_DEFAULT);
|
||||
|
||||
ItemIds.FIRE_ORB = config.getItem(Strings.FIRE_ORB_NAME, ItemIds.FIRE_ORB_DEFAULT).getInt(ItemIds.FIRE_ORB_DEFAULT);
|
||||
ItemIds.WATER_ORB = config.getItem(Strings.WATER_ORB_NAME, ItemIds.WATER_ORB_DEFAULT).getInt(ItemIds.WATER_ORB_DEFAULT);
|
||||
ItemIds.EARTH_ORB = config.getItem(Strings.EARTH_ORB_NAME, ItemIds.EARTH_ORB_DEFAULT).getInt(ItemIds.EARTH_ORB_DEFAULT);
|
||||
ItemIds.AIR_ORB = config.getItem(Strings.AIR_ORB_NAME, ItemIds.AIR_ORB_DEFAULT).getInt(ItemIds.AIR_ORB_DEFAULT);
|
||||
ItemIds.ENERGY_ORB = config.getItem(Strings.ENERGY_ORB_NAME, ItemIds.ENERGY_ORB_DEFAULT).getInt(ItemIds.ENERGY_ORB_DEFAULT);
|
||||
|
||||
ItemIds.VOID_SHARD = config.getItem(Strings.VOID_SHARD_NAME, ItemIds.VOID_SHARD_DEFAULT).getInt(ItemIds.VOID_SHARD_DEFAULT);
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
public static void save()
|
||||
{
|
||||
config.save();
|
||||
}
|
||||
}
|
||||
112
common/MysticWorld/Util/Localizations.java
Normal file
112
common/MysticWorld/Util/Localizations.java
Normal 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;
|
||||
}
|
||||
}
|
||||
116
common/MysticWorld/Util/RecipeHandler.java
Normal file
116
common/MysticWorld/Util/RecipeHandler.java
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import MysticOres.Items.Items;
|
||||
import MysticWorld.Blocks.BlockHandler;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class RecipeHandler {
|
||||
|
||||
public static void init(){
|
||||
itemRecipes();
|
||||
itemSmelting();
|
||||
}
|
||||
|
||||
private static void itemRecipes(){
|
||||
|
||||
//Staff Hilt Recipe
|
||||
GameRegistry.addRecipe(new ItemStack(ItemHandler$1.staffParts, 1, 1), new Object[] {
|
||||
" # ", "#$#", " # ", '#', Item.ingotGold, '$', Item.diamond
|
||||
});
|
||||
|
||||
//Staff Handle Recipe
|
||||
GameRegistry.addRecipe(new ItemStack(ItemHandler$1.staffParts, 1, 2), new Object[] {
|
||||
"#", "$", "S", '#', Item.goldNugget, '$', Item.stick, 'S', Item.dyePowder
|
||||
});
|
||||
|
||||
//Staff Topper Recipe
|
||||
GameRegistry.addRecipe(new ItemStack(ItemHandler$1.staffParts, 1, 3), new Object[] {
|
||||
" # ", "#$#", " # ", '#', Item.ingotGold, '$', Item.netherStar
|
||||
});
|
||||
|
||||
//Staff Recipe
|
||||
GameRegistry.addRecipe(new ItemStack(ItemHandler$1.staffParts, 1, 0), new Object[] {
|
||||
" #", " X ", "Y ", '#', new ItemStack(ItemHandler$1.staffParts, 1, 3), 'X', new ItemStack(ItemHandler$1.staffParts, 1, 2), 'Y', new ItemStack(ItemHandler$1.staffParts, 1, 1)
|
||||
});
|
||||
|
||||
//Orb Recipes
|
||||
orbRecipe(ItemHandler$1.fireOrb, new ItemStack(ItemHandler$1.imbuedShard, 1, 0));
|
||||
orbRecipe(ItemHandler$1.waterOrb, new ItemStack(ItemHandler$1.imbuedShard, 1, 1));
|
||||
orbRecipe(ItemHandler$1.earthOrb, new ItemStack(ItemHandler$1.imbuedShard, 1, 2));
|
||||
orbRecipe(ItemHandler$1.airOrb, new ItemStack(ItemHandler$1.imbuedShard, 1, 3));
|
||||
orbRecipe(ItemHandler$1.energyOrb, new ItemStack(ItemHandler$1.imbuedShard, 1, 4));
|
||||
|
||||
//Staff Recipes
|
||||
staffRecipe(ItemHandler$1.fireStaff, new ItemStack(ItemHandler$1.fireOrb));
|
||||
staffRecipe(ItemHandler$1.waterStaff, new ItemStack(ItemHandler$1.waterOrb));
|
||||
staffRecipe(ItemHandler$1.earthStaff, new ItemStack(ItemHandler$1.earthOrb));
|
||||
staffRecipe(ItemHandler$1.airStaff, new ItemStack(ItemHandler$1.airOrb));
|
||||
staffRecipe(ItemHandler$1.energyStaff, new ItemStack(ItemHandler$1.energyOrb));
|
||||
|
||||
//Verdite Armor
|
||||
helmetRecipe(ItemHandler$1.verditeHelmet, new ItemStack(Items.Resource, 1, 0));
|
||||
chestplateRecipe(ItemHandler$1.verditeChestplate, new ItemStack(Items.Resource, 1, 0));
|
||||
leggingsRecipe(ItemHandler$1.verditeLeggings, new ItemStack(Items.Resource, 1, 0));
|
||||
bootsRecipe(ItemHandler$1.verditeBoots, new ItemStack(Items.Resource, 1, 0));
|
||||
|
||||
//Mithril Armor
|
||||
helmetRecipe(ItemHandler$1.mithrilHelmet, new ItemStack(Items.Resource, 1, 1));
|
||||
chestplateRecipe(ItemHandler$1.mithrilChestplate, new ItemStack(Items.Resource, 1, 1));
|
||||
leggingsRecipe(ItemHandler$1.mithrilLeggings, new ItemStack(Items.Resource, 1, 1));
|
||||
bootsRecipe(ItemHandler$1.mithrilBoots, new ItemStack(Items.Resource, 1, 1));
|
||||
|
||||
//Adamantine Armor
|
||||
helmetRecipe(ItemHandler$1.adamantineHelmet, new ItemStack(Items.Resource, 1, 2));
|
||||
chestplateRecipe(ItemHandler$1.adamantineChestplate, new ItemStack(Items.Resource, 1, 2));
|
||||
leggingsRecipe(ItemHandler$1.adamantineLeggings, new ItemStack(Items.Resource, 1, 2));
|
||||
bootsRecipe(ItemHandler$1.adamantineBoots, new ItemStack(Items.Resource, 1, 2));
|
||||
|
||||
//Iridium Armor
|
||||
helmetRecipe(ItemHandler$1.iridiumHelmet, new ItemStack(Items.Resource, 1, 3));
|
||||
chestplateRecipe(ItemHandler$1.iridiumChestplate, new ItemStack(Items.Resource, 1, 3));
|
||||
leggingsRecipe(ItemHandler$1.iridiumLeggings, new ItemStack(Items.Resource, 1, 3));
|
||||
bootsRecipe(ItemHandler$1.iridiumBoots, new ItemStack(Items.Resource, 1, 3));
|
||||
}
|
||||
|
||||
private static void itemSmelting(){
|
||||
GameRegistry.addSmelting(ItemHandler$1.imbuedShard.itemID, new ItemStack(ItemHandler$1.voidShard, 1), 0.5f);
|
||||
}
|
||||
|
||||
private static void staffRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(output, 1), input, new ItemStack(ItemHandler$1.staffParts, 1, 0));
|
||||
}
|
||||
|
||||
private static void orbRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
|
||||
"##", "##", '#', input
|
||||
});
|
||||
}
|
||||
|
||||
private static void helmetRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
|
||||
"###", "# #", '#', input
|
||||
});
|
||||
}
|
||||
|
||||
private static void chestplateRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
|
||||
"# #", "###", "###", '#', input
|
||||
});
|
||||
}
|
||||
|
||||
private static void leggingsRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
|
||||
"###", "# #", "# #", '#', input
|
||||
});
|
||||
}
|
||||
|
||||
private static void bootsRecipe(Item output, ItemStack input){
|
||||
GameRegistry.addRecipe(new ItemStack(output, 1), new Object[] {
|
||||
"# #", "# #", '#', input
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
11
common/MysticWorld/Util/Reference.java
Normal file
11
common/MysticWorld/Util/Reference.java
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
public class Reference {
|
||||
|
||||
public static final String MOD_ID = "MysticWorld";
|
||||
public static final String MOD_NAME = "Mystic World";
|
||||
public static final String VERSION_NUMBER = "0.1a";
|
||||
public static final String SERVER_PROXY_CLASS = "MysticWorld.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "MysticWorld.Client.ClientProxy";
|
||||
|
||||
}
|
||||
19
common/MysticWorld/Util/TabMysticWorld.java
Normal file
19
common/MysticWorld/Util/TabMysticWorld.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
|
||||
public class TabMysticWorld extends CreativeTabs {
|
||||
|
||||
public TabMysticWorld(int par1, String par2Str) {
|
||||
super(par1, par2Str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getIconItemStack() {
|
||||
return new ItemStack(ItemHandler$1.earthStaff, 1);
|
||||
}
|
||||
|
||||
}
|
||||
129
common/MysticWorld/Util/TickHandler.java
Normal file
129
common/MysticWorld/Util/TickHandler.java
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
package MysticWorld.Util;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import MysticWorld.Blocks.BlockBush;
|
||||
import MysticWorld.Blocks.BlockHandler;
|
||||
import MysticWorld.Blocks.BlockPlatform;
|
||||
import MysticWorld.Items.ItemHandler$1;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.entity.projectile.EntityPotion;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.IScheduledTickHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
|
||||
public class TickHandler implements IScheduledTickHandler
|
||||
{
|
||||
private EnumSet ticks;
|
||||
|
||||
public static final Enchantment[] enchantmentsPick = { Enchantment.efficiency, Enchantment.fortune, Enchantment.silkTouch, Enchantment.unbreaking };
|
||||
|
||||
public TickHandler(){
|
||||
this.ticks = EnumSet.of(TickType.PLAYER);
|
||||
}
|
||||
|
||||
public void tickStart(EnumSet<TickType> type, Object... tickData){
|
||||
Random rand = new Random();
|
||||
EntityPlayer player = (EntityPlayer)tickData[0];
|
||||
World world = player.worldObj;
|
||||
InventoryPlayer inventory = player.inventory;
|
||||
ItemStack itemstack = inventory.getCurrentItem();
|
||||
|
||||
pillarTick(player, world, inventory, rand);
|
||||
}
|
||||
|
||||
public void tickEnd(EnumSet<TickType> type, Object... tickData){
|
||||
EntityPlayer player = (EntityPlayer)tickData[0];
|
||||
World world = player.worldObj;
|
||||
InventoryPlayer inventory = player.inventory;
|
||||
}
|
||||
|
||||
public EnumSet ticks(){
|
||||
return this.ticks;
|
||||
}
|
||||
|
||||
public String getLabel(){
|
||||
return "mystic world tick";
|
||||
}
|
||||
|
||||
public int nextTickSpacing(){
|
||||
return 20;
|
||||
}
|
||||
|
||||
private static void pillarTick(EntityPlayer player, World world, InventoryPlayer inventory, Random rand)
|
||||
{
|
||||
ItemStack itemStack = inventory.getCurrentItem();
|
||||
|
||||
int blockX = (int)player.posX - 1;
|
||||
int blockY = (int)(player.posY - 0.15D);
|
||||
int blockZ = (int)player.posZ - 1;
|
||||
|
||||
int blockId = world.getBlockId(blockX, blockY, blockZ);
|
||||
int blockMeta = world.getBlockMetadata(blockX, blockY, blockZ);
|
||||
|
||||
if (blockId == BlockHandler.pillarPlatform.blockID)
|
||||
{
|
||||
switch (blockMeta)
|
||||
{
|
||||
//food
|
||||
case 0:
|
||||
int foodLevel = player.getFoodStats().getFoodLevel();
|
||||
player.getFoodStats().setFoodLevel((int)((double)foodLevel + 0.5D));
|
||||
player.getFoodStats().setFoodSaturationLevel(20);
|
||||
break;
|
||||
//regeneration
|
||||
case 1:
|
||||
player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 6000, 4));
|
||||
break;
|
||||
//speed
|
||||
case 2:
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 6000, 4));
|
||||
break;
|
||||
//haste
|
||||
case 3:
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.getId(), 6000, 4));
|
||||
break;
|
||||
//resistance
|
||||
case 4:
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 6000, 4));
|
||||
break;
|
||||
//jump boost
|
||||
case 5:
|
||||
player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 6000, 4));
|
||||
break;
|
||||
//fire
|
||||
case 6:
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 6000, 4));
|
||||
break;
|
||||
//enchanter
|
||||
case 7:
|
||||
if (itemStack != null && (itemStack.itemID == Item.pickaxeWood.itemID || itemStack.itemID == Item.pickaxeStone.itemID ||
|
||||
itemStack.itemID == Item.pickaxeIron.itemID || itemStack.itemID == Item.pickaxeGold.itemID || itemStack.itemID == Item.pickaxeDiamond.itemID))
|
||||
{
|
||||
if (itemStack.isItemEnchanted() != true && player.experienceLevel >= 10)
|
||||
{
|
||||
player.experienceLevel -= 10;
|
||||
itemStack.addEnchantment(enchantmentsPick[rand.nextInt(3)], rand.nextInt(4) + 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue