Posted November 9, 20204 yr Hi everybody ! I have a problem with my custom event's code... @SubscribeEvent public static void onShiftInElevator(InputEvent.KeyInputEvent event) { LivingEntity player = Minecraft.getInstance().player; World world = player.getEntityWorld(); if (event.getKey() == GLFW_KEY_LEFT_SHIFT) { if (world.getBlockState(player.func_233580_cy_().add(0, -1, 0)).getBlock() == (ModBlocks.ELEVATOR_BLOCK.get())) { boolean finish = false; double checkY = -1; while(!finish && checkY > -11) { checkY--; if (world.getBlockState(player.func_233580_cy_().add(0, checkY, 0)).getBlock() == (ModBlocks.ELEVATOR_BLOCK.get())) { player.sendMessage(ITextComponent.func_244388_a("Test"), player.getUniqueID()); player.setPositionAndUpdate(player.getPosX(), player.getPosY()+checkY+1, player.getPosZ()); finish = true; } } } } } I want that when the player sneak on the ModBlocks.ELEVATOR_BLOCK, he is teleported to the next same block below him. I tried this code, and the message "Test" (line 12) appear, but the player still not move... Please, can anybody help me to fix it ???? Thanks a lot ! Edited November 10, 20204 yr by Korantin
November 9, 20204 yr You can't update entity position on client. You can use Entity#isSneaking and do it on server. Edited November 9, 20204 yr by poopoodice
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.