Block Movement Towards Player? (Block AI)

Started by ItsSnowingSome… on Wed, 12/09/2020 - 21:02

Topic category: Help with modding (Java Edition)

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Block Movement Towards Player? (Block AI)
Wed, 12/09/2020 - 21:55 (edited)

I was looking around for an answer or to see if it was even possible, however, I was wondering if there was a way to make a procedure to move a block towards a player and not just directly where the player is, sort of like an basic AI (And maybe detect if a player is nearby before doing so). I'm not very bright when it comes to more advanced procedures, so, any help is appreciated!

 

(Edit: First three replies are just my own, because I meant to reply to and older question just in case anyone was looking for answers. Instead I now just look dumb, oh well, if anyone is having trouble getting geckolib animations to work, I can help)

Edited by ItsSnowingSomeWhereElse on Wed, 12/09/2020 - 21:55
Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I figured it out now with…
Wed, 12/09/2020 - 21:15

I figured it out now with the release of 2020.5, Import your model like normal, however, instead of importing the animated java file normally make a folder named "animations" (Without quotes of course) under "Mod name"\src\main\resources\assets\"Mod name" and place your animated java file into the animations folder. Lastly, make sure after attaching your animation to your model though a procedure check the code (It should be near the bottom in quotes and should be after "Mod name"\src\main\resources\assets\"Mod name") and rename the animated java file to what's in the quotes of your code.

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ah I replied to the wrong…
Wed, 12/09/2020 - 21:16

Ah I replied to the wrong one ._.

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This hasn't been answered…
Wed, 12/09/2020 - 21:36

This hasn't been answered yet, I was just being really dumb as I thought this was an old post of mine since it was on the bottom of the list (And I sort of wish I could remove the replies, but I get why there's no option to). Any answers to the question above would be highly appreciated!

Last seen on 21:34, 12. May 2022
Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
So do you mean a block that…
Wed, 12/09/2020 - 22:23

So do you mean a block that is able to move closer to the player? I have a few questions about this first: would the block be constrained to block coordinates, or would it be able to move freely? How many blocks are you planning to move like this? And finally, what do the blocks do once close or intersecting with you? I hope to help, just need a few more details first :P

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Sorry about the lack of…
Wed, 12/09/2020 - 23:55

Sorry about the lack of details! But, yes! :D And I do mean constrained to block coordinates not freely, and I was planning on making one (or two) that had a trail of another type of block behind it (At least for a test mod I'm making just to test things for a bigger mod I've been working on (Its just to not mess anything up since I seem to do that easily when trying out new things :| )) I tried using an invisible mob with no collision but, it didn't turn out how I hoped besides okay pathfinding (Might be easier to try to fix the mob (It had a (maybe too) simple procedure to just place a randomly decaying block (I tried having it be a block that turned into a decaying block to have something more closer to what I hoped, but, it still looked incorrect) at its location, but, the trail part was not working as I hoped (Probably since I was relying on random decay too much)). Also, thinking it'd damage (with knockback) the player like a mob would. I prefer to use a block since it'd might move a tad cleaner, but, I'm open to using a mob. I hope that answered your questions! (And sorry, that was more then you asked for '-'' but, I hope it helps!)

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Sorry if I replied to the…
Thu, 12/10/2020 - 01:35

Sorry if I replied to the topic instead of you! '~' (Or at least I think I did '-'' still a tad new to this site ._.) But yes! to sum up what I said in my long, messy reply to the topic, I would like the block's movement to be constrained to block coordinates, and I'm planning to make at least two that can move like this (With a set number of a different type of block trailing behind it). Also, lastly, I'd like to have the blocks damage the player (with knockback) when the block touches. I've tried doing this with an invisible mob with no collision (because of it's pathfinding and because it'd not just go though blocks) (the mob also placed decaying blocks at the its location), and it didn't turn out how I hoped even after fixing the AI path node type, and I rather use just a block. (But, if it proves to be a bit too much, I'd be fine just trying to fix the mob version) I hope this answers your questions! :D

Last seen on 05:29, 31. Jan 2022
Joined Nov 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
a block that acts like a mob…
Fri, 12/11/2020 - 08:01

a block that acts like a mob? interesting concept!

you can use the block's on tick event to check if there's any player nearby, if so, remove the block and replace with a custom mob that looks exactly like the block. with this custom mob you can configure its AI to do the things you want it to do. 

if the player moves out of range or something, then kill the mob and place your custom block in its place.

Last seen on 20:26, 2. Feb 2022
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
That's a really good idea!…
Sat, 12/12/2020 - 02:37

That's a really good idea!

However, I'm looking see if I can make the block itself act like a mob without using mobs (Sort of as a challenge I guess, which has proven quite difficult for me), and if I can't, well, I don't mind. I'll keep that idea in mind however! I have future mob that had to do almost exactly that

Also if your wondering, I managed to somewhat do this with a mob that places blocks (You can walk through) at it's location, sadly, the mob suffocates no matter what I do to the mob or block. Also places two blocks at its location sometimes which makes the trailing blocks (different blocks for each segment) break. Got it to mostly work however