Jump to content

Special tool


GodOfYeti

Recommended Posts

Because I have almost no idea what you want to archieve I'll just ask:

1. "If I took a block"

Vanilla or custom?

2. "onBlockActivated method"

Should it be block activation, break or right-click?

3. "check the tool that click the block"

Again - which click? Left, right? Only click or break?

4 "drop the block"

Well, dropping need breaking, so are you activating block, breaking it or clicking?

5. "block requires a special tool"

How can block "require" special tool? Then again - speacial tool to break it, or to activate it?

 

Last, but not least - are you high? :)

width=360 height=176http://i.memeful.com/media/post/1d4BJDM_700wa_0.gif[/img]

 

You are probably looking for BlockBreakEvent or PlayerInteractEvent (or something like it) for Vanilla, and for custom, probably: on BlockDestroyedByPlayer maybe. Anyway - events mentioned 1st can be cancelled to no break block, or you can modify their loot to loot other stuff depending on tool used.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Idk why you are trying to simulate breaking block by using onBlockActivated, but that's not my concern.

 

Yeah, in theory (even practice) that should work. Remember to always check if slot in not null before you try to get item from it.

Also use instanceof instead of "==". (Unless you want a direct to-class comprasion).

 

Finally - to break block you can setBlock to air (depending on which version you use 1.7 or 1.8 methods are different) or simulate BlockBreak by simply telling block to insta-break.

 

In any case - to drop items you should use: BlockFurnace#breakBlock(), code starting with EntityItem entityitem = new EntityItem....

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Idk why you are trying to simulate breaking block by using onBlockActivated, but that's not my concern.

 

It comes from IC2: just "mining" the block out ruins the machine.  You have to use a wrench and "disassemble it" (shift-right click, as right-click just rotates it).

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

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.