Jump to content

Recommended Posts

Posted

My latest mini-mod practice project is to duplicate an old mod I saw in a let's play once, which would simply tell you on the Debug (F3) screen if you're standing in a slime chunk (I'll find this useful for my future slime-spawning mod since Rei's detection is wonky). I've sussed out how to add the text to the Debug screen, no problem. 

 

Where I'm getting caught up is getting my current position in order to do the calculations. Unlike the other events I've dealt with to date, world, position, and player don't seem to show up in the inheritance chain for RenderGameOverlayEvent. Please forgive me if I'm missing something obvious -- I've been working with a certain other language for several years that has sabotaged my brain's ability to properly map out scoping.

 

I figure that, if the answer to my question is "no", then I can "scrape" the X and Z coords out of the debug text lines and use them, but if there's a way to get posX and posZ straight, it'll be that much cleaner.

 

 

Posted

Most of those things (world, player...) are not needed to be sent in the event, as there exist only a single one for each client.  E.G each client only has a single world object, and is responsible for the position of a single player.  As such, these fields are accessible directly from the Minecraft class, in the form of  Minecraft.getMinecraft().thePlayer  and Minecraft.getMinecraft().theWorld  ..  These are a global reference can be accessed from anywhere (as long as it is client side, trying to use either on server side will crash with a ClassNotFound exception for Minecraft.class)

 

That gets you the 'controlling' client player, and the world he/she is currently residing in.  From there you can easily poll the player.posX/etc to get your positioning to calculate your chunks :)

Posted

That, my friend, is exactly what I needed. Thank you!

 

I still seem to have a glitch in my code somewhere, so I'm not done bughunting yet, but that was a big boost. Much obliged.

Posted

One of another problem you could encounter is that I don't think the data which says which chunks are slime chunks is available client sided...

Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.

Posted
  On 8/27/2013 at 9:44 PM, MineMaarten said:

One of another problem you could encounter is that I don't think the data which says which chunks are slime chunks is available client sided...

 

Yeah, I was just coming back to post something to that effect. Using Minecraft.getMinecraft().theWorld will return a "Multiplayer" world, even if loaded single player. I'm pretty sure it's the same case for loading .thePlayer.

 

What I've ended up doing was trapping WorldEvent.Load and saving the world and the seed into static values for the mod, and that worked nicely. I've now got my "Slime Chunk: Yes/No" line on the debug screen.

 

Of course, I can't stop there. Now the wild hair has expanded so that I want a line of all spawnable monsters for the given location (I saw a let's play on YT with such a mod once, but it doesn't seem to exist for 1.5.2).

 

Bouncing around the code suggests I'm looking for IChunkProvider.getPossibleCreatures() but I'm still having some trouble sussing that one out. I'm not sure if I'm using the wrong positioning or the wrong provider, but it just keeps returning EntityEnderman and that's it. It's closer than I was yesterday, though.

 

Update: Or possibly I should take a look in WorldEvent.java which seems to obligingly provide a static PotentialSpawns class... Nerp... that seems to be for adding potential spawns...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I can't figure out if you're looking for help trying to steal someone elses work, or cheat at the game....
    • Title: Why Is It So Hard to Rename and Restructure Mods Like Xray or AntiXray? 🤔 Post text: Hey everyone! I’ve been digging into Minecraft modding for a while and have one big question that I can’t figure out on my own. Maybe someone with more experience could help or give me some advice. Here’s the issue: When I take a “normal” Minecraft mod — for example, one that just adds some blocks or new items — I can easily change its structure, package names, or even rebrand it entirely. It’s straightforward. But as soon as I try this with cheat-type mods like XrayMod or AntiXray, everything falls apart. Even if I just rename the classes, refactor the packages, or hide its identity somehow, the mod either breaks or stops working properly. XrayMod in particular is proving to be a nightmare to modify without losing its core function. So my question is — why is this so much harder with cheat mods like Xray? Is there something fundamentally different about how they’re coded, loaded, or protected that prevents simple renaming or restructuring? And if so, how can I actually learn to understand someone else’s cheat mod enough to safely refactor it without breaking the core features? I’ve already been spending over two months trying to figure this out and haven’t gotten anywhere. It feels like there must be some trick or knowledge I’m missing. Would really appreciate any thoughts, tips, or references — maybe there are guides or techniques for understanding cheat-mod internals? Or if you’ve successfully “disguised” a cheat mod like Xray before, I’d love to hear how you did it. Thanks in advance for any help or discussion. ✌️
    • just started making cinamatic contect check it out on my channel or check out my facebook page    Humbug City Minecraft Youtube https://www.youtube.com/watch?v=v2N6OveKwno https://www.facebook.com/profile.php?id=61575866982337  
    • Where did you get the schematic? Source/Link? And do use an own modpack or a pre-configured from curseforge? If yes, which one On a later time, I can make some tests on my own - but I need the schematic and the modpack name
  • Topics

×
×
  • Create New...

Important Information

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