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

[1.12] ItemCraftedEvent problems [SOLVED]


TheTrollguy_
 Share

Recommended Posts

So I've been kinda stuck with this event with casting.

 

event.player returns an instance of EntityPlayer, but I need EntityPlayerMP to give the player some recipes. If I cast it to EntityPlayerSP or EntityPlayerMP, it throws ClassCastException (casting it to 'MP crashes Minecraft). Is there any way I can get instances of EntityPlayerSP and EntityPlayerMP or is there a way to check on which side the code is run?

Edited by TheTrollguy_
Link to comment
Share on other sites

this checks which side the code is on. this answers part of your question   

world.isRemote is false if server world 

if (!world.isRemote) {
      
        

}
            
            
            
           
            
            
        
        

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