Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. What he said. + (probably) RenderWorldLast + You might need more than just defining coord-based vertexes. Translations, rotations and scale is a thing. Probably some camera based stuff (examples in vanilla code, simplier ones are in e.g RenderLiving#renderLivingLabel (or similar name)).
  2. Until 1.8 (I am not sure about exact release) you will need deobfuscated API (which you should find in IC downloads). As of some newer forge - you don't need anything specific. As to installing: Throw API anywhere (can be some (any) folder in project) and simply add it as library like you normally would do (in eclipse). APIs are usually shipped with source like API-src.zip/jar which you can attach to library in eclipse (again - like you normally would). As to modding side: 1st of all - add API to your mod's dependencies (in @Mod annotation), obviously. I am unsure if anything else is needed because it really depends (you may have to use ShadowJar, but it also depends).
  3. In 1.7 you need to assign IExtendedEntityProperties (IEEP) via @SubscribeEvent of EntityConstructingEvent. IEEP is generally assigned on both sides, but it is entirely up to you. If the data will be only used by server (nothing will be ever displayed to clients) you can assign IEEP only on server (!world.isRemote), otherwise assign on both. Your IEEP class will need to hold that one integer generated during construction (mind that there is alredy Random instance in entity class). If the value should be saved (not per-session) - you need to write/read it from NBT (all in IEEP interface). If you need clients to ever see anything - you will always need to sync data (SimpleNetworkWrapper - SNW). Links: Sides: http://mcforge.readthedocs.io/en/latest/concepts/sides/ IEEP: http://mcforge.readthedocs.io/en/latest/datastorage/extendedentityproperties/ Implementation: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-forge-1-6-4-1-8-eventhandler-and SNW: www.minecraftforge.net/forum/index.php/topic,20135.0.html Implementation: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/2137055-1-7-x-1-8-customizing-packet-handling-with Ask if you have a problem (but seriously, you ahve everything you need to make what you are after, use google for Event tutorials)
  4. 1. What you are asking is AI, if you wanted all entities to have such frighten AI you can write it and add to entitities on EntityJoinWorld Event. AI could be triggered by LivingHurtEvent (some boolean). 2. Looku into World#getEntitiesWithAABB (or similar name).
  5. I am not sure but I think latest versions support Wavefront. If not - there is always B3D which can be easily generated from Wavefront (google converters). I am almost sure you can simply point e.g Block's json to load .obj model definition. As to converting to .json - noooope I never seen anything like it, .json is good format but I never saw anyone to use it for complicated models.
  6. Pointless idea, there is a reason server requires resource pack. Anyway - it is possible (everything is), but just note that it is not only not-basic but also requires quite some Java knowledge (probably Reflection). This mod can be clientSideOnly (look at @Mod). All resource packs are being held in Minecraft#defaultResourcePacks (or name of sorts). After being downloaded and loaded by client, they will (probably) be there. You will need to simply force replacement. If you want to do it "smarter" and cancel downloading all the way, you can probably hook into packet pipeline and catch packets that in any way ask about resources. I wouldn't really expect anyone here to tell you exacly what to do, this is totally not standard idea and if it hasn't been written alredy, there is a reason for that.
  7. http://mcforge.readthedocs.org/en/latest/datastorage/capabilities/ https://github.com/MinecraftForge/MinecraftForge/blob/1.9/src/test/java/net/minecraftforge/test/NoBedSleepingTest.java
  8. Oh dang, dude. Okay, so: 1.1. It's non-optimal (pointless) to make 'new' objects when you don't need that. * Make static field and make 'Overlay(Minecraft.getMinecraft(), player);' once. 1.2. I am not saying anything (but I am), but the constructor (and whole design) is pointless. *Just make static method or in-event code that will get player and mc from Minecraft#thePlayer and Minecraft.getMinecraft(). 2. Actual problem: 2.1. RenderGameOverlayEvent has TWO sub-events. Pre and Post (look into class). * You need to use one event, preferably Post. 2.2. In RenderGameOverlayEvent there is event.type. * Pick one EventType, otherwise code is called multiple times (about 15). I suggest using 'ALL'. Why do you get multiple renders: You should alredy come up with that reading 1 and 2. You are making new Overaly that renders stuff multiple times per frame.
  9. Okay, I forgot - it's not designed to help (event). You can: (in event) ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); int x = Mouse.getEventX() / scaledresolution.getScaleFactor(); int y = (mc.displayHeight - Mouse.getEventY()) / scaledresolution.getScaleFactor(); Then using that you can render (image i guess, or really anything) using one of Gui.class methods (or other ones). Big note: image will try to render in zLevel = 0, which is not desired since it will just not work (in that event). At least, that is what I remember from some past problems (maybe changed). In that case you can use: GL11.glTranslate(0.0F, 0.0F, zLevel);
  10. Could you show you Event class?
  11. ItemTooltipEvent? Gives you (last) chance to modify rendering.
  12. BakedQuad format is quite bigger than 4 ints. Internals try to acces 4th index (you have 0-3) and thus - crash.
  13. hook = new EntityGrapplingHook(worldIn, playerIn, 1.5F); You are replacing global field with new object. Then you are killing it, leaving old intact. Not to mention this (whole class) is not gonna work, everything will break and stuff... You CAN'T hold ANY (non-shared) fields in Item class iteslef, Item is a singleton! You need to save stuff in ItemStack (entity reference can be saved as UUID) or @Capability of ItemStack (as of 1.8.9+).
  14. 1.8.9+: http://mcforge.readthedocs.org/en/latest/datastorage/capabilities/ -1.8.9: http://mcforge.readthedocs.org/en/latest/datastorage/extendedentityproperties/ Make object, attach it, store mana, edit it when needed. Regeneration can be done with PlayerTickEvent (pick event.phase). You will NEED packets: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html Rendering can be done with RenderGameOverlayEvent (pick sub event, most likely Post and event.type).
  15. I recently stopped using all my about-year-old configs based on Forge Configuration in favor of HOCON format (https://github.com/typesafehub/config). I can only say I am like... infinitely satisfied. You have more readable JSON format which can have comments and can be even sent to clients as serialized JSON, I mean - how fun is that! And the API - it is so nice and tidy (gotta love e.g: default fallbacks). If any, I'd recommend you guys utilizing this or something of this sort.
  16. You need direct and fallback references to do this. There can be situation in which either one of those is not loaded in world. In that case you can't do much (you can force loading TileEntity, but not Entity). Remember that - handle it somehow. As to how to store: (example) In Entity: Fields: int x, y, z; TileEnttiy te; Use NBT to save/load x/y/z. Whenever you need to access it you want to ask "te" first, if null - set it using x/y/z. In TileEntity: Fields: UUID uuid; Entity entity; Use NBT to save/load uuid. Whenever you need to access Entity you ask "entity" first, if null - find and set it using uuid. Look into World.class for uuid methods (use search and look for any UUID related stuff). I don't remember exact method name UUID can be nicely serialized to 2 longs which can be put to NBT. (UUID#getMostSignificantBits() and UUID#getLeastSignificantBits()) You can also save it as String, but it is worse. Note (again): It is impossible to always have reference from Tile to Entity and vice versa, they can be NOT loaded to world, you can't do much about it. If you NEED some fallback algorithms to handle it you can schelude them to run first thing after entity/tile is loaded.
  17. You don't register command handler. You use it to register Commands. Common: (server commands) @EventHandler public void serverLoad(FMLServerStartingEvent event) { event.registerServerCommand(new SomeCommand()); } For client only: (you call this in preInit) ClientCommandHandler.instance.registerCommand(new SomeCommand()); Seriously - you can find this anywhere on google.
  18. I have no idea what you are pointing out by that reference (The Official Crafting Dead), but as to making texture render directly on skin you want RenderPlayerEvent and fun with images. You basically can rewrite RenderPlayer class and make it use desired textures as skin (or even overlay few of them). Remember to use Pre and Post event. First cancel normal rendering, then render your own.
  19. As of 1.9 WorldRenderer is VertexBuffer. Lookup Gui.class for use examples of vertex format. You know, just adding and drawing vertexes will place them "who knows where". What is your translation/scale context? What event or other rendering are you using?
  20. As you probably know NBT is literally a Map<String, NBTBase>. From what I remember system (NBT) itself will shit bricks if you go beyond 512 map depth. Look NBTTagCompound#read or something.
  21. Pretty much says it all: http://www.minecraftforge.net/forum/index.php/topic,38407.msg202060.html#msg202060 So yeah - mod can be server or client only as long as some side won't say "I won't let you in" or other cases.
  22. Yup, GL requires vertexes to be added counter-clockwise.
  23. I'd just like to add: 1.8 was time when all sorts of hooks were being added to rendering systems (they still are). The "trick" I did there was of "times require it" sort, but "times change" and that may no longer be good now. Thing that I'm saying - if you are planning on updating to 1.9 anytime soon (where rendering changed again a bit), you might look into other solutions - I can't say this approach still works now (1.9), but it might.
  24. 1. If the server is on different version then you - no matter what you do, it will kick you. 2. If server has Forge installed - it will require you to have required (which is defined by authors) mods to allow you to connect. As to other installed mods - if the server won't explicitly decide to not allow you, you can connect. 3. If you have mods on your client and connect to non-forge server - server won't care. As to "if I can play with them installed": Yes and no. If the mod is DESIGNED to work on Client (client mods) or is able to handle vanilla server connection - yeah, everything will work. If the mod is not prepared to work on vanilla or is not client only - you will have problems. Most of them will probably be display problems or errors in logs, but you will also get crashes in many cases. What you should do: Use official laun cher and setup 2 profiles (which is done by forge installer), and simply use profile you want to play (vanilla or forge). So finally: NO - mods will not be disabled unless authors do it for you (they almost never do) and only mods that WILL work are client sided mods like Minimap.
  25. If I understand correctly - you know how to store data in world - as TileEntity, but you don't know how to store data when block is held - as ItemStack? Well - yes, you can simply store NBT inside ItemStack. Just note that they will not stack or something. As to how to exhange that data between TileEntity and ItemStack - you use various methods inside your Block class - you override method of placing to get NBT from ItemStack and transfer it to TileEntity placed and other way around using breakBlock (or something...).
×
×
  • Create New...

Important Information

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