Jump to content

Recommended Posts

Posted

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.

Posted

1) Not a support issue

2) You're not casting numbers correctly

3) We don't support 1.6.4 anymore

4) This is not the modder support area.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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