Jump to content

[1.6.4]Ghost player positon.


FLUFFY2

Recommended Posts

When i get the Player position:

int x = (int)player.posX;

int y = (int)player.posY;

int z = (int)player.posZ;

 

Its slipped sometimes away.

In default worldtype its sometimes under me sometime not!

Other cases its +1 or -1 to X or Y.

I flat its never where i stand.

For example: Playing a sound not plays where i stand.

 

 

I made a dummy dynamic light for testing reasons.

PLAYER ticking CLIENT registration.

There is no packet or anything special, just CLIENT.

TestTickHandler:

 

 

package fluffy.lantern.handler;

import java.util.EnumSet;

 

import net.minecraft.block.Block;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.world.EnumSkyBlock;

import cpw.mods.fml.common.ITickHandler;

import cpw.mods.fml.common.TickType;

public class TestTickHandler implements ITickHandler

{

private final EnumSet<TickType> ticksToGet;

 

private static int lastX = 0;

private static int lastY = 0;

private static int lastZ = 0;

 

 

public TestTickHandler(EnumSet<TickType> ticksToGet)

{

this.ticksToGet = ticksToGet;

}

 

@Override

public void tickStart(EnumSet<TickType> type, Object... tickData)

{

playerTick((EntityPlayer)tickData[0]);

}

@Override

public void tickEnd(EnumSet<TickType> type, Object... tickData)

{

}

@Override

public EnumSet<TickType> ticks()

{

return ticksToGet;

}

@Override

public String getLabel()

{

return "TutorialPlayerTick";

}

 

public static void playerTick(EntityPlayer player)

{

if(player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID == Block.torchWood.blockID){

 

int x = (int)player.posX;

int y = (int)player.posY;

int z = (int)player.posZ;

 

if(x != lastX || y != lastY || z != lastZ)

{

player.worldObj.setLightValue(EnumSkyBlock.Block, x, y, z, 14);

 

player.worldObj.updateLightByType(EnumSkyBlock.Block, lastX, lastY, lastZ);

 

player.worldObj.updateLightByType(EnumSkyBlock.Block, x+1, y, z);

player.worldObj.updateLightByType(EnumSkyBlock.Block, x-1, y, z);

player.worldObj.updateLightByType(EnumSkyBlock.Block, x, y+1, z);

player.worldObj.updateLightByType(EnumSkyBlock.Block, x, y-1, z);

player.worldObj.updateLightByType(EnumSkyBlock.Block, x, y, z+1);

player.worldObj.updateLightByType(EnumSkyBlock.Block, x, y, z-1);

 

lastX = x;

lastY = y;

lastZ = z;

}

 

}else if((player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().itemID != Block.torchWood.blockID) || (player.getCurrentEquippedItem() == null))

{

player.worldObj.updateLightByType(EnumSkyBlock.Block, lastX, lastY, lastZ);

 

lastX = 0;

lastY = 0;

lastZ = 0;

}

}

}

 

 

 

I thing its a Forge or Minecraft related bug.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

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