Posted May 26, 20169 yr So I want to make small modifications base vanilla block behaviour, specifically make rose bushes prick (damage) the player when walking through them. I'm not sure how I could do this, and I don't want to go around experimenting with stuff as that will probably break everything. How would I go about doing this? For my specific case is their an easy and simple way of adding functionality to blocks/items? No signature for you!
May 26, 20169 yr Author So I want to make small modifications base vanilla block behaviour, specifically make rose bushes prick (damage) the player when walking through them. I'm not sure how I could do this, and I don't want to go around experimenting with stuff as that will probably break everything. How would I go about doing this? For my specific case is their an easy and simple way of adding functionality to blocks/items? No signature for you!
May 26, 20169 yr How you add functionality depends on the functionality you're adding. In this case, there's no event for block collisions so you'll need to subscribe to either PlayerTickEvent (fired only for players, make sure you check the event's Phase before running your code) or LivingUpdateEvent (fired for all living entities). In your event handler, iterate through all blocks inside the entity's bounding box (see Entity#doBlockCollisions ) and check if each one is a rose bush before damaging the entity. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 26, 20169 yr How you add functionality depends on the functionality you're adding. In this case, there's no event for block collisions so you'll need to subscribe to either PlayerTickEvent (fired only for players, make sure you check the event's Phase before running your code) or LivingUpdateEvent (fired for all living entities). In your event handler, iterate through all blocks inside the entity's bounding box (see Entity#doBlockCollisions ) and check if each one is a rose bush before damaging the entity. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 26, 20169 yr Author Ty so much. I ended up getting it working, although the check to see if its a rose and not another type of flower is a bit messy, but it works! No signature for you!
May 26, 20169 yr Author Ty so much. I ended up getting it working, although the check to see if its a rose and not another type of flower is a bit messy, but it works! No signature for you!
May 26, 20169 yr You might also look at how cactus does its damage. There might be something to learn there. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
May 26, 20169 yr You might also look at how cactus does its damage. There might be something to learn there. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
May 26, 20169 yr Cactus uses the onCollide method, which not all blocks override. 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.
May 26, 20169 yr Cactus uses the onCollide method, which not all blocks override. 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.