Jump to content

[1.7.10] How to perform an action only if a block is shift+right clicked on.


Recommended Posts

Posted

The title pretty much says it. Is there some sort of event for this? I've seen it done by other mods before, so I know it's possible.

Posted

I am on 1.8 so no help here, BUT - notice that blocks like Workbench only 'work' when you are not sneaking. (sneaking makes you place blocks).

Use reverse-tactic (look vanilla).

 

Also - if you don't want to use player.isSneaking (or whatever the field's name is)and need that value on server, you will need to make IExtendedEntityProperties and store when the button is pressed and when not (send packet from client to server - on click "true" on unclick "false").

1.7.10 is no longer supported by forge, you are on your own.

Posted
 
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float f, float g, float t){
if (!world.isRemote && player.isSneaking()){
            //Player is Sneak + Right Clicking
        } else {
            //Player is just clicking
        }
        return true;
}

Posted

Thanks guys, I'm away from my code atm, I'll try that tomorrow...

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://pastebin.com/rqdPUUCX I tried everything I could think of but most modpacks would crash before running. My laptop used to work just fine with forge. I updated drivers, java, fiddled with amount of allocated ram. So I deleted my .minecraft and installed forge and even still, modless, I get exit code 1. Vanilla Minecraft works just fine. Any help would be greatly appreciated! Processor    AMD Ryzen 7 5800HS with Radeon Graphics            3.20 GHz Installed RAM    16.0 GB (15.4 GB usable) Product ID    00342-20881-05972-AAOEM System type    64-bit operating system, x64-based processor
    • Hello everyone. I am trying to set up a modded Minecraft server for version 1.20.1 but am running into an issue in which the server "freezes" during startup. The logs end at a certain point during startup, and no useful error messages are provided. Does anybody have any idea what might be happening? I am using a custom modlist.   Log File: https://api.mclo.gs/1/raw/eW4Nukg (There is an error message for "Quark", but it is not causing the issue I am having)
    • Hello everyone. I am trying to set up a modded Minecraft server for version 1.20.1 but am running into an issue in which the server "freezes" during startup. The logs end at a certain point during startup, and no useful error messages are provided. Does anybody have any idea what might be happening? I am using a custom modlist.   Log File: https://api.mclo.gs/1/raw/eW4Nukg (There is an error message for "Quark", but it is not causing the issue I am having)
    • bedbuewfbyirewibuewbufbiuewfbhiewbvuiwrv
    • System Info:     - OS: CachyOS x86_64 - (Arch based)     - Kernel: Linux 6.13.0-2-cachyos     - CPU: AMD Ryzen 5 7600X (12) @ 5.45 GHz     - GPU 1: NVIDIA GeForce RTX 4070 [Discrete]     - GPU 2: AMD Raphael [Integrated] Versions:     - openjdk 23.0.2 2025-01-21     - forge-1.21.4-54.0.21-installer.jar Log:     - forge-1.21.4-54.0.21-installer.jar.log Error: net/minecraft/world/ticks/package-info.class version.json Processor failed, invalid outputs: /home/ori/Desktop/Bots/Serverbot/MC_Worlds/ForgeTest/./libraries/net/minecraft/server/1.21.4/server-1.21.4-official.jar Expected: 0c21a12f2007a8243664e81cb1c353d94ed721a1 Actual: 0cf72b1d313f7cd54003e29428c02769068f25db There was an error during installation Regardless if I am installing client or server, it throws this error. I have tried changing my java version to java 18, tried different forge installer versions. I am out of ideas.
  • Topics

×
×
  • Create New...

Important Information

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