Jump to content

Recommended Posts

Posted (edited)

When the player tries to place a block, delete the block, and give the same block back.(not sure if theres a simpler method for this). I dont know about items...

 

EDIT: Look at playerInteractEvent.

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted (edited)

I just created a spell like this, although I didn't test it in multiplayer yet. 

I created a player capability with 3 variables: ticksStunned, isStunned, and stunDuration.

So when the player is hit by the potion you would set isStunned to true and set the stunDuration.

use PlayerTickEvent and make sure ur on phase START,

check if the world is remote, if it is check if the player is stunned from the capability. if they are stunned increment ticksStunned. then check if they are stunned && (ticksStunned % stunDuration != 0)  and if that is true do KeyBinding.unPressAllKeys(); else set isStunned to false and reset ticksStunned to 0;

That stops all keyboard input except the esc key(or whatever pause game key is), open inventory key, and hotbar hotkeys.

Then u need another event for the mouse called MouseEvent, this is client side only so no need to check isRemote here.

in here just check if the player isStunned and if they are event.setCanceled(true);

if they aren't getting stunned for long enough or something like that isn't working right you may need to use packets to sync data from server to client or vice verse, I haven't fully tested this so idk if you can get away without packets here yet.

Edited by Kriptikz

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.