Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

Fastbridge Mod for MC Forge 1.8.9

MasterOf13FPS

Administrator
Staff member
Administrator
MasterOf13FPS
Joined
Jul 11, 2020
Messages
0
Reaction score
25
Points
0
Req:
  1. When you hold a block and walk to the edge of a block it makes you sneak.
Thats it, nothing speacial, no gui, no toggle, just this. Iam a moron when it comes to coding tho, so yaeh, hope you guys can help me :)
 
Code:
@Override
    public void onUpdate() {
        if(mc.thePlayer.inventory.getCurrentItem() != null && (mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBlock)){
            BlockPos bp = new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0D, mc.thePlayer.posZ);
            if(Minecraft.theWorld.getBlockState(bp).getBlock() != Blocks.air){
                mc.gameSettings.keyBindSneak.pressed = false;
            }else{
                mc.gameSettings.keyBindSneak.pressed = true;
            }   
        }
    }

Diesen Code in einer Update Methode ausführen :)
 
onUpdate() This?
Diesen Code in einer Update Methode ausführen :)

Edit: Or do you mean a Events Class? I think you see that I have no fing clue about modding ^^
 
Last edited by a moderator:
Uhm, i dont know the name of the update Event in Forge, but in that Event you have to paste the code
 
No here is a Tutorial for Events in Forge
and think you use the LivingEvent.LivingUpdateEvent instead of the LoginEvent. There you can paste the Code inside the update Method
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top