Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. I just figured out that Items can't use Block's model as total-base. You need to have Item.json that will use Block's model.json as parent. Why doees everyone in every tutorial/documentation/comment names both the same (that got me confused). SUCCESS
  2. I am tired of this. Tried to follow tutorials but seems like there was (I mean, must have been, because it's not working) some update lately. Forge build 1306 (latest). // I am passing "ore_copper" as name: private void registerItemModel(String name) { System.out.println(name); Item item = GameRegistry.findItem(InitUtil.ModID, name); System.out.println(item); ModelResourceLocation model = new ModelResourceLocation(InitUtil.ModID.toLowerCase() + ":" + name, "inventory"); System.out.println(model); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, model); } [19:26:47] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.ClientProxy:registerItemModel:64]: ore_copper [19:26:47] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.ClientProxy:registerItemModel:66]: net.minecraft.item.ItemBlock@4fe57305 [19:26:47] [Client thread/INFO] [sTDOUT]: [com.midstcraft.ernio.RoA.ClientProxy:registerItemModel:68]: roa:ore_copper#inventory .......... [19:26:49] [Client thread/ERROR] [FML]: Model definition for location roa:ore_copper#inventory not found What the hell? Note: My world-model (placed) is working. Edit: I edited post (had mistakie in code) Edit 2: Assets: assets.roa.blockstates/ore_copper.json assets.roa.models.block/ore_copper_model_0.json
  3. @deadrecon98 You have weird way of helping ppl. Not that I am condemning that you want to help, but if you don't know how to make something, please don't say "you can't" or "you must do it that way". Don't take it as offense please. But now back to thread: Drawin player is quite simple. As long as you have players skin loaded it's even simplier. // Only for Client-side!!! ResourceLocation skin = ((AbstractClientPlayer) player).getLocationSkin(); This will give you read-to-use resource, if reffered player has cached skin on your client. Next you can do whetever the hell you want with it. this.mc.getTextureManager().bindTexture(skin); //bind texture to renderer this.drawTexturedModalRect(xPos, yPos, xOffset, yOffset, width, height); Edit: Start with drawTexturedModalRect(0, 0, 0, 0, 256, 256); - it should give the idea of how to move texture around. You can render parts of resource few times to archive full player front-texture. Quite simple. As to code provided by deadrecon98 - this is very outdated code. in 1.7.10 you can find new one for rendering player (probably in GuiInventory, i don't remember) and in 1.8 there is even renderer for EntityLivingBase.
  4. Yup, alredy figured it out, thanks. Problem is a bit different. Situation: Having 2 blocks: Block oreCopper: - unlocalized name: ore_copper - uses: assets.mod.blockstates.ore_copper.json Block oreTin: - unlocalized name: ore_tin - uses: assets.mod.blockstates.ore_tin.json Those 2 blocks aren't meta-blocks (each has their own instance). Now - Is it possible to: Assign both blockstates to use: assets.mod.models.blocks.ore_model.json But pass 2 different textures from each (tin has different than copper). I know I can do that by creating ore_copper_model.json and set parent to be ore_model.json and then inside ore_copper_model.json use textures: { } annotation to pass different texture to parent, BUT if i do this i will have to do ONE blockstate = ONE model (which is child of ore_model.json). And I would like to pass texture straight from blockstate (without using metadata variants). Is such passing possible? Edit: I don't think so. Well - assuming from what vanilla assets are doing. Other question: When you are assigning model to be child of other model, how does it look inside memory - are you having 2 different-same models or one model and some smart memory-saving parent-child relation?
  5. I remember there was one or two threads about it, but can't find them (using search and going WAY back in threads). Basically, would it be possible to have ore.json and ore_model.json that would be used by e.g 10 blocks with different unlocalized name?
  6. Oh wait, I am dumb... ResourceLocation skin = ((AbstractClientPlayer) player).getLocationSkin(); My eye missed it. But then again - getting skin from nick is not working (returns black-purple squares).
  7. How to properly obtain skin from Entity (EntityPlayer in this case)? String nick = "myNick"; ResourceLocation skin; if (nick != null && nick.length() > 0) { skin = AbstractClientPlayer.getLocationSkin(nick); } Now: I don't want to use downloader, I want to retrieve skin from cache.
  8. "Because Forge Configuration always contains the comment" - Wrong, it doesn't (unless I misunderstood) "i cant send it using a packet" - You can send everything using packets, you are just looking for easy way. Proper way of doing it would be: 1. Config loads 2. Sets some virtual data, example: (doesn't need that if) if (conf.containsKey("Generics")) MyVirtualStorageClass.setGenerics(conf.get("Generics").getStringList()); 3. And at this point you don't give a damn about config no more - everything is virtual. 4. In your packet you simply MyVirtualStorageClass.getGenerics (which will return some String array) and write all strings to buffer. 5. On receiver side you read it and put in client-side vitrual storage class or actually anny other kind of storage (file cache). I don't see why you want to send whole config so badly, it'd bebetter to send key info when you login on server and then on client use that info to e.g change sky behaviour (color and shit).
  9. You need to send packet everytime something is changed (added/removed) in list to keep it synced.
  10. If you really want to do it from mod, why not looking into GuiMultiplayer? Two ways: 1. Decode servers.dat (I belive it's NBT format, check out read/write methods) on mod startup, check if server entry exists and add your own if not. 2. Add server entry manually in gui screen. Few things: - You can only add the servers when the Gui is opened. Since GuiMultiplayer extends GuiScreen you can subscribe to GuiOpenEvent check if newGui is instanceof GuiMultiplayer and if so, pass an argument to add entry if it doesn't exist. Edit: Actually no, GuiOpenEvent will be fired before server lists exist (I think), so you will have to make some Integer in client proxy which will be your "delay" and then launch code (you will also need ClientTickEvent to count-down). Provide some code for more help.
  11. Basically I //commented my code TODO for later researches and after I updated to latest 1.8 (build 1306) next day, method was there - same as in 1.7.10 (look 1st post). Code is still being deobfuscated, so in next 1.8 updates there will be still some translations.
  12. If you are talking about SMP = dedicated server then: Client is built of Client thread and Integrated Server thread if you are running on SSP. If you connect to SMP (dedicated) your client will only have Client thread running and dedicated server will take role of Server thread. To change values on sides you need to implement communication - packets. Also: YOU SHOULD NEVER, EVER change stuff directly (only with packets) in one thread using other thread (even in SSP). Tutorials: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with
  13. Yuuuup, It works like a charm. http://img-9gag-lol.9cache.com/photo/aKg3ZY3_460sa_v1.gif[/img] Thanks as always diesieben (da real MVP). Handler#onMessage(...) System.out.println("RECEIVED OPEN CLOSE GUI PACKET"); Minecraft.getMinecraft().addScheduledTask(new ScheludedClientTask(message)); Task: private IMessage message; public ScheludedClientTask(IMessage message) { this.message = message; } @Override public void run() { EntityPlayer player = Minecraft.getMinecraft().thePlayer; if (message instanceof PacketOpenCloseGui) { PacketOpenCloseGui msg = (PacketOpenCloseGui) this.message; switch(msg.b) { case 1: player.openGui(Main.instance, 100, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); break; } } } Task will run after thePlayer is constructed. Thread solved.
  14. Oh my, new things ;p Okay, I implemented IThreadListener and (inside onMessage) this.addScheduledTask(new ScheludedTask((byte) 0, player, message)); ScheludedTask is my implementation of Runnable How do I actually make my Runnable run()? I am totally green here. Idk if I should even pass message into Runnable. Thanks for help EDIT: W8, don't tell me, i think I got it working! (testing critical situations).
  15. God... this is literally 3rd thread with same problem. Have look at this: http://www.minecraftforge.net/forum/index.php/topic,27329.msg139843.html#msg139843 I just updated from 1.7.10 to 1.8 and this shit is messing with my brain again. In 1.7.10 solution was to use combination of: PlayerLoggedInEvent PlayerRespawnEvent PlayerChangedDimensionEvent ...and there was no problem since at the time any of those was executed client alredy had his entity. But now, someone decided to make me hang myself on a mouse cable by making PlayerLoggedInEvent launch just before client has constructed my player, so I (again) cannot send any "initial" packet. EntityConstructing and EntityJoinWorldEvent on CLIENT happen WAY too late and until that time I cannot do shit. Anyone knows anything here? Goal stays the same: Send synchro packet to player after he reconstructs (no matter why - login/respawn). Ofc do it without using ticks and client-side requests.
  16. Reinstalled whole thing... #meh
  17. Are those tasks shared between server-client? (both client and server has every task class and can do whetever he wants with it) In that case - yeah, use ID for each task and send only packet with id. I suggest having HashMap with all registered tasks (id, task) and make method getTaskById(); And that'll be perfectly fine. I was thinking that you are making custom tasks inside config and want to send them to client. In that case you would need a well-done constructor system and use some nice checksums and data holders, but that's not the case here. I btw. siemka Coraz więcej Polaków tu widzę.
  18. [12:24:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [12:24:47] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker [12:24:47] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [12:24:47] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_11] at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.8.0_11] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_11] at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_11] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_11] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.8.0_11] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_11] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:106) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_11] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_11] at java.lang.Class.forName0(Native Method) ~[?:1.8.0_11] at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_11] at net.minecraft.launchwrapper.Launch.launch(Launch.java:98) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?] at GradleStart.main(GradleStart.java:45) [start/:?] I don't even know where to start. Anyone knows common reasons? Why? I just updated to latest 1.8, fixed my code and this thing happens. (yes, I know how to setup forge)
  19. "But my orders arent made in that way." There is no other way. Evrything IS made of bytes. If it exists, you can write it to buffer. Maybe share how are your orders made?
  20. You will have to make response Server->Client packet. Simply send packet to player that is viewing GUI whenever task-list changes. You can put response in onMessage or directly into entity class (make wrapper for addTask that will take addTaskWrapped(EntityAIBaseOrder task, EntityPlayer player) and send update packet to player from arguments). You will ofc have to also put packet-update in other places. I'd suggest making refresh button on client-side which would request tasks from server.
  21. tess.setColorOpaque(color.getRed(), color.getGreen(), color.getBlue()); tess.getWorldRenderer(). Was trying to find it, but it just happened that I am Jon Snow ;p Edit: Forge had some method-name updates, i found it.
  22. I am here literally just to say that this thing is so god damn cool !!! (i just had to) Also: wouldn't this break all other mods (anything that uses ticks actually) and speed up/down things to strange brackets?
  23. What you are talking about is NOT Reflection, it's ASM (manipulating bytecode), and NO - you don't need it. Use Forge Events: LivingSetAttackTargetEvent Get event.target, if target instaceof EntityPlayer then checks his helmet, if helmet == yours set target to null. Note: I've never used it, and I am not quite sure if it will work - setting terget to null might only null event reference not the actual target (I am not in IDE). Just try and see if it ll work. As to "protecting them" - it's quite harder part, you will need to add new AI stuff and save player to be protected in IExtendedEntityProperties. I don't event know if you can add AI to vanilla mob (never done that). If not - you are better of extending mob and removeing normal one spawning from all biomes or cancel their spawn event.
  24. I've never used it yet, but its 1.8. http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Check it out, it has some stuff about json models and textures.
  25. It's an item, only thing you can store in item is ItemStack's NBT (and meta ofc). Also - your idea of "saving NBT" is wrong. Something that I got confused too earlier - NBTs are java Maps, also note that either way ItemStack is sent from server to client, sending more packets is another weight for your connection. Also - you can't send pcket and expect shit to happen, you need to store packet-gotten info somewhere, so you would need IEEP. Also - if you are storing cooldown in item its per-item cooldown, not a global one. Idk what's the idea here but i think it's more realistic to have 3 RPGs that have separate cooldown. Next fact - ItemStack's NBT is NOT saved to HDD everytime you change it, it's either saved by world-saver or current-inventory-it-is-in saver. For players it happen fairly often (on SP everyime you pause game, on MP every "some" ticks or when you disconnect). Next - TickHandler will cost more than smply saving stuff to ItemStack's NBT. And btw - using IEEP+packets to store global cooldowns will also save data (unless you don't want it to).
×
×
  • Create New...

Important Information

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