Jump to content

[1.10.2] Stop player from using the left hand slot


XFactHD

Recommended Posts

I am creating a mod that adds all kinds of guns and three types of riot shields. For the sake of realism I want the player to only be able to put guns into the main hand slots and the riot shields only being usable from the offhand slot. I also want the player to only be able to place ANY item into the offhand if the gun they are carrying in the main hand is a pistol. Is there an easy way to do this?

Link to comment
Share on other sites

I am creating a mod that adds all kinds of guns and three types of riot shields. For the sake of realism I want the player to only be able to put guns into the main hand slots and the riot shields only being usable from the offhand slot. I also want the player to only be able to place ANY item into the offhand if the gun they are carrying in the main hand is a pistol. Is there an easy way to do this?

I do not think there is. The problem with this is that right click for the left hand is processed before right hand's right click. Plus there is no current loop in to that slot.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Two of the three riot shields have a special ability which will be toggled with a dedicated keybinding. Turning the shield to the right while aiming down sight will be handled in the onItemRightClick method for the pistol in the right hand, so that is not the problem. My problem is that I need to block the player from putting anything into the offhand while using a gun that needs to be held with two hands (every gun except pistols) and to block the player from placing any gun into the offhand.

Link to comment
Share on other sites

Two of the three riot shields have a special ability which will be toggled with a dedicated keybinding. Turning the shield to the right while aiming down sight will be handled in the onItemRightClick method for the pistol in the right hand, so that is not the problem. My problem is that I need to block the player from putting anything into the offhand while using a gun that needs to be held with two hands (every gun except pistols) and to block the player from placing any gun into the offhand.

Plus there is no current loop in to that slot.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Can you explain that, please, I have no idea what you mean with that :/.

There is no event to mess with that slot, you could subscribe to the Right Click event and stop it there...

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Am I just too dumb to find it or does Forge not have a SlotClickEvent anymore?

I don't think it ever did? And if it did it doesn't now (at least to my knowledge).

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

I just looked in the 1.7.10 branch of Forge and there I did neither find this event. I may just ask for something like that to be implemented.

Put in a PR, I have thought of many uses for this myself, but have never actually needed it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

The cleavers in tinkers construct do this. At least it disables right click from the left hand slot.

There was something like that a long time ago before left and right hand was fully implemented. Something like 1.6.4ish. I believe it was removed/you can't see it.

But I believe it was too resource heavy to be completely functional after left and right hand was fully implemented.

/it would have screwed up the actual right and left hand stuff if there was a forge hook for it... or something like that. There was a reason that's all I know.

 

The cleavers work nice though.

Link to comment
Share on other sites

The cleavers in tinkers construct do this. At least it disables right click from the left hand slot.

There was something like that a long time ago before left and right hand was fully implemented. Something like 1.6.4ish. I believe it was removed/you can't see it.

But I believe it was too resource heavy to be completely functional after left and right hand was fully implemented.

/it would have screwed up the actual right and left hand stuff if there was a forge hook for it... or something like that. There was a reason that's all I know.

 

The cleavers work nice though.

Cleavers don't have a right click function though...

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

The cleavers in tinkers construct do this. At least it disables right click from the left hand slot.

There was something like that a long time ago before left and right hand was fully implemented. Something like 1.6.4ish. I believe it was removed/you can't see it.

But I believe it was too resource heavy to be completely functional after left and right hand was fully implemented.

/it would have screwed up the actual right and left hand stuff if there was a forge hook for it... or something like that. There was a reason that's all I know.

 

The cleavers work nice though.

Cleavers don't have a right click function though...

 

which effectively makes it so you can't use things in the left hand slot.

You could use a shift right click function for that or have it spawn in a spare item and then do things at the item.

Link to comment
Share on other sites

The cleavers in tinkers construct do this. At least it disables right click from the left hand slot.

There was something like that a long time ago before left and right hand was fully implemented. Something like 1.6.4ish. I believe it was removed/you can't see it.

But I believe it was too resource heavy to be completely functional after left and right hand was fully implemented.

/it would have screwed up the actual right and left hand stuff if there was a forge hook for it... or something like that. There was a reason that's all I know.

 

The cleavers work nice though.

Cleavers don't have a right click function though...

 

which effectively makes it so you can't use things in the left hand slot.

You could use a shift right click function for that or have it spawn in a spare item and then do things at the item.

I don't think you understand the problem he wants it to function on right click, but only when it is in the specified slot IE guns in right hand and shields in left hand. This could be accomplished via the ItemRightClickEvent.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

The cleavers in tinkers construct do this. At least it disables right click from the left hand slot.

There was something like that a long time ago before left and right hand was fully implemented. Something like 1.6.4ish. I believe it was removed/you can't see it.

But I believe it was too resource heavy to be completely functional after left and right hand was fully implemented.

/it would have screwed up the actual right and left hand stuff if there was a forge hook for it... or something like that. There was a reason that's all I know.

 

The cleavers work nice though.

Cleavers don't have a right click function though...

 

which effectively makes it so you can't use things in the left hand slot.

You could use a shift right click function for that or have it spawn in a spare item and then do things at the item.

I don't think you understand the problem he wants it to function on right click, but only when it is in the specified slot IE guns in right hand and shields in left hand. This could be accomplished via the ItemRightClickEvent.

 

Shift makes you move slower, then you could put the riot shield up and do the rightclickevent.

I dunno... maybe movement would be too slow though. Like you can throw a snowball and charge a bow at the same time.

Link to comment
Share on other sites

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.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.