Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. What do you want with this merge method? Just... where did you get it from? Leave it alone. Merge is merge. Set is set. Is there anything you do not understand as of now? What is the problem? The proper method as of 1.8 is NBT#setTag(String key, NBTBase) NBTBase is base class of all nbt data. You can compare it to a simple java Object.class. Now, this NBTBase extends to "generic" data - which are integers, Strings, double, whatever - which can be used with e.g: NBT#setDouble(String key, double value). It is either that or it extends to a NBTTagCompound - which translated to "java" is literally a MAP. NBTTagCompound can contain any NBTBase or even next sub-maps - NBTTagCompounds. To set map inside map you can use NBT#setTag(String key, NBTBase subMap). Why did I made mistake in my last post? Because this: NBT#getCompoundTag(String key) I though the setter has similar name. Anyway, what many people miss is the fact that e.g: NBT$setString(String key, String value) is actually a wrapper method to something like this: NBT#setTag(String key, new NBTTagString(value)); Once you experiment with this you will see that it's VERY obvious in its design. Post full code if you need assistance.
  2. I am about few weeks before starting doing rendering for my armor systems (no longer 20-vanilla-shields, and self-designed multi armor pieces). Good to hear that I just shot down future looking through model loaders' code. Damn - it took me like 2min to find this. If you have repo you can link it, might be useful in few weeks just to see other's people ideas (you know - some tweaks and tricks that I might catch up with).
  3. NBTTagCompound nbt = stack.getTagCompound() if(nbt == null) { nbt = new NBTTagCompound(); stack.setTagCompound(nbt); } nbt.setCompoundTag("Tag1", new NBTTagCompound()); nbt.setCompoundTag("Tag2", new NBTTagCompound()); Will produce stack with: NBT >>Tag1 >>Tag2 Each tag is treated like NBTTagCompound, e.g you can save: NBT >>Tag1 >>>>String:"LOL" >>>>Integer:5 >>Tag2 >>>>String:"LOL2" >>>>Integer:10 I belive you just didn't fully understand NBTs structure - they are just maps that can contain objects - and those objects also can be maps (NBTTagCompounds) EDIT: P.S: If you want direct heelp, post full code dammit!
  4. You could ask Fry (RainWarrior) directly - he's the one designing most of rendering systems (from what i know/see). Try IRC or Git, it can really be just a matter of small thing you are missing. Other way - hours of studying B3D loader and rendering internals... EDIT: Btw.: I strongly belive I've seen wavefront loader implementation for 1.8, someone updated it from what I remember. BOOM: https://github.com/hsyyid/HaloMod/tree/master/src/main/java/com/arisux/xlib/api/wavefrontapi Should work (seems pretty good to me, never used), yet still - this only solves you whining (lol) about B3D loader. You still have to find a way to render it for items (HaloCraft seems to be a VERY damn good source of info, just look at dem client classes). P.S: Tell me if it works.
  5. You need to say - based on what? ItemStack's NBT? ISmartItemModel is your shot. You willl still need json models etc. Other option would be having variants and change item's meta (recreate item on certain action). https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe15_item_smartitemmodel
  6. No, no - Forge's Configuration files. Whenever you make Configuration generate "default" something it uses 4 spaces. I just hate it - I am advanced "fussy" guy so everytime I change something in .cfg I have to do those stupid spaces, I just want Tab! Example: this.get("Something.test", "Look", new String[] { "TEST" }).getStringList()) Will generate this: Something { test { S:Look < TEST > } } (Above: Talking about spaces, I want Tabs)
  7. So - possible? If not supported, is there a single place I can make quick @Override or is it everywhere? Ofc. we are talking about default-generated nodes.
  8. Ernio

    Gravity

    Asweez, why so many threads. You have like 5 with "Gravity" in title. Anyway - in almost every thead it has been told that minecraft doesn't have "gravity". There is no such thing as gravity, only static edit: 'hard-coded' acceleration down. I belive it is not accesible directly, so only way would be to counter or ASM it. Have a look: http://lmgtfy.com/?q=Anti-gravity+Mod I belive there is src somewhere. (If not - decomplie it)
  9. This should help. http://www.minecraftforge.net/forum/index.php/topic,31297.msg165510.html#msg165510
  10. Tell me, when key is not pressed, does it mean that it is released? Startig boolean (keyReleased) should be true.
  11. Just a note: Writing this mod PROPERLY up to point of what you wrote here would probably take up to few months of everyday coding. What Forge does? Just google it. For short answer: When minecraft is being loaded, Forge injects it modifications into vanilla code, those modifications are responsible for calling different stuff from registries that you register your stuff to by making @Mod. Events are something that allows you to add your own call to some action in vanilla - e.g LivingHurtEvent is called everytime someone gets hurt. Events allows you to manipulate outcome of certain action or even cancel it. What are you doing when making something? You are pretty much using vanilla code as base (extending it) with your custom code that then you register into Forge. Forge itself is responsible for putting that code to work, saving/loding it and making it as compatible as possible with other mods. How to write your proposed mod? * You define your worlds as what it seems - pregenerated (Valhalla = giant hall), generating a structure and loading it are 2 different things - 1st is much harder. Please define. For good example lookup how vanilla's villages generate. * In any way - you will need to create your own dimensions that you will register into DimensionManager, lookup surface or hell dimension, you pretty much use same style. * You also need custom generators, not my field of expertise, but that alone will take a LOT of time. * Making power flow through water might be tricky. You best shot would be to make your mechanisms simply check if there is water around. There is no easy way of doing it - you could do something like: if (waterIsTouching) scan.if.this.water.has.connection.to.power.source() // you would ofc check max 16 block around - more would be too resource-eating. For mobs - I will STRONGLY disagree with predecessor - 1st you write Entity (lookup e.g EntityZombie), write it's tasks, THEN you make renderer. Design -> Logic -> Looks Useful templates: http://www.minecraftforge.net/forum/index.php/topic,26267.0.html Useful info: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html EDIT: I could write essay here about what you should do, but 1st - explore Forge and read links I gave you. Then ask more direct questions. Thinking about it now - without good Forge experience, writing this properly can take even more than said before.
  12. Reminds me of: "It's not a bug! it's an undocumented feature!" - Abraham Lincoln, 1862
  13. Yes, you have to learn Java and Forge in order to write anything not-trivial.
  14. Block, alike Items are singularities that only define with what you are dealing with. Things that actually store data are: * ItemStack for Items (in their NBT) * 4bits for Blocks. (4bits are called meta in 1.7.10) If you need more data - you use TileEntity. TileEntity is thing placed "on top" of block position in world (coordincates). TileEntity can store data (to HDD) alike ItemStack - in NBT, with one difference - it can also have its own fields in its object (ItemStack has only NBT field). To make TileEntity: (example): https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe20_tileentity_data For other examples I STRONGLY suggest reading vanilla code - easiest one is Furnace.
  15. Vanilla entity I belive? LivingUpdateEvent Many ways to do that, e.g grab lastPosX and check if is different than posX. YOu can probably also check other fields.
  16. I personally would go with 1st solution (PlayerTickEvent) - there might be mods that would set currentItem directly or by other means than wheeling. It would also resolve all other sources of changing currentItem. Just run simple check and as told - in addition add "something" on client in case of non-smootheness. As to why 120, -120, 0 - it is number awfully reminding me of 360 (1/3) which is obviously a wheel (or circle, whatever). But idk really.
  17. Theoretically 1: LivingHurtEvent - get source, check if explosion, cancell. Theoretically 2: ExplosionEvent.Detonate - remove affected entities from List of affected ones.
  18. public int currentItem; In InventoryPlayer. Use PlayerTickEvent to set it to 3 (max) whenever it's bigger than that. I think you should run it on both sides, and if there will be rendering glitch where HUD shows larger than 3, then you might even use RenderTickEvent on clint side - it will always stay within server's, just look good. Other way around it is to subscribe to MouseEvent and check if event was "wheeling" and cancel if currentItem is bigger than 3, BUT that might get buggy since you would cancell whole MouseEvent just to do one thing (there are other things).
  19. M-Kay - Lemme start with: "Oh! Ma eyes! Thy paste wall of maddening code!" // I don't much time so can't look closely, sorry. And now - if that is your 1st mod, I suggest looking up good-practice examples: www.minecraftforge.net/forum/index.php/topic,26267.0.html Everything you need to know (template) is there. For more knowledge: http://greyminecraftcoder.blogspot.co.at/p/list-of-topics.html and http://jabelarminecraft.blogspot.com/
  20. Jesus christ - REMOVE IT NOW. There are events for a reason - Subscribe to MouseEvent, check if mouse is clicked and perform click from code-level if needed. Also: I HATE those kind of "cheaty" ways of coding (meaning you are writing "easing" gameplay mod).
  21. Facts: - You can export wavefront as B3D - for that google plugin for Blender. (B3D exporter I guess) - I have no idea why not .obj - My guess - Fry (guy who does Forge's model systems) wanted to experiment with different format and he liked B3D, I also heard that B3D is "simplier" and more "clear" - whatever that means. You simply export model in B3D format (via plugin) and use it in Forge's B3D loader.
  22. 1. Moar code. Might be handy: "new" Entity is created once - by spawner. When entity is "new" NBT is NOT being read. Loaded entities on the other hand are being created using reflection (.newInstance()) and then filled with data from NBT. Following that - you can/should inject yourself into MyEntity(World) constructor that will ALWAYS (no matter if loaded or created) will set default values for your vehicle. Then if it happend that entity was loaded from world - use your readNBT method to replace file field. Idk whole code so might be missing design.
  23. Biggest issue here is actually not gravity or walking, but player himself - head != legs. Rotation renderer will do nothing (entities have eye height). Have look at PlayerAPI and SmartMoving You want to dig around that. (REALLY HARD)
  24. Checked on my own, indeed - communication seems to be impossible before: [server thread/INFO] [FML]: [server thread] Server side modded connection established ...occurs. You will probably have to send data elsewhere. Edit: I'd go with: 1. ServerRequest in PlayerLoggedInEvent 2. Client receives request and sends data.
  25. 1. Did you register msg? 2. If yes, server might not have constructed EntityPlayer for you at time of sending, but I don't remember - try using EntityCOnstruction event to check that.
×
×
  • Create New...

Important Information

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