Jump to content

Recommended Posts

Posted

It's a big question. Maybe anyone has his own opinion. I'm trying to talk about mine.

 

'Event' is something that happened or is happening. When the zombie hit you, it's an event(And we would know that it's LivingAttackEvent and LivingHurtEvent).

 

As the mod required, you may want to know about what event is happenning. If we want to make zombie very very strong, we can catch the 'event' that when the damage is count(LivingHurtEvent), and change the damage to make the zombie stronger(there is other way to do this of course). Or we could apply special effect to the player when he's hit by zombie. To know when the player is hit, you need events.

 

And many other events, like LivingDeathEvent. To catch this event allow you to do something when someone(Zombie, Player or other living) died. And do something you want after this, like bury them. To know when someone die, you need events.

 

To catch the event, add an annotation before the method, and register it. The class is as below.

 

public class EventTest {
@ForgeSubscribe(priority = EventPriority.LOW,receiveCanceled = true)
public void test1(LivingFallEvent event)
{
    if(event.entityLiving instanceof EntityPlayer)
    {
        EntityPlayer entityPlayer = (EntityPlayer)event.entityLiving;
        entityPlayer.sendChatToPlayer(ChatMessageComponent.func_111066_d("Falling Star!You fell "+event.distance+ " meters.That's cool,man!");
    }
}
}

 

And registe it with

 MinecraftForge.EVENT_BUS.register(new EventTest());

 

So when someone fall to the ground, he will receive a message how far he fall.

 

And you can set event.distance to 0.0f or 24.f to get rid of the falling damage or make the player die when fall, no matter how far he falls.

 

And there are many feature of event, like result, priority, cancelable and so on.

Maybe you should figure it out yourself.

Posted

Hi

 

Forge events are a way for the vanilla+forge code to call your code when something happens.  This lets you customise the game behaviour without having to modify the vanilla code yourself.

 

For example - PlayerSleepInBedEvent

If you register a listener for this event (say thePlayerSleptInBed()), then your method thePlayerSleptInBed will be called whenever a player sleeps in a bed.

 

Forge uses a bit of a mishmash of events, handlers, hooks, and other techniques to enable your code to get itself called when particular things happen.  Events is just one of those.

 

A useful link:

http://www.minecraftforge.net/wiki/Event_Reference

 

-TGG

Posted

Thanks! (there are alot of basic minecraft modding tutorials out there, but i still feel so lost when I am looking through all forge stuff, thanks for shedding some light on the events stuff!)

Posted

Another thing to note is that events is NOT a forge concept.

Events is a programming concept, as are much of the confusing forge and minecraft stuff.

It's a good idea to search around for general peogramming information on such concepts as well as to learn about the specifics of forge ;)

If you guys dont get it.. then well ya.. try harder...

Guest
This topic is now closed to further replies.

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.