Topic category: Advanced modding
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
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
Ok thanks I`ll change it now and see if its better now
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?
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 :)
Wait for 1.8.3MCreator the feature will be added then.
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
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)
How can I make a new keybind and also is there a way that Pylo can fix this?
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 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.
That's good, it prevent Cheats in servers