Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Pixelmon Events not triggered


Ctwx
 Share

Recommended Posts

Hello,

I am trying to program a small mod that is working with Pixelmon Reforged.

In the @Mod annotated class' constructor I register an EventHandler class like this:

public ExampleMod() {
     MinecraftForge.EVENT_BUS.register(new com.example.examplemod.EventHandler());
}

The EventHandler class looks like this:

package com.example.examplemod;

import com.pixelmonmod.pixelmon.api.events.DropEvent;
import com.pixelmonmod.pixelmon.api.pokemon.PokemonSpec;
import com.pixelmonmod.pixelmon.api.trading.TradePair;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.logging.log4j.Logger;

public class EventHandler {

    private Logger logger;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
        logger = event.getModLog();
        logger.info("### EXAMPLE MOD LOADED");
    }

    @SubscribeEvent
    public void ev(DropEvent event) {
        logger.info("### onEconomyEvent " + event.player);
        PokemonSpec exchange = PokemonSpec.from("glumanda");
        PokemonSpec offer = PokemonSpec.from("mewto");
        TradePair tradePair = new TradePair(offer, exchange);
        com.pixelmonmod.pixelmon.api.trading.NPCTrades.showTrade(event.player, tradePair);
    }

    @SubscribeEvent
    public void pickupItem(EntityItemPickupEvent event) {
        System.out.println("### Item picked up! " + event.getItem().getName());
    }
}

I added a test event which I found in the documentation. It gets triggered. But the DropEvent (or other Pixelmon events) does not. I checked different events but none of them are triggered. (I found them here: https://reforged.gg/docs/)

 

I put the pixelmon jar into a "lib" folder and added the dependency like this:

dependencies {
    provided fileTree(include: ['*.jar'], dir: 'lib')
}

Why aren't any of those events triggered?

Link to comment
Share on other sites

Have you tried contacting the author?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

They have a forum, but nothing about modding for it. They also don't provide and source so it is a bit harder. The only thing they provide are the docs above. But I found threads regarding Pixelmon modding here so I thought this forum might be a good place to ask.

 

Interestingly the DropEvent (https://reforged.gg/docs/com/pixelmonmod/pixelmon/api/events/DropEvent.html) I want to listen to extends net.minecraftforge.fml.common.eventhandler.Event. This is very strange...

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

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