Jump to content

jredfox

Members
  • Posts

    660
  • Joined

  • Last visited

Everything posted by jredfox

  1. Isn't that the case with every mod you need to open up your lang file to find the keys anyways? Mine is no different just a different location I suppose I could just add a description saying where to config them and if they refuse to do that they simply just use a resource pack. Maybe you misunderstood me the key of the lang is always going to be in the file the user doesn't have to specify the key in code as it's auto generated from the resource location they put in. and it can be changed to as long as it's during preinit 2d point is valid you would have to delete old lang files before regenerating them I put that on modders fault not client's( I guess I could prevent this by having a mode where it always deletes the old lang files making them unconfigurable unless you have a resource pack but, of course this would be disabled by default it would solely be for dev people using my library. I already have a boolean for isEclipse so it's highly possible to do so 3d point yes I know so how do I get this to be kept only on client?
  2. it's not those are the initial values people can config them in the actual file later from where it is generated. Think of it like forge's config hey I want this int forge says ok give me the default value so if it doesn't exists I can create them if it does I will grab them. Difference is I keep lines in memory till I am done forges you can turn off and then have to reload. Although you can simulate this with mine by simply never storing it for more then you need it. So basically the display name can be whatever but, it will re-add them if you call a new block and it can't find the line
  3. new BasicBlock(new ResourceLocation("modid:block"),new LangEntry("Basic Block","en_us") ); goal creates registers after preinits models,registers to forge as well as setting the lang. Sadly models are WIP right now so they don't auto gen defaults based on type as of yet. As for when it registers it does it during the register event. I don't know about you but, I enjoy the lazy life just need to optimize it so it registers lang on client side only. That's why I enjoyed 1.7.10 so much 1-2 lines of code you got a block into the game not hundreds later
  4. Ok I undersand why you so mad now? I use my line library so if the identifier of the line is tile.stone.name it will say hey this line already exists don't add it for the default addLine() keeping them as configurations. ConfigBase config = new ConfigBase(file); config.addLine(new LineBase("tile.stone.name=Ardvark"); config.updateConfig(true,false,true);//first is alphabitize,force update,the third is messege when updating Output if already exists: none since it already has the line tile.stone.name Same concept with my dungeon tweaks it only appends a line if it doesn't exists so the main point of a configuration file is to gather data. You can config them with my mod via > config > evilnotchlib > lang > en_us.lang. And since it's a resource pack the higher ones will be overriding me so there is nothing to worry about.
  5. my program auto adds the file though. I just need it running on only client side. it doesn't take much ms like 50ms for a huge file once per launch. It only reads it once and then writes it if and only if it detects an update. Also one file per language for all mods using the specific object and if not registered won't create that file. You didn't have a problem with generating json models which is more on ram?
  6. package com.EvilNotch.lib.util.minecraft.content; public class LangEntry { public String langDisplayName = null; public String langType = null; public String langId = null; /** * use this one if your manually calling it for advanced constructors in basic items/blocks */ public LangEntry(String display,String langType){ this.langDisplayName = display; this.langType = langType; } /** * Don't use this one if your using the advanced constructor on basic items/blocks as it auto fills in the id of the lang */ public LangEntry(String display,String langType,String langid){ this.langDisplayName = display; this.langType = langType; this.langId = langid; } @Override public String toString(){return this.langId + "=" + this.langDisplayName + " Lang:" + this.langType;} public String getString(){return this.langId + "=" + this.langDisplayName;} @Override public boolean equals(Object obj){ if(!(obj instanceof LangEntry)) return false; LangEntry lang = (LangEntry)obj; return this.langId.equals(lang.langId) && this.langType.equals(lang.langType); } } Basically it's three strings that organized like a resource location lang.id is "tile.minecraft.stone.name" lang.displayname is the name to display "Stone" lang.entryType = "en_us" || "ru" etc... I was going to use a set of three strings but, code started looking like a mess for myself so I converted it to an object the user inputs lang language and lang display name then the constructor takes care of the lang.id
  7. ok so how do I convert this code to client only the constructor has the lang object but, how do I make it do nothing on the server side for the lang objects(basically just a set of 3 strings[id,name,langaguetype])? https://gist.github.com/jredfox/b55321cd33653f919fac659cd3128b96 Constructor call snip: for(LangEntry entry : langlist) { entry.langId = "tile." + unlocalname + ".name"; this.langs.add(entry); }
  8. Is lang files on the server I thought it was client only for altering strings into readable names? Ok so I do need IResourcePack start working on this tomorrow
  9. is there already a way in forge for loading external resources such as .lang files or does this require vanilla implementation of IResourcePack? How do you register an IResourcePack? Yes the point is automation and I already have a config library in place for this already I just need to know best way for mc/forge to load this into a resource
  10. I took a look at the player's inventory in a snapshot a couple months ago and it had nothing but, string ids I didn't believe I saw metadata for regular items only picks could be mistaking.
  11. well it's a separate issue so I will just post a new forum thought I would just ask since it looked like you might know.
  12. No I am not that's the point automation is the point. I don't want people or me to manually write lines to a .lang file when I can just automate it and add the line if it doesn't exist. I only need one lang file per language since I can override even other mods lang with another lang. I already have an highly optimized way of reading and writing using my library only writes if it detects an update reads it using java api. I also plan on only loading plan on only writing lang files from languages that are registered. To make things simple again How do I load en_us.lang external from the jar? I just need the lang file loading from an external location from the jar file where do I override? Do I require an IResourcePack?
  13. Ok how do you get the en_us.lang to an external file location from the jar loading since I want to read and write to it for my library it automates things. And if the read/write stops in the middle I don't want the jar file corrupting
  14. is this the same for older versions like 1.8.9 and 1.10.2?
  15. when I rename en_US.lang > "en_us.lang" it no longer works anymore. I looked at the twilight forest mod and they didn't use caps I tried using a resource pack and it required lowercase. What is the fix since twilight forest and resource packs both require toLowerCase()? If it makes a difference it happens the same way once it's compiled Solution: use a pack.mcmeta or use caps for the last two letters forge I suppose has a different format from resource packs? Example below first comment
  16. ok I was assuming their would be confusing behavior in lang. Thanks this helped
  17. ok setAccessible(true) is why it's being able to be modified even though it's final. Well I found this article for static final and it sounds like it works depending on the security enabled or not https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection
  18. didn't work just tried it Lang: vanillalife:obsidian_pickaxe=Obsidian Pickaxe Code: public static final String modid = "vanillalife"; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { opic = new ItemBasicPickaxe(obsidian_material,modid + ":" + "obsidian_pickaxe"); } ItemBasicPickaxe: public ItemBasicPickaxe(ToolMaterial material,String id,CreativeTabs tab) { super(material); this.setRegistryName(id); this.setUnlocalizedName(id); this.setCreativeTab(tab); MainJava.items.add(this); ForgeRegistries.ITEMS.register(this); }
  19. Well I have performed it on static fields before, as to why it's working on final fields I have no idea. I just set the instance to null when it's static.
  20. yes I know that I was doing a debug test. I fixed it using MCPMappingsApi my own I was stating for some reason I was able to change the final field even though it's suppose to be never changed because it was final. Does this mean the final was removed at runtime? public static void setMaterial(Block b, Material m) { ReflectionUtil.setObject(b, m, Block.class, MCPMappings.getField(Block.class,"blockMaterial")); } I choose to ignore exceptions specifically for this since if a mod is incompatible rather then the material not getting set or OS causing exceptions I would rather it continue the program and just not work in that specific area.
  21. So I was going to implement and try to edit a final field like I found online on how to do but, I discovered I wasn't even calling my new method and it was working. By changing block material. public static void setMaterial(Block b, Material m) { ReflectionUtil.setObject(b, m, Block.class, "blockMaterial"); } public static void setObject(Object instance,Object toset,Class clazz,String str) { try{ ReflectionHelper.findField(clazz, str).set(instance,toset); }catch(Exception e){e.printStackTrace();} } Main Class: System.out.println("Before:" + (BlockApi.getblockmaterial(Blocks.STONE) == Material.ROCK) ); BlockApi.setMaterial(Blocks.STONE, Material.WOOD); System.out.println("After:" + (BlockApi.getblockmaterial(Blocks.STONE) == Material.ROCK) + " isWood:" + (BlockApi.getblockmaterial(Blocks.STONE) == Material.WOOD) ); Output: true false isWood:true
  22. Well thanks for pointing this out your a life saver. Was wondering why there was no specific forced format pattern I could find
  23. are you sure so if I had an item I could simply use "icepickaxe=Ice Pickaxe" as a lang and it would work for my item or is there more to it? well if that's the case I would have a hard time using my line library as it's always a specific parsing format. It would have to be string = key like you said but, that would put more strain on the coder changing lang entries
  24. Well I was trying to achieve validations and optimizations by skipping invalid config/line entries. So Basically in dungeon tweaks I will use this as an example: Example: when a mod loads up with say twilight forest and then you take the mod out, I don't expect it to be loading twilight forest config file if the mod isn't loaded. My mod generates all modids that have entities into files for users to edit to be parsed for dungeon tweaks. The issue comes into play when the mod would always skip parsing the mod generated file even when the mod was loaded. I wasn't comparing to file characters so it would return false with buildcraft and never parse it. Even if it parsed the file the other validation occurred. Solution: patch dungeon tweaks and manually handle it per mod that auto generates files like this
  25. It's fine I will just have to manually handle per mod that stores modid as file name toFileCharacters for everything I guess
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.