public void processCommand(final ICommandSender icommandsender, final String[] astring) { final File f = new File(Minecraft.getMinecraft().mcDataDir, "extrautilities_localization.txt"); final Map<String, Properties> k = (Map<String, Properties>)ReflectionHelper.getPrivateValue((Class)LanguageRegistry.class, (Object)LanguageRegistry.instance(), new String[] { "modLanguageData" }); final String lang = FMLCommonHandler.instance().getCurrentLanguage(); final Properties p = k.get(lang); String t = ""; for (final Map.Entry<Object, Object> entry : p.entrySet()) { t = t + entry.getKey() + "=" + entry.getValue() + "\n"; } try { Files.write((CharSequence)t, f, Charsets.UTF_8); LogHelper.info("Dumped Language data to " + f.getAbsolutePath(), new Object[0]); } catch (Exception exception) { exception.printStackTrace(); } }
public ProspectingTool() { super("prospectingTool"); this.setMaxDamage(64); this.setMaxStackSize(1); LanguageRegistry.instance().addStringLocalization("item."+ProspectingTool.class.getCanonicalName()+".name", "en_US", "Prospecting Supplies"); GameRegistry.addShapelessRecipe( new ItemStack(this), new ItemStack(Items.book), new ItemStack(Items.feather), new ItemStack(Items.dye), new ItemStack(Items.glass_bottle), new ItemStack(Items.stone_pickaxe), new ItemStack(Items.stone_shovel), new ItemStack(Items.compass)); GameRegistry.addRecipe(new ProspectingRepairRecipe()); this.setCreativeTab(CreativeTabs.tabTools); }
public static void injectLanguage(File source, Side side) { try { ZipFile zf = new ZipFile(source); for (ZipEntry ze : Collections.list(zf.entries())) { Matcher matcher = Pattern.compile("(?:.+/|)([\\w_-]+).lang").matcher(ze.getName()); if (matcher.matches()) { String lang = matcher.group(1); FMLLog.fine("Injecting found translation data for lang %s in zip file %s at %s into language system", lang, source.getName(), ze.getName()); LanguageRegistry.instance().injectLanguage(lang, StringTranslate.parseLangFile(zf.getInputStream(ze))); // Ensure en_US is available to StringTranslate on the server if ("en_US".equals(lang) && side == Side.SERVER) StringTranslate.inject(zf.getInputStream(ze)); } } zf.close(); } catch (Exception e) { Logger.logError("Could not inject language file!"); e.printStackTrace(); } }
@EventHandler public void load(FMLInitializationEvent event){ proxy.registerRenderInformation(); //Recipes //Crafting //Shapeless GameRegistry.addShapelessRecipe(new ItemStack(Blocks.farmland, 1), Blocks.dirt, Items.stone_hoe); //Shaped GameRegistry.addShapedRecipe(new ItemStack(Blocks.command_block), "X X", " Y ", "X X", 'X', Blocks.noteblock, 'Y', Items.redstone); //Smelting GameRegistry.addSmelting(Blocks.coal_block, new ItemStack(Blocks.water), 20f); GameRegistry.addSmelting(Items.iron_axe, new ItemStack(Items.diamond_axe), 600f); //Creativetabs LanguageRegistry.instance().addStringLocalization("itemGroup.tabSteamAge", "en_US", "SteamAge"); }
public static void init() { LogHelper.debug(ConfigurationHandler.enableCarnivalClowns); if(ConfigurationHandler.enableCarnivalClowns == true) { EntityRegistry.registerModEntity(EntityCarnivalClown.class, "carnival_clown", 1, Reference.MOD_ID, 80, 3, true); RenderingRegistry.registerEntityRenderingHandler(EntityCarnivalClown.class, new RenderClown(new ModelCarnivalClown(), 0.5F)); EntityRegistry.addSpawn(EntityCarnivalClown.class, 10, 1, 2, EnumCreatureType.creature, BiomeGenBase.plains); ModelCarnivalClown.registerEntityEgg(EntityCarnivalClown.class, 0xffffff, 0xff0000); LanguageRegistry.instance().addStringLocalization("entity.Carnival.carnival_clown.name", "en_US", "Carnival Clown"); } //Temporarily removed while i think of a way to fix it /*EntityRegistry.registerModEntity(EntityDethknight.class, "dethknight", 2, Reference.MOD_ID, 80, 3, true); RenderingRegistry.registerEntityRenderingHandler(EntityDethknight.class, new RenderDethknight(new ModelDethknight(), 0.5F)); EntityRegistry.addSpawn(EntityDethknight.class, 10, 1, 2, EnumCreatureType.creature, BiomeGenBase.plains); ModelCarnivalClown.registerEntityEgg(EntityDethknight.class, 0x000000, 0xff0000); LanguageRegistry.instance().addStringLocalization("entity.Carnival.dethknight.name", "en_US", "Dethknight");*/ }
@EventHandler public void load(FMLInitializationEvent event) { wwbstab = new InventoryTab(CreativeTabs.getNextID(), "Bank System Tab"); bank = new BlockBank(Config.bankBlock, Material.wood).setHardness(20f) .setResistance(35f).setUnlocalizedName("bank") .setCreativeTab(wwbstab); me = new BlockME(Config.MEBlock, Material.wood).setHardness(50f) .setResistance(150f).setUnlocalizedName("M.E.") .setCreativeTab(wwbstab); LanguageRegistry.addName(bank, "Bank"); GameRegistry.registerBlock(bank, "wwbs"); LanguageRegistry.addName(me, "Massive Exchange"); GameRegistry.registerBlock(me, "massiveExchange"); NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler()); GameRegistry.registerTileEntity(WwmeTE.class, "wwme"); }
@Override public void onInit() { LanguageRegistry lang = LanguageRegistry.instance(); if (enableBeeAnalyzer) { MiscPeripherals.instance.blockAlpha.registerTile(4).setClass(TileBeeAnalyzer.class).setSprites("analyzer_bee").setName("beeAnalyzer").setInfoText(MiscPeripherals.instance.descriptive ? "This block is computer powered!" : null); GameRegistry.registerTileEntity(TileBeeAnalyzer.class, "MiscPeripherals Bee Analyzer"); lang.addStringLocalization("miscperipherals.beeAnalyzer.name", "Bee Analyzer"); GameRegistry.registerCustomItemStack("beeAnalyzer", new ItemStack(MiscPeripherals.instance.blockAlpha, 1, 4)); } if (enableTreeAnalyzer) { MiscPeripherals.instance.blockAlpha.registerTile(11).setClass(TileTreeAnalyzer.class).setSprites("analyzer_tree").setName("treeAnalyzer").setInfoText(MiscPeripherals.instance.descriptive ? "This block is computer powered!" : null); GameRegistry.registerTileEntity(TileTreeAnalyzer.class, "MiscPeripherals Tree Analyzer"); lang.addStringLocalization("miscperipherals.treeAnalyzer.name", "Tree Analyzer"); GameRegistry.registerCustomItemStack("treeAnalyzer", new ItemStack(MiscPeripherals.instance.blockAlpha, 1, 11)); } if (enableButterflyAnalyzer) { MiscPeripherals.instance.blockBeta.registerTile(9).setClass(TileButterflyAnalyzer.class).setSprites("analyzer_butterfly").setName("butterflyAnalyzer").setInfoText(MiscPeripherals.instance.descriptive ? "This block is computer powered!" : null); GameRegistry.registerTileEntity(TileButterflyAnalyzer.class, "MiscPeripherals Butterfly Analyzer"); lang.addStringLocalization("miscperipherals.butterflyAnalyzer.name", "Butterfly Analyzer"); GameRegistry.registerCustomItemStack("butterflyAnalyzer", new ItemStack(MiscPeripherals.instance.blockBeta, 1, 9)); } }
@Override public void onInit() { if (enableSignalController) { MiscPeripherals.instance.blockAlpha.registerTile(14).setClass(TileSignalController.class).setSprites("signalBox").setName("signalController").setInfoText(MiscPeripherals.instance.descriptive ? "This block is computer powered!" : null); GameRegistry.registerTileEntity(TileSignalController.class, "MiscPeripherals Signal Controller"); LanguageRegistry.instance().addStringLocalization("miscperipherals.signalController.name", "Electronic Signal Controller"); ItemStack controller = GameRegistry.findItemStack("Railcraft", "signal.box.controller", 1); if (controller == null) controller = GameRegistry.findItemStack("Railcraft", "part.circuit.signal", 1); if (controller == null) controller = new ItemStack(Item.redstoneRepeater); ItemStack receiver = GameRegistry.findItemStack("Railcraft", "signal.box.receiver", 1); if (receiver == null) receiver = GameRegistry.findItemStack("Railcraft", "part.circuit.signal", 1); if (receiver == null) receiver = new ItemStack(Item.redstoneRepeater); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(MiscPeripherals.instance.blockAlpha, 1, 14), true, "GRG", "@D#", "GRG", 'G', Item.ingotGold, 'R', Item.redstone, 'D', Item.diamond, '@', controller, '#', receiver)); GameRegistry.registerCustomItemStack("signalController", new ItemStack(MiscPeripherals.instance.blockAlpha, 1, 14)); } }
public static void loadDarkItems(){ darkSword = new ItemDarkSword(6000, ZeroQuest.darkEssenceMaterial).setUnlocalizedName("darkSword").setTextureName(ZeroQuest.modid + ":" + "darkSword"); darkAxe = new ItemDarkAxe(6001, ZeroQuest.darkEssenceMaterial).setUnlocalizedName("darkAxe").setTextureName(ZeroQuest.modid + ":" + "darkAxe"); darkPickaxe = new ItemDarkPickaxe(6002, ZeroQuest.darkEssenceMaterial).setUnlocalizedName("darkPickaxe").setTextureName(ZeroQuest.modid + ":" + "darkPickaxe"); darkShovel = new ItemDarkShovel(6003, ZeroQuest.darkEssenceMaterial).setUnlocalizedName("darkShovel").setTextureName(ZeroQuest.modid + ":" + "darkShovel"); darkHoe = new ItemDarkHoe(6004, ZeroQuest.darkEssenceMaterial).setUnlocalizedName("darkHoe").setTextureName(ZeroQuest.modid + ":" + "darkHoe"); //darkSpark = new ItemDarkSpark(6090).setUnlocalizedName("darkSpark").setTextureName(ZeroQuest.modid + ":" + "darkSpark"); darkEssence = new ItemEssence(6100).setUnlocalizedName("darkEssence").setTextureName(ZeroQuest.modid + ":" + "darkEssence"); darkDust = new ItemDust(6101).setUnlocalizedName("darkDust").setTextureName(ZeroQuest.modid + ":" + "darkDust"); darkGrain = new ItemGrain(6102).setUnlocalizedName("darkGrain").setTextureName(ZeroQuest.modid + ":" + "darkGrain"); darkNileBone = new ItemNileBone(6103).setUnlocalizedName("nileDarkBone").setTextureName(ZeroQuest.modid + ":" + "nileDarkBone"); LanguageRegistry.addName(darkEssence, "Dark Essence"); LanguageRegistry.addName(darkDust, "Dark Dust"); LanguageRegistry.addName(darkGrain, "Dark Grain"); LanguageRegistry.addName(darkSword, "Dark Sword"); LanguageRegistry.addName(darkAxe, "Dark Axe"); LanguageRegistry.addName(darkPickaxe, "Dark Pickaxe"); LanguageRegistry.addName(darkShovel, "Dark Shovel"); LanguageRegistry.addName(darkHoe, "Dark Hoe"); LanguageRegistry.addName(darkNileBone, "Dark Nile Bone"); //LanguageRegistry.addName(darkSpark, "Dark Spark"); }
public static void loadDarkBlocks(){ /*darlaxStone = new BlockDarlaxStone(800,Material.rock).setUnlocalizedName("darlaxStone").setTextureName(ZeroQuest.modid + ":" + "darlaxStone"); GameRegistry.registerBlock(darlaxStone, ZeroQuest.modid + "." + darlaxStone.getUnlocalizedName().substring(5)); blockTeleporter2 = new BlockTeleporter(801).setUnlocalizedName("blockTeleporter2"); GameRegistry.registerBlock(blockTeleporter2, ZeroQuest.modid + "." + blockTeleporter2.getUnlocalizedName().substring(5)); darlaxFire = new BlockDarkFire(802).setUnlocalizedName("darlaxFire").setTextureName(ZeroQuest.modid + ":" + "darlaxFire"); GameRegistry.registerBlock(darlaxFire, ZeroQuest.modid + "." + darlaxFire.getUnlocalizedName().substring(5));*/ darkGrainOre = new BlockDarkGrainOre(803,Material.rock).setUnlocalizedName("darkGrainOre").setTextureName(ZeroQuest.modid + ":" + "darkGrainOre"); GameRegistry.registerBlock(darkGrainOre, ZeroQuest.modid +"." + darkGrainOre.getUnlocalizedName().substring(5)); /*LanguageRegistry.addName(darlaxStone, "Darlax Stone"); LanguageRegistry.addName(blockTeleporter2, "Darlax Teleporter Block"); LanguageRegistry.addName(darlaxFire, "Darlax Fire");*/ LanguageRegistry.addName(darkGrainOre, "Dark Grain Ore"); }
public static void addNames() { LanguageRegistry.addName(nileStone, "Nile Stone"); LanguageRegistry.addName(nileCobblestone, "Nile Cobbletone"); LanguageRegistry.addName(vitoidPlant, "Vitoid Plant"); //LanguageRegistry.addName(nileLog, "Nile Log"); //LanguageRegistry.addName(nileLeaf, "Nile Leaves"); //LanguageRegistry.addName(nileSapling, "Nile Sapling"); LanguageRegistry.addName(nileWorktable, "Nile Crafting Table"); LanguageRegistry.addName(nileBlackFlower, "Nile Black Flower"); LanguageRegistry.addName(nillaxStone, "Nillax Stone"); LanguageRegistry.addName(blockTeleporter, "Nillax Teleporter Block"); LanguageRegistry.addName(nileFire, "Nile Fire"); LanguageRegistry.addName(nileBlueFlower, "Nile Blue Flower"); LanguageRegistry.addName(destroFlower, "Destro Flower"); LanguageRegistry.addName(nilePinkFlower, "Nile Pink Flower"); LanguageRegistry.addName(nileCoalOre, "Nile Coal Ore"); LanguageRegistry.addName(nileGrainOre, "Nile Grain Ore"); LanguageRegistry.addName(looseBedrock, "Loose Bedrock"); }
/*** * Loads in all the Localization files. */ public static void loadLanguages() { //For every file specified, load them into the Language Registry for (Localizations localization : Localizations.values()) { String localizationFile = Localizations.LANG_RESOURCE_LOCATION + localization.getFile(); try { BufferedReader paramReader = new BufferedReader(new InputStreamReader(ZeroQuest.class.getResourceAsStream(localizationFile))); String line = ""; while((line = paramReader.readLine()) != null) { if(!line.isEmpty() && !line.startsWith("#")) { String[] split = line.split("="); String inGameName = split[1]; int count = 2; while(split.length > count) { inGameName += split[count] + (split.length - 1 != count ? "=" : ""); ++count; } LanguageRegistry.instance().addStringLocalization(split[0], LocalizationHelper.getLocaleFromFileName(localizationFile), inGameName); } } } catch(Exception e) { e.printStackTrace(); } } }
public ItemAnnihilationManipulator() { super(ToolMaterial.EMERALD); this.setNoRepair(); this.setMaxStackSize(1); if (FMLCommonHandler.instance().getSide().isClient()) { this.setCreativeTab(TEProxy.tabTETools); } setUnlocalizedName("itemAnnihilationManipulator"); LanguageRegistry.instance().addStringLocalization( "item.itemAnnihilationManipulator.name", "Annihilation Manipulator"); MinecraftForge.EVENT_BUS.register(this); this.setHarvestLevel("pickaxe", 1000); this.setHarvestLevel("shovel", 999); this.setHarvestLevel("axe", 998); }
@Override protected void drawGuiContainerForegroundLayer(int j, int i) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); String line = LanguageRegistry.instance().getStringLocalization("gui.autochisel.name"); // this.drawCenteredString(fontRenderer, isExtended()?"Carve":"Carve blocks", 88, 13, 0x888888); fontRendererObj.drawString(line, (xSize - fontRendererObj.getStringWidth(line)) / 2, -6, 0x404040); line = LanguageRegistry.instance().getStringLocalization("gui.autochisel.patterns"); fontRendererObj.drawString(line, 25, 34, 0x404040); line = LanguageRegistry.instance().getStringLocalization("gui.autochisel.input"); fontRendererObj.drawString(line, 48 - fontRendererObj.getStringWidth(line), 14, 0x404040); line = LanguageRegistry.instance().getStringLocalization("gui.autochisel.output"); fontRendererObj.drawString(line, 129, 14, 0x404040); //fontRenderer.drawString(line, 5-fontRenderer.getStringWidth(line) / 2, 13, 0x404040); }
private void registerItems() { // Register our own creative tab Billund.creativeTab = new CreativeTabBillund( CreativeTabs.getNextID(), "Billund" ); // Billund block Billund.Blocks.billund = new BlockBillund( Billund.billundBlockID ); GameRegistry.registerBlock( Billund.Blocks.billund, "Billund" ); LanguageRegistry.instance().addNameForObject( Billund.Blocks.billund, "en_US", "Billund" ); // Brick item Billund.Items.brick = new ItemBrick( Billund.brickItemID ); LanguageRegistry.instance().addNameForObject( Billund.Items.brick, "en_US", "Billund Brick" ); // Order form item Billund.Items.orderForm = new ItemOrderForm( Billund.orderFormItemID ); LanguageRegistry.instance().addNameForObject( Billund.Items.orderForm, "en_US", "Billund Order Form" ); }
public static void init(String[] blocksData) { for(int i=0;i<blocksData.length;i++) { String[] data = IOHelper.getData(blocksData[i]); //{blockname,texturename,material,tool,hardness,resistance,lightlevel,harvestlevel} if(data.length==8) { CustomItems.blocks.add(new CustomBlock(IOHelper.getMaterial(data[2]), Integer.parseInt(data[4]), Integer.parseInt(data[5]), Integer.parseInt(data[6]))); CustomItems.blocks.get(i).setBlockName(Reference.MOD_ID.toLowerCase()+":"+data[1]); CustomItems.blocks.get(i).setHarvestLevel(data[3], Integer.parseInt(data[7])); GameRegistry.registerBlock(CustomItems.blocks.get(i), data[1]); LanguageRegistry.instance().addStringLocalization(CustomItems.blocks.get(i).getUnlocalizedName()+".name","en_US", data[0]); } else { LogHelper.info("Error parsing "+blocksData[i]); } } }
public static void init(String[] fluidsData) { for(int i=0;i<fluidsData.length;i++) { String[] data = IOHelper.getData(fluidsData[i]); //{liquidname,texturename,luminosity,density,temperature,viscosity,gasorliquid} if(data.length==7) { CustomItems.fluids.add(new CustomFluid(data[1], Integer.parseInt(data[2]), Integer.parseInt(data[3]), Integer.parseInt(data[4]), Integer.parseInt(data[5]), data[6].equals("g"))); CustomItems.fluidBlocks.add(new CustomFluidBlock(CustomItems.fluids.get(i))); CustomItems.fluidBlocks.get(i).setBlockName(Reference.MOD_ID.toLowerCase() + ":" + data[1]); CustomItems.fluids.get(i).setBlock(CustomItems.fluidBlocks.get(i)); CustomItems.buckets.add(new CustomBucket(CustomItems.fluidBlocks.get(i))); CustomItems.buckets.get(i).setUnlocalizedName(Reference.MOD_ID.toLowerCase() + ":" + data[1] + "Bucket"); FluidRegistry.registerFluid(CustomItems.fluids.get(i)); RegisterHelper.registerBlock(CustomItems.fluidBlocks.get(i), Reference.MOD_ID.toLowerCase() + ":" + data[1]); RegisterHelper.registerItem(CustomItems.buckets.get(i), data[1]+"Bucket"); LanguageRegistry.instance().addStringLocalization(CustomItems.fluidBlocks.get(i).getUnlocalizedName()+".name","en_US",data[0]); LanguageRegistry.instance().addStringLocalization(CustomItems.fluids.get(i).getUnlocalizedName(),"en_US",data[0]); LanguageRegistry.instance().addStringLocalization(CustomItems.buckets.get(i).getUnlocalizedName()+".name","en_US",data[0]+" Bucket"); } else { LogHelper.info("Error parsing "+fluidsData[i]); } } }
protected static void doMessagePlayer(EntityPlayer plai, String str, final boolean alert) { if (IaSPlayerHelper.dochat && plai.worldObj.isRemote) { final String localized = LanguageRegistry.instance().getStringLocalization("ias2.message."+str); if(!localized.isEmpty()) { final ChatComponentText txt = new ChatComponentText(localized); if(alert) txt.setChatStyle(new ChatStyle().setItalic(true).setBold(true).setColor(EnumChatFormatting.RED)); else txt.setChatStyle(new ChatStyle().setItalic(true).setColor(EnumChatFormatting.GRAY)); if(alert) { plai.addChatMessage(new ChatComponentText("")); plai.addChatMessage(txt); plai.addChatMessage(new ChatComponentText("")); } else plai.addChatMessage(txt); IaSPlayerHelper.dochat = false; } } else { IaSPlayerHelper.dochat = true; } }
@Override public void init() { super.init(); String[] types = new String[]{"Helmet", "Chestplate", "Leggings", "Boots"}; for (int i = 0; i < types.length; i++) LanguageRegistry.instance().addStringLocalization( "item.armorEnder" + i + ".name", String.format("Ender-Infused %s", types[i])); FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); for (KeyBinding binding : allBindings) ClientRegistry.registerKeyBinding(binding); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityHMS.class, new HMSTESR()); MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock( EACommonProxy.blockHMS), new ItemRendererHMS()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRockExterminator.class, new RockExterminatorTESR()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock( // EACommonProxy.blockRockExterminator), new ItemRendererRockExterminator()); MinecraftForgeClient.registerItemRenderer(EACommonProxy.itemWarpGem, new ItemRendererWarpGem()); }
public static void registerGalacticraftNonMobEntity(Class<? extends Entity> var0, String var1, int trackingDistance, int updateFreq, boolean sendVel) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { LanguageRegistry.instance().addStringLocalization("entity.GalacticraftMars." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); } EntityRegistry.registerModEntity(var0, var1, GCCoreUtil.nextInternalID(), GalacticraftPlanets.instance, trackingDistance, updateFreq, sendVel); }
public static void registerGalacticraftNonMobEntity(Class<? extends Entity> var0, String var1, int trackingDistance, int updateFreq, boolean sendVel) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { LanguageRegistry.instance().addStringLocalization("entity.GalacticraftCore." + var1 + ".name", GCCoreUtil.translate("entity." + var1 + ".name")); } EntityRegistry.registerModEntity(var0, var1, nextInternalID(), GalacticraftCore.instance, trackingDistance, updateFreq, sendVel); }
/** * Registers a space creature. * * @param var0 * @param var1 * @param back * @param fore */ public static void registerSpaceCreature(Class<? extends Entity> var0, String var1, int back, int fore) { if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { LanguageRegistry.instance().addStringLocalization("entity." + var1 + ".name", SpaceTranslate.translate("entity.spaceCore." + var1 + ".name")); } int newID = EntityRegistry.instance().findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(var0, var1, newID, back, fore); EntityRegistry.registerModEntity(var0, var1, nextInternalID(), SpaceCore.instance, 80, 3, true); }
/** * add item to the hashmap * @param name * @param newItem */ private static void addItem(String[] name, Item newItem) { itemMap.put(name[0], newItem); GameRegistry.registerItem(newItem, newItem.getUnlocalizedName()); LanguageRegistry.addName(newItem, name[1]); }
/** * add item to the hashMap, with a recipe, name[0]=search map name, name[1]=ingame name * @param name * @param newItem * @param recipe */ private static void addItem(String[] name, Item newItem, Object[] recipe) { itemMap.put(name[0], newItem); GameRegistry.registerItem(newItem, newItem.getUnlocalizedName()); LanguageRegistry.addName(newItem, name[1]); GameRegistry.addRecipe(new ItemStack(newItem), recipe); }
/** * register an entity to the hashmap * @param name name that will be used to lookup the entity * @param mobClass * @param localization {"entity.entityname.name", "en_us", "Ingame Name"} */ private static void registerMob(String name, Class mobClass, int id) { EntityRegistry.registerGlobalEntityID(mobClass, name, id); LanguageRegistry.instance().addStringLocalization("entity." + name + ".name", "en_US", name); Piggalot.proxy.registerNPC(mobClass, new GGPMobsRenderer(new ModelBiped(), 0.4F, name)); EntityRegistry.addSpawn(mobClass, 10, 1, 1, EnumCreatureType.ambient, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.beach); }
@EventHandler public void preinit(FMLPreInitializationEvent event) { modifierDirectory = new File(event.getSuggestedConfigurationFile().getAbsolutePath().replace(MODID + ".cfg", NAME)); if(modifierDirectory.exists()) for(File f : modifierDirectory.listFiles()) f.delete(); else modifierDirectory.mkdir(); configFile = new File(event.getSuggestedConfigurationFile().getAbsolutePath().replace(MODID, NAME)); jsonFile = new File(event.getSuggestedConfigurationFile().getAbsolutePath().replace(MODID, NAME).replace(".cfg", ".json")); if(!jsonFile.exists()) { jsonFile = new File(modifierDirectory.getAbsolutePath() + File.separator + NAME + ".json"); if(!jsonFile.exists()){ try { jsonFile.createNewFile(); PrintStream out = new PrintStream(new FileOutputStream(jsonFile)); writeDefaultJSON(out); out.close(); } catch (IOException e) { Logger.getLogger(NAME).log(Level.WARNING, "Could not create json file - " + e); } } } GameRegistry.registerItem(updateChecker, "updateChecker"); LanguageRegistry.addName(updateChecker, "Update Checker"); CraftingManager.getInstance().addRecipe(new ItemStack(updateChecker), "RRR", "RBR", "RRR", 'R', Items.redstone, 'B', Items.bread); TConstructRegistry.registerActiveToolMod(new TModifiersToolMod()); MinecraftForge.EVENT_BUS.register(this); }
@Override @SuppressWarnings("deprecation") public void preInit(FMLPreInitializationEvent evt) { this.languageMap.forEach((language, map) -> { String lang = language.replace('-', '_'); map.forEach((key, value) -> LanguageRegistry.instance().addStringLocalization(key, lang, value)); }); Game.events().on(LanguageEvent.RegisterTranslation.class).withPriority(EventBus.PRIORITY_LOW).bind(this::register); }
public static void addNames(){ //Temporary Naming LanguageRegistry.addName(doomShrineBlock, "Doom Shrine"); LanguageRegistry.addName(shrineStaffItem, "Shrine Staff"); LanguageRegistry.addName(leafItem, "Leaf"); LanguageRegistry.addName(shrineScripturesItem, "Shrine Scriptures"); LanguageRegistry.instance().addStringLocalization("itemGroup.Doom Shrine", "en_US", "Doom Shrine"); }
@EventHandler public void preInit(FMLPreInitializationEvent event) { //Do strange hacks. //Block.blocksList[Block.skull.blockID] = null; //Block.blocksList[Block.skull.blockID] = (new BlockSkullOverride(Block.skull.blockID)) // .setHardness(1.0F).setStepSound(Block.soundStoneFootstep) // .setUnlocalizedName("skull").setTextureName("skull"); //Block.skull = Block.blocksList[Block.skull.blockID]; //Get on with things. config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); iu = new InitUtils(); iu.config = config; iu.log = logger; iu.tab = tabWeirdScience; iu.modid = "weirdscience"; ConfAnnotationParser anno = new ConfAnnotationParser(config); try { anno.parse(this.getClass()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //logger.warning("Important news: " + Integer.toString(this.testConf)); //logger.info("Testing."); LanguageRegistry.instance().addStringLocalization("itemGroup.tabWeirdScience", "en_US", "Weird Science"); //NetworkRegistry.registerGuiHandler(this, new WeirdScienceGUIHandler()); MinecraftForge.EVENT_BUS.register(bucketMan); }
@Override public void initGui() { super.initGui(); button = new GuiButton(0, guiLeft+7, guiTop+50, 60, 20, LanguageRegistry.instance().getStringLocalization("gui.aec2.spectrometer.compo")); buttonList.add(button); }
@Override protected void actionPerformed(GuiButton b) { if (compoMode) { compoMode = false; button.displayString = LanguageRegistry.instance().getStringLocalization("gui.aec2.spectrometer.props"); } else { compoMode = true; button.displayString = LanguageRegistry.instance().getStringLocalization("gui.aec2.spectrometer.compo"); } }
public String getStatName(int i) { switch (i) { case HARDNESS: return LanguageRegistry.instance().getStringLocalization("strings.aec2.hardness"); case DENSITY: return LanguageRegistry.instance().getStringLocalization("strings.aec2.density"); case ENERGY: return LanguageRegistry.instance().getStringLocalization("strings.aec2.energy"); case REACTIVITY: return LanguageRegistry.instance().getStringLocalization("strings.aec2.reactivity"); case STABILITY: return LanguageRegistry.instance().getStringLocalization("strings.aec2.stability"); } return "???"; }
public void cacheStackAndName() { BetterBarrels.debug("15 - Looking up user friendly name for " + (this.level.material.isOreDict() ? this.level.material.name : new StringBuilder().append(this.level.material.modDomain).append(":").append(this.level.material.name).append(":").append(this.level.material.meta).toString())); this.materialStack = this.level.material.getStack(); this.name = this.materialStack.func_82833_r(); if (this.name.indexOf(".name") > 0) { this.name = LanguageRegistry.instance().getStringLocalization(this.name); } BetterBarrels.debug("16 - Found: " + this.name); }
private void registerEntities() { arrowEntityId = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID( ArrowEntity.class, "decoArrow", arrowEntityId ); EntityRegistry.registerModEntity( ArrowEntity.class, "decoArrow", arrowEntityId, this, 64, 20, false ); //EntityRegistry.instance().lookupModSpawn( ArrowEntity.class, false ).setCustomSpawning( null, true ); LanguageRegistry.instance().addStringLocalization( "entity.deco_arrow.name", "Arrow" ); }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void loadLanguageFile(String lang, Properties langPack) { HashMap<String, String> parsedLangFile = new HashMap<String, String>(); parsedLangFile.putAll((Map) langPack); // lovely casting hack LanguageRegistry.instance().injectLanguage(lang.intern(), parsedLangFile); }
/** * Initialize the blocks, items, tick handler * @param evt */ @EventHandler public void load(FMLInitializationEvent evt) { guestBedBlock = new BlockGuestBed(bedBlockID).setHardness(0.2F).setUnlocalizedName("guest_bed").setTextureName("bed"); guestBedItem = (new ItemGuestBed(bedItemID)).setMaxStackSize(1).setUnlocalizedName("guest_bed").setTextureName("bed"); GameRegistry.registerBlock(guestBedBlock, "Guest Bed Block"); LanguageRegistry.addName(guestBedBlock, "Guest Bed"); GameRegistry.registerItem(guestBedItem, "Guest Bed Item"); LanguageRegistry.addName(guestBedItem, "Guest Bed"); TickRegistry.registerTickHandler(new TickHandlerSleep(), Side.SERVER); }
@EventHandler public void load(FMLInitializationEvent event) { itemCoin = new ItemCoin(itemCoinID).setUnlocalizedName("itemCoin"); itemSmallCoinStack = new ItemSmallCoinStack(itemSSTackID) .setUnlocalizedName("itemSmallCoinStack"); itemLargeCoinStack = new ItemLargeCoinStack(itemLStackID) .setUnlocalizedName("itemLargeCoinStack"); itemCoinHeap = new ItemCoinHeap(itemHeapID) .setUnlocalizedName("itemCoinHeap"); itemSeller = new ItemSeller(itemSellerID) .setUnlocalizedName("itemSeller"); blockTradeStation = new BlockTradeStation(blockTradeStationID) .setUnlocalizedName("blockTradeStation"); GameRegistry.registerBlock(blockTradeStation, modid + (blockTradeStation.getUnlocalizedName().substring(5))); LanguageRegistry.addName(blockTradeStation, "Universal Trade Station"); LanguageRegistry.addName(itemCoin, "Coin"); LanguageRegistry.addName(itemSmallCoinStack, "Coin Stack"); LanguageRegistry.addName(itemLargeCoinStack, "Large Coin Stack"); LanguageRegistry.addName(itemCoinHeap, "Coin Pile"); LanguageRegistry.addName(itemSeller, "Selling Catalogue"); UCRecipeHelper.addCoinRecipes(); UCRecipeHelper.addTradeStationRecipe(); UCItemPricer.initPrices(); GameRegistry.registerTileEntity(UCTileEntity.class, "UCTSTileEntity"); NetworkRegistry.instance().registerGuiHandler(this, new UCGuiHandler()); }
@EventHandler public void load(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new MocapEventHandler()); int id = 0; EntityRegistry.registerModEntity(EntityMocap.class, "EntityMocap", id, this, 80, 1, true); id++; LanguageRegistry.instance().addStringLocalization( "entity.EntityMocap.name", "en_US", "Mocap Actor"); proxy.registerRenderers(); }