Jump to content

HalestormXV

Forge Modder
  • Posts

    328
  • Joined

  • Last visited

Everything posted by HalestormXV

  1. Got it and applied it. Seems to work fine on both a server test environment and regular singleplayer environment. Found it easier to have a keybind press pass the player and their hand to a function that alters the NBT data of the item the player is holding
  2. So here is a question. I have an item and I want the item to do different things based on its NBT data (if this is the best way to do it). I want the player to be able to change that NBT Data with a keypress. So the default item when you create it/craft it sets up an NBT field and sets it to like 1 and when you right click puts resistance on you becasue that field is one. This will make it very simple to just use a switch to determine which ability to cast since the NBT will be an int field. The player then can press the "M" key or whatever and change the item being held's NBT data field to like 2 and this will make it so when you right click the item it will cast Fire Resistance or something to that effect. So is this method the best way to do this? Or is their a better way to do it? Plus I'm imagining packets would need to be involved so that the game knows "When player presses <KEYBIND> change the NBT Data" right?
  3. Gotcha and in the server proxy return ctx.getServerHandler().player; will return what exactly? Will it still be null? Will it return EntityPlayerMP? Sorry if it sounds dumb but I want to actually learn it lol not just get answers. I get what the client side one will do. And yes, although it is really cool to have your IDE auto-convert things to lambda you still need to do the legwork to learn it. I am one who learns by example, so when I see the code in front of me and see what it spits out I can take it apart and understand it.
  4. Alright, yeah that fixed the Lambda version, thank you for that. But I'm still curious as to why. Any thoughts on why that is needed for Lambda but not for Run?
  5. So I am using 1.8 and fiddling with Lambda where and when I can as it is cleaner and I happen to like it more. So I have a nice little packet that works fine when doing it this way: https://pastebin.com/Q0u1JmLJ (Yes this is just a snip of the code, as the code isn't really at issue) https://pastebin.com/sEezYdRu (This is the Lambda Conversion) Now I should note that I am using IntelliJ which I love and does that conversion for me and I've never once had an issue with it converting anything to Lambda. So the question is really, when it converts to Lambda is it getting rid of something that is needed or is this just something else? Forgive the ignorance as I am just starting to use Lambda and also just starting to realize just how powerful IntelliJ is, as I've always used Eclipse. Here is the crash that generates when it is in Lambda form: https://pastebin.com/WcR6316z For now I am keeping it in its original format because like I said, it works beautifully when it is in the original format.
  6. Got it, so anytime the method called to update the value of the capability I can call the sync to update it with the same value and it should be fine. So for example, @Override public void gainRuneLevel(int value) { int clampValue = this.runeLevel - value; this.runeLevel = MathHelper.clamp(clampValue, this.min_runeLevel, this.max_runeLevel); } So I can adjust that method to take the player that this method got called on as an added argument and right below the this.runeLevel I can add to call to a SyncMethod that will take care of sending packets and what not and it should be fine? I mean obviously this is just conceptual and I won't know anything until I try it out but I wanted to gather some thoughts and ideas first.
  7. So I have a Capability. It is awesome...I love it. However if I make changes to it or want to reflect a GUI it needs to be synced with the server/client etc. No problem. I have a packet that takes care of that and works fine. Quite literally: PacketHandler.INSTANCE.sendTo(new PacketSyncRCLevel(rc_Lvl), (EntityPlayerMP)sender) Great and fantastic. It gets the job done. Displays my debug message to show it is working, etc. Except this means that every time I want to sync my Capability I will have to call this (the last argument will obviously change as well as the rc_LvL variable depending on what I am doing) So say I want to auto-sync whenever the value changes. Where would be the best place to do that? Within the interface of the capability itself? Within its handler? This is more of just a curiosity question because although I don't have to sync much of anything right now I know in the future if I want to add a GUI, level bar, or whatever a sync will need to occur.
  8. I see. It's almost like I'm better off just doing my own dimension lol. Which I planned to do anyway but alright. I will fiddle with it. Thanks for the response.
  9. Quick question. I am setting up my Biome and it is relatively basic. I would just like to know what needs to be done to replace the stone generation, so I can replace all of the Stone with my own custom Stone. I know there is: topBlock and fillerBlock and I use both of them. I usually do my topBlock set to my custom grass and the filler block is set to the custom stone, however I am trying to get a bit better with decoration of biomes. So now I want to try and do the topBlock as my custom grass and the fillerBlock as my custom dirt, so it gives that nice uniform look and simply replace some of the SmoothStone with my own custom SmoothStone. I know there are different gens available but I don't think I saw a stone gen. So any help/shove in the right direction would be beneficial. Here is the simple Biome class. I didn't pastebin it because it is quite small. Like I said it is a very basic and simple biome, at least for now.
  10. EDIT: Nevermind, stupid mistake on my part as is often the case. I fixed it. However I do have a question somewhat related to fluids since I am new to them and all. How do I make it act like water where it pushes the player and stuff like that? Or if they go into a "gas" liquid it will make them float up and stuff. Or apply potion effects and cool little things like that? Does that use the onEntityCollide function or something like that? Im guessing BlockFluidClassic has all of those nifty little things in it? So I'd just be able to make something that extends that.
  11. So the correct format would be: ModelLoader.setCustomMeshDefinition(item, (stack -> modelResourceLocation)) Or something else entirely?
  12. So I am trying to create some custom fluids and I found a thread here that was responded to by @Choonster and he gave an excellent link to his Repo on how he does Fluids and it is well documented but it is for 1.10.2. However, it all looks to still be applicable to 1.12.2 with the exception of this https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/78140ee977ac6bdfe1b455a2de54c9cd777b693b/src/main/java/choonster/testmod3/client/model/ModModelManager.java#L52-L72. Apparently, ModelLoader.setCustomMeshDefinition(item, MeshDefinitionFix.create is no longer valid. I'm just curious to know what this has been changed to, or if there is another way to do this now in 1.12.2 that can be applied to the code.
  13. So I am trying to move my DualFurance over to 1.12.2 and all is well. It works great....but I broke my container when you shift click an Item that is fuel. If you shift click and item that is not fuel but can go into the furnace, nothing happens. https://pastebin.com/wSXMKVxp I know its probably in the transferStackInSlot since that is the home of the lovely Shift+Click from what I can recall. Thoughts or ideas? If you need the other classes here they are: OutputSlot: https://pastebin.com/eFbzLxUn DualFurance/Runic Inscriber: https://pastebin.com/dWji7KYB The Crash: https://pastebin.com/EfL4zfDm
  14. Thanks for the help and the lesson. Marking this as solved. I apprecaite the time and the examples.
  15. Ahhh, I understand, I think. So even though Mystic Cobble is a totally separate block, it is technically dropping Mystic Cobble (Meta/Damage 4) and Minecraft is kinda like Wtf? There is no Mystic Cobble with Meta 4. Throw him checkered box. So does that mean I'd have to strip meta 4 from the https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/java/halestormxv/objects/blocks/BlockStones.java#L130 before returning the item? Or is there an alternative way? Set the dropped item to have "no damage." I am hoping that I am not going to need the dreaded bitWise operators again. They always screw me up. EDIT: Never Mind, Im an idiot.... if (state.getValue(VARIANT) == EnumHandlerStone.EnumTypeStone.MYSTIC_SMOOTHSTONE) { return 0; } in my damageDropped fixed it because I only care about the MysticSmoothStone when it drops. It just needs to make sure to not damage that. Everything else's defaults are fine. There shouldn\t be anything wrong with doing it that way right?
  16. BUMP - I'm at a loss here. I can't figure this out for the life of me. It should literally be so simple. I break a block, I get a different block. Why it works with one and not the other is beyond me. Hopefully somone can shed some light on this. I mean it is probably so stupid and I am so frustrated that I just can't see it. Here is the code, it is easier to just post my GitHub link instead of pastebin everything. CODE: https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/java/halestormxv/init/BlockInit.java https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/java/halestormxv/utils/handlers/EnumHandlerStone.java https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/java/halestormxv/objects/blocks/BlockStones.java JSONS https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/resources/assets/hsrs/blockstates/block_mystic_cobblestone.json https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/resources/assets/hsrs/blockstates/stone.json https://github.com/HalestormXV/Runic-Sorcery/blob/master/src/main/resources/assets/hsrs/models/block/block_mystic_cobblestone.json And yes @Draco18s I did read what you said and I understood what you meant. As a matter of fact I used it to render my furnace block which has multiple variants. But the issue here is that the block that should drop is literally just a basic block. No variants, nothing. The block that should drop it is the one that is a Variant, but even as you may see in the code, I beleive I accounted for that.
  17. Fixed it, thanks. I thought something looked wrong with the tutorial since I have done similar things like this in the past and it just seemed off but I wasn't sure if something changed in 1.12.2 or something that I may have missed.
  18. So a simple question. I followed this tutorial by McJty which utilizes the SimpleNetwork message setup. He uses MovingObjectPosition which I know has been changed to RayTraceResult so I made that change. But when I am on a server and press the Key Bind the client crashes with this: https://pastebin.com/Aje5pDik It's crashing at line 38 of this class: https://pastebin.com/4x3hKbMd Now I know from some past network usage on older versions, that usually Minecraft.getMinecraft() may not be the best thing to use since if I recall getMinecraft() is a bad function to call on a server (perhaps I am wrong). I am only guessing that it has to do with that because it works fine on SinglePlayer only. It only blows up like that if you do it while logged into a server. Insights? Correction that needs to be applied? Perhaps the tutorial was made for a different version of Forge and something else was changed that I was unaware of? If you happen to need the PacketHandler itself, it is really small so I just pasted it.
  19. Thank you for the help and the example code. I apprecaite it. Okay, I know it is terribly confusing. Unfortunatly trying to communicate this particular issue is difficult. Here is a video with explanation to clear it up. https://www.dropbox.com/s/pz5brwov61md321/ErrorRender.mp4?dl=0 As you can see the hotbar has the Variant Blocks. The block with Meta 0 (the intital block) is the one that I have 59 of in the inventory. Every block in the hotbar is a variant block (meta block, subtype, etc. whatever it is correctly called now), that all have models registered for both items and blocks (and they have an item model registered as well as you can see by me placing them and breaking them later in the video) And when I break them (the light blue ones), they drop themselves with the correct model. They drop the correct block of themself and correclty render the item as it is on the ground. Once I break the Light Blue Smoothstone, you can see it drops the Light Blue Cobblestone as it should (which is a unique block unto itself). As you can see I then place both the Light Blue Cobblestone and the Pink Cobblestone. (Both are entirely separate blocks, not variant blocks, nothing. Just separate blocks with different IDs.) Once I break them as you can see in the video they drop themselves correctly just like in Minecraft. The model is rendered, the items is fine, and it has its own item model, everything is good. I then go to break the pink blocks and as you can see in the video they all drop themselves and have a model registered to each along with their item model and drop it accordingly. I then go to break the Pink Smoothstone and as you can see the checkered box shows up. However, it is still the correct block (Pink Cobblestone, as you can see when it goes into my inventory). So I just am failing to see why it does this and why it specifically is this one block when all of the others do exactly what they should.
  20. Okay and thanks for the example and explanation. I appreciate it. Question though that I have is, this holds true even though the block that is supposed to “Drop” isn’t a Variant block? I guess I’m just trying to understand how it works. All the Variant blocks drop themselves as items just fine when you break them. The only two blocks that aren’t supposed to drop themselves are the smoothstone ones. Meta data 0 and Meta data 4. They are supposed to drop an entirely separate block (kinda like glow stone and dust) The meta 0 drops the counterpart but the Meta 4 drops the checkered box. Once again both the blocks that Meta 0 and Meta 4 are supposed to drop are entirely separate blocks. So you still need to register separate models for each?
  21. So I have some Variant blocks. And they are great, and work fine. They replicate Smoothstone and when you break them you get the Cobblestone Counterpart. I took the Vanilla function basically right out of the BlockStone class and it works fine, but only with one of the Variant Blocks. Here is what happens: https://www.dropbox.com/s/bweu8qclnzjn1m4/ErrorHelp.mp4?dl=0 As you can see, the Blue Block (Default State) breaks just fine and drops the Cobblestone Counterpart (which is a separate block entirely). The Pink Block, which is a Variant with a meta data value of 4, drops the correct block, the Pink Cobble Counterpart and when you pick it up or place it, it renders fine, but when it is "dropped" by the Pink Stone it isn't rendering. I can throw the pink cobble on the floor and it renders, I can break the pink cobble and it renders just fine. There are no rendering errors on startup, or registry errors. And like I said, if I place the Pink Cobblestone standalone and break it it drops itself and has no issue rendering the texture. It is only when I break the Pink Smoothstone. So maybe I overlooked something, but the drop code is basically straight out of the vanilla code. https://pastebin.com/wXs9qTaZ (Drop code is on line 119) https://pastebin.com/wtPK4aye (EnumHandler) I don't think it is a JSON issue since nothing spits out on startup and the block renders just fine when I break it on its own, but if you still need them just let me know and I will post them.
  22. No arguments/reasons/excuses there. But that is why I post on these forums, because no matter how incompetant some of my posts may seem I always learn something from them lol. (Gently, or Harshly) So the stream() basically renders the entire loop and array adding in the getBiomList useless which I see by utilizing the stream() and erasing that entire loop and add to array. Because what the ForgeRegistries.BIOMES.getValues().stream().map(Biome::getBiomeClass).collect(Collectors.toList()) is essentially doing, is going into the Registry and pulling out all the Biomes that have been registered, getting their Values and placing them in a map which is storing their Class and the collector is basically collecting that entire map and turning it into a list, correct? So you can simply return that. Now because it is turning it into a List I am imagining that you can work with it as a List just like any other list right?
  23. Thank you for that and for providing the stream example. This is actually one of the functions I didn't write since I never worked with the structure spawning in this way, however I do see your point and its inefficency. But that is also what I get for following along with samples. Appreciate the feedback. I will be changing it up.
  24. I got sidetracked on another part of my mod becasue this was frustrating me, and often when that is the case you step away and do something else. So hence why I have not responded. I did manage, after stepping away from this piece for a little while, to get a working method of what I was trying to accomplish. Basically I just wanted a way to Fetch the registered Biomes and get their classes. I needed the classes because the generate function requires the classes as a vararg. So the function I made can be tweaked and added to, to "filter" out your biomes, or just call it without any arguments to have your structures spawn in all Biomes. I needed the base function first though which was frustrating me. But nevertheless I managed to put this together: https://pastebin.com/1MWwgjCr if anyone is interested. Feel free to comment, and criticize, or perhaps tell me this way of doing it is all wrong (and if that is the case let me know the correct way), or if it is inefficent and perhaps a more efficeint way of doing this, etc. etc. And yes alternatively i know you can just add an isEmpty() check and leave the last vararg blank and it will achieve the spawn in all biomes method but the point was to create a function so you can filter out biomes that you want.
  25. Alright, I'll be honest, I've never used the GameRegistry.findRegistry or the ForgeRegistries.BIOMES so if you can provide any examples or even OpenSource code of its use on how to return the classes it'd be most helpful. I'm trying to learn the whole Registry thing.
×
×
  • Create New...

Important Information

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