Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Эффект снаDevelance написал(а):Берешь и делаешь, чекаешь, что если стоит игрок над этим блоком, делается эффект сна.
player.setSpawnChunk(new ChunkCoordinates((int)xCoord, (int)yCoord + 3, (int)zCoord), true);// Спаван над (TileEntity) блоком
player.setSpawnChunk(new ChunkCoordinates(player.getPlayerCoordinates()), true);//Спаван около координат игрока.
/**Cool Down for Check Point PlayerEntity**/
private HashMap<EntityPlayer, Integer> cd_cp = new HashMap<EntityPlayer, Integer>();
public void updateEntity() {
//if (world.provider.canRespawnHere()) {
double d0 = 1.0D;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox((double)xCoord, (double)yCoord, (double)zCoord, (double)(xCoord + 1), (double)(yCoord + 1), (double)(zCoord + 1)).expand(d0, d0, d0);
List list = worldObj.getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);
Iterator iterator = list.iterator();
EntityPlayer player = null;
while(iterator.hasNext()) {
player = (EntityPlayer)iterator.next();
if (cd_cp.get(player) == null) {
cd_cp.put(player, 200);
player.setSpawnChunk(new ChunkCoordinates((int)xCoord, (int)yCoord + 3, (int)zCoord), true);
//player.setSpawnChunk(new ChunkCoordinates(player.getPlayerCoordinates()), true);
player.addChatMessage(new ChatComponentText(EnumChatFormatting.BOLD + "Check point."));
} else {
int cd = cd_cp.get(player);
if (cd <= 0) cd_cp.remove(player); else cd_cp.put(player, --cd);
player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC + "Cool Down " + cd + " for you Check Point."));
}
}
//}
}