Jump to content

[UNSOLVED] Nighttime check


East_Crips

Recommended Posts

Hey,

 

I want my Item only to be eaten at night,

so i made my way trough the items classes and found some stuff to work with.

The problem now is, that when i use it at night, it disappears after rightclicking it without the drink animation.

But anything else works, can't use it when it's not nighttime :)

 

here's the code

    public int check = 0;
    public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer player)
    {
    	if(!w.isRemote)
    	{
    		int day;
    		if(w.isDaytime()) day = 1;
    		else day = 0;
    		
    	switch(day)
    	{
	    	case 1:
	    	{
	    		if(check == 1) return is;
	    		check = 1;
	    		if(getCurrentLanguage() .equals("de_DE"))
	    		{
	    			player.addChatMessage("Geht nur nachts");
	    		}
	    		else
	    		{
	    			player.addChatMessage("Try again tonight");
	    		}
	    	}
	    	break;
	    	case 0:
	    	{
	    		player.setItemInUse(is, this.getMaxItemUseDuration(is));
		    	player.addChatMessage("Success!");	
		    	check = 0;
	    	}
	    	break;
    	}
    	}
        return is;
    }

 

using it at night, i get my debug message, but without the animation

    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.drink;
    }

 

can't undestand why it's not working.... it worked about 15 mins ago, when i wasn't checking for nighttime yet.

I think I messd up somewhere ^^

but still can't figure out where :/

btw. MaxItemUseDuration is 42

 

 

 

Cheers,

-East

Link to comment
Share on other sites

Sorry, I have no idea. I didn't try actions yet. I just had to say this: your signature is AWESOME!!

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

His sig is actually a pretty standard browser data detector.  It's just customized a little in terms of its output.

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

His sig is actually a pretty standard browser data detector.  It's just customized a little in terms of its output.

 

For someone who has no idea what you're talking about (that being me), his signature is magic!! *-*

WIP mods: easyautomation, easyenergy, easyelectronics, easymoney, easytrasportation, easysecurity, easymultiverse, easyfactions, easymagick, easyalchemy, easyseasons

Link to comment
Share on other sites

His sig is actually a pretty standard browser data detector.  It's just customized a little in terms of its output.

it's actually not, everything coded by me. Right click it and ull get the link, it's hostet on my Server. U can use it if u like :P

it acts like a image file, but actually is a php script.

im good at PHP ;)

 

but back to topic, does noone know how to do this? :(

the drinking animation isnt working... i right click, get my message, the bucket gets empty and that's it... no drinking animation -.-

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



×
×
  • Create New...

Important Information

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