Jump to content

1.7.10 Weird Crash I don't know what it means


[NoOneButNo]

Recommended Posts

With this code in eclipse from one of my private mods:

Spoiler

@SubscribeEvent
    public void AccessEnchant(LivingHurtEvent fEvent, World world)
    {
        if(fEvent.source.damageType != "player" && fEvent.source.damageType != "mob")
            return;
        
       
        
        if(!(fEvent.source.getSourceOfDamage() instanceof EntityLivingBase))
            return;
        
        EntityLivingBase attacker = (EntityLivingBase)fEvent.source.getSourceOfDamage();
        if(attacker == null)
            return;
        
        ItemStack dmgSource = ((EntityLivingBase)fEvent.source.getSourceOfDamage()).getHeldItem();
        if(dmgSource == null)
            return;
        
        if(EnchantmentHelper.getEnchantmentLevel(effectId, dmgSource) <= 0)
            return;
        int levelSunshine = EnchantmentHelper.getEnchantmentLevel(effectId, dmgSource);
        
        
         
        final World w = world;
                long wt = w.provider.getWorldTime();
                long constantTime = w.provider.getWorldTime ();
             
                int timeDay = 0;
                int timeNight = 11999;
                int wt2 = (int) wt;
                
                while(wt2 < 24001){
                    wt2 = wt2 - 24000;
                    
                }
                if((timeNight) > wt2)  {
                 fEvent.ammount = fEvent.ammount * (0.9f + (0.30f * levelSunshine));
                  return;
                }
                  else if(timeDay < wt2)
                  {
                      
                 fEvent.ammount = fEvent.ammount - (0.75f * levelSunshine);
                  }  
                      
                }

    }

I get this crash

 

Link to comment
Share on other sites

1.7.10 is no longer supported on this forum, your thread will probably be closed by a mod.

 

That said, the error tells you the problem:

Quote

Method public void [...] has @SubscribeEvent annotation, but requires 2 arguments.  Event handler methods must require a single argument.

You have two arguments in your event handler method, which is an invalid use of @SubscribeEvent. Event handler methods must have just one argument, the Event type.

Edited by Jay Avery
Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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