Jump to content

Recommended Posts

Posted

Since 1.10, i have considered using Events more frequently to achieve things, since it seems that it can offer some easy solutions compared to other ways. I was looking through all the Block events in hopes of finding something like onBlockStartBreak.

 

Basaically i wanted to get what's the player's held item when he starts Breaking the Block and then work based off that. The only related event that i found was the BreakEvent , but that does no good for what i am trying to do, because from my understanding after some testing, this event is fired after the block is broken.

 

Is there anything that can help me achieve what i want?

Posted

Is there anything that can help me do this?
Do what? :D

 

I am sorry if i wasn't clear enough. Sometimes what's in my head doesn't make sense out of it. :D

 

Basically i want to get what's the player's held item when he starts breaking a block (any block), and if there's any Event related to this, or if there is another way to do this.

Posted

Basically i want to get what's the player's held item when he starts breaking a block (any block), and if there's any Event related to this, or if there is another way to do this.
You again described how you intend to code something, but you have not explained what that something is.

 

I want to know what item is the player holding when he starts breaking a block.

That's the simplest way i can think of to describe it.

 

E.G: Steve is holding a stick and he is trying to break a dirt block.

I want to know what Steve is holding when he starts to break this block, which in this case would be stick.

Posted

Why? Do you want to print out a postcard saying "Steve hit rock with stick!"?

 

That would be silly, but no, i actually wanted to change the texture of my pickaxe (if the player is holding it) and spawn some tiny particles around the block.

 

EDIT: @hugo_the_dwarf: I only checked the Block events. Didn't look into player events. Thank you for suggestion. I will try that.

Posted

BreakSpeed seems like the one to use to me.

But again, what are you trying to achieve, not how you plan to code it, but what you want to happen from the player's point of view as he's playing the game.

 

e.g.

Goal: "If the player tries to mine coal with an iron pick, it starts a fire in a random nearby tile."

Code: "I want an event that lets me check the player's held item so that..."

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.

Posted

Draco, i said what i wanted to do. It's mainly for some visual effects. If this turns out to hurt the performance,( Since i would change back to the normal texture after the block is broken) i will just leave it be. But i don't think it would be nuch of a problem because the item that is supposed to have these visual effects, is only intended to be used a couple of times.

 

EDIT: @diesieben: I am sorry for the misunderstanding at the begining of the thread. I probably didn't understand exactly what your question was. My english definetly needs more work. And thank you for the help. With my current knowledge, i figured that events would be the best way to go.

Posted

Draco, i said what i wanted to do.

 

We posted at the same time.

 

Anyway.

 

The annoying thing I find about IItemProperties is that you will end up with a bunch of model json files (I much prefer blockstate files in this regard).

I haven't found a way to just "give it a different texture" as the base model file

(e.g. this one* in my own mod), the format is such that it expects a "model" tag, not a "texture" tag.  I tried just supplying a new texture and it threw a Missing Model at me for my efforts.

 

I think it has to do with the fact that an item model is still made out of baked quads, so in order to "change texture" you're actually just displaying a different model (which was run-time generated from a pre-specified texture in that model file).

 

*The "time" string should be changed, but as I was working from the vanilla Clock as a starting point I haven't changed it yet, it's just the name of the property that was created.  In this case it should be "rainfall" as it is arbitrary, but needs to match.

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.

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.