Jump to content

Naiten

Members
  • Posts

    325
  • Joined

  • Last visited

Everything posted by Naiten

  1. Title says. I want to scan a directory for language files i put into mod. public class RoWLocalizer{ public static final String localeFiles[] = {"/assets/row/lang/en_US.lang", "/assets/row/lang/de_DE.lang", "/assets/row/lang/ru_RU.lang"}; public static void init(){ // This actually works, but i don't want to list every language file in localeFiles[]. /** * <pre> * for(String s: localeFiles){ * LanguageRegistry.instance().loadLocalization(s, getLocaleFromFileName(s), false); * FMLCommonHandler.instance().getFMLLogger() * .log(Level.INFO, "[RoW] Loaded language file " + getLocaleFromFileName(s)); * } * </pre> **/ // The code i'm trying to get to work. File localesLocation = new File("/assets/row/lang/"); if(localesLocation.exists() && localesLocation.isDirectory()){ for(File f: localesLocation.listFiles()){ String s = f.getName(); if(f.isFile() && s.endsWith(".lang")){ LanguageRegistry.instance().loadLocalization(s, getLocaleFromFileName(s), false); FMLCommonHandler.instance().getFMLLogger() .log(Level.INFO, "[RoW] Loaded language file " + getLocaleFromFileName(s)); } } }else{ FMLCommonHandler.instance().getFMLLogger() .log(Level.INFO, "[RoW] Can't load lang files from " + localesLocation); } } public static String getLocaleFromFileName(String f){ return f.substring(f.lastIndexOf('/') + 1, f.lastIndexOf('.')); } } For some reason i'm always having 'Can't load lang files from' message. Any ideas?
  2. You haven't wrote that you tried 0x02 flag. Also, it's usage supposes you're doing it on client, not «set up a tick handler on server side and make him do the setBlock stuff».
  3. Try using an update flag when setting fire block to air: worldObj.setBlock(x, y, z, 0, 0, 0x02); 0x02 automatically sends update to the server, thus you won't have to mess with packets.
  4. Java reshapes your source when compiling, so you are defining your items while id variables are not loaded yet. Better way: <...> public static int hotdogID; public static int wuerstchenID; public static int wuerstchenrohID; private static Item hotdog; private static Item wuerstchenroh; private static Item wuerstchen; @EventHandler public void preInit(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); hotdogID = config.get(Configuration.CATEGORY_ITEM, "hotdog", 9000).getInt(); wuerstchenID = config.get(Configuration.CATEGORY_ITEM, "sausage", 9001).getInt(); wuerstchenrohID = config.get(Configuration.CATEGORY_ITEM, "rawsausage", 9002).getInt(); config.save(); hotdog = new ItemFood(hotdogID, 20, 0.3F, false).setMaxStackSize(16).setUnlocalizedName("hotdog").func_111206_d("hotdog:hotdog"); wuerstchenroh = new ItemFood(wuerstchenrohID, 5, 0.3F, false).setMaxStackSize(16).setUnlocalizedName("wuerstchenroh").func_111206_d("hotdog:wurst2"); wuerstchen = new ItemFood(wuerstchenID, 10, 0.3F, false).setMaxStackSize(16).setUnlocalizedName("wuerstchen").func_111206_d("hotdog:wurst"); } <...> This is not the best way, but at least it will (i guess) work.
  5. I bet this will mess up the model. More exactly: player will see not outer sides of polygons, but inner. P.S. Yes, it does: So it's better to rotate the model upside down, like GL11.glRotatef(180f, 1f, 0, 0); or GL11.glRotatef(180f, 0, 0, 1f); Yes, the model won't be mirrored, but it's only working way i can imagine.
  6. So, it's in net.minecraft.client.renderer.entity.RenderMinecart: 39 long i = (long)par1EntityMinecart.entityId * 493286711L; i = i * i * 4392167121L + i * 98761L; float f2 = (((float)(i >> 16 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; float f3 = (((float)(i >> 20 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; float f4 = (((float)(i >> 24 & 7L) + 0.5F) / 8.0F - 0.5F) * 0.004F; GL11.glTranslatef(f2, f3, f4); Can anybody explain what is this?
  7. Actually, glRotate takes not 3 arguments, but 4: an angle and coordinates of the rotating vector. So, glRotatef(player.RotationYaw, 0, 1, 0) will rotate renderer around vertical axis, as an instance.
  8. I have same. No idea whose code is that.
  9. That was about the lack of capital letters (not text, letters) in everything you write... I did my best on it
  10. »your active love and hate can help me make a better mod Okaaay. HD .obj mod models + HD mod textures + default pixelized textures + default cubic models = guess what? Yea, tastelessness! I'd recommend to make everything HD, or use cubic models and not show off. Yours faithfully, ~. P.S. Are your shift-keys broken? P.P.S. Everything not concerning graphics looks rather interesting. If you don't abandon it, the result can be top-class.
  11. What you are doing wrong? You are doing THE CODE wrong. You have 36 thousands symbols in 6 hundred lines just two check three sides! And you want as much again to check other three? Dude, this code makes no “sense”, it's extremely bulky and unoptimized, and if you found it “a lot better”, i can only suppose you to be a masochist. Or you want one's PC to lag to a death. I understand you don't want to code it again, but coding the thing, even the way GotoLink has suggested, will take less effort, than doing it in your way. Also, why do you have 48 textures instead of 16? P.S. Modding = coding, and if you want to mod, you have to code and debug (and draw textures too, of course), that's modding in a nutshell. If you are asking on the forums, be ready that people will criticize your code and suggest better ways, that's normal. Don't be so nervous, be a bit more patient, and you'll get your help then.
  12. There's a finished tutorial about TE, but remember that they consume more resources.
  13. So, i'm almost done with it. Currently the code works fine only on flat plane, because it's one o'clock am, i'm tired and don't remember how to write line equations in three dimensions. Also, it will work fine only in my or similar case, because i don't really need side-detection, rather than point-detection ('cause i represent wagon couplers as points where they are located). My draft: So, since couplers are points that are placed on wagon axis and rotate together with it, i can define their global positions by wagon position, it's rotation and preset distances between couplers and wagon centre. See the top of the draft. Then i define distance between the front/rear point and the line of player's sight direction (which is length of a perpendicular passing from point to line). Lesser value indicates needed coupler. See the top middle of the draft. To define that distance i've written a function, because i've not found anything about it in MC sources. Maybe i was searching bad, idk. I'm bad at explaining, but however: both given line and it's perpendicular could be described by angular coefficient equations, which look like y = kx + b, where k is angular coefficient (or a tangent of the angle between line and X-axis) and b is y-intercept of the line. After equations are made, they are combined and then solved, so we know coordinates of the interception point H. Finally, i use Pythagorean to define the distance between given and intersection points. See the bottom of the draft. And the last piece of code: Final note: this code was written especially for my case, if you want something more or less specific, i don't promise good results...
  14. I don't understand wtf you are talking about, especially 'mirrored model' and following part. And why you are quoting my question about such anger, presented to hydroplane. pelep, GotoLink, thanks for suggestions, but i suddenly got an idea, that will definitely work and which i like more, because i have half of it already done before. I'm currently developing it and i'll share the result if anybody wants...
  15. hydroflame, huh, what happened now? Have i unfairly offended you or what?
  16. Haven't i wrote i want to know if player has clicked front/rear side of my entity ? Are my eyes and memory tricking me? The lesson you should take from this — read more attentively, and don't be a smart-ass.
  17. You code is obviously not going to work. If you think it will, take a look at the picture: E — wagon with front and rear couplers; P1, P2 — players; rY — entity rotationYaw; players have equal rotationYaw, that in this case is zero. If i use your code it will work next way: angleDifference_1 = rY - 0; angleDifference_2 = rY - 0; angleDifference_1 = angleDifference_2 => it will return that both players have clicked same couplers, what is false. Next time think a little, before advising something that is not working and saying i'm „just mean“ and „dont want your help“.
  18. Way too complicated. Even considering i'm good at math and trigonometry...
  19. hydroflame, you are so original and talented — use your own methods instead of standard ones, model .obj files instead of ModelBase, say regular ways 'suck' and so on... I want to resemble you, that not everybody is good in 3D modelling, and Techne (or FMCModeler) is much easier for beginners like OP. So, maybe you'll stop your vainglory and saying easy ways are 'fucking retarded' (that is also rude, if you didn't know.)?
  20. I was waiting to get sure nobody has to add something on-topic. Nobody has.
  21. Maybe you'll find another place for discussing your genius codes? This topic has it's problem solved and it should be locked.
  22. I haven't said anything about 'every time i draw'.
  23. It's easier to resize image canvas than write additional code. I don't get any problems with powers of 2.
  24. hydroflame, do you have an alternative?
  25. Oh my. I've forgot that texture file must be sized in powers of 2. It's ok now.
×
×
  • Create New...

Important Information

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