Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to sub forum page

General forum

Non-course related subjects

3. Programming help

"PlayerName" moved wrongly!

  • 2014-07-17 15:20:31
    I am struggling with a problem I ran into a while ago.
    In the mod I am working on right now I made a item that is going to flash / teleport the player 1.75 blocks forward. Mostly going to be used through walls. All the codes works fine until I go into survival mode. Cause whenever I try to teleport / flash though a wall with this item I get glitched back to the same position. The item and action works in creative mode but in survival I think Minecraft has a build in anti glitching / cheating engine or some code to prevent the operation I am trying to perform.
    The console says when I am in survival mode:

    [17:10:11] [Client thread/INFO]: [CHAT] Poff!
    [17:10:11] [Server thread/WARN]: ForgeDevName moved wrongly!

    Here is the source codes that is performing this action:

    public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hit) {

    double X = player.posX;
    double Z = player.posZ;
    double Y = player.posY;

    int test = MathHelper.floor_double((double)((player.rotationYaw * 4F) / 360F) + 0.5D) & 3;

    if (test == 1) {
    X = X - 1.75;
    if (test == 3) {
    X = X + 1.75;
    if (test == 2) {
    Z = Z - 1.75;
    if (test == 0) {
    Z = Z + 1.75;
    player.setPositionAndUpdate(X, Y, Z);

    player.addChatMessage(new ChatComponentText("Poff!"));

    return true;

    How can I solve this problem? I am not a super genius programmer so a simplified answer is appreciated.

  • 2014-07-17 18:35:30
    It's because it's only doing it on the client, in creative it is accepted but not in survival, to fix it add a check and only execute your code it is run on the server.

    Add a:
    if (!world.isRemote) {


    } else {
        return false;

    Also you might want to do something about when you click on the block below the eye height, atm you get teleported into the ground.
  • 2014-07-17 19:24:28
    Thank you so much! It helped a lot
  • Log in or sign up to reply to this thread