Need Help with Pushable Block System

Started by Yusufhum3 on

Topic category: Advanced modding

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Need Help with Pushable Block System
Thu, 03/28/2019 - 18:33 (edited)

So I wanted to make a Block "pushable" if you rightclick it with a custom item in hand

So I made the Block have Gravity and made a new Procedure that happens when you rightclick the Block (I wanted to post an Image but didnt find a way how)

The Procedure is like this:

/////////////////////////

Event - triggered by external Call (no additional Trigger)

If                    [CustomItem] = Item in Entitys main hand

           AND    is   current Entity  (sub)type of EntityPlayer

do     Remove Block at X Y Z

         If               (   (round Entity direction in A° relative to S)  <= 45)

               AND    (   (round Entity direction in A° relative to S)  >= -45)

        do   Place [PushableBlock] at X Y ( Z+1 )

       else if          (   (round Entity direction in A° relative to S)  <= 135)

               AND    (   (round Entity direction in A° relative to S)  >= 45)

        do   Place [PushableBlock] at  ( X - 1 ) Y Z

       else if          (   (round Entity direction in A° relative to S)  <= 225)

               AND    (   (round Entity direction in A° relative to S)  >= 135)

        do   Place [PushableBlock] at  X Y ( Z - 1 )

        else if         (   (round Entity direction in A° relative to S)  <= 315)

               AND    (   (round Entity direction in A° relative to S)  >= 225)

        do   Place [PushableBlock] at  ( X + 1 ) Y Z

///////////////////////////

It works great but when I rightclick the Block sometimes it bugs weird and dissapears completely. I dont know why.

If you have a better solution tell me please.

 

 

  Ps: I will soon try to make it stop if a wall is in the way

Edited by Yusufhum3 on Thu, 03/28/2019 - 18:33
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You should check if there is…
Wed, 03/20/2019 - 16:00

You should check if there is air before placing the block to avoid issues.

Anyway, try to place the new block before removing the old one (swap the 2 procedure parts). Sometimes it seems that if the block/item that triggers the procedure gets removed before the procedure ends it might get broken

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok thanks I`ll change it now…
Wed, 03/20/2019 - 16:25

Ok thanks I`ll change it now and see if its better now

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
OK nice it works very fine…
Wed, 03/20/2019 - 16:39

OK nice it works very fine now thank you and is there a way that If I rightclick on the block with sneaking that I pull the Block towards the Player?

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Glad I could help :) To…
Wed, 03/20/2019 - 18:45

Glad I could help :)

To check if the player is sneaking, you have to wait for Mcreator 1.8.3. It seems it will be released soon, so you won't wait for too long :)

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wait for 1.8.3MCreator the…
Thu, 03/21/2019 - 17:11

Wait for 1.8.3MCreator the feature will be added then.

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks now I added the is…
Thu, 03/21/2019 - 18:01

Thanks now I added the is sneaking block but it still doesnt work if I rightclick it with Sneak the block doesnt move and also the Hand Animation isnt there

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That might be because in…
Fri, 03/22/2019 - 15:08

That might be because in vanilla minecraft when you sneak-click on a block you don't activate it (so you can place blocks on chests, crafting tables, etc.)

Try using something else than shift (maybe a new keybind)

Joined Dec 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make a new keybind…
Fri, 03/22/2019 - 15:18

How can I make a new keybind and also is there a way that Pylo can fix this?

Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know if keybind…
Sat, 03/23/2019 - 06:40

I don't know if keybind procedures also store the coordinates (I don't use them from a while), so I don't know. I have no ideas to be honest :/.

For fixing this, try opening an issue on the tracker.

KeyBindings are client-side…
Fri, 03/29/2019 - 16:01

KeyBindings are client-side only and can't control world data. The issue is the client to server communication. Key binding events happen on the client only. One would need to make a custom packet that sends data to the server about the keypress, but without permissions system, such packet could be exploited by users for server hacking, so right now we don't have any real solution for this.

As there is no client to server communication from client side mods so such procedures appear glitchy and sometimes don't work at all.

In MCreator 1.8.3, there is a computer icon next to the procedure triggers that are client side only.

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's good, it prevent…
Fri, 03/29/2019 - 16:04

That's good, it prevent Cheats in servers